Pushdown automaton Word aaaabbbb belongs to the language L = { a n b n | n ≥ 1 } a a a a b b b b q 2 I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 7 / 31
Pushdown automaton Word aaaabbbb belongs to the language L = { a n b n | n ≥ 1 } The automaton has read the whole word and ends with an empty stack, and so the word is accepted by the automaton. a a a a b b b b YES q 2 Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 7 / 31
Pushdown automaton Word aaaabbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b q 1 Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 8 / 31
Pushdown automaton Word aaaabbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b q 1 I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 8 / 31
Pushdown automaton Word aaaabbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b q 1 I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 8 / 31
Pushdown automaton Word aaaabbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b q 1 I I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 8 / 31
Pushdown automaton Word aaaabbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b q 1 I I I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 8 / 31
Pushdown automaton Word aaaabbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b q 2 I I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 8 / 31
Pushdown automaton Word aaaabbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b q 2 I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 8 / 31
Pushdown automaton Word aaaabbb does not belong to language L = { a n b n | n ≥ 1 } The automaton has read all word but the stack is not empty and so the word is not accepted by the automaton. a a a a b b b NO q 2 I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 8 / 31
Pushdown automaton Word aaaabbbbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b b b q 1 Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 9 / 31
Pushdown automaton Word aaaabbbbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b b b q 1 I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 9 / 31
Pushdown automaton Word aaaabbbbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b b b q 1 I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 9 / 31
Pushdown automaton Word aaaabbbbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b b b q 1 I I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 9 / 31
Pushdown automaton Word aaaabbbbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b b b q 1 I I I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 9 / 31
Pushdown automaton Word aaaabbbbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b b b q 2 I I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 9 / 31
Pushdown automaton Word aaaabbbbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b b b q 2 I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 9 / 31
Pushdown automaton Word aaaabbbbb does not belong to language L = { a n b n | n ≥ 1 } a a a a b b b b b q 2 I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 9 / 31
Pushdown automaton Word aaaabbbbb does not belong to language L = { a n b n | n ≥ 1 } The automaton reads b , it should remove a symbol from the stack but there is no symbol there. So the word is not accepted. a a a a b b b b b NO q 2 Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 9 / 31
Pushdown automaton Word aababbab does not belong to language L = { a n b n | n ≥ 1 } a a b a b b a b q 1 Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 10 / 31
Pushdown automaton Word aababbab does not belong to language L = { a n b n | n ≥ 1 } a a b a b b a b q 1 I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 10 / 31
Pushdown automaton Word aababbab does not belong to language L = { a n b n | n ≥ 1 } a a b a b b a b q 1 I I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 10 / 31
Pushdown automaton Word aababbab does not belong to language L = { a n b n | n ≥ 1 } a a b a b b a b q 2 I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 10 / 31
Pushdown automaton Word aababbab does not belong to language L = { a n b n | n ≥ 1 } The automaton has read a but it is already in the state where it removes symbols from the stack, and so the word is not accepted. a a b a b b a b NO q 2 I Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 10 / 31
Pushdown automaton A pushdown automaton can be nondeterministic and it can have ε -transitions. Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 11 / 31
Pushdown automaton A pushdown automaton can be nondeterministic and it can have ε -transitions. Example: Let us consider the language L = { w ∈ { a , b } ∗ | w = w R } . The first half of a word can be stored on the stack. When reading the second part, the automaton removes the symbols from the stack if they are same as symbols in the input. If the stack is empty after reading all word, the second is the same (the reverse of) the first. The automaton nondeterministically guesses the position of a “boundery’ between the first and the second half of a word. Those computations where the automaton guesses wrong will not accept the word.’. Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 11 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 1 Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 1 A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 1 B A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 1 B B A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 1 A B B A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 1 B A B B A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 2 B A B B A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 2 A B B A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 2 B B A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 2 B A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 2 A Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a q 2 Z Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Word abbabababba belongs to the language L = { w ∈ { a , b } ∗ | w = w R } a b b a b a b a b b a YES q 2 Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 12 / 31
Pushdown automaton Definition A pushdown automaton ( PDA ) is a tuple M = ( Q , Σ, Γ, δ, q 0 , Z 0 ) where Q is a finite non-empty set of states Σ is a finite non-empty set called an input alphabet Γ is a finite non-empty set called a stack alphabet δ : Q × ( Σ ∪ { ε } ) × Γ → P ( Q × Γ ∗ ) is a (nondeterministic) transition function q 0 ∈ Q is the initial state Z 0 ∈ Γ is the initial stack symbol Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 13 / 31
Pushdown automaton Example: L = { a n b n | n ≥ 1 } M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } Σ = { a , b } Γ = { Z , I } δ ( q 1 , a , Z ) = { ( q 1 , I ) } δ ( q 1 , b , Z ) = ∅ δ ( q 1 , a , I ) = { ( q 1 , II ) } δ ( q 1 , b , I ) = { ( q 2 , ε ) } δ ( q 2 , a , I ) = ∅ δ ( q 2 , b , I ) = { ( q 2 , ε ) } δ ( q 2 , a , Z ) = ∅ δ ( q 2 , b , Z ) = ∅ Remark: We often omit those values of transition function δ that are ∅ . Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 14 / 31
Pushdown automaton To represent transition functions, we will use a notation where a transition function is viewed as a set of rules : For every q , q ′ ∈ Q , a ∈ Σ ∪ { ε } , X ∈ Γ , and α ∈ Γ ∗ , where ( q ′ , α ) ∈ δ ( q , a , X ) there is a corresponding rule a qX − → q ′ α . Example: If δ ( q 5 , b , C ) = { ( q 3 , ACC ) , ( q 5 , BB ) , ( q 13 , ε ) } it can be represented as three rules: b b b − − − q 5 C → q 3 ACC q 5 C → q 5 BB q 5 C → q 13 Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 15 / 31
Pushdown automaton Example: The automaton, recognizing the language L = { a n b n | n ≥ 1 } , that was described before: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } Σ = { a , b } Γ = { Z , I } a q 1 Z − → q 1 I a q 1 I − → q 1 II b − q 1 I → q 2 b − q 2 I → q 2 Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 16 / 31
Pushdown automaton Example: L = { w ∈ { a , b } ∗ | w = w R } M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } Σ = { a , b } Γ = { Z , A , B } δ ( q 1 , a , Z ) = { ( q 1 , AZ ) , ( q 2 , Z ) } δ ( q 1 , b , Z ) = { ( q 1 , BZ ) , ( q 2 , Z ) } δ ( q 1 , a , A ) = { ( q 1 , AA ) , ( q 2 , A ) } δ ( q 1 , b , A ) = { ( q 1 , BA ) , ( q 2 , A ) } δ ( q 1 , a , B ) = { ( q 1 , AB ) , ( q 2 , B ) } δ ( q 1 , b , B ) = { ( q 1 , BB ) , ( q 2 , B ) } δ ( q 1 , ε, Z ) = { ( q 2 , Z ) } δ ( q 2 , ε, Z ) = { ( q 2 , ε ) } δ ( q 2 , ε, A ) = ∅ δ ( q 1 , ε, A ) = { ( q 2 , A ) } δ ( q 2 , ε, B ) = ∅ δ ( q 1 , ε, B ) = { ( q 2 , B ) } δ ( q 2 , b , A ) = ∅ δ ( q 2 , a , A ) = { ( q 2 , ε ) } δ ( q 2 , a , B ) = ∅ δ ( q 2 , b , B ) = { ( q 2 , ε ) } δ ( q 2 , a , Z ) = ∅ δ ( q 2 , b , Z ) = ∅ Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 17 / 31
Pushdown automaton Example: L = { w ∈ { a , b } ∗ | w = w R } M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } Σ = { a , b } Γ = { Z , A , B } a b ε q 1 Z − → q 1 AZ q 1 Z − → q 1 BZ q 2 Z − → q 2 a b a q 1 A − → q 1 AA q 1 A − → q 1 BA q 2 A − → q 2 a b b q 1 B − → q 1 AB q 1 B − → q 1 BB q 2 B − → q 2 a b ε q 1 Z − → q 2 Z q 1 Z − → q 2 Z q 1 Z − → q 2 Z a b ε − − − q 1 A → q 2 A q 1 A → q 2 A q 1 A → q 2 A a b ε − − − q 1 B → q 2 B q 1 B → q 2 B q 1 B → q 2 B Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 17 / 31
Computation of Pushdown Automaton Let M = ( Q , Σ, Γ, δ, q 0 , Z 0 ) be a pushdown automaton. Configurations of M : A configuration of a PDA is a triple ( q , w , α ) where q ∈ Q , w ∈ Σ ∗ , and α ∈ Γ ∗ . An initial configuration is a configuration ( q 0 , w , Z 0 ) , where w ∈ Σ ∗ . Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 18 / 31
Computation of Pushdown Automaton Steps performed by M : Binary relation − → on configurations of M represents the possible steps of computation performed by PDA M . That M can go from configuration ( q , w , α ) to configuration ( q ′ , w ′ , α ′ ) is written as ( q , w , α ) − → ( q ′ , w ′ , α ′ ) . The relation − → is defined as follows: ( q , aw , X β ) − → ( q ′ , w , αβ ) iff ( q ′ , α ) ∈ δ ( q , a , X ) where q , q ′ ∈ Q , a ∈ ( Σ ∪ { ε } ) , w ∈ Σ ∗ , X ∈ Γ , and α, β ∈ Γ ∗ . Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 19 / 31
Computation of Pushdown Automaton Computations of M : → ∗ on configurations of M as the We define binary relation − reflexive and transitive closure of − → , i.e., → ∗ ( q ′ , w ′ , α ′ ) ( q , w , α ) − if there is a sequence of configurations ( q 0 , w 0 , α 0 ) , ( q 1 , w 1 , α 1 ) , . . . , ( q n , w n , α n ) such that ( q , w , α ) = ( q 0 , w 0 , α 0 ) , ( q ′ , w ′ , α ′ ) = ( q n , w n , α n ) , and ( q i , w i , α i ) − → ( q i + 1 , w i + 1 , α i + 1 ) for each i = 0 , 1 , . . . , n − 1, i.e., ( q 0 , w 0 , α 0 ) − → ( q 1 , w 1 , α 1 ) − · · · − → ( q n , w n , α n ) → Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 20 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b q 1 A → q 1 AA q 1 A → q 1 BA − − a b q 1 B → q 1 AB q 1 B → q 1 BB − − a b q 1 Z → q 2 Z q 1 Z → q 2 Z − − a b q 1 A → q 2 A q 1 A → q 2 A − − a b q 1 B → q 2 B q 1 B → q 2 B − − ε q 1 Z → q 2 Z − ε q 1 A → q 2 A − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b q 1 A → q 1 AA q 1 A → q 1 BA − − a b q 1 B → q 1 AB q 1 B → q 1 BB − − a b q 1 Z → q 2 Z q 1 Z → q 2 Z − − a b q 1 A → q 2 A q 1 A → q 2 A − − a b q 1 B → q 2 B q 1 B → q 2 B − − ε q 1 Z → q 2 Z − ε q 1 A → q 2 A − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − a b q 1 B → q 1 AB q 1 B → q 1 BB − − a b q 1 Z → q 2 Z q 1 Z → q 2 Z − − a b q 1 A → q 2 A q 1 A → q 2 A − − a b q 1 B → q 2 B q 1 B → q 2 B − − ε q 1 Z → q 2 Z − ε q 1 A → q 2 A − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − a b q 1 Z → q 2 Z q 1 Z → q 2 Z − − a b q 1 A → q 2 A q 1 A → q 2 A − − a b q 1 B → q 2 B q 1 B → q 2 B − − ε q 1 Z → q 2 Z − ε q 1 A → q 2 A − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − a b q 1 A → q 2 A q 1 A → q 2 A − − a b q 1 B → q 2 B q 1 B → q 2 B − − ε q 1 Z → q 2 Z − ε q 1 A → q 2 A − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − → ( q 1 , bababba , ABBAZ ) − a b q 1 A → q 2 A q 1 A → q 2 A − − a b q 1 B → q 2 B q 1 B → q 2 B − − ε q 1 Z → q 2 Z − ε q 1 A → q 2 A − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − → ( q 1 , bababba , ABBAZ ) − a b q 1 A → q 2 A q 1 A → q 2 A − − → ( q 1 , ababba , BABBAZ ) − a b q 1 B → q 2 B q 1 B → q 2 B − − ε q 1 Z → q 2 Z − ε q 1 A → q 2 A − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − → ( q 1 , bababba , ABBAZ ) − a b q 1 A → q 2 A q 1 A → q 2 A − − → ( q 1 , ababba , BABBAZ ) − a b q 1 B → q 2 B q 1 B → q 2 B − − → ( q 2 , babba , BABBAZ ) − ε q 1 Z → q 2 Z − ε q 1 A → q 2 A − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − → ( q 1 , bababba , ABBAZ ) − a b q 1 A → q 2 A q 1 A → q 2 A − − → ( q 1 , ababba , BABBAZ ) − a b q 1 B → q 2 B q 1 B → q 2 B − − → ( q 2 , babba , BABBAZ ) − ε q 1 Z → q 2 Z − → ( q 2 , abba , ABBAZ ) − ε q 1 A → q 2 A − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − → ( q 1 , bababba , ABBAZ ) − a b q 1 A → q 2 A q 1 A → q 2 A − − → ( q 1 , ababba , BABBAZ ) − a b q 1 B → q 2 B q 1 B → q 2 B − − → ( q 2 , babba , BABBAZ ) − ε q 1 Z → q 2 Z − → ( q 2 , abba , ABBAZ ) − ε q 1 A → q 2 A − → ( q 2 , bba , BBAZ ) − ε q 1 B → q 2 B − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − → ( q 1 , bababba , ABBAZ ) − a b q 1 A → q 2 A q 1 A → q 2 A − − → ( q 1 , ababba , BABBAZ ) − a b q 1 B → q 2 B q 1 B → q 2 B − − → ( q 2 , babba , BABBAZ ) − ε q 1 Z → q 2 Z − → ( q 2 , abba , ABBAZ ) − ε q 1 A → q 2 A − → ( q 2 , bba , BBAZ ) − ε q 1 B → q 2 B − → ( q 2 , ba , BAZ ) − ε q 2 Z → q 2 − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − → ( q 1 , bababba , ABBAZ ) − a b q 1 A → q 2 A q 1 A → q 2 A − − → ( q 1 , ababba , BABBAZ ) − a b q 1 B → q 2 B q 1 B → q 2 B − − → ( q 2 , babba , BABBAZ ) − ε q 1 Z → q 2 Z − → ( q 2 , abba , ABBAZ ) − ε q 1 A → q 2 A − → ( q 2 , bba , BBAZ ) − ε q 1 B → q 2 B − → ( q 2 , ba , BAZ ) − ε q 2 Z → q 2 − → ( q 2 , a , AZ ) − a q 2 A → q 2 − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − → ( q 1 , bababba , ABBAZ ) − a b q 1 A → q 2 A q 1 A → q 2 A − − → ( q 1 , ababba , BABBAZ ) − a b q 1 B → q 2 B q 1 B → q 2 B − − → ( q 2 , babba , BABBAZ ) − ε q 1 Z → q 2 Z − → ( q 2 , abba , ABBAZ ) − ε q 1 A → q 2 A − → ( q 2 , bba , BBAZ ) − ε q 1 B → q 2 B − → ( q 2 , ba , BAZ ) − ε q 2 Z → q 2 − → ( q 2 , a , AZ ) − a q 2 A → q 2 − → ( q 2 , ε, Z ) − b q 2 B → q 2 − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Computation of Pushdown Automaton Example: M = ( Q , Σ, Γ, δ, q 1 , Z ) where Q = { q 1 , q 2 } , Σ = { a , b } , Γ = { Z , A , B } a b ( q 1 , abbabababba , Z ) q 1 Z → q 1 AZ q 1 Z → q 1 BZ − − a b → ( q 1 , bbabababba , AZ ) q 1 A → q 1 AA q 1 A → q 1 BA − − − → ( q 1 , babababba , BAZ ) a b − q 1 B → q 1 AB q 1 B → q 1 BB − − → ( q 1 , abababba , BBAZ ) a b − q 1 Z → q 2 Z q 1 Z → q 2 Z − − → ( q 1 , bababba , ABBAZ ) − a b q 1 A → q 2 A q 1 A → q 2 A − − → ( q 1 , ababba , BABBAZ ) − a b q 1 B → q 2 B q 1 B → q 2 B − − → ( q 2 , babba , BABBAZ ) − ε q 1 Z → q 2 Z − → ( q 2 , abba , ABBAZ ) − ε q 1 A → q 2 A − → ( q 2 , bba , BBAZ ) − ε q 1 B → q 2 B − → ( q 2 , ba , BAZ ) − ε q 2 Z → q 2 − → ( q 2 , a , AZ ) − a q 2 A → q 2 − → ( q 2 , ε, Z ) − b → ( q 2 , ε, ε ) q 2 B → q 2 − − Z. Sawa (TU Ostrava) Theoretical Computer Science December 3, 2020 21 / 31
Recommend
More recommend