Formal Languages
TP4: Grammars
Exercise 1
Can a context-sensitive grammar generate the language Lprime= { ap | p is a prime number} ?
Exercise 2 (Ogden Lemma Applications)
Exercise 3
Give the Chomsky normal form of the grammar ({S,A,B},{a,b},P,S) defined by the rules:
Show that if a word u is generated by a non-terminal A, then there exists words u1 and u2 respectively generated by B and C such that A → BC ∈ P.
Deduce an algorithm in O(n3) that, given a word u, where |u|=n, answer wether or not u can be generated by G.
Exercise 4
Consider the language L=LG(S) where grammar G is defined by S → aSSb+c. Show that every rationnal language included in L is finite.
Exercice 5.
Let K be a rationnal language and L a context-free language. Show that