(* fonction dont on va calculer le point fixe : *)

Fixpoint map_replace (A : Set) (m : Map A) {struct m} : 
 ad -> A -> Map A :=
  fun (a : ad) (x : A) =>
  match m with
  | M0 => M0 A
  | M1 b y => if Neqb a b then M1 A b x else M1 A b y
  | M2 m n =>
      match a with
      | N0 => M2 A (map_replace A m N0 x) n
      | Npos q =>
          match q with
          | xH => M2 A m (map_replace A n N0 x)
          | xO p => M2 A (map_replace A m (Npos p) x) n
          | xI p => M2 A m (map_replace A n (Npos p) x)
          end
      end
  end.Fixpoint map_or (m0 m1 : Map bool) {struct m1} : Map bool :=
  match m0, m1 with
  | M0, _ => M0 bool
  | _, M0 => M0 bool
  | M1 a0 b0, M1 a1 b1 =>
      if Neqb a0 a1 then M1 bool a0 (b0 || b1) else M0 bool
  | M1 _ _, M2 _ _ => M0 bool
  | M2 _ _, M1 _ _ => M0 bool
  | M2 x0 y0, M2 x1 y1 => M2 bool (map_or x0 x1) (map_or y0 y1)
  end.Fixpoint pl_coacc (d : preDTA) (pl : prec_list) {struct pl} : 
 Map bool :=
  match pl with
  | prec_empty => map_mini state d
  | prec_cons a la ls =>
      map_replace bool (map_or (pl_coacc d la) (pl_coacc d ls)) a true
  end.Fixpoint st_coacc (d : preDTA) (s : state) {struct s} : 
 Map bool :=
  match s with
  | M0 => map_mini state d
  | M1 a pl => pl_coacc d pl
  | M2 x y => map_or (st_coacc d x) (st_coacc d y)
  end.Fixpoint predta_coacc_0 (d d' : preDTA) {struct d'} : 
 Map bool -> Map bool :=
  fun m : Map bool =>
  match d', m with
  | M0, M0 => map_mini state d
  | M1 a s, M1 a' b =>
      if Neqb a a' && b then st_coacc d s else map_mini state d
  | M2 x y, M2 z t => map_or (predta_coacc_0 d x z) (predta_coacc_0 d y t)
  | _, _ => map_mini state d
  end.Definition predta_coacc (d : preDTA) (a : ad) (m : Map bool) : 
  Map bool := map_replace bool (predta_coacc_0 d d m) a true.Definition predta_coacc_states (d : preDTA) (a : ad) : 
  Map bool :=
  power (Map bool) (predta_coacc d a) (map_mini state d)
    (S (MapCard state d)).Definition predta_coacc_states_0 (d : preDTA) (a : ad) : 
  Map bool :=
  lazy_power bool eqm_bool (predta_coacc d a) (map_mini state d)
    (S (MapCard state d)).

(* Specifications: *)
Lemma map_or_mapget_true_l : forall (m0 m1 : Map bool) (a : ad), domain_equal bool bool m0 m1 -> MapGet bool m0 a = Some true -> MapGet bool (map_or m0 m1) a = Some true.
Lemma map_or_mapget_true_ld : forall (d : preDTA) (m0 m1 : Map bool) (a : ad), ensemble_base state d m0 -> ensemble_base state d m1 -> MapGet bool m0 a = Some true -> MapGet bool (map_or m0 m1) a = Some true.
Lemma map_or_mapget_true_r : forall (m0 m1 : Map bool) (a : ad), domain_equal bool bool m0 m1 -> MapGet bool m0 a = Some true -> MapGet bool (map_or m1 m0) a = Some true.
Lemma map_or_mapget_true_rd : forall (d : preDTA) (m0 m1 : Map bool) (a : ad), ensemble_base state d m0 -> ensemble_base state d m1 -> MapGet bool m1 a = Some true -> MapGet bool (map_or m0 m1) a = Some true.
Lemma map_or_mapget_true_inv : forall (m0 m1 : Map bool) (a : ad), MapGet bool (map_or m0 m1) a = Some true -> MapGet bool m0 a = Some true \/ MapGet bool m1 a = Some true.
Lemma map_replace_mapget_ins_true_0 : forall (m : Map bool) (a : ad) (b : bool), MapGet bool m a = Some b -> MapGet bool (map_replace bool m a true) a = Some true.
Lemma map_replace_mapget_ins_true_1 : forall (m : Map bool) (a a' : ad), MapGet bool m a = Some true -> MapGet bool (map_replace bool m a' true) a = Some true.
Lemma map_replace_mapget_true_inv : forall (m : Map bool) (a b : ad), MapGet bool (map_replace bool m a true) b = Some true -> b = a \/ MapGet bool m b = Some true.
Lemma map_or_def_ok : forall m0 m1 : Map bool, domain_equal bool bool m0 m1 -> domain_equal bool bool m0 (map_or m0 m1).
Lemma map_or_def_ok_d : forall (d : preDTA) (m0 m1 : Map bool), ensemble_base state d m0 -> ensemble_base state d m1 -> ensemble_base state d (map_or m0 m1).
Lemma map_replace_def_ok : forall (A : Set) (m : Map A) (a : ad) (x : A), domain_equal A A m (map_replace A m a x).
Lemma map_replace_def_ok_d : forall (d : preDTA) (m : Map bool) (a : ad) (x : bool), ensemble_base state d m -> ensemble_base state d (map_replace bool m a x).
Lemma pl_coacc_def_ok : forall (d : preDTA) (pl : prec_list), ensemble_base state d (pl_coacc d pl).
Lemma st_coacc_def_ok : forall (d : preDTA) (s : state), ensemble_base state d (st_coacc d s).
Lemma predta_coacc_0_def_ok : forall (d d' : preDTA) (m : Map bool), ensemble_base state d (predta_coacc_0 d d' m).
Lemma predta_coacc_def_ok : forall (d : preDTA) (a : ad) (m : Map bool), ensemble_base state d (predta_coacc d a m).