%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% Copyright Ericsson AB 2021-2025. All Rights Reserved.
%%
%% %CopyrightEnd%

[;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.

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

[;1mExamples[0m

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