
[;1m  partition(SetOfSets)[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  partition(SetFun, 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  partition(SetFun, Set1, Set2)[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.
