(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(* 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_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.
(* existence de chemins dans les prec_list *)

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.