Toc Cae 2
Toc Cae 2
2M
1)Define PDA
The PDA can be defined as a collection of 7 tuples: M= (Q, ∑, δ, Γ, q0, Z, F)
δ: Transition function which is used for moving from current state to next state.
Γ: a tape symbol which can be pushed and popped from the stack
Ex: δ(q,a,x)=(p,α)
from state ‘q’ with a input ‘a’, with stack symbol ‘z’, goes to state ‘p’, x is replaced by string ‘α’.
2)Advantages of PDA
• PDA can remember an infinite amount of information.
Let P =(Q, ∑, Γ, δ, q0, Z, F) be a PDA. The language acceptable by the final state can be defined as:
Let P =(Q, ∑, Γ, δ, q0, Z, F) be a PDA. The language acceptable by empty stack can be defined as:
• Top down Parser- Parsing starts from the top with the start symbol and derives a string using
a parse tree.
• Bottom up parser- Starts from the bottom with the string and comes to the start symbol
using a parse tree.
• For any language L, we break its strings into five parts and pump second and fourth
substring.
Procedure:
(Q, ∑, δ, Γ, q0, B, F)
where –
7)Define Universal Turing Machine
A UTM is a TM, whose input consists of 2 parts
8)Advantages of TM
• A PDA can only access the top of its stack, whereas a TM can access any position on an
infinite tape.
• The infinite tape cannot be simulated with a single stack, so a PDA is less computationally
powerful.
• There are algorithms that can be programmed with a TM that cannot be programmed with
a PDA.
9) Validations in TM
• Storage in finite control
• Multiple track TM
• Multitape TM
• Multihead TM
• Multitape Multihead TM
q2 – accepting state.
• Push Operation:
• Pop Operation:
– δ(q0, b, a) = (q1, ε)
– δ(q1, b, a) = (q1, ε)
• Accept
δ(q1, ε, Z) = (q2, Z)
⊢ δ(q1, b, aZ)
⊢ δ(q1, ε, Z)
⊢ δ(q2, ε) ACCEPTED
Design PDA to accept L={xCxr / x = {a, b}*}
Solution:
• Starts with a or b.
• The values before c will be reversed after c.
• For every a's and b's push them into STACK
• When 'c' comes no operations.
• Pop STACK for 'a' for 'a' and 'b' for 'b' after c.
Transition Diagram:
Transition function:
δ(q0, a, Z) = (q0, aZ)
δ(q0, a, a) = (q0, aa)
δ(q0, b, Z) = (q0, bZ)
δ(q0, b, b) = (q0, bb)
δ(q0, a, b) = (q0, ab)
δ(q0, b, a) = (q0, ba)
δ(q0, c, a) = (q1, a)
δ(q0, c, b) = (q1, b)
δ(q1, b, b) = (q1, ε)
δ(q1, a, a) = (q1, ε)
δ(q1, ε, Z) = (qf, Z)
Step 3: The initial symbol of CFG will be the initial symbol in the PDA.
Step 3: The initial symbol of CFG will be the initial symbol in the PDA.
• A finite set Q of states (& the start state & the set of accepting/final states).
• A finite set ∑ which is called the input alphabet.
• A finite set Γ which is called the stack alphabet (& the initial stack symbol $).
• A finite set of transition instructions (or a transition function T).
Transition Function
5)Construct TM
Construct TM for the language L ={anbn} where n>=1
Each ‘a' should convert to X and then move along with the input tape and convert b to Y. Now,
repeat this process for all a's and b’s.
q0 is the control
Steps:
Transition table:
Construct TM for the language L ={anb2n} where n>=1
6) Construct Universal Turning Machine
Steps: