:: DTCONSTR  semantic presentation
deffunc H1(   set ) ->    Element of  NAT  = 0;
deffunc H2(   set ,   set ,   set ) ->    Element of  NAT  = 0;
theorem Th1: :: DTCONSTR:1
theorem Th2: :: DTCONSTR:2
E3:  dom (roots {} ) = 
 dom {} 
by TREES_3:23, TREES_3:def 18
.= 
 {} 
by FINSEQ_1:26
;
theorem Th3: :: DTCONSTR:3
theorem Th4: :: DTCONSTR:4
theorem Th5: :: DTCONSTR:5
theorem Th6: :: DTCONSTR:6
theorem Th7: :: DTCONSTR:7
theorem Th8: :: DTCONSTR:8
scheme  :: DTCONSTR:sch 3
s3{ 
F1() 
->   Function, 
F2() 
->  non 
empty  DTConstrStr , 
F3() 
->  non 
empty  set , 
F4(   
set ) 
->    Element of 
F3(), 
F5(   
set ,   
set ,   
set ) 
->    Element of 
F3() } :
ex 
b1 being  
Subset of 
(FinTrees [:the carrier of F2(),F3():]) st 
( 
b1 =  Union F1() & ( for 
b2 being  
Symbol of 
F2()  st 
b2 in  Terminals F2() holds  
root-tree [b2,F4(b2)] in b1 ) & ( for 
b2 being  
Symbol of 
F2()
 for 
b3 being   
FinSequence of 
b1  st 
b2 ==>  pr1 (roots b3) holds 
[b2,F5(b2,(pr1 (roots b3)),(pr2 (roots b3)))] -tree b3 in b1 ) & ( for 
b2 being  
Subset of 
(FinTrees [:the carrier of F2(),F3():])  st ( for 
b3 being  
Symbol of 
F2()  st 
b3 in  Terminals F2() holds  
root-tree [b3,F4(b3)] in b2 ) & ( for 
b3 being  
Symbol of 
F2()
 for 
b4 being   
FinSequence of 
b2  st 
b3 ==>  pr1 (roots b4) holds 
[b3,F5(b3,(pr1 (roots b4)),(pr2 (roots b4)))] -tree b4 in b2 ) holds 
b1 c= b2 ) )
 
 
provided
 
:: deftheorem Def1  DTCONSTR:def 1 : 
canceled; 
:: deftheorem Def2  DTCONSTR:def 2 : 
canceled; 
:: deftheorem Def3  DTCONSTR:def 3 : 
canceled; 
:: deftheorem Def4   defines TS DTCONSTR:def 4 : 
defpred S1[   set ,   set ] means ( a1 = 1 & ( a2 = <*0*> or a2 = <*1*> ) );
:: deftheorem Def5   defines PeanoNat DTCONSTR:def 5 : 
set c1 =  PeanoNat ;
Lemma10: 
the carrier of PeanoNat  = {0,1}
 
by Def5;
then reconsider c2 = 0, c3 = 1 as   Symbol of PeanoNat  by TARSKI:def 2;
Lemma11: 
( c3 ==> <*c2*> & c3 ==> <*c3*> )
 
by Def5;
Lemma12: 
c3 ==> <*c2*>
 
by Def5;
Lemma13: 
c3 ==> <*c3*>
 
by Def5;
Lemma14: 
 Terminals PeanoNat  = { b1 where B is   Symbol of PeanoNat  : for b1 being  FinSequence  holds not b1 ==> b2 } 
 
by LANG1:def 2;
then Lemma16: 
c2 in  Terminals PeanoNat 
 
by Lemma14;
Lemma17: 
 Terminals PeanoNat  c= {c2}
 
Lemma18: 
 NonTerminals PeanoNat  = { b1 where B is   Symbol of PeanoNat  : ex b1 being  FinSequence st b1 ==> b2 } 
 
by LANG1:def 3;
then Lemma19: 
c3 in  NonTerminals PeanoNat 
 
by Lemma12;
then Lemma20: 
{c3} c=  NonTerminals PeanoNat 
 
by ZFMISC_1:37;
Lemma21: 
 NonTerminals PeanoNat  c= {c3}
 
then Lemma22: 
 NonTerminals PeanoNat  = {c3}
 
by Lemma20, XBOOLE_0:def 10;
reconsider c4 =  TS PeanoNat  as  non empty Subset of (FinTrees the carrier of PeanoNat ) by Def4, Lemma16;
:: deftheorem Def6   defines with_terminals DTCONSTR:def 6 : 
:: deftheorem Def7   defines with_nonterminals DTCONSTR:def 7 : 
:: deftheorem Def8   defines with_useful_nonterminals DTCONSTR:def 8 : 
Lemma26: 
(  PeanoNat  is with_terminals &  PeanoNat  is with_nonterminals &  PeanoNat  is with_useful_nonterminals )
 
:: deftheorem Def9   defines SubtreeSeq DTCONSTR:def 9 : 
theorem Th9: :: DTCONSTR:9
theorem Th10: :: DTCONSTR:10
set c5 =  PeanoNat ;
reconsider c6 = c2 as   Terminal of PeanoNat  by Lemma16;
reconsider c7 = c3 as   NonTerminal of PeanoNat  by Lemma19;
:: deftheorem Def10   defines plus-one DTCONSTR:def 10 : 
deffunc H3(   set ,   set ,   FinSequence of  NAT ) ->   Nat =  plus-one a3;
:: deftheorem Def11   defines PN-to-NAT DTCONSTR:def 11 : 
:: deftheorem Def12   defines PNsucc DTCONSTR:def 12 : 
deffunc H4(   set ,   Element of  TS PeanoNat ) ->    Element of  TS PeanoNat  =  PNsucc a2;
:: deftheorem Def13   defines NAT-to-PN DTCONSTR:def 13 : 
theorem Th11: :: DTCONSTR:11
E33: 0 = 
PN-to-NAT  . (root-tree c6)
by Def11
.= 
PN-to-NAT  . (NAT-to-PN  . 0)
by Def13
;
theorem Th12: :: DTCONSTR:12
:: deftheorem Def14   defines FlattenSeq DTCONSTR:def 14 : 
theorem Th13: :: DTCONSTR:13
definition
let c8 be  non 
empty  DTConstrStr ;
let c9 be   
DecoratedTree of the 
carrier of 
c8;
assume E37: 
c9 in  TS c8
 ;
defpred S2[   
set ] 
means a1 in  Terminals c8;
deffunc H5(   
set ) 
->    set  = 
<*a1*>;
deffunc H6(   
set ) 
->    set  =  
{} ;
consider c10 being   
Function of the 
carrier of 
c8,
(Terminals c8) *  such that E39: 
for 
b1 being   
set   st 
b1 in the 
carrier of 
c8 holds 
( ( 
S2[
b1] implies 
c10 . b1 = H5(
b1) ) & (  not 
S2[
b1] implies 
c10 . b1 = H6(
b1) ) )
 
from FUNCT_2:sch 9(E38);
deffunc H7(  
Symbol of 
c8) 
->    Element of 
(Terminals c8) *  = 
c10 . a1;
deffunc H8(   
set ,   
set ,   
FinSequence of 
(Terminals c8) * ) 
->    Element of 
(Terminals c8) *  =  
FlattenSeq a3;
deffunc H9(   
set ) 
->    set  = 
<*a1*>;
func  TerminalString c2 ->    FinSequence of  
Terminals a1 means :
Def15: 
:: DTCONSTR:def 15
ex 
b1 being  
Function of  
TS a1,
(Terminals a1) *  st 
( 
a3 = b1 . a2 & ( for 
b2 being  
Symbol of 
a1  st 
b2 in  Terminals a1 holds 
b1 . (root-tree b2) = <*b2*> ) & ( for 
b2 being  
Symbol of 
a1 for 
b3 being   
FinSequence of  
TS a1  st 
b2 ==>  roots b3 holds 
b1 . (b2 -tree b3) =  FlattenSeq (b1 * b3) ) );
existence 
ex b1 being   FinSequence of  Terminals c8ex b2 being  Function of  TS c8,(Terminals c8) *  st 
( b1 = b2 . c9 & ( for b3 being  Symbol of c8  st b3 in  Terminals c8 holds 
b2 . (root-tree b3) = <*b3*> ) & ( for b3 being  Symbol of c8
 for b4 being   FinSequence of  TS c8  st b3 ==>  roots b4 holds 
b2 . (b3 -tree b4) =  FlattenSeq (b2 * b4) ) )
 
uniqueness 
for b1, b2 being   FinSequence of  Terminals c8  st ex b3 being  Function of  TS c8,(Terminals c8) *  st 
( b1 = b3 . c9 & ( for b4 being  Symbol of c8  st b4 in  Terminals c8 holds 
b3 . (root-tree b4) = <*b4*> ) & ( for b4 being  Symbol of c8
 for b5 being   FinSequence of  TS c8  st b4 ==>  roots b5 holds 
b3 . (b4 -tree b5) =  FlattenSeq (b3 * b5) ) ) & ex b3 being  Function of  TS c8,(Terminals c8) *  st 
( b2 = b3 . c9 & ( for b4 being  Symbol of c8  st b4 in  Terminals c8 holds 
b3 . (root-tree b4) = <*b4*> ) & ( for b4 being  Symbol of c8
 for b5 being   FinSequence of  TS c8  st b4 ==>  roots b5 holds 
b3 . (b4 -tree b5) =  FlattenSeq (b3 * b5) ) ) holds 
b1 = b2
 
consider c11 being   
Function of the 
carrier of 
c8,the 
carrier of 
c8 *  such that E41: 
for 
b1 being   
set   st 
b1 in the 
carrier of 
c8 holds 
c11 . b1 = H9(
b1)
 
from FUNCT_2:sch 2(E40);
deffunc H10(  
Symbol of 
c8) 
->    Element of the 
carrier of 
c8 *  = 
c11 . a1;
deffunc H11(  
Symbol of 
c8,   
set ,   
FinSequence of the 
carrier of 
c8 * ) 
->    Element of the 
carrier of 
c8 *  = 
(c11 . a1) ^ (FlattenSeq a3);
func  PreTraversal c2 ->    FinSequence of the 
carrier of 
a1 means :
Def16: 
:: DTCONSTR:def 16
ex 
b1 being  
Function of  
TS a1,the 
carrier of 
a1 *  st 
( 
a3 = b1 . a2 & ( for 
b2 being  
Symbol of 
a1  st 
b2 in  Terminals a1 holds 
b1 . (root-tree b2) = <*b2*> ) & ( for 
b2 being  
Symbol of 
a1 for 
b3 being   
FinSequence of  
TS a1 for 
b4 being  
FinSequence  st 
b4 =  roots b3 & 
b2 ==> b4 holds 
for 
b5 being   
FinSequence of the 
carrier of 
a1 *   st 
b5 = b1 * b3 holds 
b1 . (b2 -tree b3) = <*b2*> ^ (FlattenSeq b5) ) );
existence 
ex b1 being   FinSequence of the carrier of c8ex b2 being  Function of  TS c8,the carrier of c8 *  st 
( b1 = b2 . c9 & ( for b3 being  Symbol of c8  st b3 in  Terminals c8 holds 
b2 . (root-tree b3) = <*b3*> ) & ( for b3 being  Symbol of c8
 for b4 being   FinSequence of  TS c8
 for b5 being  FinSequence  st b5 =  roots b4 & b3 ==> b5 holds 
for b6 being   FinSequence of the carrier of c8 *   st b6 = b2 * b4 holds 
b2 . (b3 -tree b4) = <*b3*> ^ (FlattenSeq b6) ) )
 
uniqueness 
for b1, b2 being   FinSequence of the carrier of c8  st ex b3 being  Function of  TS c8,the carrier of c8 *  st 
( b1 = b3 . c9 & ( for b4 being  Symbol of c8  st b4 in  Terminals c8 holds 
b3 . (root-tree b4) = <*b4*> ) & ( for b4 being  Symbol of c8
 for b5 being   FinSequence of  TS c8
 for b6 being  FinSequence  st b6 =  roots b5 & b4 ==> b6 holds 
for b7 being   FinSequence of the carrier of c8 *   st b7 = b3 * b5 holds 
b3 . (b4 -tree b5) = <*b4*> ^ (FlattenSeq b7) ) ) & ex b3 being  Function of  TS c8,the carrier of c8 *  st 
( b2 = b3 . c9 & ( for b4 being  Symbol of c8  st b4 in  Terminals c8 holds 
b3 . (root-tree b4) = <*b4*> ) & ( for b4 being  Symbol of c8
 for b5 being   FinSequence of  TS c8
 for b6 being  FinSequence  st b6 =  roots b5 & b4 ==> b6 holds 
for b7 being   FinSequence of the carrier of c8 *   st b7 = b3 * b5 holds 
b3 . (b4 -tree b5) = <*b4*> ^ (FlattenSeq b7) ) ) holds 
b1 = b2
 
deffunc H12(  
Symbol of 
c8) 
->    Element of the 
carrier of 
c8 *  = 
c11 . a1;
deffunc H13(  
Symbol of 
c8,   
set ,   
FinSequence of the 
carrier of 
c8 * ) 
->    Element of the 
carrier of 
c8 *  = 
(FlattenSeq a3) ^ (c11 . a1);
func  PostTraversal c2 ->    FinSequence of the 
carrier of 
a1 means :
Def17: 
:: DTCONSTR:def 17
ex 
b1 being  
Function of  
TS a1,the 
carrier of 
a1 *  st 
( 
a3 = b1 . a2 & ( for 
b2 being  
Symbol of 
a1  st 
b2 in  Terminals a1 holds 
b1 . (root-tree b2) = <*b2*> ) & ( for 
b2 being  
Symbol of 
a1 for 
b3 being   
FinSequence of  
TS a1 for 
b4 being  
FinSequence  st 
b4 =  roots b3 & 
b2 ==> b4 holds 
for 
b5 being   
FinSequence of the 
carrier of 
a1 *   st 
b5 = b1 * b3 holds 
b1 . (b2 -tree b3) = (FlattenSeq b5) ^ <*b2*> ) );
existence 
ex b1 being   FinSequence of the carrier of c8ex b2 being  Function of  TS c8,the carrier of c8 *  st 
( b1 = b2 . c9 & ( for b3 being  Symbol of c8  st b3 in  Terminals c8 holds 
b2 . (root-tree b3) = <*b3*> ) & ( for b3 being  Symbol of c8
 for b4 being   FinSequence of  TS c8
 for b5 being  FinSequence  st b5 =  roots b4 & b3 ==> b5 holds 
for b6 being   FinSequence of the carrier of c8 *   st b6 = b2 * b4 holds 
b2 . (b3 -tree b4) = (FlattenSeq b6) ^ <*b3*> ) )
 
uniqueness 
for b1, b2 being   FinSequence of the carrier of c8  st ex b3 being  Function of  TS c8,the carrier of c8 *  st 
( b1 = b3 . c9 & ( for b4 being  Symbol of c8  st b4 in  Terminals c8 holds 
b3 . (root-tree b4) = <*b4*> ) & ( for b4 being  Symbol of c8
 for b5 being   FinSequence of  TS c8
 for b6 being  FinSequence  st b6 =  roots b5 & b4 ==> b6 holds 
for b7 being   FinSequence of the carrier of c8 *   st b7 = b3 * b5 holds 
b3 . (b4 -tree b5) = (FlattenSeq b7) ^ <*b4*> ) ) & ex b3 being  Function of  TS c8,the carrier of c8 *  st 
( b2 = b3 . c9 & ( for b4 being  Symbol of c8  st b4 in  Terminals c8 holds 
b3 . (root-tree b4) = <*b4*> ) & ( for b4 being  Symbol of c8
 for b5 being   FinSequence of  TS c8
 for b6 being  FinSequence  st b6 =  roots b5 & b4 ==> b6 holds 
for b7 being   FinSequence of the carrier of c8 *   st b7 = b3 * b5 holds 
b3 . (b4 -tree b5) = (FlattenSeq b7) ^ <*b4*> ) ) holds 
b1 = b2
 
 
end;
 
:: deftheorem Def15   defines TerminalString DTCONSTR:def 15 : 
:: deftheorem Def16   defines PreTraversal DTCONSTR:def 16 : 
:: deftheorem Def17   defines PostTraversal DTCONSTR:def 17 : 
:: deftheorem Def18   defines TerminalLanguage DTCONSTR:def 18 : 
:: deftheorem Def19   defines PreTraversalLanguage DTCONSTR:def 19 : 
:: deftheorem Def20   defines PostTraversalLanguage DTCONSTR:def 20 : 
theorem Th14: :: DTCONSTR:14
theorem Th15: :: DTCONSTR:15
theorem Th16: :: DTCONSTR:16
theorem Th17: :: DTCONSTR:17
theorem Th18: :: DTCONSTR:18
theorem Th19: :: DTCONSTR:19