(* définition de la fonction dont on va calculer le point fixe *)

Fixpoint pl_non_empty (m : Map bool) (p : prec_list) {struct p} : bool :=
  match p with
  | prec_empty => true
  | prec_cons a la ls =>
      match ls with
      | prec_empty =>
          match MapGet bool m a with
          | Some b => b && pl_non_empty m la
          | None => false
          end
      | prec_cons _ _ _ =>
          match MapGet bool m a with
          | Some b => pl_non_empty m ls || b && pl_non_empty m la
          | None => pl_non_empty m ls
          end
      end
  end.Fixpoint st_non_empty (m : Map bool) (s : state) {struct s} : bool :=
  match s with
  | M0 => false
  | M1 _ p => pl_non_empty m p
  | M2 a b => st_non_empty m a || st_non_empty m b
  end.Fixpoint dta_app_ne_aux (d : preDTA) (m r : Map bool) {struct r} :
 Map bool :=
  match d, r with
  | M0, _ => M0 bool
  | M1 a s, M0 => M0 bool
  | M1 a s, M1 a' b =>
      if Neqb a a' then M1 bool a (b || st_non_empty m s) else M0 bool
  | M1 a s, M2 _ _ => M0 bool
  | M2 d0 d1, M0 => M0 bool
  | M2 d0 d1, M1 _ _ => M0 bool
  | M2 d0 d1, M2 r0 r1 =>
      M2 bool (dta_app_ne_aux d0 m r0) (dta_app_ne_aux d1 m r1)
  end.Definition dta_app_ne (d : preDTA) (m : Map bool) : 
  Map bool := dta_app_ne_aux d m m.Definition dta_non_empty_states (d : preDTA) : Map bool :=
  power (Map bool) (dta_app_ne d) (map_mini state d) (S (MapCard state d)).Definition dta_states_non_empty (d : DTA) : Map bool :=
  match d with
  | dta p a => dta_non_empty_states p
  end.Definition dta_non_empty_states_lazy (d : preDTA) : 
  Map bool :=
  lazy_power bool eqm_bool (dta_app_ne d) (map_mini state d)
    (S (MapCard state d)).Definition dta_states_non_empty_lazy (d : DTA) : Map bool :=
  match d with
  | dta p a => dta_non_empty_states_lazy p
  end.

Lemma dta_app_ne_def_ok : forall d : preDTA, def_ok_app bool (ensemble_base state d) (dta_app_ne d).