
  [;1m-spec partition(SetOfSets) -> Partition[0m
  [;1m                   when SetOfSets :: set_of_sets(), Partition :: a_set().[0m

  Returns the partition of the union of the set of sets [;;4mSetOfSets[0m
  such that two elements are considered equal if they belong to the
  same elements of [;;4mSetOfSets[0m.

    1> Sets1 = sofs:from_term([[a,b,c],[d,e,f],[g,h,i]]),
    Sets2 = sofs:from_term([[b,c,d],[e,f,g],[h,i,j]]),
    P = sofs:partition(sofs:union(Sets1, Sets2)),
    sofs:to_external(P).
    [[a],[b,c],[d],[e,f],[g],[h,i],[j]]

  [;1m-spec partition(SetFun, Set) -> Partition[0m
  [;1m                   when[0m
  [;1m                       SetFun :: set_fun(),[0m
  [;1m                       Partition :: a_set(),[0m
  [;1m                       Set :: a_set().[0m

  Returns the partition of [;;4mSet[0m such that two elements are
  considered equal if the results of applying [;;4mSetFun[0m are equal.

    1> Ss = sofs:from_term([[a],[b],[c,d],[e,f]]),
    SetFun = fun(S) -> sofs:from_term(sofs:no_elements(S)) end,
    P = sofs:partition(SetFun, Ss),
    sofs:to_external(P).
    [[[a],[b]],[[c,d],[e,f]]]

  [;1m-spec partition(SetFun, Set1, Set2) -> {Set3, Set4}[0m
  [;1m                   when[0m
  [;1m                       SetFun :: set_fun(),[0m
  [;1m                       Set1 :: a_set(),[0m
  [;1m                       Set2 :: a_set(),[0m
  [;1m                       Set3 :: a_set(),[0m
  [;1m                       Set4 :: a_set().[0m

  Returns a pair of sets that, regarded as constituting a set, forms
  a partition of [;;4mSet1[0m. If the result of applying [;;4mSetFun[0m to an
  element of [;;4mSet1[0m gives an element in [;;4mSet2[0m, the element belongs
  to [;;4mSet3[0m, otherwise the element belongs to [;;4mSet4[0m.

    1> R1 = sofs:relation([{1,a},{2,b},{3,c}]),
    S = sofs:set([2,4,6]),
    {R2,R3} = sofs:partition(1, R1, S),
    {sofs:to_external(R2),sofs:to_external(R3)}.
    {[{2,b}],[{1,a},{3,c}]}

  [;;4mpartition(F, S1, S2)[0m is equivalent to [;;4m{restriction(F, S1, S2),[0m
  [;;4mdrestriction(F, S1, S2)}[0m.
