Article BINTREE2, MML version 4.99.1005

:: BINTREE2:th 1
theorem
for b1 being set
for b2 being Relation-like Function-like FinSequence-like set
for b3 being Element of NAT
      st b2 in b1 *
   holds b2 | Seg b3 in b1 *;

:: BINTREE2:th 2
theorem
for b1 being non empty Tree-like binary set
for b2 being Element of b1 holds
   b2 is FinSequence of BOOLEAN;

:: BINTREE2:modenot 1 => BINTREE2:mode 1
definition
  let a1 be non empty Tree-like binary set;
  redefine mode Element of a1 -> FinSequence of BOOLEAN;
end;

:: BINTREE2:th 3
theorem
for b1 being non empty Tree-like set
      st b1 = {0,1} *
   holds b1 is binary;

:: BINTREE2:th 4
theorem
for b1 being non empty Tree-like set
      st b1 = {0,1} *
   holds Leaves b1 = {};

:: BINTREE2:th 5
theorem
for b1 being non empty Tree-like binary set
for b2 being Element of NAT
for b3 being Element of b1
      st b3 in b1 -level b2
   holds b3 is Element of b2 -tuples_on BOOLEAN;

:: BINTREE2:th 6
theorem
for b1 being non empty Tree-like set
      st for b2 being Element of b1 holds
           succ b2 = {b2 ^ <*0*>,b2 ^ <*1*>}
   holds Leaves b1 = {};

:: BINTREE2:th 7
theorem
for b1 being non empty Tree-like set
      st for b2 being Element of b1 holds
           succ b2 = {b2 ^ <*0*>,b2 ^ <*1*>}
   holds b1 is binary;

:: BINTREE2:th 8
theorem
for b1 being non empty Tree-like set holds
      b1 = {0,1} *
   iff
      for b2 being Element of b1 holds
         succ b2 = {b2 ^ <*0*>,b2 ^ <*1*>};

:: BINTREE2:sch 1
scheme BINTREE2:sch 1
{F1 -> non empty set,
  F2 -> Element of F1()}:
ex b1 being Function-like DecoratedTree-like binary ParametrizedSubset of F1() st
   proj1 b1 = {0,1} * &
    b1 . {} = F2() &
    (for b2 being Element of proj1 b1 holds
       P1[b1 . b2, b1 . (b2 ^ <*0*>), b1 . (b2 ^ <*1*>)])
provided
   for b1 being Element of F1() holds
      ex b2, b3 being Element of F1() st
         P1[b1, b2, b3];


:: BINTREE2:sch 2
scheme BINTREE2:sch 2
{F1 -> non empty set,
  F2 -> Element of F1()}:
ex b1 being Function-like DecoratedTree-like binary ParametrizedSubset of F1() st
   proj1 b1 = {0,1} * &
    b1 . {} = F2() &
    (for b2 being Element of proj1 b1 holds
       P1[b1 . b2, b1 . (b2 ^ <*0*>)] &
        P2[b1 . b2, b1 . (b2 ^ <*1*>)])
provided
   for b1 being Element of F1() holds
      ex b2 being Element of F1() st
         P1[b1, b2]
and
   for b1 being Element of F1() holds
      ex b2 being Element of F1() st
         P2[b1, b2];


:: BINTREE2:funcnot 1 => BINTREE2:func 1
definition
  let a1 be non empty Tree-like binary set;
  let a2 be non empty Element of NAT;
  func NumberOnLevel(A2,A1) -> Function-like quasi_total Relation of a1 -level a2,NAT means
    for b1 being Element of a1
       st b1 in a1 -level a2
    for b2 being Element of a2 -tuples_on BOOLEAN
          st b2 = Rev b1
       holds it . b1 = (Absval b2) + 1;
end;

:: BINTREE2:def 1
theorem
for b1 being non empty Tree-like binary set
for b2 being non empty Element of NAT
for b3 being Function-like quasi_total Relation of b1 -level b2,NAT holds
      b3 = NumberOnLevel(b2,b1)
   iff
      for b4 being Element of b1
         st b4 in b1 -level b2
      for b5 being Element of b2 -tuples_on BOOLEAN
            st b5 = Rev b4
         holds b3 . b4 = (Absval b5) + 1;

:: BINTREE2:funcreg 1
registration
  let a1 be non empty Tree-like binary set;
  let a2 be non empty Element of NAT;
  cluster NumberOnLevel(a2,a1) -> Function-like one-to-one quasi_total;
end;

:: BINTREE2:attrnot 1 => BINTREE2:attr 1
definition
  let a1 be non empty Tree-like set;
  attr a1 is full means
    a1 = {0,1} *;
end;

:: BINTREE2:dfs 2
definiens
  let a1 be non empty Tree-like set;
To prove
     a1 is full
it is sufficient to prove
  thus a1 = {0,1} *;

:: BINTREE2:def 2
theorem
for b1 being non empty Tree-like set holds
      b1 is full
   iff
      b1 = {0,1} *;

:: BINTREE2:th 9
theorem
{0,1} * is non empty Tree-like set;

:: BINTREE2:th 10
theorem
for b1 being non empty Tree-like set
   st b1 = {0,1} *
for b2 being Element of NAT holds
   0* b2 in b1 -level b2;

:: BINTREE2:th 11
theorem
for b1 being non empty Tree-like set
   st b1 = {0,1} *
for b2 being non empty Element of NAT
for b3 being Element of b2 -tuples_on BOOLEAN holds
   b3 in b1 -level b2;

:: BINTREE2:funcreg 2
registration
  let a1 be non empty Tree-like binary set;
  let a2 be Element of NAT;
  cluster a1 -level a2 -> finite;
end;

:: BINTREE2:condreg 1
registration
  cluster non empty Tree-like full -> binary (set);
end;

:: BINTREE2:exreg 1
registration
  cluster non empty Tree-like full set;
end;

:: BINTREE2:th 12
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT holds
   Seg (2 to_power b2) c= proj2 NumberOnLevel(b2,b1);

:: BINTREE2:funcnot 2 => BINTREE2:func 2
definition
  let a1 be non empty Tree-like full set;
  let a2 be non empty Element of NAT;
  func FinSeqLevel(A2,A1) -> FinSequence of a1 -level a2 equals
    (NumberOnLevel(a2,a1)) ";
end;

:: BINTREE2:def 3
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT holds
   FinSeqLevel(b2,b1) = (NumberOnLevel(b2,b1)) ";

:: BINTREE2:funcreg 3
registration
  let a1 be non empty Tree-like full set;
  let a2 be non empty Element of NAT;
  cluster FinSeqLevel(a2,a1) -> one-to-one;
end;

:: BINTREE2:th 13
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT holds
   (NumberOnLevel(b2,b1)) . 0* b2 = 1;

:: BINTREE2:th 14
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT
for b3 being Element of b2 -tuples_on BOOLEAN
      st b3 = 0* b2
   holds (NumberOnLevel(b2,b1)) . 'not' b3 = 2 to_power b2;

:: BINTREE2:th 15
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT holds
   (FinSeqLevel(b2,b1)) . 1 = 0* b2;

:: BINTREE2:th 16
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT
for b3 being Element of b2 -tuples_on BOOLEAN
      st b3 = 0* b2
   holds (FinSeqLevel(b2,b1)) . (2 to_power b2) = 'not' b3;

:: BINTREE2:th 17
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT
for b3 being Element of NAT
      st b3 in Seg (2 to_power b2)
   holds (FinSeqLevel(b2,b1)) . b3 = Rev (b2 -BinarySequence (b3 -' 1));

:: BINTREE2:th 18
theorem
for b1 being non empty Tree-like full set
for b2 being Element of NAT holds
   Card (b1 -level b2) = 2 to_power b2;

:: BINTREE2:th 19
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT holds
   len FinSeqLevel(b2,b1) = 2 to_power b2;

:: BINTREE2:th 20
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT holds
   dom FinSeqLevel(b2,b1) = Seg (2 to_power b2);

:: BINTREE2:th 21
theorem
for b1 being non empty Tree-like full set
for b2 being non empty Element of NAT holds
   proj2 FinSeqLevel(b2,b1) = b1 -level b2;

:: BINTREE2:th 22
theorem
for b1 being non empty Tree-like full set holds
   (FinSeqLevel(1,b1)) . 1 = <*0*>;

:: BINTREE2:th 23
theorem
for b1 being non empty Tree-like full set holds
   (FinSeqLevel(1,b1)) . 2 = <*1*>;

:: BINTREE2:th 24
theorem
for b1 being non empty Tree-like full set
for b2, b3 being non empty Element of NAT
   st b3 <= 2 to_power (b2 + 1)
for b4 being Element of b2 -tuples_on BOOLEAN
      st b4 = (FinSeqLevel(b2,b1)) . ((b3 + 1) div 2)
   holds (FinSeqLevel(b2 + 1,b1)) . b3 = b4 ^ <*(b3 + 1) mod 2*>;