(* 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                                                     *)
Unset Standard Proposition Elimination Names.
(* fonction définissant la sémantique : reconnaissance d'un terme par un automate *)
Fixpoint rec_term (d : preDTA) (a : ad) (t : term)
(n : nat) {struct n} : bool :=
match n with
| O => false
| S k =>
match t with
| app c l =>
match MapGet _ d a with
| None => false
| Some lts =>
match MapGet _ lts c with
| None => false
| Some pre => rec_list_terms d pre l k
end
end
end
end
with rec_list_terms (d : preDTA) (pre : prec_list)
(l : term_list) (n : nat) {struct n} : bool :=
match n with
| O => false
| S k =>
match pre with
| prec_empty => match l with
| tnil => true
| _ => false
end
| prec_cons st stp pre' =>
match l with
| tnil => false
| tcons hd tl =>
rec_list_terms d pre' l k
|| rec_term d st hd k && rec_list_terms d stp tl k
end
end
end.
(* bornes sur l'entier décroissant (terminaison de la fonction reconnaissance *)

Lemma borne_1 :
forall (d : preDTA) (s : state),
state_in_dta d s -> taille_1 s <= DTA_taille d.