(**************************************************************)




Inductive Derive_P_A_3 : Word * Conf -> Word * Conf -> Prop :=
  | Derive3_X :
      forall (w u s : Word) (x : Elt),
      dans x X ->
      Derive_P_A_3 (s, (cons x w, cons x u)) (Append s (cons x nil), (w, u))
  | Derive3_V :
      forall (v w u s : Word) (x : Elt),
      dans (couple x (word u)) R ->
      Derive_P_A_3 (s, (cons x w, v)) (s, (Append u w, v)).(**************************************************************)




Inductive Derive_P_A_3 : Word * Conf -> Word * Conf -> Prop :=
  | Derive3_X :
      forall (w u s : Word) (x : Elt),
      dans x X ->
      Derive_P_A_3 (s, (cons x w, cons x u)) (Append s (cons x nil), (w, u))
  | Derive3_V :
      forall (v w u s : Word) (x : Elt),
      dans (couple x (word u)) R ->
      Derive_P_A_3 (s, (cons x w, v)) (s, (Append u w, v)).(**************************************************************)




Inductive Derive_P_A_3 : Word * Conf -> Word * Conf -> Prop :=
  | Derive3_X :
      forall (w u s : Word) (x : Elt),
      dans x X ->
      Derive_P_A_3 (s, (cons x w, cons x u)) (Append s (cons x nil), (w, u))
  | Derive3_V :
      forall (v w u s : Word) (x : Elt),
      dans (couple x (word u)) R ->
      Derive_P_A_3 (s, (cons x w, v)) (s, (Append u w, v)).Definition Derivestar_P_A_3 := Rstar (Word * Conf) Derive_P_A_3.

(* Specifications: *)
Lemma Conserve_App_s_u : forall s1 s2 u1 u2 v1 v2 : Word, Derive_P_A_3 (s1, (u1, v1)) (s2, (u2, v2)) -> Append s1 v1 = Append s2 v2.
Lemma Derisvestar_P_A_3_conserve : forall s1 s2 u1 u2 v1 v2 : Word, Derivestar_P_A_3 (s1, (u1, v1)) (s2, (u2, v2)) -> Append s1 v1 = Append s2 v2.
Lemma Derive_P_A_2_imp_Derive_P_A_3 : forall (s : Word) (x y : Conf), Derive_P_A_2 x y -> exists s2 : Word, Derive_P_A_3 (s, x) (s2, y).
Lemma Derivestar_P_A_2_imp_Derivestar_P_A_3 : forall x y : Conf, Derivestar_P_A_2 x y -> forall s : Word, exists s2 : Word, Derivestar_P_A_3 (s, x) (s2, y).
Lemma Deriveg_imp_Deriveg_App_2 : forall x y a : Word, inmonoid X a -> Deriveg X R x y -> Deriveg X R (Append a x) (Append a y).
Lemma Derive_P_A_3_imp_Derivegstar : forall x y x' y' s s' : Word, Derive_P_A_3 (s, (x, y)) (s', (x', y')) -> inmonoid X s -> Derivegstar X R (Append s x) (Append s' x').
Lemma Derive_P_A_3_conserve_inmonoid_s : forall x y x' y' s s' : Word, Derive_P_A_3 (s, (x, y)) (s', (x', y')) -> inmonoid X s -> inmonoid X s'.
Lemma Derivestar_P_A_3_imp_Derivegstar : forall x y x' y' s s' : Word, Derivestar_P_A_3 (s, (x, y)) (s', (x', y')) -> inmonoid X s -> Derivegstar X R (Append s x) (Append s' x').
Theorem Derivestar_P_A_imp_Derivestar : forall x y : Word, Derivestar_P_A X d (x, y) (nil, nil) -> Derivestar R x y.
Theorem equiv_APD_Gram : l_egal (LA X wd wa d) (LG X V R S').