(* 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                                                     *)
(* correction d'un preDTA : pas de référence à des adresses extérieures à l'automate *)
Definition prec_list_ref_ok (p : prec_list) (d : preDTA) : Prop :=
forall a : ad,
prec_occur p a -> exists s : state, MapGet state d a = Some s.
Definition state_ref_ok (s : state) (d : preDTA) : Prop :=
forall (a : ad) (p : prec_list),
MapGet prec_list s a = Some p -> prec_list_ref_ok p d.
Definition preDTA_ref_ok (d : preDTA) : Prop :=
forall (a : ad) (s : state) (c : ad) (pl : prec_list) (b : ad),
MapGet state d a = Some s ->
MapGet prec_list s c = Some pl ->
prec_occur pl b -> exists s0 : state, MapGet state d b = Some s0.
Definition preDTA_ref_ok_distinct (d d' : preDTA) : Prop :=
forall (a : ad) (s : state),
MapGet state d a = Some s -> state_ref_ok s d'.
Definition DTA_ref_ok (d : DTA) : Prop :=
match d with
| dta p a => preDTA_ref_ok p
end.

(* Specifications: *)
Lemma prec_list_ref_ok_destr :
forall (a : ad) (la ls : prec_list) (d : preDTA),
prec_list_ref_ok (prec_cons a la ls) d ->
prec_list_ref_ok la d /\ prec_list_ref_ok ls d.
Lemma state_ref_ok_M2_destr :
forall (s0 s1 : state) (d : preDTA),
state_ref_ok (M2 prec_list s0 s1) d ->
state_ref_ok s0 d /\ state_ref_ok s1 d.
Lemma preDTA_ref_ok_def :
forall d : preDTA,
preDTA_ref_ok d <->
(forall (a : ad) (s : state),
MapGet state d a = Some s -> state_ref_ok s d).
Lemma preDTA_ref_ok_distinct_dest :
forall d0 d1 d : preDTA,
preDTA_ref_ok_distinct (M2 state d0 d1) d ->
preDTA_ref_ok_distinct d0 d /\ preDTA_ref_ok_distinct d1 d.