(* 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)).

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.