Article FSCIRC_2, MML version 4.99.1005

:: FSCIRC_2:funcnot 1 => FSCIRC_2:func 1
definition
  let a1 be natural set;
  let a2, a3 be Relation-like Function-like FinSequence-like set;
  func A1 -BitSubtracterStr(A2,A3) -> non empty strict non void unsplit gate`1=arity gate`2isBoolean ManySortedSign means
    ex b1, b2 being ManySortedSet of NAT st
       it = b1 . a1 &
        b1 . 0 = 1GateCircStr(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
        b2 . 0 = [<*>,(0 -tuples_on BOOLEAN) --> TRUE] &
        (for b3 being natural set
        for b4 being non empty ManySortedSign
        for b5 being set
              st b4 = b1 . b3 & b5 = b2 . b3
           holds b1 . (b3 + 1) = b4 +* BitSubtracterWithBorrowStr(a2 . (b3 + 1),a3 . (b3 + 1),b5) &
            b2 . (b3 + 1) = BorrowOutput(a2 . (b3 + 1),a3 . (b3 + 1),b5));
end;

:: FSCIRC_2:def 1
theorem
for b1 being natural set
for b2, b3 being Relation-like Function-like FinSequence-like set
for b4 being non empty strict non void unsplit gate`1=arity gate`2isBoolean ManySortedSign holds
      b4 = b1 -BitSubtracterStr(b2,b3)
   iff
      ex b5, b6 being ManySortedSet of NAT st
         b4 = b5 . b1 &
          b5 . 0 = 1GateCircStr(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
          b6 . 0 = [<*>,(0 -tuples_on BOOLEAN) --> TRUE] &
          (for b7 being natural set
          for b8 being non empty ManySortedSign
          for b9 being set
                st b8 = b5 . b7 & b9 = b6 . b7
             holds b5 . (b7 + 1) = b8 +* BitSubtracterWithBorrowStr(b2 . (b7 + 1),b3 . (b7 + 1),b9) &
              b6 . (b7 + 1) = BorrowOutput(b2 . (b7 + 1),b3 . (b7 + 1),b9));

:: FSCIRC_2:funcnot 2 => FSCIRC_2:func 2
definition
  let a1 be natural set;
  let a2, a3 be Relation-like Function-like FinSequence-like set;
  func A1 -BitSubtracterCirc(A2,A3) -> strict locally-finite gate`2=den Boolean MSAlgebra over a1 -BitSubtracterStr(a2,a3) means
    ex b1, b2, b3 being ManySortedSet of NAT st
       a1 -BitSubtracterStr(a2,a3) = b1 . a1 &
        it = b2 . a1 &
        b1 . 0 = 1GateCircStr(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
        b2 . 0 = 1GateCircuit(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
        b3 . 0 = [<*>,(0 -tuples_on BOOLEAN) --> TRUE] &
        (for b4 being natural set
        for b5 being non empty ManySortedSign
        for b6 being non-empty MSAlgebra over b5
        for b7 being set
              st b5 = b1 . b4 & b6 = b2 . b4 & b7 = b3 . b4
           holds b1 . (b4 + 1) = b5 +* BitSubtracterWithBorrowStr(a2 . (b4 + 1),a3 . (b4 + 1),b7) &
            b2 . (b4 + 1) = b6 +* BitSubtracterWithBorrowCirc(a2 . (b4 + 1),a3 . (b4 + 1),b7) &
            b3 . (b4 + 1) = BorrowOutput(a2 . (b4 + 1),a3 . (b4 + 1),b7));
end;

:: FSCIRC_2:def 2
theorem
for b1 being natural set
for b2, b3 being Relation-like Function-like FinSequence-like set
for b4 being strict locally-finite gate`2=den Boolean MSAlgebra over b1 -BitSubtracterStr(b2,b3) holds
      b4 = b1 -BitSubtracterCirc(b2,b3)
   iff
      ex b5, b6, b7 being ManySortedSet of NAT st
         b1 -BitSubtracterStr(b2,b3) = b5 . b1 &
          b4 = b6 . b1 &
          b5 . 0 = 1GateCircStr(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
          b6 . 0 = 1GateCircuit(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
          b7 . 0 = [<*>,(0 -tuples_on BOOLEAN) --> TRUE] &
          (for b8 being natural set
          for b9 being non empty ManySortedSign
          for b10 being non-empty MSAlgebra over b9
          for b11 being set
                st b9 = b5 . b8 & b10 = b6 . b8 & b11 = b7 . b8
             holds b5 . (b8 + 1) = b9 +* BitSubtracterWithBorrowStr(b2 . (b8 + 1),b3 . (b8 + 1),b11) &
              b6 . (b8 + 1) = b10 +* BitSubtracterWithBorrowCirc(b2 . (b8 + 1),b3 . (b8 + 1),b11) &
              b7 . (b8 + 1) = BorrowOutput(b2 . (b8 + 1),b3 . (b8 + 1),b11));

:: FSCIRC_2:funcnot 3 => FSCIRC_2:func 3
definition
  let a1 be natural set;
  let a2, a3 be Relation-like Function-like FinSequence-like set;
  func A1 -BitBorrowOutput(A2,A3) -> Element of InnerVertices (a1 -BitSubtracterStr(a2,a3)) means
    ex b1 being ManySortedSet of NAT st
       it = b1 . a1 &
        b1 . 0 = [<*>,(0 -tuples_on BOOLEAN) --> TRUE] &
        (for b2 being natural set holds
           b1 . (b2 + 1) = BorrowOutput(a2 . (b2 + 1),a3 . (b2 + 1),b1 . b2));
end;

:: FSCIRC_2:def 3
theorem
for b1 being natural set
for b2, b3 being Relation-like Function-like FinSequence-like set
for b4 being Element of InnerVertices (b1 -BitSubtracterStr(b2,b3)) holds
      b4 = b1 -BitBorrowOutput(b2,b3)
   iff
      ex b5 being ManySortedSet of NAT st
         b4 = b5 . b1 &
          b5 . 0 = [<*>,(0 -tuples_on BOOLEAN) --> TRUE] &
          (for b6 being natural set holds
             b5 . (b6 + 1) = BorrowOutput(b2 . (b6 + 1),b3 . (b6 + 1),b5 . b6));

:: FSCIRC_2:th 1
theorem
for b1, b2 being Relation-like Function-like FinSequence-like set
for b3, b4, b5 being ManySortedSet of NAT
   st b3 . 0 = 1GateCircStr(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
      b4 . 0 = 1GateCircuit(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
      b5 . 0 = [<*>,(0 -tuples_on BOOLEAN) --> TRUE] &
      (for b6 being natural set
      for b7 being non empty ManySortedSign
      for b8 being non-empty MSAlgebra over b7
      for b9 being set
            st b7 = b3 . b6 & b8 = b4 . b6 & b9 = b5 . b6
         holds b3 . (b6 + 1) = b7 +* BitSubtracterWithBorrowStr(b1 . (b6 + 1),b2 . (b6 + 1),b9) &
          b4 . (b6 + 1) = b8 +* BitSubtracterWithBorrowCirc(b1 . (b6 + 1),b2 . (b6 + 1),b9) &
          b5 . (b6 + 1) = BorrowOutput(b1 . (b6 + 1),b2 . (b6 + 1),b9))
for b6 being natural set holds
   b6 -BitSubtracterStr(b1,b2) = b3 . b6 & b6 -BitSubtracterCirc(b1,b2) = b4 . b6 & b6 -BitBorrowOutput(b1,b2) = b5 . b6;

:: FSCIRC_2:th 2
theorem
for b1, b2 being Relation-like Function-like FinSequence-like set holds
0 -BitSubtracterStr(b1,b2) = 1GateCircStr(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
 0 -BitSubtracterCirc(b1,b2) = 1GateCircuit(<*>,(0 -tuples_on BOOLEAN) --> TRUE) &
 0 -BitBorrowOutput(b1,b2) = [<*>,(0 -tuples_on BOOLEAN) --> TRUE];

:: FSCIRC_2:th 3
theorem
for b1, b2 being Relation-like Function-like FinSequence-like set
for b3 being set
      st b3 = [<*>,(0 -tuples_on BOOLEAN) --> TRUE]
   holds 1 -BitSubtracterStr(b1,b2) = (1GateCircStr(<*>,(0 -tuples_on BOOLEAN) --> TRUE)) +* BitSubtracterWithBorrowStr(b1 . 1,b2 . 1,b3) &
    1 -BitSubtracterCirc(b1,b2) = (1GateCircuit(<*>,(0 -tuples_on BOOLEAN) --> TRUE)) +* BitSubtracterWithBorrowCirc(b1 . 1,b2 . 1,b3) &
    1 -BitBorrowOutput(b1,b2) = BorrowOutput(b1 . 1,b2 . 1,b3);

:: FSCIRC_2:th 4
theorem
for b1, b2, b3 being set
      st b3 = [<*>,(0 -tuples_on BOOLEAN) --> TRUE]
   holds 1 -BitSubtracterStr(<*b1*>,<*b2*>) = (1GateCircStr(<*>,(0 -tuples_on BOOLEAN) --> TRUE)) +* BitSubtracterWithBorrowStr(b1,b2,b3) &
    1 -BitSubtracterCirc(<*b1*>,<*b2*>) = (1GateCircuit(<*>,(0 -tuples_on BOOLEAN) --> TRUE)) +* BitSubtracterWithBorrowCirc(b1,b2,b3) &
    1 -BitBorrowOutput(<*b1*>,<*b2*>) = BorrowOutput(b1,b2,b3);

:: FSCIRC_2:th 5
theorem
for b1 being Element of NAT
for b2, b3 being FinSeqLen of b1
for b4, b5, b6, b7 being Relation-like Function-like FinSequence-like set holds
b1 -BitSubtracterStr(b2 ^ b4,b3 ^ b6) = b1 -BitSubtracterStr(b2 ^ b5,b3 ^ b7) &
 b1 -BitSubtracterCirc(b2 ^ b4,b3 ^ b6) = b1 -BitSubtracterCirc(b2 ^ b5,b3 ^ b7) &
 b1 -BitBorrowOutput(b2 ^ b4,b3 ^ b6) = b1 -BitBorrowOutput(b2 ^ b5,b3 ^ b7);

:: FSCIRC_2:th 6
theorem
for b1 being Element of NAT
for b2, b3 being FinSeqLen of b1
for b4, b5 being set holds
(b1 + 1) -BitSubtracterStr(b2 ^ <*b4*>,b3 ^ <*b5*>) = (b1 -BitSubtracterStr(b2,b3)) +* BitSubtracterWithBorrowStr(b4,b5,b1 -BitBorrowOutput(b2,b3)) &
 (b1 + 1) -BitSubtracterCirc(b2 ^ <*b4*>,b3 ^ <*b5*>) = (b1 -BitSubtracterCirc(b2,b3)) +* BitSubtracterWithBorrowCirc(b4,b5,b1 -BitBorrowOutput(b2,b3)) &
 (b1 + 1) -BitBorrowOutput(b2 ^ <*b4*>,b3 ^ <*b5*>) = BorrowOutput(b4,b5,b1 -BitBorrowOutput(b2,b3));

:: FSCIRC_2:th 7
theorem
for b1 being Element of NAT
for b2, b3 being Relation-like Function-like FinSequence-like set holds
(b1 + 1) -BitSubtracterStr(b2,b3) = (b1 -BitSubtracterStr(b2,b3)) +* BitSubtracterWithBorrowStr(b2 . (b1 + 1),b3 . (b1 + 1),b1 -BitBorrowOutput(b2,b3)) &
 (b1 + 1) -BitSubtracterCirc(b2,b3) = (b1 -BitSubtracterCirc(b2,b3)) +* BitSubtracterWithBorrowCirc(b2 . (b1 + 1),b3 . (b1 + 1),b1 -BitBorrowOutput(b2,b3)) &
 (b1 + 1) -BitBorrowOutput(b2,b3) = BorrowOutput(b2 . (b1 + 1),b3 . (b1 + 1),b1 -BitBorrowOutput(b2,b3));

:: FSCIRC_2:th 8
theorem
for b1, b2 being Element of NAT
   st b1 <= b2
for b3, b4 being Relation-like Function-like FinSequence-like set holds
InnerVertices (b1 -BitSubtracterStr(b3,b4)) c= InnerVertices (b2 -BitSubtracterStr(b3,b4));

:: FSCIRC_2:th 9
theorem
for b1 being Element of NAT
for b2, b3 being Relation-like Function-like FinSequence-like set holds
InnerVertices ((b1 + 1) -BitSubtracterStr(b2,b3)) = (InnerVertices (b1 -BitSubtracterStr(b2,b3))) \/ InnerVertices BitSubtracterWithBorrowStr(b2 . (b1 + 1),b3 . (b1 + 1),b1 -BitBorrowOutput(b2,b3));

:: FSCIRC_2:funcnot 4 => FSCIRC_2:func 4
definition
  let a1, a2 be Element of NAT;
  let a3, a4 be Relation-like Function-like FinSequence-like set;
  assume 1 <= a1 & a1 <= a2;
  func (A1,A2)-BitSubtracterOutput(A3,A4) -> Element of InnerVertices (a2 -BitSubtracterStr(a3,a4)) means
    ex b1 being Element of NAT st
       a1 = b1 + 1 &
        it = BitSubtracterOutput(a3 . a1,a4 . a1,b1 -BitBorrowOutput(a3,a4));
end;

:: FSCIRC_2:def 4
theorem
for b1, b2 being Element of NAT
   st 1 <= b1 & b1 <= b2
for b3, b4 being Relation-like Function-like FinSequence-like set
for b5 being Element of InnerVertices (b2 -BitSubtracterStr(b3,b4)) holds
      b5 = (b1,b2)-BitSubtracterOutput(b3,b4)
   iff
      ex b6 being Element of NAT st
         b1 = b6 + 1 &
          b5 = BitSubtracterOutput(b3 . b1,b4 . b1,b6 -BitBorrowOutput(b3,b4));

:: FSCIRC_2:th 10
theorem
for b1, b2 being Element of NAT
   st b2 < b1
for b3, b4 being Relation-like Function-like FinSequence-like set holds
(b2 + 1,b1)-BitSubtracterOutput(b3,b4) = BitSubtracterOutput(b3 . (b2 + 1),b4 . (b2 + 1),b2 -BitBorrowOutput(b3,b4));

:: FSCIRC_2:th 11
theorem
for b1 being Element of NAT
for b2, b3 being Relation-like Function-like FinSequence-like set holds
InnerVertices (b1 -BitSubtracterStr(b2,b3)) is Relation-like set;

:: FSCIRC_2:th 12
theorem
for b1, b2, b3 being set holds
InnerVertices BorrowIStr(b1,b2,b3) = {[<*b1,b2*>,and2a],[<*b2,b3*>,and2],[<*b1,b3*>,and2a]};

:: FSCIRC_2:th 13
theorem
for b1, b2, b3 being set
      st b1 <> [<*b2,b3*>,and2] &
         b2 <> [<*b1,b3*>,and2a] &
         b3 <> [<*b1,b2*>,and2a]
   holds InputVertices BorrowIStr(b1,b2,b3) = {b1,b2,b3};

:: FSCIRC_2:th 14
theorem
for b1, b2, b3 being set holds
InnerVertices BorrowStr(b1,b2,b3) = {[<*b1,b2*>,and2a],[<*b2,b3*>,and2],[<*b1,b3*>,and2a]} \/ {BorrowOutput(b1,b2,b3)};

:: FSCIRC_2:th 15
theorem
for b1, b2, b3 being set
      st b1 <> [<*b2,b3*>,and2] &
         b2 <> [<*b1,b3*>,and2a] &
         b3 <> [<*b1,b2*>,and2a]
   holds InputVertices BorrowStr(b1,b2,b3) = {b1,b2,b3};

:: FSCIRC_2:th 16
theorem
for b1, b2, b3 being set
      st b1 <> [<*b2,b3*>,and2] &
         b2 <> [<*b1,b3*>,and2a] &
         b3 <> [<*b1,b2*>,and2a] &
         b3 <> [<*b1,b2*>,'xor']
   holds InputVertices BitSubtracterWithBorrowStr(b1,b2,b3) = {b1,b2,b3};

:: FSCIRC_2:th 17
theorem
for b1, b2, b3 being set holds
InnerVertices BitSubtracterWithBorrowStr(b1,b2,b3) = ({[<*b1,b2*>,'xor'],2GatesCircOutput(b1,b2,b3,'xor')} \/ {[<*b1,b2*>,and2a],[<*b2,b3*>,and2],[<*b1,b3*>,and2a]}) \/ {BorrowOutput(b1,b2,b3)};

:: FSCIRC_2:funcreg 1
registration
  let a1 be Element of NAT;
  let a2, a3 be Relation-like Function-like FinSequence-like set;
  cluster a1 -BitBorrowOutput(a2,a3) -> pair;
end;

:: FSCIRC_2:th 18
theorem
for b1, b2 being Relation-like Function-like FinSequence-like set
for b3 being Element of NAT
      st ((b3 -BitBorrowOutput(b1,b2)) `1 = <*> &
         (b3 -BitBorrowOutput(b1,b2)) `2 = (0 -tuples_on BOOLEAN) --> TRUE implies proj1 ((b3 -BitBorrowOutput(b1,b2)) `2) <> 0 -tuples_on BOOLEAN)
   holds Card ((b3 -BitBorrowOutput(b1,b2)) `1) = 3 &
    (b3 -BitBorrowOutput(b1,b2)) `2 = or3 &
    proj1 ((b3 -BitBorrowOutput(b1,b2)) `2) = 3 -tuples_on BOOLEAN;

:: FSCIRC_2:th 19
theorem
for b1 being Element of NAT
for b2, b3 being Relation-like Function-like FinSequence-like set
for b4 being set holds
   b1 -BitBorrowOutput(b2,b3) <> [b4,and2] &
    b1 -BitBorrowOutput(b2,b3) <> [b4,and2a] &
    b1 -BitBorrowOutput(b2,b3) <> [b4,'xor'];

:: FSCIRC_2:th 20
theorem
for b1, b2 being Relation-like Function-like FinSequence-like nonpair-yielding set
for b3 being Element of NAT holds
   InputVertices ((b3 + 1) -BitSubtracterStr(b1,b2)) = (InputVertices (b3 -BitSubtracterStr(b1,b2))) \/ ((InputVertices BitSubtracterWithBorrowStr(b1 . (b3 + 1),b2 . (b3 + 1),b3 -BitBorrowOutput(b1,b2))) \ {b3 -BitBorrowOutput(b1,b2)}) &
    InnerVertices (b3 -BitSubtracterStr(b1,b2)) is Relation-like set &
    InputVertices (b3 -BitSubtracterStr(b1,b2)) is without_pairs;

:: FSCIRC_2:th 21
theorem
for b1 being Element of NAT
for b2, b3 being nonpair-yielding FinSeqLen of b1 holds
InputVertices (b1 -BitSubtracterStr(b2,b3)) = (proj2 b2) \/ proj2 b3;

:: FSCIRC_2:th 22
theorem
for b1, b2, b3 being set
for b4 being Element of product the Sorts of BorrowCirc(b1,b2,b3)
for b5, b6, b7 being Element of BOOLEAN
      st b5 = b4 . [<*b1,b2*>,and2a] &
         b6 = b4 . [<*b2,b3*>,and2] &
         b7 = b4 . [<*b1,b3*>,and2a]
   holds (Following b4) . BorrowOutput(b1,b2,b3) = (b5 'or' b6) 'or' b7;

:: FSCIRC_2:th 23
theorem
for b1, b2, b3 being set
   st b1 <> [<*b2,b3*>,and2] &
      b2 <> [<*b1,b3*>,and2a] &
      b3 <> [<*b1,b2*>,and2a] &
      b3 <> [<*b1,b2*>,'xor']
for b4 being Element of product the Sorts of BorrowCirc(b1,b2,b3) holds
   Following(b4,2) is stable(BorrowStr(b1,b2,b3), BorrowCirc(b1,b2,b3));

:: FSCIRC_2:th 24
theorem
for b1, b2, b3 being set
   st b1 <> [<*b2,b3*>,and2] &
      b2 <> [<*b1,b3*>,and2a] &
      b3 <> [<*b1,b2*>,and2a] &
      b3 <> [<*b1,b2*>,'xor']
for b4 being Element of product the Sorts of BitSubtracterWithBorrowCirc(b1,b2,b3)
for b5, b6, b7 being Element of BOOLEAN
      st b5 = b4 . b1 & b6 = b4 . b2 & b7 = b4 . b3
   holds (Following(b4,2)) . BitSubtracterOutput(b1,b2,b3) = (b5 'xor' b6) 'xor' b7 &
    (Following(b4,2)) . BorrowOutput(b1,b2,b3) = ((('not' b5) '&' b6) 'or' (b6 '&' b7)) 'or' (('not' b5) '&' b7);

:: FSCIRC_2:th 25
theorem
for b1, b2, b3 being set
   st b1 <> [<*b2,b3*>,and2] &
      b2 <> [<*b1,b3*>,and2a] &
      b3 <> [<*b1,b2*>,and2a] &
      b3 <> [<*b1,b2*>,'xor']
for b4 being Element of product the Sorts of BitSubtracterWithBorrowCirc(b1,b2,b3) holds
   Following(b4,2) is stable(BitSubtracterWithBorrowStr(b1,b2,b3), BitSubtracterWithBorrowCirc(b1,b2,b3));

:: FSCIRC_2:th 26
theorem
for b1 being Element of NAT
for b2, b3 being nonpair-yielding FinSeqLen of b1
for b4 being Element of product the Sorts of b1 -BitSubtracterCirc(b2,b3) holds
   Following(b4,1 + (2 * b1)) is stable(b1 -BitSubtracterStr(b2,b3), b1 -BitSubtracterCirc(b2,b3));