(* reconnaissance des listes de termes par chemins dans les prec_list *)

Inductive pl_path : Set :=
  | pl_path_nil : pl_path
  | pl_path_cons : ad -> pl_path -> pl_path.(* reconnaissance des listes de termes par chemins dans les prec_list *)

Inductive pl_path : Set :=
  | pl_path_nil : pl_path
  | pl_path_cons : ad -> pl_path -> pl_path.(* reconnaissance des listes de termes par chemins dans les prec_list *)

Inductive pl_path : Set :=
  | pl_path_nil : pl_path
  | pl_path_cons : ad -> pl_path -> pl_path.Inductive pl_path_incl : pl_path -> prec_list -> Prop :=
  | pl_path_incl_nil : pl_path_incl pl_path_nil prec_empty
  | pl_path_incl_cons :
      forall (plp : pl_path) (a : ad) (la ls : prec_list),
      pl_path_incl plp la ->
      pl_path_incl (pl_path_cons a plp) (prec_cons a la ls)
  | pl_path_incl_next :
      forall (plp : pl_path) (a : ad) (la ls : prec_list),
      pl_path_incl plp ls ->
      plp <> pl_path_nil -> pl_path_incl plp (prec_cons a la ls).Inductive pl_path_incl : pl_path -> prec_list -> Prop :=
  | pl_path_incl_nil : pl_path_incl pl_path_nil prec_empty
  | pl_path_incl_cons :
      forall (plp : pl_path) (a : ad) (la ls : prec_list),
      pl_path_incl plp la ->
      pl_path_incl (pl_path_cons a plp) (prec_cons a la ls)
  | pl_path_incl_next :
      forall (plp : pl_path) (a : ad) (la ls : prec_list),
      pl_path_incl plp ls ->
      plp <> pl_path_nil -> pl_path_incl plp (prec_cons a la ls).Inductive pl_path_incl : pl_path -> prec_list -> Prop :=
  | pl_path_incl_nil : pl_path_incl pl_path_nil prec_empty
  | pl_path_incl_cons :
      forall (plp : pl_path) (a : ad) (la ls : prec_list),
      pl_path_incl plp la ->
      pl_path_incl (pl_path_cons a plp) (prec_cons a la ls)
  | pl_path_incl_next :
      forall (plp : pl_path) (a : ad) (la ls : prec_list),
      pl_path_incl plp ls ->
      plp <> pl_path_nil -> pl_path_incl plp (prec_cons a la ls).Inductive pl_path_incl : pl_path -> prec_list -> Prop :=
  | pl_path_incl_nil : pl_path_incl pl_path_nil prec_empty
  | pl_path_incl_cons :
      forall (plp : pl_path) (a : ad) (la ls : prec_list),
      pl_path_incl plp la ->
      pl_path_incl (pl_path_cons a plp) (prec_cons a la ls)
  | pl_path_incl_next :
      forall (plp : pl_path) (a : ad) (la ls : prec_list),
      pl_path_incl plp ls ->
      plp <> pl_path_nil -> pl_path_incl plp (prec_cons a la ls).Inductive pl_path_recon : preDTA -> term_list -> pl_path -> Prop :=
  | pl_path_rec_nil : forall d : preDTA, pl_path_recon d tnil pl_path_nil
  | pl_path_rec_cons :
      forall (d : preDTA) (a : ad) (t : term) (plp : pl_path)
        (tl : term_list),
      reconnaissance d a t ->
      pl_path_recon d tl plp ->
      pl_path_recon d (tcons t tl) (pl_path_cons a plp).Inductive pl_path_recon : preDTA -> term_list -> pl_path -> Prop :=
  | pl_path_rec_nil : forall d : preDTA, pl_path_recon d tnil pl_path_nil
  | pl_path_rec_cons :
      forall (d : preDTA) (a : ad) (t : term) (plp : pl_path)
        (tl : term_list),
      reconnaissance d a t ->
      pl_path_recon d tl plp ->
      pl_path_recon d (tcons t tl) (pl_path_cons a plp).Inductive pl_path_recon : preDTA -> term_list -> pl_path -> Prop :=
  | pl_path_rec_nil : forall d : preDTA, pl_path_recon d tnil pl_path_nil
  | pl_path_rec_cons :
      forall (d : preDTA) (a : ad) (t : term) (plp : pl_path)
        (tl : term_list),
      reconnaissance d a t ->
      pl_path_recon d tl plp ->
      pl_path_recon d (tcons t tl) (pl_path_cons a plp).Definition pl_path_rec_equiv_0_def (d : preDTA) (pl : prec_list)
  (tl : term_list) :=
  liste_reconnait d pl tl ->
  exists plp : pl_path, pl_path_incl plp pl /\ pl_path_recon d tl plp.Fixpoint pl_path_length (plp : pl_path) : nat :=
  match plp with
  | pl_path_nil => 0
  | pl_path_cons _ p => S (pl_path_length p)
  end.

(* Specifications: *)
Lemma pl_path_exists : forall pl : prec_list, exists p : pl_path, pl_path_incl p pl.
Lemma non_empty_pl_path_exists : forall pl : prec_list, pl <> prec_empty -> exists p : pl_path, pl_path_incl p pl /\ 1 <= pl_path_length p.
Lemma pl_path_rec_equiv_0_0 : forall d : preDTA, pl_path_rec_equiv_0_def d prec_empty tnil.
Lemma pl_path_rec_equiv_0_1 : forall (d : preDTA) (a : ad) (la ls : prec_list) (hd : term) (tl : term_list), reconnaissance d a hd -> liste_reconnait d la tl -> pl_path_rec_equiv_0_def d la tl -> pl_path_rec_equiv_0_def d (prec_cons a la ls) (tcons hd tl).
Lemma pl_path_rec_equiv_0_2 : forall (d : preDTA) (a : ad) (la ls : prec_list) (hd : term) (tl : term_list), liste_reconnait d ls (tcons hd tl) -> pl_path_rec_equiv_0_def d ls (tcons hd tl) -> pl_path_rec_equiv_0_def d (prec_cons a la ls) (tcons hd tl).
Lemma pl_path_rec_equiv_0_3 : forall (p : preDTA) (p0 : prec_list) (t : term_list), liste_reconnait p p0 t -> pl_path_rec_equiv_0_def p p0 t.
Lemma pl_path_rec_equiv_0 : forall (d : preDTA) (pl : prec_list) (tl : term_list), liste_reconnait d pl tl -> exists plp : pl_path, pl_path_incl plp pl /\ pl_path_recon d tl plp.