60 likes | 159 Views
CSci 4011. INHERENT LIMITATIONS OF COMPUTER PROGRAMS. EXAMPLES. Give TM state diagrams for:. { a n b n a n | n ≥ 0 }. { w | w = w R }. { w | #a(w) = #b(w) + #c(w) }. ADD = {1 i #1 j #1 k | i+j = k }. 11#111#11111. x 1#111# z 1111. xx #111# zz 111. xx # x 11# zzz 11.
E N D
CSci 4011 INHERENT LIMITATIONS OF COMPUTER PROGRAMS
EXAMPLES Give TM state diagrams for: { anbnan | n ≥ 0 } { w | w = wR} { w | #a(w) = #b(w) + #c(w) }
ADD = {1i#1j#1k | i+j = k} 11#111#11111 x1#111#z1111 xx#111#zz111 xx#x11#zzz11 xx#xx1#zzzz1 xx#xxx#zzzzz
z→z,R 1→1,R 1→1,R # →#,R q1: 0 # FIND-1-R q3: 1 # FIND-1-R q7: 2 # FIND-1-R # →#,R □→□,L # →#,L qR: REJECT 1→x,R z→z,R 1→z,L 1 →1,R # →#,L x→x,R 1→x,R q6: 2 # REJ-1-R q4: 1 # FIND-1-L q0: 0 # FIND-1-L □→□,L # →#,R # →#,R qa: ACCEPT x→x,R x→x,R # →#,L # →#,L q8: 2 # FIND-x-L q2: 0 # FIND-x-L q5: 1 # FIND-x-L 1→1,L 1→1,L z→z,L
MUL = {1i#1j#1k | ij = k and i, j, k ≥ 1} 11#111#111111 x1#111#111111 x1#yyy#zzz111 x1#111#zzz111 xx#yyy#zzzzzz
LUP = {1i#x1#...#xn | n ≥i and xi = x1} 111#101#11#101 x11#101#11#101 xx1#101#11#101 .. .. .. .. . . . . xxx#101#11#101