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

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.