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

[;1m  relative_product(ListOrRel, BinRel1)[0m

  Returns the relative product.

  If [;;4mListOrRel[0m is a non-empty list [R[1], ..., R[n]] of binary
  relations and [;;4mBinRel1[0m is a binary relation, then [;;4mBinRel2[0m is
  the relative product of the ordered set (R[i], ..., R[n]) and [;;4m[0m
  [;;4mBinRel1[0m.

  Notice that [;;4mrelative_product([R1], R2)[0m is different from [;;4m[0m
  [;;4mrelative_product(R1, R2)[0m; the list of one element is not
  identified with the element itself.

[;1mExamples[0m

    1> R1 = sofs:relation([{a,b},{c,a}]).
    2> R2 = sofs:relation([{a,1},{a,2}]).
    3> S = sofs:from_term([{{b,1},b1},{{b,2},b2}]).
    4> R3 = sofs:relative_product([R1,R2], S).
    5> sofs:to_external(R3).
    [{a,b1},{a,b2}]

  If [;;4mListOrRel[0m is a binary relation, then [;;4mBinRel2[0m is the
  relative product of the binary relations [;;4mListOfRel[0m and [;;4mBinRel1[0m.

[;1mExamples[0m

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