reserve S for OrderSortedSign;
reserve S for OrderSortedSign,
  X for ManySortedSet of S,
  o for OperSymbol of S ,
  b for Element of ([:the carrier' of S,{the carrier of S}:] \/ Union (coprod X
  ))*;
reserve x for set;

theorem Th45:
  for S be locally_directed regular monotone OrderSortedSign, X
  be non-empty ManySortedSet of S, R be monotone MSEquivalence-like
  OrderSortedRelation of ParsedTermsOSA(X) holds PTCongruence(X) c= R
proof
  let S be locally_directed regular monotone OrderSortedSign, X be non-empty
  ManySortedSet of S;
  set PTA = ParsedTermsOSA(X), SPTA = the Sorts of PTA, D = DTConOSA(X), M =
  PTMin X, P = PTCongruence X;
  reconsider O1 = SPTA as OrderSortedSet of S;
  let R be monotone MSEquivalence-like OrderSortedRelation of PTA;
  let i be object such that
A1: i in the carrier of S;
  reconsider s = i as Element of S by A1;
A2: R is os-compatible by OSALG_4:def 2;
  for a,b being object holds [a,b] in P.s implies [a,b] in R.s
  proof
A3: field(R.s) = SPTA.s by ORDERS_1:12;
    then
A4: R.s is_transitive_in SPTA.s by RELAT_2:def 16;
A5: R.s is_symmetric_in SPTA.s by A3,RELAT_2:def 11;
    let a,b be object such that
A6: [a,b] in P.s;
    reconsider ta=a,tb=b as Element of SPTA.s by A6,ZFMISC_1:87;
A7: a in SPTA.i by A6,ZFMISC_1:87;
A8: OSClass(P,ta) = OSClass(P,tb) by A6,OSALG_4:12;
A9: b in SPTA.i by A6,ZFMISC_1:87;
    dom SPTA = the carrier of S by PARTFUN1:def 2;
    then reconsider t1=a,t2=b as Element of PTA by A1,A7,A9,CARD_5:2;
    reconsider t1,t2 as Element of TS D by Th14;
A10: t2 in SPTA.(LeastSort t2) by Def12;
A11: M.t2 in SPTA.(LeastSort M.t2) by Def12;
    LeastSort (M.t2) <= LeastSort t2 by Th40;
    then
A12: O1.(LeastSort (M.t2)) c= O1.(LeastSort t2) by OSALG_1:def 16;
A13: [t2,M.t2] in R.(LeastSort t2) by Th44;
    LeastSort t2 <= s by A9,Def12;
    then
A14: [t2,M.t2] in R.s by A2,A10,A11,A12,A13;
    then M.t2 in SPTA.s by ZFMISC_1:87;
    then
A15: [M.t2,t2] in R.s by A9,A14,A5,RELAT_2:def 3;
    LeastSort (M.t1) <= LeastSort t1 by Th40;
    then
A16: O1.(LeastSort (M.t1)) c= O1.(LeastSort t1) by OSALG_1:def 16;
A17: M.t1 in SPTA.(LeastSort M.t1) by Def12;
A18: [t1,M.t1] in R.(LeastSort t1) by Th44;
A19: OSClass(P,t2) = OSClass(P,tb) by Def27;
    OSClass(P,t1) = OSClass(P,ta) by Def27;
    then t1 in OSClass(P,t2) by A8,A19,Th34;
    then
A20: M.t1 = M.t2 by Th42;
A21: t1 in SPTA.(LeastSort t1) by Def12;
    LeastSort t1 <= s by A7,Def12;
    then
A22: [t1,M.t1] in R.s by A2,A21,A17,A16,A18;
    then M.t1 in SPTA.s by ZFMISC_1:87;
    hence thesis by A7,A9,A20,A22,A4,A15,RELAT_2:def 8;
  end;
  hence thesis by RELAT_1:def 3;
end;
