reserve I,X,x,d,i for set;
reserve M for ManySortedSet of I;
reserve EqR1,EqR2 for Equivalence_Relation of X;
reserve I for non empty set;
reserve M for ManySortedSet of I;
reserve EqR,EqR1,EqR2,EqR3,EqR4 for Equivalence_Relation of M;
reserve S for non void non empty ManySortedSign;
reserve A for non-empty MSAlgebra over S;

theorem Th18:
  [|the Sorts of A,the Sorts of A|] is MSCongruence of A
proof
  set J = [|the Sorts of A,the Sorts of A|];
  for i be set st i in the carrier of S holds J.i is Relation of (the
  Sorts of A).i
  proof
    let i be set;
    assume i in the carrier of S;
    then J.i c= [:(the Sorts of A).i,(the Sorts of A).i:] by PBOOLE:def 16;
    hence thesis;
  end;
  then reconsider J as ManySortedRelation of the Sorts of A by MSUALG_4:def 1;
  for i be object, R be Relation of (the Sorts of A).i st i in the carrier of
  S & J.i = R holds R is Equivalence_Relation of (the Sorts of A).i
  proof
    let i be object;
    let R be Relation of (the Sorts of A).i;
    assume that
A1: i in the carrier of S and
A2: J.i = R;
    J.i = nabla (the Sorts of A).i by A1,PBOOLE:def 16;
    hence thesis by A2;
  end;
  then reconsider
  J as MSEquivalence_Relation-like ManySortedRelation of the Sorts
  of A by MSUALG_4:def 2;
  reconsider J as MSEquivalence-like ManySortedRelation of A by MSUALG_4:def 3;
  for o be OperSymbol of S, x,y be Element of Args(o,A) st (for n be Nat
st n in dom x holds [x.n,y.n] in J.((the_arity_of o)/.n)) holds [Den(o,A).x,Den
  (o,A).y] in J.(the_result_sort_of o)
  proof
    let o be OperSymbol of S;
    let x,y be Element of Args(o,A) such that
    for n be Nat st n in dom x holds [x.n,y.n] in J.((the_arity_of o)/.n);
    o in the carrier' of S;
    then
A3: o in dom (the ResultSort of S) by FUNCT_2:def 1;
    Den(o,A).y in Result(o,A);
    then Den(o,A).y in ((the Sorts of A) * the ResultSort of S).o by
MSUALG_1:def 5;
    then Den(o,A).y in (the Sorts of A).((the ResultSort of S).o) by A3,
FUNCT_1:13;
    then
A4: Den(o,A).y in (the Sorts of A).(the_result_sort_of o) by MSUALG_1:def 2;
    Den(o,A).x in Result(o,A);
    then Den(o,A).x in ((the Sorts of A) * the ResultSort of S).o by
MSUALG_1:def 5;
    then Den(o,A).x in (the Sorts of A).((the ResultSort of S).o) by A3,
FUNCT_1:13;
    then
A5: Den(o,A).x in (the Sorts of A).(the_result_sort_of o) by MSUALG_1:def 2;
    J.(the_result_sort_of o) = [:(the Sorts of A).(the_result_sort_of o),
    (the Sorts of A).(the_result_sort_of o):] by PBOOLE:def 16;
    hence thesis by A5,A4,ZFMISC_1:87;
  end;
  hence thesis by MSUALG_4:def 4;
end;
