Definition fst_ss (pair : SS.t * SS.t) :=
match pair with
|(a,b) => a
end.
Definition snd_ss (pair : SS.t * SS.t) :=
match pair with
|(a,b) => b
end.
Definition subst_in_set p1 p2 s := S.add p1 (S.remove p2 s).
Definition subst_in_ss_aux p1 p2 := (fun s ss => SS.add (subst_in_set p1 p2 s) ss).
Definition subst_in_ss p1 p2 ss :=
let pair := partition_ss p2 ss in
let fss := fst_ss(pair) in
let sss := snd_ss(pair) in
let newfss := SS.fold (subst_in_ss_aux p1 p2) fss SS.empty in
SS.union newfss sss.

Lemma proper_5 : forall p, Proper (S.Equal ==> eq) (fun s : SS.elt => negb (S.mem p s)).