(* 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                                                     *)
(* définition inductive du type des termes : *)
Inductive term : Set :=
app : ad -> term_list -> term
with term_list : Set :=
| tnil : term_list
| tcons : term -> term_list -> term_list.
(* les principes d'induction *)
Scheme term_term_list_rec := Induction for term
Sort Set
with term_list_term_rec := Induction for term_list
Sort Set.
Scheme term_term_list_ind := Induction for term
Sort Prop
with term_list_term_ind := Induction for term_list
Sort Prop.
Fixpoint lst_length (l : term_list) : nat :=
match l with
| tnil => 0
| tcons _ l' => S (lst_length l')
end.
Fixpoint term_high (t : term) : nat :=
match t with
| app a l => S (term_high_0 l)
end
with term_high_0 (l : term_list) : nat :=
match l with
| tnil => 0
| tcons hd tl => max (term_high hd) (term_high_0 tl)
end.
(* taille des termes : *)
Fixpoint taille_term (t : term) : nat :=
match t with
| app c l => S (mtaille_term_list l)
end
with mtaille_term_list (l : term_list) : nat :=
match l with
| tnil => 0
| tcons hd tl => max (taille_term hd) (mtaille_term_list tl)
end.
(* définition des structures prec_list : adjacence des états de l'automate *)
Inductive prec_list : Set :=
| prec_cons : ad -> prec_list -> prec_list -> prec_list
| prec_empty : prec_list.

Lemma pl_sum :
forall pl : prec_list,
pl = prec_empty \/
(exists a : ad,
(exists la : prec_list, (exists ls : prec_list, pl = prec_cons a la ls))).