Section mu2set.
Variable N : nat.
Definition set_1 := Evar_env'' 0 N.
Definition rel_1 (s t : var_env'') := In _ set_1 s /\ In _ set_1 t.
Definition t_to_rel1 (t : bool_expr) (ve1 ve2 : var_env') :=
eval_be' t (var_env'_or ve1 (var_env'_dash N ve2)).
Definition t_to_rel (t : bool_expr) (ve1 ve2 : var_env'') :=
t_to_rel1 t (var_env''_to_env' ve1) (var_env''_to_env' ve2).
Definition new_t_to_rel (t : bool_expr) (ve1 ve2 : var_env'') :=
t_to_rel t ve1 ve2 = true /\ rel_1 ve1 ve2.
Definition state_set (S : Ensemble var_env'') := Included _ S set_1.
Definition state_rel (R : Relation var_env'') :=
forall s t : var_env'', R s t -> rel_1 s t.  (* (In ? set_1 s) /\ (In ? set_1 t).*)
Definition set_0 := Empty_set var_env''.
Definition set_ap (x : ad) (s : var_env'') :=
In _ set_1 s /\ in_dom _ x s = true.
Definition set_or := Union var_env''.
Definition set_and := Intersection var_env''.
Definition set_neg := Setminus _ set_1.
Definition set_impl (S1 S2 : Ensemble var_env'') := set_or (set_neg S1) S2.
Definition set_iff (S1 S2 : Ensemble var_env'') :=
set_and (set_impl S1 S2) (set_impl S2 S1).
Inductive set_ex (R : Relation var_env'') (S : Ensemble var_env'') :
Ensemble var_env'' :=
setex_intro :
forall s t : var_env'',
In _ set_1 s -> R s t -> In _ S t -> In _ (set_ex R S) s.
Definition set_all (R : Relation var_env'') (S : Ensemble var_env'')
(s : var_env'') :=
In _ set_1 s /\ (forall t : var_env'', R s t -> In _ S t).
Definition set_mu (f : Ensemble var_env'' -> Ensemble var_env'')
(s : var_env'') :=
forall X : Ensemble var_env'',
state_set X -> Included _ (f X) X -> In _ X s.
Definition set_renv := ad -> Ensemble var_env''.
Definition set_tenv := ad -> Relation var_env''.
Definition sre_put (sre : set_renv) (P : ad) (S : Ensemble var_env'')
(Q : ad) := if Neqb P Q then S else sre Q.
Definition te_ste_ok (te : trans_env) (ste : set_tenv) :=
forall (a : ad) (ve1 ve2 : var_env''),
new_t_to_rel (te a) ve1 ve2 <-> ste a ve1 ve2.
Definition re_sre_ok (re : rel_env) (sre : set_renv) :=
forall P : ad, bool_expr_to_var_env'' 0 N (re P) = sre P.
Fixpoint mu_form2set (ste : set_tenv) (f : mu_form) {struct f} :
set_renv -> Ensemble var_env'' :=
fun sre =>
match f with
| mu_0 => set_0
| mu_1 => set_1
| mu_ap p => set_ap p
| mu_rel_var P => sre P
| mu_neg g => set_neg (mu_form2set ste g sre)
| mu_and g1 g2 => set_and (mu_form2set ste g1 sre) (mu_form2set ste g2 sre)
| mu_or g1 g2 => set_or (mu_form2set ste g1 sre) (mu_form2set ste g2 sre)
| mu_impl g1 g2 =>
set_impl (mu_form2set ste g1 sre) (mu_form2set ste g2 sre)
| mu_iff g1 g2 => set_iff (mu_form2set ste g1 sre) (mu_form2set ste g2 sre)
| mu_all t g => set_all (ste t) (mu_form2set ste g sre)
| mu_ex t g => set_ex (ste t) (mu_form2set ste g sre)
| mu_mu P g => set_mu (fun S => mu_form2set ste g (sre_put sre P S))
end.

Lemma ve''_to_be_ok3 :
forall (n : nat) (ve : var_env''),
n <= N -> be_ok (var_lu 0 N) (ve''_to_be ve n).