(** * CFP to CFI *)
Section Palindrome.
Variable Sigma : list symbol.
Notation StartG := (fresh Sigma).
Definition palin_G : cfg :=
(StartG, (StartG, []) ::
flat_map (fun g => [ (StartG, [g]);  (StartG, [g; StartG; g]) ]) Sigma).

(* Specifications: *)
Lemma notInZero  (x: nat) A :
not (x el A) <-> count A x = 0.
Lemma G_left x :
rewt palin_G [StartG] x -> rev x = x /\ count x StartG <= 1.
Lemma listI : forall (A : Type) (P : list A -> Prop), P [] -> (forall x, P [x]) -> (forall (x : A) (y : A) (l : list A), P l -> P (x :: l ++ [y])) -> forall l : list A, P l.
Lemma rev_palin x : x <<= StartG :: Sigma ->
x = rev x -> count x StartG <= 1 -> rewt palin_G [StartG] x.
Lemma Start_fresh x :
x <<= Sigma -> ~ StartG el x.
Lemma G_char x : x <<= Sigma ->
x = rev x <-> L palin_G x.