as many b’s as a’s
Tuesday, July 7th, 2009
This is the first half of a proof that is the first question from the may qualifiers. Tougher to write up than I thought it would be.
Let L be the language defined by the following recursive definition:
- Λ and b are in L
- If x is in L, then axb and bxa are in L
- If x and y are in L, then xy is in L
- No other strings are in L
Give a simple non-recursive definition of L. Give a formal proof that your answer is correct.
2 Solution
The language of all strings over {a,b}*, where the number of b′s is greater than or equal to the number of a’s, that is, where |b|≥|a|.
To be proved: L = A.
This will be proved in two steps.
L ⊂ A
- A ⊂ L
Proof.L ⊂ A
We proceed by structural induction. Note that for a string x, |a|x is the positive integer number of as in x.
Basis Step: Λ and b are in A. This is obvious, both are strings over {a,b}* | |b|≥|a|
Induction Hypothesis x, y ∈ A
Statement to be shown in induction step: xy, axb, bxa ∈ A, that is, applying any production rule for L to a string in A produces another string in A.
Proof of induction step:
If x ∈ A and y ∈ A then xy ∈ A.
We know that for x, |a|x ≤ |b|x and for y, |a|y ≤ |b|y. By the rules of concatenation, xy has |a|x+|a|y, |b|x+|b|y.
By properties of integers, |a|x+|a|y ≤ |b|x+|b|y, so xy ∈ A
x has |a|x ≤ |b|x by definition. axb or bxa both form new strings with the property that |a| = |a|x+1, |b|=|b|x+1. By properties of integers, |a| ≤ |b| → |a|+1 ≤ |b|+1
Therefore xy, axb, bxa are all in A, and L ⊂ A, as was to be shown.
This document was translated from LATEX by
HEVEA.