Function identify_varieties (ss : SS.t) (st : STt) {measure SS.cardinal ss}
: SS.t :=
let varieties := pick_varieties ss st in
match varieties with
|None => ss
|Some (s1,s2) => let auxsetofsets := SS.remove s2 (SS.remove s1 ss) in
let auxset := S.union s1 s2 in
let newss := SS.add auxset auxsetofsets in
identify_varieties newss st
end.

Lemma memCPAuxOK : forall m cp s e,
memCPAux m cp s = true -> InCP e cp -> S.mem e s = true.