Problem
- For some string xβΞ£β
- There exists b(x) which represents x in reverse
- Let BW(L) be the set of all backwards strings of L
- For example, L={ark,bone},BL={kra,enob}
- Prove that if L is regular, then BW(L) is also regular
Solution
We prove with Proof by Structural Induction
Define B(R) as βThere exists a Rβ² s.t BW(L(Rβ²))=L(Rβ²)
Base Case
We show that B(x) holds for β
,Ο΅,a
- Let R=β
,Rβ²=β
- Let R=Ο΅,Rβ²=Ο΅
- Let R=a,Rβ²=a
Induction Step
- Let S,TβRE
- Suppose B(S),B(T) IH
- This means βSβ²,Tβ² s.t L(Sβ²)=BW(L(S)) and L(Tβ²)=BW(L(T))
We need to show 3 cases: B(S+T), B(ST), B(Sβ)
- Case 1: R=S+T
- Then, BW(L(R))=BW(L(S+T))=BW(L(S))βͺBW(L(T))
- =L(Sβ²)+L(Tβ²) by IH
- =L(Sβ²+Tβ²) as + order doesnt matter
- =L(Rβ²)
- Case 2: R=ST
- Then, BW(L(R))=BW(L(ST))=BW(L(T))β
BW(L(S)) as swapping order of concatenation reverses the roder
- =L(Tβ²)β
L(Sβ²) by IH
- =L(Tβ²Sβ²)
- =L(Rβ²)
- Case 3: R=Sβ
- Then, BW(L(R))=BW(L(Rβ))=BW(L(R)β) as order does not matter for β
- =L(Sβ²)β
- =L(Sβ²β)
- =L(Rβ²)
- Then, by structural induction B(R) holds βRβRE