(* 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                                                     *)
(* fonction de suppression des états non coaccessibles *)
Fixpoint non_coacc_kill (d : preDTA) (m : Map bool) {struct m} : preDTA :=
match d, m with
| M0, M0 => M0 state
| M1 a s, M1 a' b => if N.eqb a a' && b then M1 state a s else M0 state
| M2 x y, M2 z t => M2 state (non_coacc_kill x z) (non_coacc_kill y t)
| _, _ => M0 state
end.
Definition predta_kill_non_coacc (d : preDTA) (a : ad) : preDTA :=
non_coacc_kill d (predta_coacc_states d a).
Definition dta_kill_non_coacc (d : DTA) : DTA :=
match d with
| dta p a => dta (predta_kill_non_coacc p a) a
end.
Definition predta_kill_non_coacc_lazy (d : preDTA)
(a : ad) : preDTA := non_coacc_kill d (predta_coacc_states_0 d a).
Definition dta_kill_non_coacc_lazy (d : DTA) : DTA :=
match d with
| dta p a => dta (predta_kill_non_coacc_lazy p a) a
end.
(* démo : un état apparait dans non_coacc_kill ssi il est coacc *)
(* coaccessibilité des états conservée en supprimant les coaccessibles *)
Definition predta_kill_non_coacc_def_0 (d : preDTA)
(a0 a1 : ad) : Prop :=
preDTA_ref_ok d ->
coacc d a0 a1 -> coacc (predta_kill_non_coacc d a0) a0 a1.

Lemma predta_kill_non_coacc_1 :
forall (d : preDTA) (a : ad) (s : state),
MapGet state d a = Some s -> predta_kill_non_coacc_def_0 d a a.