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 Th12:
  for S being OrderSortedSign, X being non-empty ManySortedSet of
  S, nt being Symbol of DTConOSA(X), ts being FinSequence of TS(DTConOSA(X)) st
  nt ==> roots ts holds nt in NonTerminals DTConOSA(X) & nt-tree ts in TS
  DTConOSA(X) & ex o being OperSymbol of S st nt = [o,the carrier of S] & ts in
  Args(o,ParsedTermsOSA(X)) & nt-tree ts = Den(o,ParsedTermsOSA(X)).ts & for s1
being Element of S holds nt-tree ts in (the Sorts of ParsedTermsOSA(X)).s1 iff
  the_result_sort_of o <= s1
proof
  let S be OrderSortedSign, X be non-empty ManySortedSet of S, nt be Symbol of
  DTConOSA(X), ts be FinSequence of TS(DTConOSA(X)) such that
A1: nt ==> roots ts;
  set D = DTConOSA(X), PTA = ParsedTermsOSA(X);
A2: nt in { s where s is Symbol of D: ex n being FinSequence st s ==> n} by A1;
  then reconsider nt1 = nt as NonTerminal of D by LANG1:def 3;
  reconsider ts1 = ts as SubtreeSeq of nt1 by A1,DTCONSTR:def 6;
  thus nt in NonTerminals D by A2,LANG1:def 3;
  then nt in [:the carrier' of S,{the carrier of S}:] by Th3;
  then consider o1,b1 being object such that
A3: o1 in the carrier' of S and
A4: b1 in {the carrier of S} and
A5: nt = [o1,b1] by ZFMISC_1:def 2;
  nt1-tree ts1 in TS D;
  hence nt-tree ts in TS DTConOSA(X);
  reconsider o1 as OperSymbol of S by A3;
  take o1;
  thus nt = [o1,the carrier of S] by A4,A5,TARSKI:def 1;
  b1 = the carrier of S by A4,TARSKI:def 1;
  then
A6: (nt1-tree ts).{} = [o1,the carrier of S] by A5,TREES_4:def 4;
  then ex p being SubtreeSeq of OSSym(o1,X) st (nt1-tree ts1) = OSSym(o1,X)
  -tree p & OSSym(o1,X) ==> roots p & p in Args(o1,PTA) & (nt1-tree ts1) = Den
  (o1,PTA).p by Th11;
  hence thesis by A6,Th11,TREES_4:15;
end;
