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.Definition memCPAux m (cp : cartesianPower positive (S (S m))) (s : SS.elt) : bool.

(* Specifications: *)
Lemma memCPAuxHdTl : forall m cp s, memCPAux (S m) cp s = S.mem (fst cp) s && memCPAux m (tailCP cp) s.
Lemma memCPAuxOK : forall m cp s e, memCPAux m cp s = true -> InCP e cp -> S.mem e s = true.
Lemma memMemCPAuxOK : forall m cp s, (forall e, InCP e cp -> S.mem e s = true) -> memCPAux m cp s = true.
Lemma memCPAuxTlOK : forall m cp s, memCPAux (S m) cp s = true -> memCPAux m (tailCP cp) s = true.