Download presentation
Presentation is loading. Please wait.
Published byAdele Fisher Modified over 9 years ago
1
PDA: Sequence of moves By Diana Castro
2
PDA: Sequence of moves for aaabbb Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 1 st Move: (q 0, aaabbb, Z 0 ) ⊦ Initial State: q 0 Initial Stack Symbol: Z 0 Accepting State: q 3
3
Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 1 st move with the table (q 0, aaabbb, Z 0 ) ⊦ Next Move
4
1. (q 0, aaabbb, Z 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 2 nd Move (q 1, aabbb, aZ 0 ) ⊦ New State Unread part of the string Add a to the Stack
5
1. (q 0, aaabbb, Z 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 2 nd move with the table (q 1, aabbb, aZ 0 ) ⊦ Next Move
6
1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 3 rd Move (q 1, abbb, aaZ 0 ) ⊦ New State Unread part of the string Add a to the Stack
7
1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 3 rd move with the table (q 1, abbb, aaZ 0 ) ⊦ Next Move
8
1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 4 th Move (q 1, bbb, aaaZ 0 ) ⊦ New State Unread part of the string Add a to the Stack
9
Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 4 th move with the table (q 1, bbb, aaaZ 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦
10
1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 5 th Move (q 2, bb, aaZ 0 ) ⊦ New State Unread part of the string Pop the Stack. In this case we Pop a, and aaZ 0 are left on the Stack.
11
Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 5 th move with the table (q 2, bb, aaZ 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦
12
1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 5 th Move (q 2, bb, aaZ 0 ) ⊦ New State Unread part of the string Pop the Stack. In this case we Pop a, and aaZ 0 are left on the Stack.
13
Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 5 th move with the table (q 2, bb, aaZ 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦
14
1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 6 th Move (q 2, b, aZ 0 ) ⊦ New State Unread part of the string Pop the Stack. In this case we Pop a, and aZ 0 are left on the Stack.
15
Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 6 th move with the table (q 2, b, a Z 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦
16
1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ 6.(q 2, b, aZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 7 th Move (q 2, Λ, Z 0 ) ⊦ New State Unread part of the string Pop the Stack. In this case we Pop a, and Z 0 are left on the Stack.
17
Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 7 th move with the table (q 2, Λ, Z 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ 6.(q 2, b, aZ 0 ) ⊦
18
1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ 6.(q 2, b, aZ 0 ) ⊦ 7.(q 2, Λ, Z 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 8 th Move (q 3, Λ, Z 0 ) ⊦ New State Unread part of the string The stack remains empty
19
Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ 6.(q 2, b, aZ 0 ) ⊦ 7.(q 2, Λ, Z 0 ) ⊦ 8.(q 3, Λ, Z 0 ) String is accepted! Done
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.