The number a is twice the number b.
Exact Grammar:
S = (a|b)* where N_a(S)=2*N_b(S)
N_a (X) means Number of a in X. etc.
At any given time, the stack can be either "a" or "b". What for? because there are no transitions a / xxbxx or b / xxaxx.
Case 1: The stack is everything.
You can see that the cycle will look like:
a (a * b) +, if the latter takes the transition L, a / L to (2-> 1)
a (a * b) + a, if in the latter case we take the transition a, Z0 / Z0 in (2-> 1). and the last "a" will not delete anything from the stack.
in each cycle, the number "jumped out" two. and the number of cycles is the same as the number "b" (except when a, Z0 / Z0 occurred last)
take the last transition L, a / L, if the number "a" is before the last "b"
take the last transition a, Z0 / Z0, if the number 'a' is odd until the last 'b'. a, Z0 / Z0 accepts another "a"
In this way,
A1=a(a*b)+a where N_a(A1)=2*N_b(A1), N_a(A1) is even A2=a(a*b)+ where N_a(A2)=2*N_b(A2), N_a(A2) is even
This will decrease to:
A=a(a|b)+ where N_a(A)=2*N_b(A), N_a(A) is even
(we will be in state 1 and will be empty)
Case 2: The stack is all b.
Similarly, you can see that each cycle will look like: b * ab * a. and in each cycle exactly one "b" will be deleted. Whenever "b" is received, "b" is pushed onto the stack. Thus, when the stack is empty and we return to state 1, the number of loops accepted is equal to the number "b that we accepted / pushed onto the stack. Thus,
B=b(b*ab*a)^n where N_b(B)=n
But you can see n = N_a (B) / 2. In this way,
B=b(b*ab*a)+ where N_a(B)=2*N_b(B)
This will decrease to:
B=b(b|a)+ where N_a(B)=2*N_b(B)
And since there are only two possible paths (A or B), and the loop can be taken 0 or 1 times,
In this way,
S=(A|B)* A=a(a|b)+ where N_a(A)=2*N_b(A) B=b(b|a)+ where N_a(B)=2*N_b(B)
This will decrease to:
S=((a|b)+)* where N_a(S)=2*N_b(S)
which will decrease to:
S=(a|b)* where N_a(S)=2*N_b(S)
QED