Using JFLAP
Given the alphabet of input symbols {a,b,c}. Use JFLAP to construct a PDA to recognize strings for which the number of a’s is twice the number of c’s. please take screen shots of important steps when you are using JFLAP, and briefly explain each step and your result.
Expert Answer
A = {Q, ∑, Γ, δ, q0, z0, F} where
Q = {q0, q1, q2, q3, q4} = set of states
∑ = {a, b, c} = input alphabet
Γ = {a, b, c, z0} = stack alphabet
F = {q4}
The PDA should accept input strings with symbols a, b and c where number of a’s is twice that of c’s.
The transition function δ is
δ(q0, c, z0) = {(q1, az0)}
δ(q1, c, c) = {(q1, cc)}
δ(q1, a, c) = {(q2, c)}
δ(q2, a, c) = {(q3, λ)}
δ(q3, a, c) = {(q2, c)}
δ(q2, b, c) = {(q3, λ)}
δ(q3, λ, z0) = {(q4, z0)}
Consider an input string aaaacc, the transitions are
δ(q0, c, z0) = {(q1, cz0)}
δ(q1, c, c) = {(q1, cc)}
δ(q1, a, c) = {(q2, c)}
δ(q2, a, c) = {(q3, λ)}
δ(q3, a, c) = {(q2, c)}
δ(q2, a, c) = {(q3, λ)}
δ(q3, λ, z0) = {(q4, z0)}
Since it halts in final state, the string is accepted.