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 Th17:
  for S being OrderSortedSign, X being non-empty ManySortedSet of
S, o be OperSymbol of S, x being Element of Args(o,ParsedTermsOSA(X)) holds for
  t being Element of TS DTConOSA(X) st t = Den(o,ParsedTermsOSA(X)).x holds
  LeastSort t = the_result_sort_of o
proof
  let S being OrderSortedSign, X being non-empty ManySortedSet of S, o be
  OperSymbol of S, x being Element of Args(o,ParsedTermsOSA(X));
  reconsider x1 = x as FinSequence of TS(DTConOSA(X)) by Th13;
  set PTA = ParsedTermsOSA(X);
  let t being Element of TS DTConOSA(X) such that
A1: t = Den(o,ParsedTermsOSA(X)).x;
  OSSym(o,X) ==> roots x by Th13;
  then consider o1 being OperSymbol of S such that
A2: OSSym(o,X) = [o1,the carrier of S] and
  x1 in Args(o1,ParsedTermsOSA(X)) and
A3: OSSym(o,X)-tree x1 = Den(o1,ParsedTermsOSA(X)).x1 and
A4: for s1 being Element of S holds OSSym(o,X)-tree x1 in (the Sorts of
  ParsedTermsOSA(X)).s1 iff the_result_sort_of o1 <= s1 by Th12;
A5: o = o1 by A2,XTUPLE_0:1;
  then t in (the Sorts of PTA).(the_result_sort_of o) by A1,A3,A4;
  hence thesis by A1,A3,A4,A5,Def12;
end;
