Article BINARI_3, MML version 4.99.1005

:: BINARI_3:th 1
theorem
for b1 being non empty Element of NAT
for b2 being Element of b1 -tuples_on BOOLEAN holds
   Absval b2 < 2 to_power b1;

:: BINARI_3:th 2
theorem
for b1 being non empty Element of NAT
for b2, b3 being Element of b1 -tuples_on BOOLEAN
      st Absval b2 = Absval b3
   holds b2 = b3;

:: BINARI_3:th 3
theorem
for b1, b2 being Relation-like Function-like FinSequence-like set
      st Rev b1 = Rev b2
   holds b1 = b2;

:: BINARI_3:th 5
theorem
for b1 being Element of NAT holds
   0* b1 in BOOLEAN *;

:: BINARI_3:th 6
theorem
for b1 being Element of NAT
for b2 being Element of b1 -tuples_on BOOLEAN
      st b2 = 0* b1
   holds 'not' b2 = b1 |-> 1;

:: BINARI_3:th 7
theorem
for b1 being non empty Element of NAT
for b2 being Element of b1 -tuples_on BOOLEAN
      st b2 = 0* b1
   holds Absval b2 = 0;

:: BINARI_3:th 8
theorem
for b1 being non empty Element of NAT
for b2 being Element of b1 -tuples_on BOOLEAN
      st b2 = 0* b1
   holds Absval 'not' b2 = (2 to_power b1) - 1;

:: BINARI_3:th 9
theorem
for b1 being Element of NAT holds
   Rev 0* b1 = 0* b1;

:: BINARI_3:th 10
theorem
for b1 being Element of NAT
for b2 being Element of b1 -tuples_on BOOLEAN
      st b2 = 0* b1
   holds Rev 'not' b2 = 'not' b2;

:: BINARI_3:th 11
theorem
Bin1 1 = <*TRUE*>;

:: BINARI_3:th 12
theorem
for b1 being non empty Element of NAT holds
   Absval Bin1 b1 = 1;

:: BINARI_3:th 13
theorem
for b1, b2 being Element of BOOLEAN holds
(b1 'or' b2 = TRUE & b1 <> TRUE implies b2 = TRUE) &
 (b1 <> TRUE & b2 <> TRUE or b1 'or' b2 = TRUE) &
 (b1 'or' b2 = FALSE implies b1 = FALSE & b2 = FALSE) &
 (b1 = FALSE & b2 = FALSE implies b1 'or' b2 = FALSE);

:: BINARI_3:th 14
theorem
for b1, b2 being Element of BOOLEAN holds
   add_ovfl(<*b1*>,<*b2*>) = TRUE
iff
   b1 = TRUE & b2 = TRUE;

:: BINARI_3:th 15
theorem
'not' <*FALSE*> = <*TRUE*>;

:: BINARI_3:th 16
theorem
'not' <*TRUE*> = <*FALSE*>;

:: BINARI_3:th 17
theorem
<*FALSE*> + <*FALSE*> = <*FALSE*>;

:: BINARI_3:th 18
theorem
<*FALSE*> + <*TRUE*> = <*TRUE*> &
 <*TRUE*> + <*FALSE*> = <*TRUE*>;

:: BINARI_3:th 19
theorem
<*TRUE*> + <*TRUE*> = <*FALSE*>;

:: BINARI_3:th 20
theorem
for b1 being non empty Element of NAT
for b2, b3 being Element of b1 -tuples_on BOOLEAN
   st b2 /. b1 = TRUE & (carry(b2,Bin1 b1)) /. b1 = TRUE
for b4 being non empty Element of NAT
      st b4 <> 1 & b4 <= b1
   holds b2 /. b4 = TRUE & (carry(b2,Bin1 b1)) /. b4 = TRUE;

:: BINARI_3:th 21
theorem
for b1 being non empty Element of NAT
for b2 being Element of b1 -tuples_on BOOLEAN
      st b2 /. b1 = TRUE & (carry(b2,Bin1 b1)) /. b1 = TRUE
   holds carry(b2,Bin1 b1) = 'not' Bin1 b1;

:: BINARI_3:th 22
theorem
for b1 being non empty Element of NAT
for b2, b3 being Element of b1 -tuples_on BOOLEAN
      st b3 = 0* b1 & b2 /. b1 = TRUE & (carry(b2,Bin1 b1)) /. b1 = TRUE
   holds b2 = 'not' b3;

:: BINARI_3:th 23
theorem
for b1 being non empty Element of NAT
for b2 being Element of b1 -tuples_on BOOLEAN
      st b2 = 0* b1
   holds carry('not' b2,Bin1 b1) = 'not' Bin1 b1;

:: BINARI_3:th 24
theorem
for b1 being non empty Element of NAT
for b2, b3 being Element of b1 -tuples_on BOOLEAN
      st b3 = 0* b1
   holds    add_ovfl(b2,Bin1 b1) = TRUE
   iff
      b2 = 'not' b3;

:: BINARI_3:th 25
theorem
for b1 being non empty Element of NAT
for b2 being Element of b1 -tuples_on BOOLEAN
      st b2 = 0* b1
   holds ('not' b2) + Bin1 b1 = b2;

:: BINARI_3:funcnot 1 => BINARI_3:func 1
definition
  let a1, a2 be natural set;
  func A1 -BinarySequence A2 -> Element of a1 -tuples_on BOOLEAN means
    for b1 being Element of NAT
          st b1 in Seg a1
       holds it /. b1 = IFEQ((a2 div (2 to_power (b1 -' 1))) mod 2,0,FALSE,TRUE);
end;

:: BINARI_3:def 1
theorem
for b1, b2 being natural set
for b3 being Element of b1 -tuples_on BOOLEAN holds
      b3 = b1 -BinarySequence b2
   iff
      for b4 being Element of NAT
            st b4 in Seg b1
         holds b3 /. b4 = IFEQ((b2 div (2 to_power (b4 -' 1))) mod 2,0,FALSE,TRUE);

:: BINARI_3:th 26
theorem
for b1 being Element of NAT holds
   b1 -BinarySequence 0 = 0* b1;

:: BINARI_3:th 27
theorem
for b1, b2 being Element of NAT
      st b2 < 2 to_power b1
   holds ((b1 + 1) -BinarySequence b2) . (b1 + 1) = FALSE;

:: BINARI_3:th 28
theorem
for b1 being non empty Element of NAT
for b2 being Element of NAT
      st b2 < 2 to_power b1
   holds (b1 + 1) -BinarySequence b2 = (b1 -BinarySequence b2) ^ <*FALSE*>;

:: BINARI_3:th 29
theorem
for b1 being Element of NAT holds
   (b1 + 1) -BinarySequence (2 to_power b1) = (0* b1) ^ <*1*>;

:: BINARI_3:th 30
theorem
for b1 being non empty Element of NAT
for b2 being Element of NAT
      st 2 to_power b1 <= b2 & b2 < 2 to_power (b1 + 1)
   holds ((b1 + 1) -BinarySequence b2) . (b1 + 1) = TRUE;

:: BINARI_3:th 31
theorem
for b1 being non empty Element of NAT
for b2 being Element of NAT
      st 2 to_power b1 <= b2 & b2 < 2 to_power (b1 + 1)
   holds (b1 + 1) -BinarySequence b2 = (b1 -BinarySequence (b2 -' (2 to_power b1))) ^ <*TRUE*>;

:: BINARI_3:th 32
theorem
for b1 being non empty Element of NAT
for b2 being Element of NAT
   st b2 < 2 to_power b1
for b3 being Element of b1 -tuples_on BOOLEAN
      st b3 = 0* b1
   holds    b1 -BinarySequence b2 = 'not' b3
   iff
      b2 = (2 to_power b1) - 1;

:: BINARI_3:th 33
theorem
for b1 being non empty Element of NAT
for b2 being Element of NAT
      st b2 + 1 < 2 to_power b1
   holds add_ovfl(b1 -BinarySequence b2,Bin1 b1) = FALSE;

:: BINARI_3:th 34
theorem
for b1 being non empty Element of NAT
for b2 being Element of NAT
      st b2 + 1 < 2 to_power b1
   holds b1 -BinarySequence (b2 + 1) = (b1 -BinarySequence b2) + Bin1 b1;

:: BINARI_3:th 35
theorem
for b1, b2 being Element of NAT holds
(b1 + 1) -BinarySequence b2 = <*b2 mod 2*> ^ (b1 -BinarySequence (b2 div 2));

:: BINARI_3:th 36
theorem
for b1 being non empty Element of NAT
for b2 being Element of NAT
      st b2 < 2 to_power b1
   holds Absval (b1 -BinarySequence b2) = b2;

:: BINARI_3:th 37
theorem
for b1 being non empty Element of NAT
for b2 being Element of b1 -tuples_on BOOLEAN holds
   b1 -BinarySequence Absval b2 = b2;