reserve S for non void non empty ManySortedSign,
  U0 for MSAlgebra over S;
reserve S for non void non empty ManySortedSign,
  X for ManySortedSet of the carrier of S,
  o for OperSymbol of S,
  b for Element of ([:the carrier' of S,{the
  carrier of S}:] \/ Union (coprod X))*;

theorem Th6:
  for S be non void non empty ManySortedSign, X be ManySortedSet of
  the carrier of S holds NonTerminals(DTConMSA(X))c= [:the carrier' of S,{the
carrier of S}:] & Union (coprod X) c= Terminals (DTConMSA(X)) & (X is non-empty
implies NonTerminals(DTConMSA(X)) = [:the carrier' of S,{the carrier of S}:] &
  Terminals (DTConMSA(X)) = Union (coprod X))
proof
  let S be non void non empty ManySortedSign, X be ManySortedSet of the
  carrier of S;
  set D = DTConMSA(X), A = [:the carrier' of S,{the carrier of S}:] \/ Union (
  coprod (X qua ManySortedSet of the carrier 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 REL X by A5,LANG1:def 1;
    hence thesis by A3,Def7;
  end;
A6: Union(coprod X) misses [:the carrier' of S,{the carrier of S}:] by Th4;
  thus
A7: Union (coprod X) c= Terminals (DTConMSA(X))
  proof
    let x be object;
    assume
A8: 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,A8,XBOOLE_0:3;
  end;
  assume
A9: X is non-empty;
  thus NonTerminals D c= [:the carrier' of S,{the carrier of S}:] by A2;
  thus
A10: [:the carrier' of S,{the carrier of S}:] c= NonTerminals D
  proof
    let x be object;
    assume
A11: x in [:the carrier' of S,{the carrier of S}:];
    then consider
    o being OperSymbol of S, x2 being Element of {the carrier of S}
    such that
A12: x = [o,x2] by DOMAIN_1:1;
    set O = the_arity_of o;
    defpred P[object,object] means $2 in coprod (O.$1,X);
A13: 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 a in dom O by FINSEQ_1:def 3;
      then
A14:  O.a in rng O by FUNCT_1:def 3;
A15:  rng O c= the carrier of S by FINSEQ_1:def 4;
      then consider x be object such that
A16:  x in X.(O.a) by A9,A14,XBOOLE_0:def 1;
      take [x,O.a];
      thus thesis by A14,A15,A16,Def2;
    end;
    consider b be Function such that
A17: dom b = Seg len O &
for a be object st a in Seg len O holds P[a,b.a]
    from CLASSES1:sch 1(A13);
    reconsider b as FinSequence by A17,FINSEQ_1:def 2;
    rng b c= A
    proof
      let a be object;
A18:  rng O c= the carrier of S by FINSEQ_1:def 4;
      assume a in rng b;
      then consider c be object such that
A19:  c in dom b and
A20:  b.c = a by FUNCT_1:def 3;
      dom O = Seg len O by FINSEQ_1:def 3;
      then
A21:  O.c in rng O by A17,A19,FUNCT_1:def 3;
      dom coprod(X) = the carrier of S by PARTFUN1:def 2;
      then (coprod(X)).(O.c) in rng coprod(X) by A21,A18,FUNCT_1:def 3;
      then
A22:  coprod(O.c,X) in rng coprod(X) by A21,A18,Def3;
      a in coprod(O.c,X) by A17,A19,A20;
      then a in union rng coprod(X) by A22,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;
A23: now
      let c be set;
      assume
A24:  c in dom b;
      dom O = Seg len O by FINSEQ_1:def 3;
      then
A25:  O.c in rng O by A17,A24,FUNCT_1:def 3;
A26:  rng O c= the carrier of S by FINSEQ_1:def 4;
      dom coprod(X) = the carrier of S by PARTFUN1:def 2;
      then (coprod(X)).(O.c) in rng coprod(X) by A25,A26,FUNCT_1:def 3;
      then
A27:  coprod(O.c,X) in rng coprod(X) by A25,A26,Def3;
      P[c,b.c] by A17,A24;
      then b.c in union rng coprod(X) by A27,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 b.c in coprod(O.c,X) by A17,A24;
    end;
A28: 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 A11,A12,
XBOOLE_0:def 3;
    len b = len O by A17,FINSEQ_1:def 3;
    then [xa,b] in REL(X) by A23,Th5;
    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 A12,A28,LANG1:def 3;
  end;
A29: (Terminals D) misses (NonTerminals D) by DTCONSTR:8;
  thus Terminals D c= Union (coprod X)
  proof
    let x be object;
    assume x in Terminals D;
    then x in A & not x in [:the carrier' of S,{the carrier of S}:] by A1,A29
,A10,XBOOLE_0:3,def 3;
    hence thesis by XBOOLE_0:def 3;
  end;
  thus thesis by A7;
end;
