Article DTCONSTR, MML version 4.99.1005

:: DTCONSTR:th 1
theorem
for b1 being non empty set
for b2 being FinSequence of FinTrees b1 holds
   b2 is FinSequence of Trees b1;

:: DTCONSTR:th 2
theorem
for b1, b2 being set
for b3 being FinSequence of b1
      st b2 in dom b3
   holds b3 . b2 in b1;

:: DTCONSTR:condreg 1
registration
  let a1 be set;
  cluster -> FinSequence-like (Element of a1 *);
end;

:: DTCONSTR:condreg 2
registration
  let a1 be non empty set;
  let a2 be DTree-set of a1;
  cluster -> DTree-yielding (FinSequence of a2);
end;

:: DTCONSTR:modenot 1 => DTCONSTR:mode 1
definition
  let a1 be non empty set;
  let a2 be non empty DTree-set of a1;
  let a3 be non empty Element of bool a2;
  redefine mode Element of a3 -> Element of a2;
end;

:: DTCONSTR:funcnot 1 => DTCONSTR:func 1
definition
  let a1 be non empty set;
  let a2 be DTree-set of a1;
  let a3 be FinSequence of a2;
  redefine func roots a3 -> FinSequence of a1;
end;

:: DTCONSTR:th 3
theorem
roots {} = {};

:: DTCONSTR:th 4
theorem
for b1 being Relation-like Function-like DecoratedTree-like set holds
   roots <*b1*> = <*b1 . {}*>;

:: DTCONSTR:th 5
theorem
for b1 being non empty set
for b2 being Element of bool FinTrees b1
for b3 being FinSequence of b2
      st len roots b3 = 1
   holds ex b4 being Element of FinTrees b1 st
      b3 = <*b4*> & b4 in b2;

:: DTCONSTR:th 6
theorem
for b1, b2 being Relation-like Function-like DecoratedTree-like set holds
roots <*b1,b2*> = <*b1 . {},b2 . {}*>;

:: DTCONSTR:funcnot 2 => DTCONSTR:func 2
definition
  let a1, a2 be set;
  let a3 be FinSequence of [:a1,a2:];
  redefine func pr1 a3 -> FinSequence of a1;
end;

:: DTCONSTR:funcnot 3 => DTCONSTR:func 3
definition
  let a1, a2 be set;
  let a3 be FinSequence of [:a1,a2:];
  redefine func pr2 a3 -> FinSequence of a2;
end;

:: DTCONSTR:th 7
theorem
pr1 {} = {} & pr2 {} = {};

:: DTCONSTR:funcreg 1
registration
  let a1 be non empty set;
  let a2 be Relation of a1,a1 *;
  cluster DTConstrStr(#a1,a2#) -> non empty strict;
end;

:: DTCONSTR:sch 1
scheme DTCONSTR:sch 1
{F1 -> non empty set}:
ex b1 being non empty strict DTConstrStr st
   the carrier of b1 = F1() &
    (for b2 being Element of the carrier of b1
    for b3 being FinSequence of the carrier of b1 holds
          b2 ==> b3
       iff
          P1[b2, b3])


:: DTCONSTR:sch 2
scheme DTCONSTR:sch 2
{F1 -> non empty set}:
for b1, b2 being non empty strict DTConstrStr
      st the carrier of b1 = F1() &
         (for b3 being Element of the carrier of b1
         for b4 being FinSequence of the carrier of b1 holds
               b3 ==> b4
            iff
               P1[b3, b4]) &
         the carrier of b2 = F1() &
         (for b3 being Element of the carrier of b2
         for b4 being FinSequence of the carrier of b2 holds
               b3 ==> b4
            iff
               P1[b3, b4])
   holds b1 = b2


:: DTCONSTR:th 8
theorem
for b1 being non empty DTConstrStr holds
   Terminals b1 misses NonTerminals b1;

:: DTCONSTR:sch 3
scheme DTCONSTR:sch 3
{F1 -> Relation-like Function-like set,
  F2 -> non empty DTConstrStr,
  F3 -> non empty set,
  F4 -> Element of F3(),
  F5 -> Element of F3()}:
ex b1 being Element of bool FinTrees [:the carrier of F2(),F3():] st
   b1 = Union F1() &
    (for b2 being Element of the carrier of F2()
          st b2 in Terminals F2()
       holds root-tree [b2,F4(b2)] in b1) &
    (for b2 being Element of the carrier 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 Element of bool FinTrees [:the carrier of F2(),F3():]
          st (for b3 being Element of the carrier of F2()
                   st b3 in Terminals F2()
                holds root-tree [b3,F4(b3)] in b2) &
             (for b3 being Element of the carrier 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
   proj1 F1() = NAT
and
   F1() . 0 = {root-tree [b1,b2] where b1 is Element of the carrier of F2(), b2 is Element of F3(): (b1 in Terminals F2() & b2 = F4(b1) or b1 ==> {} & b2 = F5(b1, {}, {}))}
and
   for b1 being Element of NAT holds
      F1() . (b1 + 1) = (F1() . b1) \/ {[b2,F5(b2, pr1 roots b3, pr2 roots b3)] -tree b3 where b2 is Element of the carrier of F2(), b3 is Element of (F1() . b1) *: ex b4 being FinSequence of FinTrees [:the carrier of F2(),F3():] st
         b3 = b4 & b2 ==> pr1 roots b4};


:: DTCONSTR:sch 4
scheme DTCONSTR:sch 4
{F1 -> Relation-like Function-like set,
  F2 -> non empty DTConstrStr,
  F3 -> non empty set,
  F4 -> Element of F3(),
  F5 -> Element of F3()}:
ex b1 being Element of bool FinTrees the carrier of F2() st
   b1 = {b2 `1 where b2 is Element of FinTrees [:the carrier of F2(),F3():]: b2 in Union F1()} &
    (for b2 being Element of the carrier of F2()
          st b2 in Terminals F2()
       holds root-tree b2 in b1) &
    (for b2 being Element of the carrier of F2()
    for b3 being FinSequence of b1
          st b2 ==> roots b3
       holds b2 -tree b3 in b1) &
    (for b2 being Element of bool FinTrees the carrier of F2()
          st (for b3 being Element of the carrier of F2()
                   st b3 in Terminals F2()
                holds root-tree b3 in b2) &
             (for b3 being Element of the carrier of F2()
             for b4 being FinSequence of b2
                   st b3 ==> roots b4
                holds b3 -tree b4 in b2)
       holds b1 c= b2)
provided
   proj1 F1() = NAT
and
   F1() . 0 = {root-tree [b1,b2] where b1 is Element of the carrier of F2(), b2 is Element of F3(): (b1 in Terminals F2() & b2 = F4(b1) or b1 ==> {} & b2 = F5(b1, {}, {}))}
and
   for b1 being Element of NAT holds
      F1() . (b1 + 1) = (F1() . b1) \/ {[b2,F5(b2, pr1 roots b3, pr2 roots b3)] -tree b3 where b2 is Element of the carrier of F2(), b3 is Element of (F1() . b1) *: ex b4 being FinSequence of FinTrees [:the carrier of F2(),F3():] st
         b3 = b4 & b2 ==> pr1 roots b4};


:: DTCONSTR:sch 5
scheme DTCONSTR:sch 5
{F1 -> Relation-like Function-like set,
  F2 -> non empty DTConstrStr,
  F3 -> non empty set,
  F4 -> Element of F3(),
  F5 -> Element of F3()}:
for b1 being Element of NAT
for b2 being Element of FinTrees [:the carrier of F2(),F3():]
      st b2 in Union F1()
   holds    b2 in F1() . b1
   iff
      height proj1 b2 <= b1
provided
   proj1 F1() = NAT
and
   F1() . 0 = {root-tree [b1,b2] where b1 is Element of the carrier of F2(), b2 is Element of F3(): (b1 in Terminals F2() & b2 = F4(b1) or b1 ==> {} & b2 = F5(b1, {}, {}))}
and
   for b1 being Element of NAT holds
      F1() . (b1 + 1) = (F1() . b1) \/ {[b2,F5(b2, pr1 roots b3, pr2 roots b3)] -tree b3 where b2 is Element of the carrier of F2(), b3 is Element of (F1() . b1) *: ex b4 being FinSequence of FinTrees [:the carrier of F2(),F3():] st
         b3 = b4 & b2 ==> pr1 roots b4};


:: DTCONSTR:sch 6
scheme DTCONSTR:sch 6
{F1 -> Relation-like Function-like set,
  F2 -> non empty DTConstrStr,
  F3 -> non empty set,
  F4 -> Element of F3(),
  F5 -> Element of F3()}:
for b1, b2 being Function-like DecoratedTree-like ParametrizedSubset of [:the carrier of F2(),F3():]
      st b1 in Union F1() & b2 in Union F1() & b1 `1 = b2 `1
   holds b1 = b2
provided
   proj1 F1() = NAT
and
   F1() . 0 = {root-tree [b1,b2] where b1 is Element of the carrier of F2(), b2 is Element of F3(): (b1 in Terminals F2() & b2 = F4(b1) or b1 ==> {} & b2 = F5(b1, {}, {}))}
and
   for b1 being Element of NAT holds
      F1() . (b1 + 1) = (F1() . b1) \/ {[b2,F5(b2, pr1 roots b3, pr2 roots b3)] -tree b3 where b2 is Element of the carrier of F2(), b3 is Element of (F1() . b1) *: ex b4 being FinSequence of FinTrees [:the carrier of F2(),F3():] st
         b3 = b4 & b2 ==> pr1 roots b4};


:: DTCONSTR:funcnot 4 => DTCONSTR:func 4
definition
  let a1 be non empty DTConstrStr;
  func TS A1 -> Element of bool FinTrees the carrier of a1 means
    (for b1 being Element of the carrier of a1
           st b1 in Terminals a1
        holds root-tree b1 in it) &
     (for b1 being Element of the carrier of a1
     for b2 being FinSequence of it
           st b1 ==> roots b2
        holds b1 -tree b2 in it) &
     (for b1 being Element of bool FinTrees the carrier of a1
           st (for b2 being Element of the carrier of a1
                    st b2 in Terminals a1
                 holds root-tree b2 in b1) &
              (for b2 being Element of the carrier of a1
              for b3 being FinSequence of b1
                    st b2 ==> roots b3
                 holds b2 -tree b3 in b1)
        holds it c= b1);
end;

:: DTCONSTR:def 4
theorem
for b1 being non empty DTConstrStr
for b2 being Element of bool FinTrees the carrier of b1 holds
      b2 = TS b1
   iff
      (for b3 being Element of the carrier of b1
             st b3 in Terminals b1
          holds root-tree b3 in b2) &
       (for b3 being Element of the carrier of b1
       for b4 being FinSequence of b2
             st b3 ==> roots b4
          holds b3 -tree b4 in b2) &
       (for b3 being Element of bool FinTrees the carrier of b1
             st (for b4 being Element of the carrier of b1
                      st b4 in Terminals b1
                   holds root-tree b4 in b3) &
                (for b4 being Element of the carrier of b1
                for b5 being FinSequence of b3
                      st b4 ==> roots b5
                   holds b4 -tree b5 in b3)
          holds b2 c= b3);

:: DTCONSTR:sch 7
scheme DTCONSTR:sch 7
{F1 -> non empty DTConstrStr}:
for b1 being Function-like DecoratedTree-like ParametrizedSubset of the carrier of F1()
      st b1 in TS F1()
   holds P1[b1]
provided
   for b1 being Element of the carrier of F1()
         st b1 in Terminals F1()
      holds P1[root-tree b1]
and
   for b1 being Element of the carrier of F1()
   for b2 being FinSequence of TS F1()
         st b1 ==> roots b2 &
            (for b3 being Function-like DecoratedTree-like ParametrizedSubset of the carrier of F1()
                  st b3 in proj2 b2
               holds P1[b3])
      holds P1[b1 -tree b2];


:: DTCONSTR:sch 8
scheme DTCONSTR:sch 8
{F1 -> non empty DTConstrStr,
  F2 -> non empty set,
  F3 -> Element of F2(),
  F4 -> Element of F2()}:
ex b1 being Function-like quasi_total Relation of TS F1(),F2() st
   (for b2 being Element of the carrier of F1()
          st b2 in Terminals F1()
       holds b1 . root-tree b2 = F3(b2)) &
    (for b2 being Element of the carrier of F1()
    for b3 being FinSequence of TS F1()
          st b2 ==> roots b3
       holds b1 . (b2 -tree b3) = F4(b2, roots b3, b1 * b3))


:: DTCONSTR:sch 9
scheme DTCONSTR:sch 9
{F1 -> non empty DTConstrStr,
  F2 -> non empty set,
  F3 -> Element of F2(),
  F4 -> Element of F2(),
  F5 -> Function-like quasi_total Relation of TS F1(),F2(),
  F6 -> Function-like quasi_total Relation of TS F1(),F2()}:
F5() = F6()
provided
   (for b1 being Element of the carrier of F1()
          st b1 in Terminals F1()
       holds F5() . root-tree b1 = F3(b1)) &
    (for b1 being Element of the carrier of F1()
    for b2 being FinSequence of TS F1()
          st b1 ==> roots b2
       holds F5() . (b1 -tree b2) = F4(b1, roots b2, F5() * b2))
and
   (for b1 being Element of the carrier of F1()
          st b1 in Terminals F1()
       holds F6() . root-tree b1 = F3(b1)) &
    (for b1 being Element of the carrier of F1()
    for b2 being FinSequence of TS F1()
          st b1 ==> roots b2
       holds F6() . (b1 -tree b2) = F4(b1, roots b2, F6() * b2));


:: DTCONSTR:funcnot 5 => DTCONSTR:func 5
definition
  func PeanoNat -> non empty strict DTConstrStr means
    the carrier of it = {0,1} &
     (for b1 being Element of the carrier of it
     for b2 being FinSequence of the carrier of it holds
           b1 ==> b2
        iff
           b1 = 1 &
            (b2 = <*0*> or b2 = <*1*>));
end;

:: DTCONSTR:def 5
theorem
for b1 being non empty strict DTConstrStr holds
      b1 = PeanoNat
   iff
      the carrier of b1 = {0,1} &
       (for b2 being Element of the carrier of b1
       for b3 being FinSequence of the carrier of b1 holds
             b2 ==> b3
          iff
             b2 = 1 &
              (b3 = <*0*> or b3 = <*1*>));

:: DTCONSTR:attrnot 1 => DTCONSTR:attr 1
definition
  let a1 be non empty DTConstrStr;
  attr a1 is with_terminals means
    Terminals a1 <> {};
end;

:: DTCONSTR:dfs 3
definiens
  let a1 be non empty DTConstrStr;
To prove
     a1 is with_terminals
it is sufficient to prove
  thus Terminals a1 <> {};

:: DTCONSTR:def 6
theorem
for b1 being non empty DTConstrStr holds
      b1 is with_terminals
   iff
      Terminals b1 <> {};

:: DTCONSTR:attrnot 2 => DTCONSTR:attr 2
definition
  let a1 be non empty DTConstrStr;
  attr a1 is with_nonterminals means
    NonTerminals a1 <> {};
end;

:: DTCONSTR:dfs 4
definiens
  let a1 be non empty DTConstrStr;
To prove
     a1 is with_nonterminals
it is sufficient to prove
  thus NonTerminals a1 <> {};

:: DTCONSTR:def 7
theorem
for b1 being non empty DTConstrStr holds
      b1 is with_nonterminals
   iff
      NonTerminals b1 <> {};

:: DTCONSTR:attrnot 3 => DTCONSTR:attr 3
definition
  let a1 be non empty DTConstrStr;
  attr a1 is with_useful_nonterminals means
    for b1 being Element of the carrier of a1
          st b1 in NonTerminals a1
       holds ex b2 being FinSequence of TS a1 st
          b1 ==> roots b2;
end;

:: DTCONSTR:dfs 5
definiens
  let a1 be non empty DTConstrStr;
To prove
     a1 is with_useful_nonterminals
it is sufficient to prove
  thus for b1 being Element of the carrier of a1
          st b1 in NonTerminals a1
       holds ex b2 being FinSequence of TS a1 st
          b1 ==> roots b2;

:: DTCONSTR:def 8
theorem
for b1 being non empty DTConstrStr holds
      b1 is with_useful_nonterminals
   iff
      for b2 being Element of the carrier of b1
            st b2 in NonTerminals b1
         holds ex b3 being FinSequence of TS b1 st
            b2 ==> roots b3;

:: DTCONSTR:exreg 1
registration
  cluster non empty strict with_terminals with_nonterminals with_useful_nonterminals DTConstrStr;
end;

:: DTCONSTR:funcnot 6 => DTCONSTR:func 6
definition
  let a1 be non empty with_terminals DTConstrStr;
  redefine func Terminals a1 -> non empty Element of bool the carrier of a1;
end;

:: DTCONSTR:funcreg 2
registration
  let a1 be non empty with_terminals DTConstrStr;
  cluster TS a1 -> non empty;
end;

:: DTCONSTR:funcreg 3
registration
  let a1 be non empty with_useful_nonterminals DTConstrStr;
  cluster TS a1 -> non empty;
end;

:: DTCONSTR:funcnot 7 => DTCONSTR:func 7
definition
  let a1 be non empty with_nonterminals DTConstrStr;
  redefine func NonTerminals a1 -> non empty Element of bool the carrier of a1;
end;

:: DTCONSTR:modenot 2
definition
  let a1 be non empty with_terminals DTConstrStr;
  mode Terminal of a1 is Element of Terminals a1;
end;

:: DTCONSTR:modenot 3
definition
  let a1 be non empty with_nonterminals DTConstrStr;
  mode NonTerminal of a1 is Element of NonTerminals a1;
end;

:: DTCONSTR:modenot 4 => DTCONSTR:mode 2
definition
  let a1 be non empty with_nonterminals with_useful_nonterminals DTConstrStr;
  let a2 be Element of NonTerminals a1;
  mode SubtreeSeq of A2 -> FinSequence of TS a1 means
    a2 ==> roots it;
end;

:: DTCONSTR:dfs 6
definiens
  let a1 be non empty with_nonterminals with_useful_nonterminals DTConstrStr;
  let a2 be Element of NonTerminals a1;
  let a3 be FinSequence of TS a1;
To prove
     a3 is SubtreeSeq of a2
it is sufficient to prove
  thus a2 ==> roots a3;

:: DTCONSTR:def 9
theorem
for b1 being non empty with_nonterminals with_useful_nonterminals DTConstrStr
for b2 being Element of NonTerminals b1
for b3 being FinSequence of TS b1 holds
      b3 is SubtreeSeq of b2
   iff
      b2 ==> roots b3;

:: DTCONSTR:funcnot 8 => DTCONSTR:func 8
definition
  let a1 be non empty with_terminals DTConstrStr;
  let a2 be Element of Terminals a1;
  redefine func root-tree a2 -> Element of TS a1;
end;

:: DTCONSTR:funcnot 9 => DTCONSTR:func 9
definition
  let a1 be non empty with_nonterminals with_useful_nonterminals DTConstrStr;
  let a2 be Element of NonTerminals a1;
  let a3 be SubtreeSeq of a2;
  redefine func a2 -tree a3 -> Element of TS a1;
end;

:: DTCONSTR:th 9
theorem
for b1 being non empty with_terminals DTConstrStr
for b2 being Element of TS b1
for b3 being Element of Terminals b1
      st b2 . {} = b3
   holds b2 = root-tree b3;

:: DTCONSTR:th 10
theorem
for b1 being non empty with_terminals with_nonterminals DTConstrStr
for b2 being Element of TS b1
for b3 being Element of NonTerminals b1
      st b2 . {} = b3
   holds ex b4 being FinSequence of TS b1 st
      b2 = b3 -tree b4 & b3 ==> roots b4;

:: DTCONSTR:funcreg 4
registration
  cluster PeanoNat -> non empty strict with_terminals with_nonterminals with_useful_nonterminals;
end;

:: DTCONSTR:funcnot 10 => DTCONSTR:func 10
definition
  let a1 be Element of NonTerminals PeanoNat;
  let a2 be Element of TS PeanoNat;
  redefine func a1 -tree a2 -> Element of TS PeanoNat;
end;

:: DTCONSTR:funcnot 11 => DTCONSTR:func 11
definition
  let a1 be FinSequence of NAT;
  assume a1 <> {};
  func plus-one A1 -> Element of NAT means
    ex b1 being Element of NAT st
       it = b1 + 1 & a1 . 1 = b1;
end;

:: DTCONSTR:def 10
theorem
for b1 being FinSequence of NAT
   st b1 <> {}
for b2 being Element of NAT holds
      b2 = plus-one b1
   iff
      ex b3 being Element of NAT st
         b2 = b3 + 1 & b1 . 1 = b3;

:: DTCONSTR:funcnot 12 => DTCONSTR:func 12
definition
  func PN-to-NAT -> Function-like quasi_total Relation of TS PeanoNat,NAT means
    (for b1 being Element of the carrier of PeanoNat
           st b1 in Terminals PeanoNat
        holds it . root-tree b1 = 0) &
     (for b1 being Element of the carrier of PeanoNat
     for b2 being FinSequence of TS PeanoNat
           st b1 ==> roots b2
        holds it . (b1 -tree b2) = plus-one (it * b2));
end;

:: DTCONSTR:def 11
theorem
for b1 being Function-like quasi_total Relation of TS PeanoNat,NAT holds
      b1 = PN-to-NAT
   iff
      (for b2 being Element of the carrier of PeanoNat
             st b2 in Terminals PeanoNat
          holds b1 . root-tree b2 = 0) &
       (for b2 being Element of the carrier of PeanoNat
       for b3 being FinSequence of TS PeanoNat
             st b2 ==> roots b3
          holds b1 . (b2 -tree b3) = plus-one (b1 * b3));

:: DTCONSTR:funcnot 13 => DTCONSTR:func 13
definition
  let a1 be Element of TS PeanoNat;
  func PNsucc A1 -> Element of TS PeanoNat equals
    1 -tree <*a1*>;
end;

:: DTCONSTR:def 12
theorem
for b1 being Element of TS PeanoNat holds
   PNsucc b1 = 1 -tree <*b1*>;

:: DTCONSTR:funcnot 14 => DTCONSTR:func 14
definition
  func NAT-to-PN -> Function-like quasi_total Relation of NAT,TS PeanoNat means
    it . 0 = root-tree 0 &
     (for b1 being natural set holds
        it . (b1 + 1) = PNsucc (it . b1));
end;

:: DTCONSTR:def 13
theorem
for b1 being Function-like quasi_total Relation of NAT,TS PeanoNat holds
      b1 = NAT-to-PN
   iff
      b1 . 0 = root-tree 0 &
       (for b2 being natural set holds
          b1 . (b2 + 1) = PNsucc (b1 . b2));

:: DTCONSTR:th 11
theorem
for b1 being Element of TS PeanoNat holds
   b1 = NAT-to-PN . (PN-to-NAT . b1);

:: DTCONSTR:th 12
theorem
for b1 being Element of NAT holds
   b1 = PN-to-NAT . (NAT-to-PN . b1);

:: DTCONSTR:funcnot 15 => DTCONSTR:func 15
definition
  let a1 be set;
  let a2 be FinSequence of a1 *;
  func FlattenSeq A2 -> Element of a1 * means
    ex b1 being Function-like quasi_total Relation of [:a1 *,a1 *:],a1 * st
       (for b2, b3 being Element of a1 * holds
        b1 .(b2,b3) = b2 ^ b3) &
        it = b1 "**" a2;
end;

:: DTCONSTR:def 14
theorem
for b1 being set
for b2 being FinSequence of b1 *
for b3 being Element of b1 * holds
      b3 = FlattenSeq b2
   iff
      ex b4 being Function-like quasi_total Relation of [:b1 *,b1 *:],b1 * st
         (for b5, b6 being Element of b1 * holds
          b4 .(b5,b6) = b5 ^ b6) &
          b3 = b4 "**" b2;

:: DTCONSTR:th 13
theorem
for b1 being set
for b2 being Element of b1 * holds
   FlattenSeq <*b2*> = b2;

:: DTCONSTR:funcnot 16 => DTCONSTR:func 16
definition
  let a1 be non empty DTConstrStr;
  let a2 be Function-like DecoratedTree-like ParametrizedSubset of the carrier of a1;
  assume a2 in TS a1;
  func TerminalString A2 -> FinSequence of Terminals a1 means
    ex b1 being Function-like quasi_total Relation of TS a1,(Terminals a1) * st
       it = b1 . a2 &
        (for b2 being Element of the carrier of a1
              st b2 in Terminals a1
           holds b1 . root-tree b2 = <*b2*>) &
        (for b2 being Element of the carrier of a1
        for b3 being FinSequence of TS a1
              st b2 ==> roots b3
           holds b1 . (b2 -tree b3) = FlattenSeq (b1 * b3));
end;

:: DTCONSTR:def 15
theorem
for b1 being non empty DTConstrStr
for b2 being Function-like DecoratedTree-like ParametrizedSubset of the carrier of b1
   st b2 in TS b1
for b3 being FinSequence of Terminals b1 holds
      b3 = TerminalString b2
   iff
      ex b4 being Function-like quasi_total Relation of TS b1,(Terminals b1) * st
         b3 = b4 . b2 &
          (for b5 being Element of the carrier of b1
                st b5 in Terminals b1
             holds b4 . root-tree b5 = <*b5*>) &
          (for b5 being Element of the carrier of b1
          for b6 being FinSequence of TS b1
                st b5 ==> roots b6
             holds b4 . (b5 -tree b6) = FlattenSeq (b4 * b6));

:: DTCONSTR:funcnot 17 => DTCONSTR:func 17
definition
  let a1 be non empty DTConstrStr;
  let a2 be Function-like DecoratedTree-like ParametrizedSubset of the carrier of a1;
  assume a2 in TS a1;
  func PreTraversal A2 -> FinSequence of the carrier of a1 means
    ex b1 being Function-like quasi_total Relation of TS a1,(the carrier of a1) * st
       it = b1 . a2 &
        (for b2 being Element of the carrier of a1
              st b2 in Terminals a1
           holds b1 . root-tree b2 = <*b2*>) &
        (for b2 being Element of the carrier of a1
        for b3 being FinSequence of TS a1
        for b4 being Relation-like Function-like FinSequence-like set
           st b4 = roots b3 & b2 ==> b4
        for b5 being FinSequence of (the carrier of a1) *
              st b5 = b1 * b3
           holds b1 . (b2 -tree b3) = <*b2*> ^ FlattenSeq b5);
end;

:: DTCONSTR:def 16
theorem
for b1 being non empty DTConstrStr
for b2 being Function-like DecoratedTree-like ParametrizedSubset of the carrier of b1
   st b2 in TS b1
for b3 being FinSequence of the carrier of b1 holds
      b3 = PreTraversal b2
   iff
      ex b4 being Function-like quasi_total Relation of TS b1,(the carrier of b1) * st
         b3 = b4 . b2 &
          (for b5 being Element of the carrier of b1
                st b5 in Terminals b1
             holds b4 . root-tree b5 = <*b5*>) &
          (for b5 being Element of the carrier of b1
          for b6 being FinSequence of TS b1
          for b7 being Relation-like Function-like FinSequence-like set
             st b7 = roots b6 & b5 ==> b7
          for b8 being FinSequence of (the carrier of b1) *
                st b8 = b4 * b6
             holds b4 . (b5 -tree b6) = <*b5*> ^ FlattenSeq b8);

:: DTCONSTR:funcnot 18 => DTCONSTR:func 18
definition
  let a1 be non empty DTConstrStr;
  let a2 be Function-like DecoratedTree-like ParametrizedSubset of the carrier of a1;
  assume a2 in TS a1;
  func PostTraversal A2 -> FinSequence of the carrier of a1 means
    ex b1 being Function-like quasi_total Relation of TS a1,(the carrier of a1) * st
       it = b1 . a2 &
        (for b2 being Element of the carrier of a1
              st b2 in Terminals a1
           holds b1 . root-tree b2 = <*b2*>) &
        (for b2 being Element of the carrier of a1
        for b3 being FinSequence of TS a1
        for b4 being Relation-like Function-like FinSequence-like set
           st b4 = roots b3 & b2 ==> b4
        for b5 being FinSequence of (the carrier of a1) *
              st b5 = b1 * b3
           holds b1 . (b2 -tree b3) = (FlattenSeq b5) ^ <*b2*>);
end;

:: DTCONSTR:def 17
theorem
for b1 being non empty DTConstrStr
for b2 being Function-like DecoratedTree-like ParametrizedSubset of the carrier of b1
   st b2 in TS b1
for b3 being FinSequence of the carrier of b1 holds
      b3 = PostTraversal b2
   iff
      ex b4 being Function-like quasi_total Relation of TS b1,(the carrier of b1) * st
         b3 = b4 . b2 &
          (for b5 being Element of the carrier of b1
                st b5 in Terminals b1
             holds b4 . root-tree b5 = <*b5*>) &
          (for b5 being Element of the carrier of b1
          for b6 being FinSequence of TS b1
          for b7 being Relation-like Function-like FinSequence-like set
             st b7 = roots b6 & b5 ==> b7
          for b8 being FinSequence of (the carrier of b1) *
                st b8 = b4 * b6
             holds b4 . (b5 -tree b6) = (FlattenSeq b8) ^ <*b5*>);

:: DTCONSTR:funcnot 19 => DTCONSTR:func 19
definition
  let a1 be non empty with_nonterminals DTConstrStr;
  let a2 be Element of the carrier of a1;
  func TerminalLanguage A2 -> Element of bool ((Terminals a1) *) equals
    {TerminalString b1 where b1 is Element of FinTrees the carrier of a1: b1 in TS a1 & b1 . {} = a2};
end;

:: DTCONSTR:def 18
theorem
for b1 being non empty with_nonterminals DTConstrStr
for b2 being Element of the carrier of b1 holds
   TerminalLanguage b2 = {TerminalString b3 where b3 is Element of FinTrees the carrier of b1: b3 in TS b1 & b3 . {} = b2};

:: DTCONSTR:funcnot 20 => DTCONSTR:func 20
definition
  let a1 be non empty with_nonterminals DTConstrStr;
  let a2 be Element of the carrier of a1;
  func PreTraversalLanguage A2 -> Element of bool ((the carrier of a1) *) equals
    {PreTraversal b1 where b1 is Element of FinTrees the carrier of a1: b1 in TS a1 & b1 . {} = a2};
end;

:: DTCONSTR:def 19
theorem
for b1 being non empty with_nonterminals DTConstrStr
for b2 being Element of the carrier of b1 holds
   PreTraversalLanguage b2 = {PreTraversal b3 where b3 is Element of FinTrees the carrier of b1: b3 in TS b1 & b3 . {} = b2};

:: DTCONSTR:funcnot 21 => DTCONSTR:func 21
definition
  let a1 be non empty with_nonterminals DTConstrStr;
  let a2 be Element of the carrier of a1;
  func PostTraversalLanguage A2 -> Element of bool ((the carrier of a1) *) equals
    {PostTraversal b1 where b1 is Element of FinTrees the carrier of a1: b1 in TS a1 & b1 . {} = a2};
end;

:: DTCONSTR:def 20
theorem
for b1 being non empty with_nonterminals DTConstrStr
for b2 being Element of the carrier of b1 holds
   PostTraversalLanguage b2 = {PostTraversal b3 where b3 is Element of FinTrees the carrier of b1: b3 in TS b1 & b3 . {} = b2};

:: DTCONSTR:th 14
theorem
for b1 being Function-like DecoratedTree-like ParametrizedSubset of the carrier of PeanoNat
      st b1 in TS PeanoNat
   holds TerminalString b1 = <*0*>;

:: DTCONSTR:th 15
theorem
for b1 being Element of the carrier of PeanoNat holds
   TerminalLanguage b1 = {<*0*>};

:: DTCONSTR:th 16
theorem
for b1 being Element of TS PeanoNat holds
   PreTraversal b1 = ((height proj1 b1) |-> 1) ^ <*0*>;

:: DTCONSTR:th 17
theorem
for b1 being Element of the carrier of PeanoNat holds
   (b1 = 0 implies PreTraversalLanguage b1 = {<*0*>}) &
    (b1 = 1 implies PreTraversalLanguage b1 = {(b2 |-> 1) ^ <*0*> where b2 is Element of NAT: b2 <> 0});

:: DTCONSTR:th 18
theorem
for b1 being Element of TS PeanoNat holds
   PostTraversal b1 = <*0*> ^ ((height proj1 b1) |-> 1);

:: DTCONSTR:th 19
theorem
for b1 being Element of the carrier of PeanoNat holds
   (b1 = 0 implies PostTraversalLanguage b1 = {<*0*>}) &
    (b1 = 1 implies PostTraversalLanguage b1 = {<*0*> ^ (b2 |-> 1) where b2 is Element of NAT: b2 <> 0});

:: DTCONSTR:th 20
theorem
for b1 being set holds
   FlattenSeq <*> (b1 *) = <*> b1;

:: DTCONSTR:th 21
theorem
for b1 being set
for b2, b3 being FinSequence of b1 * holds
FlattenSeq (b2 ^ b3) = (FlattenSeq b2) ^ FlattenSeq b3;

:: DTCONSTR:th 22
theorem
for b1 being set
for b2, b3 being Element of b1 * holds
FlattenSeq <*b2,b3*> = b2 ^ b3;

:: DTCONSTR:th 23
theorem
for b1 being set
for b2, b3, b4 being Element of b1 * holds
FlattenSeq <*b2,b3,b4*> = (b2 ^ b3) ^ b4;

:: DTCONSTR:th 24
theorem
for b1 being set
for b2, b3 being FinSequence of b1 *
      st b2 c= b3
   holds FlattenSeq b2 c= FlattenSeq b3;