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
  ))*;

theorem Th3:
  for S be OrderSortedSign, X be non-empty ManySortedSet of S holds
  NonTerminals(DTConOSA(X)) = [:the carrier' of S,{the carrier of S}:] &
  Terminals (DTConOSA(X)) = Union (coprod X)
proof
  let S be OrderSortedSign, X be non-empty ManySortedSet of S;
  set D = DTConOSA(X), A = [:the carrier' of S,{the carrier of S}:] \/ Union (
  coprod (X qua ManySortedSet of S));
A1: the carrier of D = (Terminals D) \/ (NonTerminals D) by LANG1:1;
  thus
A2: NonTerminals D c= [:the carrier' of S,{the carrier of S}:]
  proof
    let x be object;
    assume x in NonTerminals D;
    then
    x in { s where s is Symbol of D: ex n being FinSequence st s ==> n} by
LANG1:def 3;
    then consider s be Symbol of D such that
A3: s = x and
A4: ex n being FinSequence st s ==> n;
    consider n be FinSequence such that
A5: s ==> n by A4;
    [s,n] in the Rules of D by A5,LANG1:def 1;
    then reconsider n as Element of A* by ZFMISC_1:87;
    reconsider s as Element of A;
    [s,n] in OSREL X by A5,LANG1:def 1;
    hence thesis by A3,Def4;
  end;
A6: Union(coprod X) misses [:the carrier' of S,{the carrier of S}:] by
MSAFREE:4;
  thus
A7: [:the carrier' of S,{the carrier of S}:] c= NonTerminals D
  proof
    let x be object;
    assume
A8: x in [:the carrier' of S,{the carrier of S}:];
    then consider
    o being Element of the carrier' of S, x2 being Element of {the
    carrier of S} such that
A9: x = [o,x2] by DOMAIN_1:1;
    set O = the_arity_of o;
    defpred P[object,object] means
ex i being Element of S st i <= O/.$1 & $2 in
    coprod(i,X);
A10: for a be object st a in Seg len O ex b be object st P[a,b]
    proof
      let a be object;
      assume a in Seg len O;
      then
A11:  a in dom O by FINSEQ_1:def 3;
      then
A12:  O.a in rng O by FUNCT_1:def 3;
A13:  rng O c= the carrier of S by FINSEQ_1:def 4;
      then consider x be object such that
A14:  x in X.(O.a) by A12,XBOOLE_0:def 1;
      take y = [x,O.a];
      take O/.a;
      y in coprod(O.a,X) by A12,A13,A14,MSAFREE:def 2;
      hence thesis by A11,PARTFUN1:def 6;
    end;
    consider b be Function such that
A15: dom b = Seg len O & for a be object st a in Seg len O holds P[a,b.a]
    from CLASSES1:sch 1(A10);
    reconsider b as FinSequence by A15,FINSEQ_1:def 2;
    rng b c= A
    proof
      let a be object;
      assume a in rng b;
      then consider c be object such that
A16:  c in dom b and
A17:  b.c = a by FUNCT_1:def 3;
      consider i being Element of S such that
      i <= O/.c and
A18:  a in coprod(i,X) by A15,A16,A17;
      dom coprod(X) = the carrier of S by PARTFUN1:def 2;
      then (coprod(X)).(i) in rng coprod(X) by FUNCT_1:def 3;
      then coprod(i,X) in rng coprod(X) by MSAFREE:def 3;
      then a in union rng coprod(X) by A18,TARSKI:def 4;
      then a in Union coprod(X) by CARD_3:def 4;
      hence thesis by XBOOLE_0:def 3;
    end;
    then reconsider b as FinSequence of A by FINSEQ_1:def 4;
    reconsider b as Element of A* by FINSEQ_1:def 11;
A19: now
      let c be set;
      assume c in dom b;
      then consider i being Element of S such that
A20:  i <= O/.c and
A21:  b.c in coprod(i,X) by A15;
      dom coprod(X) = the carrier of S by PARTFUN1:def 2;
      then (coprod(X)).(i) in rng coprod(X) by FUNCT_1:def 3;
      then coprod(i,X) in rng coprod(X) by MSAFREE:def 3;
      then b.c in union rng coprod(X) by A21,TARSKI:def 4;
      then b.c in Union coprod(X) by CARD_3:def 4;
      hence b.c in [:the carrier' of S,{the carrier of S}:] implies for o1 be
OperSymbol of S st [o1,the carrier of S] = b.c holds the_result_sort_of o1 <= O
      /.c by A6,XBOOLE_0:3;
      assume b.c in Union (coprod X);
      thus ex i being Element of S st i <= O/.c & b.c in coprod(i,X) by A20,A21
;
    end;
A22: the carrier of S = x2 by TARSKI:def 1;
    then reconsider
    xa = [o,the carrier of S] as Element of (the carrier of D) by A8,A9,
XBOOLE_0:def 3;
    len b = len O by A15,FINSEQ_1:def 3;
    then [xa,b] in OSREL(X) by A19,Th2;
    then xa ==> b by LANG1:def 1;
    then xa in { t where t is Symbol of D: ex n be FinSequence st t ==> n};
    hence thesis by A9,A22,LANG1:def 3;
  end;
A23: (Terminals D) misses (NonTerminals D) by DTCONSTR:8;
  thus Terminals D c= Union (coprod X)
  proof
    let x be object;
    assume
A24: x in Terminals D;
    then
A25: x in A by A1,XBOOLE_0:def 3;
    not x in [:the carrier' of S,{the carrier of S}:] by A23,A7,A24,XBOOLE_0:3;
    hence thesis by A25,XBOOLE_0:def 3;
  end;
  let x be object;
  assume
A26: x in Union (coprod X);
  then x in A by XBOOLE_0:def 3;
  then x in Terminals D or x in NonTerminals D by A1,XBOOLE_0:def 3;
  hence thesis by A6,A2,A26,XBOOLE_0:3;
end;
