:: FACIRC_2 semantic presentation

theorem Th1: :: FACIRC_2:1
for b1, b2, b3 being set st b1 <> b3 & b2 <> b3 holds
{b1,b2} \ {b3} = {b1,b2}
proof end;

theorem Th2: :: FACIRC_2:2
canceled;

theorem Th3: :: FACIRC_2:3
for b1, b2, b3 being set holds
( b1 <> [<*b1,b2*>,b3] & b2 <> [<*b1,b2*>,b3] )
proof end;

registration
cluster void -> unsplit gate`1=arity gate`2isBoolean ManySortedSign ;
coherence
for b1 being ManySortedSign st b1 is void holds
( b1 is unsplit & b1 is gate`1=arity & b1 is gate`2isBoolean )
proof end;
end;

registration
cluster strict void unsplit gate`1=arity gate`2isBoolean ManySortedSign ;
existence
ex b1 being ManySortedSign st
( b1 is strict & b1 is void )
proof end;
end;

definition
let c1 be set ;
func SingleMSS c1 -> strict void ManySortedSign means :Def1: :: FACIRC_2:def 1
the carrier of a2 = {a1};
existence
ex b1 being strict void ManySortedSign st the carrier of b1 = {c1}
proof end;
uniqueness
for b1, b2 being strict void ManySortedSign st the carrier of b1 = {c1} & the carrier of b2 = {c1} holds
b1 = b2
proof end;
end;

:: deftheorem Def1 defines SingleMSS FACIRC_2:def 1 :
for b1 being set
for b2 being strict void ManySortedSign holds
( b2 = SingleMSS b1 iff the carrier of b2 = {b1} );

registration
let c1 be set ;
cluster SingleMSS a1 -> non empty strict void unsplit gate`1=arity gate`2isBoolean ;
coherence
not SingleMSS c1 is empty
proof end;
end;

definition
let c1 be set ;
func SingleMSA c1 -> strict Boolean MSAlgebra of SingleMSS a1 means :: FACIRC_2:def 2
verum;
existence
ex b1 being strict Boolean MSAlgebra of SingleMSS c1 st verum
;
uniqueness
for b1, b2 being strict Boolean MSAlgebra of SingleMSS c1 holds b1 = b2
proof end;
end;

:: deftheorem Def2 defines SingleMSA FACIRC_2:def 2 :
for b1 being set
for b2 being strict Boolean MSAlgebra of SingleMSS b1 holds
( b2 = SingleMSA b1 iff verum );

theorem Th4: :: FACIRC_2:4
for b1 being set
for b2 being ManySortedSign holds SingleMSS b1 tolerates b2
proof end;

theorem Th5: :: FACIRC_2:5
for b1 being set
for b2 being non empty ManySortedSign st b1 in the carrier of b2 holds
(SingleMSS b1) +* b2 = ManySortedSign(# the carrier of b2,the OperSymbols of b2,the Arity of b2,the ResultSort of b2 #)
proof end;

theorem Th6: :: FACIRC_2:6
for b1 being set
for b2 being non empty strict ManySortedSign
for b3 being Boolean MSAlgebra of b2 st b1 in the carrier of b2 holds
(SingleMSA b1) +* b3 = MSAlgebra(# the Sorts of b3,the Charact of b3 #)
proof end;

notation
synonym <*> for {} ;
end;

definition
redefine func <*> as <*> -> FinSeqLen of 0;
coherence
<*> is FinSeqLen of 0
proof end;
end;

definition
let c1 be Nat;
let c2, c3 be FinSequence;
E4: ( 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) is unsplit & 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) is gate`1=arity & 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) is gate`2isBoolean & not 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) is void & not 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) is empty & 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) is strict ) ;
func c1 -BitAdderStr c2,c3 -> non empty strict non void unsplit gate`1=arity gate`2isBoolean ManySortedSign means :Def3: :: FACIRC_2:def 3
ex b1, b2 being ManySortedSet of NAT st
( a4 = b1 . a1 & b1 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b2 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b3 being Nat
for b4 being non empty ManySortedSign
for b5 being set st b4 = b1 . b3 & b5 = b2 . b3 holds
( b1 . (b3 + 1) = b4 +* (BitAdderWithOverflowStr (a2 . (b3 + 1)),(a3 . (b3 + 1)),b5) & b2 . (b3 + 1) = MajorityOutput (a2 . (b3 + 1)),(a3 . (b3 + 1)),b5 ) ) );
uniqueness
for b1, b2 being non empty strict non void unsplit gate`1=arity gate`2isBoolean ManySortedSign st ex b3, b4 being ManySortedSet of NAT st
( b1 = b3 . c1 & b3 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b4 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b5 being Nat
for b6 being non empty ManySortedSign
for b7 being set st b6 = b3 . b5 & b7 = b4 . b5 holds
( b3 . (b5 + 1) = b6 +* (BitAdderWithOverflowStr (c2 . (b5 + 1)),(c3 . (b5 + 1)),b7) & b4 . (b5 + 1) = MajorityOutput (c2 . (b5 + 1)),(c3 . (b5 + 1)),b7 ) ) ) & ex b3, b4 being ManySortedSet of NAT st
( b2 = b3 . c1 & b3 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b4 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b5 being Nat
for b6 being non empty ManySortedSign
for b7 being set st b6 = b3 . b5 & b7 = b4 . b5 holds
( b3 . (b5 + 1) = b6 +* (BitAdderWithOverflowStr (c2 . (b5 + 1)),(c3 . (b5 + 1)),b7) & b4 . (b5 + 1) = MajorityOutput (c2 . (b5 + 1)),(c3 . (b5 + 1)),b7 ) ) ) holds
b1 = b2
proof end;
existence
ex b1 being non empty strict non void unsplit gate`1=arity gate`2isBoolean ManySortedSign ex b2, b3 being ManySortedSet of NAT st
( b1 = b2 . c1 & b2 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b3 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b4 being Nat
for b5 being non empty ManySortedSign
for b6 being set st b5 = b2 . b4 & b6 = b3 . b4 holds
( b2 . (b4 + 1) = b5 +* (BitAdderWithOverflowStr (c2 . (b4 + 1)),(c3 . (b4 + 1)),b6) & b3 . (b4 + 1) = MajorityOutput (c2 . (b4 + 1)),(c3 . (b4 + 1)),b6 ) ) )
proof end;
end;

:: deftheorem Def3 defines -BitAdderStr FACIRC_2:def 3 :
for b1 being Nat
for b2, b3 being FinSequence
for b4 being non empty strict non void unsplit gate`1=arity gate`2isBoolean ManySortedSign holds
( b4 = b1 -BitAdderStr b2,b3 iff ex b5, b6 being ManySortedSet of NAT st
( b4 = b5 . b1 & b5 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b6 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b7 being Nat
for b8 being non empty ManySortedSign
for b9 being set st b8 = b5 . b7 & b9 = b6 . b7 holds
( b5 . (b7 + 1) = b8 +* (BitAdderWithOverflowStr (b2 . (b7 + 1)),(b3 . (b7 + 1)),b9) & b6 . (b7 + 1) = MajorityOutput (b2 . (b7 + 1)),(b3 . (b7 + 1)),b9 ) ) ) );

definition
let c1 be Nat;
let c2, c3 be FinSequence;
func c1 -BitAdderCirc c2,c3 -> strict gate`2=den Boolean Circuit of a1 -BitAdderStr a2,a3 means :Def4: :: FACIRC_2:def 4
ex b1, b2, b3 being ManySortedSet of NAT st
( a1 -BitAdderStr a2,a3 = b1 . a1 & a4 = b2 . a1 & b1 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b2 . 0 = 1GateCircuit <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b3 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b4 being Nat
for b5 being non empty ManySortedSign
for b6 being non-empty MSAlgebra of b5
for b7 being set st b5 = b1 . b4 & b6 = b2 . b4 & b7 = b3 . b4 holds
( b1 . (b4 + 1) = b5 +* (BitAdderWithOverflowStr (a2 . (b4 + 1)),(a3 . (b4 + 1)),b7) & b2 . (b4 + 1) = b6 +* (BitAdderWithOverflowCirc (a2 . (b4 + 1)),(a3 . (b4 + 1)),b7) & b3 . (b4 + 1) = MajorityOutput (a2 . (b4 + 1)),(a3 . (b4 + 1)),b7 ) ) );
uniqueness
for b1, b2 being strict gate`2=den Boolean Circuit of c1 -BitAdderStr c2,c3 st ex b3, b4, b5 being ManySortedSet of NAT st
( c1 -BitAdderStr c2,c3 = b3 . c1 & b1 = b4 . c1 & b3 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b4 . 0 = 1GateCircuit <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b5 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b6 being Nat
for b7 being non empty ManySortedSign
for b8 being non-empty MSAlgebra of b7
for b9 being set st b7 = b3 . b6 & b8 = b4 . b6 & b9 = b5 . b6 holds
( b3 . (b6 + 1) = b7 +* (BitAdderWithOverflowStr (c2 . (b6 + 1)),(c3 . (b6 + 1)),b9) & b4 . (b6 + 1) = b8 +* (BitAdderWithOverflowCirc (c2 . (b6 + 1)),(c3 . (b6 + 1)),b9) & b5 . (b6 + 1) = MajorityOutput (c2 . (b6 + 1)),(c3 . (b6 + 1)),b9 ) ) ) & ex b3, b4, b5 being ManySortedSet of NAT st
( c1 -BitAdderStr c2,c3 = b3 . c1 & b2 = b4 . c1 & b3 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b4 . 0 = 1GateCircuit <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b5 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b6 being Nat
for b7 being non empty ManySortedSign
for b8 being non-empty MSAlgebra of b7
for b9 being set st b7 = b3 . b6 & b8 = b4 . b6 & b9 = b5 . b6 holds
( b3 . (b6 + 1) = b7 +* (BitAdderWithOverflowStr (c2 . (b6 + 1)),(c3 . (b6 + 1)),b9) & b4 . (b6 + 1) = b8 +* (BitAdderWithOverflowCirc (c2 . (b6 + 1)),(c3 . (b6 + 1)),b9) & b5 . (b6 + 1) = MajorityOutput (c2 . (b6 + 1)),(c3 . (b6 + 1)),b9 ) ) ) holds
b1 = b2
proof end;
existence
ex b1 being strict gate`2=den Boolean Circuit of c1 -BitAdderStr c2,c3ex b2, b3, b4 being ManySortedSet of NAT st
( c1 -BitAdderStr c2,c3 = b2 . c1 & b1 = b3 . c1 & b2 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b3 . 0 = 1GateCircuit <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b4 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b5 being Nat
for b6 being non empty ManySortedSign
for b7 being non-empty MSAlgebra of b6
for b8 being set st b6 = b2 . b5 & b7 = b3 . b5 & b8 = b4 . b5 holds
( b2 . (b5 + 1) = b6 +* (BitAdderWithOverflowStr (c2 . (b5 + 1)),(c3 . (b5 + 1)),b8) & b3 . (b5 + 1) = b7 +* (BitAdderWithOverflowCirc (c2 . (b5 + 1)),(c3 . (b5 + 1)),b8) & b4 . (b5 + 1) = MajorityOutput (c2 . (b5 + 1)),(c3 . (b5 + 1)),b8 ) ) )
proof end;
end;

:: deftheorem Def4 defines -BitAdderCirc FACIRC_2:def 4 :
for b1 being Nat
for b2, b3 being FinSequence
for b4 being strict gate`2=den Boolean Circuit of b1 -BitAdderStr b2,b3 holds
( b4 = b1 -BitAdderCirc b2,b3 iff ex b5, b6, b7 being ManySortedSet of NAT st
( b1 -BitAdderStr b2,b3 = b5 . b1 & b4 = b6 . b1 & b5 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b6 . 0 = 1GateCircuit <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b7 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b8 being Nat
for b9 being non empty ManySortedSign
for b10 being non-empty MSAlgebra of b9
for b11 being set st b9 = b5 . b8 & b10 = b6 . b8 & b11 = b7 . b8 holds
( b5 . (b8 + 1) = b9 +* (BitAdderWithOverflowStr (b2 . (b8 + 1)),(b3 . (b8 + 1)),b11) & b6 . (b8 + 1) = b10 +* (BitAdderWithOverflowCirc (b2 . (b8 + 1)),(b3 . (b8 + 1)),b11) & b7 . (b8 + 1) = MajorityOutput (b2 . (b8 + 1)),(b3 . (b8 + 1)),b11 ) ) ) );

definition
let c1 be Nat;
let c2, c3 be FinSequence;
set c4 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )];
func c1 -BitMajorityOutput c2,c3 -> Element of InnerVertices (a1 -BitAdderStr a2,a3) means :Def5: :: FACIRC_2:def 5
ex b1 being ManySortedSet of NAT st
( a4 = b1 . a1 & b1 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b2 being Nat
for b3 being set st b3 = b1 . b2 holds
b1 . (b2 + 1) = MajorityOutput (a2 . (b2 + 1)),(a3 . (b2 + 1)),b3 ) );
uniqueness
for b1, b2 being Element of InnerVertices (c1 -BitAdderStr c2,c3) st ex b3 being ManySortedSet of NAT st
( b1 = b3 . c1 & b3 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b4 being Nat
for b5 being set st b5 = b3 . b4 holds
b3 . (b4 + 1) = MajorityOutput (c2 . (b4 + 1)),(c3 . (b4 + 1)),b5 ) ) & ex b3 being ManySortedSet of NAT st
( b2 = b3 . c1 & b3 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b4 being Nat
for b5 being set st b5 = b3 . b4 holds
b3 . (b4 + 1) = MajorityOutput (c2 . (b4 + 1)),(c3 . (b4 + 1)),b5 ) ) holds
b1 = b2
proof end;
existence
ex b1 being Element of InnerVertices (c1 -BitAdderStr c2,c3)ex b2 being ManySortedSet of NAT st
( b1 = b2 . c1 & b2 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b3 being Nat
for b4 being set st b4 = b2 . b3 holds
b2 . (b3 + 1) = MajorityOutput (c2 . (b3 + 1)),(c3 . (b3 + 1)),b4 ) )
proof end;
end;

:: deftheorem Def5 defines -BitMajorityOutput FACIRC_2:def 5 :
for b1 being Nat
for b2, b3 being FinSequence
for b4 being Element of InnerVertices (b1 -BitAdderStr b2,b3) holds
( b4 = b1 -BitMajorityOutput b2,b3 iff ex b5 being ManySortedSet of NAT st
( b4 = b5 . b1 & b5 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b6 being Nat
for b7 being set st b7 = b5 . b6 holds
b5 . (b6 + 1) = MajorityOutput (b2 . (b6 + 1)),(b3 . (b6 + 1)),b7 ) ) );

theorem Th7: :: FACIRC_2:7
for b1, b2 being FinSequence
for b3, b4, b5 being ManySortedSet of NAT st b3 . 0 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b4 . 0 = 1GateCircuit <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & b5 . 0 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] & ( for b6 being Nat
for b7 being non empty ManySortedSign
for b8 being non-empty MSAlgebra of b7
for b9 being set st b7 = b3 . b6 & b8 = b4 . b6 & b9 = b5 . b6 holds
( b3 . (b6 + 1) = b7 +* (BitAdderWithOverflowStr (b1 . (b6 + 1)),(b2 . (b6 + 1)),b9) & b4 . (b6 + 1) = b8 +* (BitAdderWithOverflowCirc (b1 . (b6 + 1)),(b2 . (b6 + 1)),b9) & b5 . (b6 + 1) = MajorityOutput (b1 . (b6 + 1)),(b2 . (b6 + 1)),b9 ) ) holds
for b6 being Nat holds
( b6 -BitAdderStr b1,b2 = b3 . b6 & b6 -BitAdderCirc b1,b2 = b4 . b6 & b6 -BitMajorityOutput b1,b2 = b5 . b6 )
proof end;

theorem Th8: :: FACIRC_2:8
for b1, b2 being FinSequence holds
( 0 -BitAdderStr b1,b2 = 1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & 0 -BitAdderCirc b1,b2 = 1GateCircuit <*> ,((0 -tuples_on BOOLEAN ) --> FALSE ) & 0 -BitMajorityOutput b1,b2 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] )
proof end;

theorem Th9: :: FACIRC_2:9
for b1, b2 being FinSequence
for b3 being set st b3 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] holds
( 1 -BitAdderStr b1,b2 = (1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE )) +* (BitAdderWithOverflowStr (b1 . 1),(b2 . 1),b3) & 1 -BitAdderCirc b1,b2 = (1GateCircuit <*> ,((0 -tuples_on BOOLEAN ) --> FALSE )) +* (BitAdderWithOverflowCirc (b1 . 1),(b2 . 1),b3) & 1 -BitMajorityOutput b1,b2 = MajorityOutput (b1 . 1),(b2 . 1),b3 )
proof end;

theorem Th10: :: FACIRC_2:10
for b1, b2, b3 being set st b3 = [<*> ,((0 -tuples_on BOOLEAN ) --> FALSE )] holds
( 1 -BitAdderStr <*b1*>,<*b2*> = (1GateCircStr <*> ,((0 -tuples_on BOOLEAN ) --> FALSE )) +* (BitAdderWithOverflowStr b1,b2,b3) & 1 -BitAdderCirc <*b1*>,<*b2*> = (1GateCircuit <*> ,((0 -tuples_on BOOLEAN ) --> FALSE )) +* (BitAdderWithOverflowCirc b1,b2,b3) & 1 -BitMajorityOutput <*b1*>,<*b2*> = MajorityOutput b1,b2,b3 )
proof end;

theorem Th11: :: FACIRC_2:11
for b1 being Nat
for b2, b3 being FinSeqLen of b1
for b4, b5, b6, b7 being FinSequence holds
( b1 -BitAdderStr (b2 ^ b4),(b3 ^ b6) = b1 -BitAdderStr (b2 ^ b5),(b3 ^ b7) & b1 -BitAdderCirc (b2 ^ b4),(b3 ^ b6) = b1 -BitAdderCirc (b2 ^ b5),(b3 ^ b7) & b1 -BitMajorityOutput (b2 ^ b4),(b3 ^ b6) = b1 -BitMajorityOutput (b2 ^ b5),(b3 ^ b7) )
proof end;

theorem Th12: :: FACIRC_2:12
for b1 being Nat
for b2, b3 being FinSeqLen of b1
for b4, b5 being set holds
( (b1 + 1) -BitAdderStr (b2 ^ <*b4*>),(b3 ^ <*b5*>) = (b1 -BitAdderStr b2,b3) +* (BitAdderWithOverflowStr b4,b5,(b1 -BitMajorityOutput b2,b3)) & (b1 + 1) -BitAdderCirc (b2 ^ <*b4*>),(b3 ^ <*b5*>) = (b1 -BitAdderCirc b2,b3) +* (BitAdderWithOverflowCirc b4,b5,(b1 -BitMajorityOutput b2,b3)) & (b1 + 1) -BitMajorityOutput (b2 ^ <*b4*>),(b3 ^ <*b5*>) = MajorityOutput b4,b5,(b1 -BitMajorityOutput b2,b3) )
proof end;

theorem Th13: :: FACIRC_2:13
for b1 being Nat
for b2, b3 being FinSequence holds
( (b1 + 1) -BitAdderStr b2,b3 = (b1 -BitAdderStr b2,b3) +* (BitAdderWithOverflowStr (b2 . (b1 + 1)),(b3 . (b1 + 1)),(b1 -BitMajorityOutput b2,b3)) & (b1 + 1) -BitAdderCirc b2,b3 = (b1 -BitAdderCirc b2,b3) +* (BitAdderWithOverflowCirc (b2 . (b1 + 1)),(b3 . (b1 + 1)),(b1 -BitMajorityOutput b2,b3)) & (b1 + 1) -BitMajorityOutput b2,b3 = MajorityOutput (b2 . (b1 + 1)),(b3 . (b1 + 1)),(b1 -BitMajorityOutput b2,b3) )
proof end;

theorem Th14: :: FACIRC_2:14
for b1, b2 being Nat st b1 <= b2 holds
for b3, b4 being FinSequence holds InnerVertices (b1 -BitAdderStr b3,b4) c= InnerVertices (b2 -BitAdderStr b3,b4)
proof end;

theorem Th15: :: FACIRC_2:15
for b1 being Nat
for b2, b3 being FinSequence holds InnerVertices ((b1 + 1) -BitAdderStr b2,b3) = (InnerVertices (b1 -BitAdderStr b2,b3)) \/ (InnerVertices (BitAdderWithOverflowStr (b2 . (b1 + 1)),(b3 . (b1 + 1)),(b1 -BitMajorityOutput b2,b3)))
proof end;

definition
let c1, c2 be Nat;
assume E13: ( c1 >= 1 & c1 <= c2 ) ;
let c3, c4 be FinSequence;
func c1,c2 -BitAdderOutput c3,c4 -> Element of InnerVertices (a2 -BitAdderStr a3,a4) means :Def6: :: FACIRC_2:def 6
ex b1 being Nat st
( a1 = b1 + 1 & a5 = BitAdderOutput (a3 . a1),(a4 . a1),(b1 -BitMajorityOutput a3,a4) );
uniqueness
for b1, b2 being Element of InnerVertices (c2 -BitAdderStr c3,c4) st ex b3 being Nat st
( c1 = b3 + 1 & b1 = BitAdderOutput (c3 . c1),(c4 . c1),(b3 -BitMajorityOutput c3,c4) ) & ex b3 being Nat st
( c1 = b3 + 1 & b2 = BitAdderOutput (c3 . c1),(c4 . c1),(b3 -BitMajorityOutput c3,c4) ) holds
b1 = b2
;
existence
ex b1 being Element of InnerVertices (c2 -BitAdderStr c3,c4)ex b2 being Nat st
( c1 = b2 + 1 & b1 = BitAdderOutput (c3 . c1),(c4 . c1),(b2 -BitMajorityOutput c3,c4) )
proof end;
end;

:: deftheorem Def6 defines -BitAdderOutput FACIRC_2:def 6 :
for b1, b2 being Nat st b1 >= 1 & b1 <= b2 holds
for b3, b4 being FinSequence
for b5 being Element of InnerVertices (b2 -BitAdderStr b3,b4) holds
( b5 = b1,b2 -BitAdderOutput b3,b4 iff ex b6 being Nat st
( b1 = b6 + 1 & b5 = BitAdderOutput (b3 . b1),(b4 . b1),(b6 -BitMajorityOutput b3,b4) ) );

theorem Th16: :: FACIRC_2:16
for b1, b2 being Nat st b2 < b1 holds
for b3, b4 being FinSequence holds (b2 + 1),b1 -BitAdderOutput b3,b4 = BitAdderOutput (b3 . (b2 + 1)),(b4 . (b2 + 1)),(b2 -BitMajorityOutput b3,b4)
proof end;

E14: now
let c1 be Nat;
let c2 be FinSeqLen of c1 + 1;
c1 >= 0 by NAT_1:18;
then E15: ( c1 + 1 <> 0 & len c2 = c1 + 1 ) by CIRCCOMB:def 12, NAT_1:38;
then c2 <> <*> by FINSEQ_1:25;
then consider c3 being FinSequence, c4 being set such that
E16: c2 = c3 ^ <*c4*> by FINSEQ_1:63;
len <*c4*> = 1 by FINSEQ_1:57;
then c1 + 1 = (len c3) + 1 by E15, E16, FINSEQ_1:35;
then len c3 = c1 ;
then reconsider c5 = c3 as FinSeqLen of c1 by CIRCCOMB:def 12;
take c6 = c5;
take c7 = c4;
thus c2 = c6 ^ <*c7*> by E16;
end;

E15: now
let c1 be Nat;
let c2 be nonpair-yielding FinSeqLen of c1 + 1;
consider c3 being FinSeqLen of c1, c4 being set such that
E16: c2 = c3 ^ <*c4*> by Lemma14;
E17: ( dom c3 c= dom c2 & c3 = c2 | (dom c3) ) by E16, FINSEQ_1:33, FINSEQ_1:39;
c3 is nonpair-yielding
proof
let c5 be set ; :: according to FACIRC_1:def 3
assume c5 in dom c3 ;
then ( c5 in dom c2 & c3 . c5 = c2 . c5 ) by E17, FUNCT_1:70;
hence not c3 . c5 is pair by FACIRC_1:def 3;
end;
then reconsider c5 = c3 as nonpair-yielding FinSeqLen of c1 ;
( c1 + 1 in Seg (c1 + 1) & dom c2 = Seg (len c2) ) by FINSEQ_1:6, FINSEQ_1:def 3;
then ( c1 + 1 in dom c2 & c2 . ((len c5) + 1) = c4 & len c5 = c1 ) by E16, CIRCCOMB:def 12, FINSEQ_1:59;
then reconsider c6 = c4 as non pair set by FACIRC_1:def 3;
take c7 = c5;
take c8 = c6;
thus c2 = c7 ^ <*c8*> by E16;
end;

theorem Th17: :: FACIRC_2:17
for b1 being Nat
for b2, b3 being FinSequence holds InnerVertices (b1 -BitAdderStr b2,b3) is Relation
proof end;

theorem Th18: :: FACIRC_2:18
for b1, b2, b3 being set holds InnerVertices (MajorityIStr b1,b2,b3) = {[<*b1,b2*>,'&' ],[<*b2,b3*>,'&' ],[<*b3,b1*>,'&' ]}
proof end;

theorem Th19: :: FACIRC_2:19
for b1, b2, b3 being set st b1 <> [<*b2,b3*>,'&' ] & b2 <> [<*b3,b1*>,'&' ] & b3 <> [<*b1,b2*>,'&' ] holds
InputVertices (MajorityIStr b1,b2,b3) = {b1,b2,b3}
proof end;

theorem Th20: :: FACIRC_2:20
for b1, b2, b3 being set holds InnerVertices (MajorityStr b1,b2,b3) = {[<*b1,b2*>,'&' ],[<*b2,b3*>,'&' ],[<*b3,b1*>,'&' ]} \/ {(MajorityOutput b1,b2,b3)}
proof end;

theorem Th21: :: FACIRC_2:21
for b1, b2, b3 being set st b1 <> [<*b2,b3*>,'&' ] & b2 <> [<*b3,b1*>,'&' ] & b3 <> [<*b1,b2*>,'&' ] holds
InputVertices (MajorityStr b1,b2,b3) = {b1,b2,b3}
proof end;

theorem Th22: :: FACIRC_2:22
for b1, b2 being non empty ManySortedSign st b1 tolerates b2 & InputVertices b1 = InputVertices b2 holds
InputVertices (b1 +* b2) = InputVertices b1
proof end;

theorem Th23: :: FACIRC_2:23
for b1, b2, b3 being set st b1 <> [<*b2,b3*>,'&' ] & b2 <> [<*b3,b1*>,'&' ] & b3 <> [<*b1,b2*>,'&' ] & b3 <> [<*b1,b2*>,'xor' ] holds
InputVertices (BitAdderWithOverflowStr b1,b2,b3) = {b1,b2,b3}
proof end;

theorem Th24: :: FACIRC_2:24
for b1, b2, b3 being set holds InnerVertices (BitAdderWithOverflowStr b1,b2,b3) = ({[<*b1,b2*>,'xor' ],(2GatesCircOutput b1,b2,b3,'xor' )} \/ {[<*b1,b2*>,'&' ],[<*b2,b3*>,'&' ],[<*b3,b1*>,'&' ]}) \/ {(MajorityOutput b1,b2,b3)}
proof end;

registration
cluster empty -> non pair set ;
coherence
for b1 being set st b1 is empty holds
not b1 is pair
proof end;
end;

registration
cluster <*> -> non pair nonpair-yielding ;
coherence
{} is nonpair-yielding
proof end;
let c1 be nonpair-yielding Function;
let c2 be set ;
cluster a1 . a2 -> non pair ;
coherence
not c1 . c2 is pair
proof end;
end;

registration
let c1 be Nat;
let c2, c3 be FinSequence;
cluster a1 -BitMajorityOutput a2,a3 -> pair ;
coherence
c1 -BitMajorityOutput c2,c3 is pair
proof end;
end;

theorem Th25: :: FACIRC_2:25
for b1, b2 being FinSequence
for b3 being Nat holds
( ( (b3 -BitMajorityOutput b1,b2) `1 = <*> & (b3 -BitMajorityOutput b1,b2) `2 = (0 -tuples_on BOOLEAN ) --> FALSE & proj1 ((b3 -BitMajorityOutput b1,b2) `2 ) = 0 -tuples_on BOOLEAN ) or ( Card ((b3 -BitMajorityOutput b1,b2) `1 ) = 3 & (b3 -BitMajorityOutput b1,b2) `2 = or3 & proj1 ((b3 -BitMajorityOutput b1,b2) `2 ) = 3 -tuples_on BOOLEAN ) )
proof end;

theorem Th26: :: FACIRC_2:26
for b1 being Nat
for b2, b3 being FinSequence
for b4 being set holds
( b1 -BitMajorityOutput b2,b3 <> [b4,'&' ] & b1 -BitMajorityOutput b2,b3 <> [b4,'xor' ] )
proof end;

theorem Th27: :: FACIRC_2:27
for b1, b2 being nonpair-yielding FinSequence
for b3 being Nat holds
( InputVertices ((b3 + 1) -BitAdderStr b1,b2) = (InputVertices (b3 -BitAdderStr b1,b2)) \/ ((InputVertices (BitAdderWithOverflowStr (b1 . (b3 + 1)),(b2 . (b3 + 1)),(b3 -BitMajorityOutput b1,b2))) \ {(b3 -BitMajorityOutput b1,b2)}) & InnerVertices (b3 -BitAdderStr b1,b2) is Relation & not InputVertices (b3 -BitAdderStr b1,b2) is with_pair )
proof end;

theorem Th28: :: FACIRC_2:28
for b1 being Nat
for b2, b3 being nonpair-yielding FinSeqLen of b1 holds InputVertices (b1 -BitAdderStr b2,b3) = (rng b2) \/ (rng b3)
proof end;

Lemma26: for b1, b2, b3 being set
for b4 being State of (MajorityCirc b1,b2,b3)
for b5, b6, b7 being Element of BOOLEAN st b5 = b4 . b1 & b6 = b4 . b2 & b7 = b4 . b3 holds
( (Following b4) . [<*b1,b2*>,'&' ] = b5 '&' b6 & (Following b4) . [<*b2,b3*>,'&' ] = b6 '&' b7 & (Following b4) . [<*b3,b1*>,'&' ] = b7 '&' b5 )
proof end;

theorem Th29: :: FACIRC_2:29
for b1, b2, b3 being set
for b4 being State of (MajorityCirc b1,b2,b3)
for b5, b6, b7 being Element of BOOLEAN st b5 = b4 . [<*b1,b2*>,'&' ] & b6 = b4 . [<*b2,b3*>,'&' ] & b7 = b4 . [<*b3,b1*>,'&' ] holds
(Following b4) . (MajorityOutput b1,b2,b3) = (b5 'or' b6) 'or' b7
proof end;

Lemma28: for b1, b2, b3 being set st b1 <> [<*b2,b3*>,'&' ] & b2 <> [<*b3,b1*>,'&' ] & b3 <> [<*b1,b2*>,'&' ] holds
for b4 being State of (MajorityCirc 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) . (MajorityOutput b1,b2,b3) = ((b5 '&' b6) 'or' (b6 '&' b7)) 'or' (b7 '&' b5) & (Following b4,2) . [<*b1,b2*>,'&' ] = b5 '&' b6 & (Following b4,2) . [<*b2,b3*>,'&' ] = b6 '&' b7 & (Following b4,2) . [<*b3,b1*>,'&' ] = b7 '&' b5 )
proof end;

theorem Th30: :: FACIRC_2:30
for b1, b2, b3 being set st b1 <> [<*b2,b3*>,'&' ] & b2 <> [<*b3,b1*>,'&' ] & b3 <> [<*b1,b2*>,'&' ] & b3 <> [<*b1,b2*>,'xor' ] holds
for b4 being State of (MajorityCirc b1,b2,b3) holds Following b4,2 is stable
proof end;

theorem Th31: :: FACIRC_2:31
for b1, b2, b3 being set st b1 <> [<*b2,b3*>,'&' ] & b2 <> [<*b3,b1*>,'&' ] & b3 <> [<*b1,b2*>,'&' ] & b3 <> [<*b1,b2*>,'xor' ] holds
for b4 being State of (BitAdderWithOverflowCirc 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) . (BitAdderOutput b1,b2,b3) = (b5 'xor' b6) 'xor' b7 & (Following b4,2) . (MajorityOutput b1,b2,b3) = ((b5 '&' b6) 'or' (b6 '&' b7)) 'or' (b7 '&' b5) )
proof end;

theorem Th32: :: FACIRC_2:32
for b1, b2, b3 being set st b1 <> [<*b2,b3*>,'&' ] & b2 <> [<*b3,b1*>,'&' ] & b3 <> [<*b1,b2*>,'&' ] & b3 <> [<*b1,b2*>,'xor' ] holds
for b4 being State of (BitAdderWithOverflowCirc b1,b2,b3) holds Following b4,2 is stable
proof end;

Lemma31: for b1 being Nat ex b2 being Function of NAT , NAT st
( b2 . 0 = 1 & b2 . 1 = 2 & b2 . 2 = b1 )
proof end;

theorem Th33: :: FACIRC_2:33
for b1 being Nat
for b2, b3 being nonpair-yielding FinSeqLen of b1
for b4 being State of (b1 -BitAdderCirc b2,b3) holds Following b4,(1 + (2 * b1)) is stable
proof end;

theorem Th34: :: FACIRC_2:34
for b1 being Nat
for b2 being FinSeqLen of b1 + 1 ex b3 being FinSeqLen of b1ex b4 being set st b2 = b3 ^ <*b4*> by Lemma14;

theorem Th35: :: FACIRC_2:35
canceled;

theorem Th36: :: FACIRC_2:36
for b1 being Nat
for b2 being nonpair-yielding FinSeqLen of b1 + 1 ex b3 being nonpair-yielding FinSeqLen of b1ex b4 being non pair set st b2 = b3 ^ <*b4*> by Lemma15;

theorem Th37: :: FACIRC_2:37
for b1 being Nat ex b2 being Function of NAT , NAT st
( b2 . 0 = 1 & b2 . 1 = 2 & b2 . 2 = b1 ) by Lemma31;