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 Th44:
  for S be locally_directed regular monotone OrderSortedSign,
  X be non-empty ManySortedSet of S,
  R be monotone MSEquivalence-like (OrderSortedRelation of ParsedTermsOSA(X)),
  t be Element of TS DTConOSA(X) holds
  [t,(PTMin X).t] in R.(LeastSort t)
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;
  let R be monotone MSEquivalence-like OrderSortedRelation of PTA;
  defpred P3[set] means ex t1 being Element of TS D st t1 = $1 & [t1,M.t1] in
  R.(LeastSort t1);
  let t be Element of TS D;
A1: R is os-compatible by OSALG_4:def 2;
A2: for nt being Symbol of D, ts1 being FinSequence of TS(D) st nt ==> roots
ts1 & (for dt1 being DecoratedTree of the carrier of D st dt1 in rng ts1 holds
  P3[dt1] ) holds P3[nt-tree ts1]
  proof
    let nt being Symbol of D, ts1 being FinSequence of TS(D) such that
A3: nt ==> roots ts1 and
A4: for dt1 being DecoratedTree of the carrier of D st dt1 in rng ts1
    holds P3[dt1];
    consider o being OperSymbol of S such that
A5: nt = [o,the carrier of S] and
A6: ts1 in Args(o,PTA) and
A7: nt-tree ts1 = Den(o,PTA).ts1 and
    for s1 being Element of S holds nt-tree ts1 in SPTA.s1 iff
    the_result_sort_of o <= s1 by A3,Th12;
    reconsider t1 = nt-tree ts1 as Element of TS D by A3,Th12;
A8: dom ((PTMin X)*ts1) = dom ts1 by FINSEQ_3:120;
    reconsider tsa =ts1 as Element of Args(o,PTA) by A6;
    set w = the_arity_of o;
A9: rng ts1 c= TS D by FINSEQ_1:def 4;
    set lo = LBound(o,LeastSorts (M*ts1)), rs1 = the_result_sort_of o;
A10: t1 = OSSym(o,X)-tree ts1 by A5;
    then
A11: OSSym(LBound(o,LeastSorts (M*ts1)),X) ==> roots (M*ts1) by A3,A5,Th40;
    then reconsider tsm =M*ts1 as Element of Args(lo,PTA) by Th13;
A12: dom ts1 = dom w by A6,MSUALG_3:6;
A13: for y being Nat st y in dom tsm holds [tsm.y,tsa.y] in R.((
    the_arity_of o)/.y)
    proof
      let y being Nat such that
A14:  y in dom tsm;
      ts1.y in rng ts1 by A8,A14,FUNCT_1:3;
      then reconsider td1=ts1.y as Element of TS D by A9;
      consider t2 being Element of TS D such that
A15:  t2 = td1 and
A16:  [t2,M.t2] in R.(LeastSort t2) by A4,A8,A14,FUNCT_1:3;
A17:  M.t2 = tsm.y by A14,A15,FINSEQ_3:120;
A18:  M.t2 in SPTA.(LeastSort t2) by A16,ZFMISC_1:87;
      tsa.y in SPTA.(w/.y) by A8,A12,A14,MSUALG_6:2;
      then
A19:  LeastSort t2 <= w/.y by A15,Def12;
A20:  t2 in SPTA.(LeastSort t2) by A16,ZFMISC_1:87;
      field(R.(LeastSort t2)) = SPTA.(LeastSort t2) by ORDERS_1:12;
      then R.(LeastSort t2) is_symmetric_in SPTA.(LeastSort t2) by
RELAT_2:def 11;
      then [M.t2,t2] in R.(LeastSort t2) by A16,A20,A18,RELAT_2:def 3;
      hence thesis by A1,A15,A20,A18,A17,A19;
    end;
    LeastSorts (M*ts1) <= the_arity_of o by A3,A5,A10,Th40;
    then lo <= o by OSALG_1:35;
    then
A21: [Den(lo,PTA).tsm,Den(o,PTA).tsa] in R.(the_result_sort_of o) by A13,
OSALG_4:def 26;
    then
A22: Den(o,PTA).tsa in SPTA.rs1 by ZFMISC_1:87;
A23: LeastSort t1 = the_result_sort_of o by A6,A7,Th17;
A24: OSSym(o,X) ==> roots ts1 by A3,A5;
    take t1;
    thus t1 = nt-tree ts1;
    field(R.rs1) = SPTA.rs1 by ORDERS_1:12;
    then
A25: R.rs1 is_symmetric_in SPTA.rs1 by RELAT_2:def 11;
    Den(lo,PTA).tsm in SPTA.rs1 by A21,ZFMISC_1:87;
    then
A26: [Den(o,PTA).tsa,Den(lo,PTA).tsm] in R.rs1 by A21,A22,A25,RELAT_2:def 3;
    consider o4 being OperSymbol of S such that
A27: OSSym(lo,X) = [o4,the carrier of S] and
    M*ts1 in Args(o4,PTA) and
A28: OSSym(lo,X)-tree (M*ts1) = Den(o4,PTA).(M*ts1) and
    for s1 being Element of S holds OSSym(lo,X)-tree (M*ts1) in SPTA.s1
    iff the_result_sort_of o4 <= s1 by A11,Th12;
    lo = o4 by A27,XTUPLE_0:1;
    hence thesis by A5,A7,A24,A26,A23,A28,Th40;
  end;
A29: for s being Symbol of D st s in Terminals D holds P3[root-tree s]
  proof
    let sy being Symbol of D;
    assume sy in Terminals D;
    then
A30: ex s be Element of S, x be set st x in X.s & sy = [x,s] by Th4;
    then reconsider t1 = root-tree sy as Element of TS D by Th10;
    take t1;
A31: t1 in SPTA.(LeastSort t1) by Def12;
    field(R.(LeastSort t1)) = SPTA.(LeastSort t1) by ORDERS_1:12;
    then
A32: R.(LeastSort t1) is_reflexive_in SPTA.(LeastSort t1) by RELAT_2:def 9;
    t1 = M.t1 by A30,Th40;
    hence thesis by A31,A32,RELAT_2:def 1;
  end;
  for dt being DecoratedTree of the carrier of D st dt in TS(D) holds P3[
  dt] from DTCONSTR:sch 7(A29,A2);
  then
  ex t1 being Element of TS D st t = t1 & [t1,M.t1] in R.( LeastSort t1 );
  hence thesis;
end;
