Section MuEval.
Variable gc : BDDconfig -> list ad -> BDDconfig.
Hypothesis gc_is_OK : gc_OK gc.
Variable te : trans_env.
Variable bte : Btrans_env.
(* semantics for mu_calculus formulae; but the fixpoint operator is instead interpreted as iteration of a function atmost 2^n times *)
Fixpoint mu_eval (f : mu_form) : rel_env -> bool_expr :=
fun re =>
match f with
| mu_0 => Zero
| mu_1 => One
| mu_ap p => Var p
| mu_rel_var P => re P
| mu_neg g => Neg (mu_eval g re)
| mu_and g h => ANd (mu_eval g re) (mu_eval h re)
| mu_or g h => Or (mu_eval g re) (mu_eval h re)
| mu_impl g h => Impl (mu_eval g re) (mu_eval h re)
| mu_iff g h => Iff (mu_eval g re) (mu_eval h re)
| mu_all t g => mu_all_eval N (te t) (mu_eval g re)
| mu_ex t g => mu_ex_eval N (te t) (mu_eval g re)
| mu_mu P g =>
fst (iter2n _ be_eq_dec (fun be => mu_eval g (re_put re P be)) Zero N)
end.
Definition re_to_be_inc (f : rel_env -> bool_expr)
(P : ad) :=
forall (re : rel_env) (be1 be2 : bool_expr),
be_le be1 be2 -> be_le (f (re_put re P be1)) (f (re_put re P be2)).
Definition re_to_be_dec (f : rel_env -> bool_expr)
(P : ad) :=
forall (re : rel_env) (be1 be2 : bool_expr),
be_le be1 be2 -> be_le (f (re_put re P be2)) (f (re_put re P be1)).
Definition ad_to_be_ok (vf : ad -> bool) (abe : ad -> bool_expr) :=
forall x : ad, be_ok vf (abe x).
Definition ad_to_be_eq (f1 f2 : ad -> bool_expr) :=
forall x : ad, be_eq (f1 x) (f2 x).
Hypothesis te_ok : ad_to_be_ok (var_lu 0 (2 * N)) te.

(* Specifications: *)
Lemma mu_all_eval_lu :
forall t be : bool_expr,
be_ok (var_lu 0 (2 * N)) t ->
be_ok (var_lu 0 N) be -> be_ok (var_lu 0 N) (mu_all_eval N t be).
Lemma mu_ex_eval_lu :
forall t be : bool_expr,
be_ok (var_lu 0 (2 * N)) t ->
be_ok (var_lu 0 N) be -> be_ok (var_lu 0 N) (mu_ex_eval N t be).