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

(* Specifications: *)
Lemma dta_states_non_empty_lazy_eg_dta_states_non_empty :
forall d : DTA, dta_states_non_empty_lazy d = dta_states_non_empty d.