Module ESF2 := FSetFacts.Facts(EqSet2).Module ESP2 := FSetProperties.Properties(EqSet2).Module ESD2 := FSetDecide.Decide(EqSet2).

(* Specifications: *)
Lemma partial_fold_ind: forall (A: Type) (P: EqSet2.t -> A -> Prop) f init final s, EqSet2.fold (fun q opte => match opte with | None => None | Some e => f q e end) s (Some init) = Some final -> (forall s', EqSet2.Empty s' -> P s' init) -> (forall x a' a'' s' s'', EqSet2.In x s -> ~EqSet2.In x s' -> ESP2.Add x s' s'' -> f x a' = Some a'' -> P s' a' -> P s'' a'') -> P s final.
Lemma in_subst_loc: forall l1 l2 q (e e': eqs), EqSet.In q e -> subst_loc l1 l2 e = Some e' -> (eloc q = l1 /\ EqSet.In (Eq (ekind q) (ereg q) l2) e') \/ (Loc.diff l1 (eloc q) /\ EqSet.In q e').
Lemma loc_type_compat_charact: forall env l e q, loc_type_compat env l e = true -> EqSet.In q e -> subtype (sel_type (ekind q) (env (ereg q))) (Loc.type l) = true \/ Loc.diff l (eloc q).