definition
let n be
Nat;
let x,
y be
FinSequence;
deffunc H1(
set ,
Nat)
-> Element of
InnerVertices (BorrowStr ((x . ($2 + 1)),(y . ($2 + 1)),$1)) =
BorrowOutput (
(x . ($2 + 1)),
(y . ($2 + 1)),$1);
deffunc H2( non
empty ManySortedSign ,
set ,
Nat)
-> ManySortedSign = $1
+* (BitSubtracterWithBorrowStr ((x . ($3 + 1)),(y . ($3 + 1)),$2));
A1:
(
1GateCircStr (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) is
unsplit &
1GateCircStr (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) is
gate`1=arity &
1GateCircStr (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) is
gate`2isBoolean & not
1GateCircStr (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) is
void & not
1GateCircStr (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) is
empty &
1GateCircStr (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) is
strict )
;
uniqueness
for b1, b2 being non empty non void strict unsplit gate`1=arity gate`2isBoolean ManySortedSign st ex f, g being ManySortedSet of NAT st
( b1 = f . n & f . 0 = 1GateCircStr (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & g . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat
for S being non empty ManySortedSign
for z being set st S = f . n & z = g . n holds
( f . (n + 1) = S +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),z)) & g . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),z) ) ) ) & ex f, g being ManySortedSet of NAT st
( b2 = f . n & f . 0 = 1GateCircStr (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & g . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat
for S being non empty ManySortedSign
for z being set st S = f . n & z = g . n holds
( f . (n + 1) = S +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),z)) & g . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),z) ) ) ) holds
b1 = b2
existence
ex b1 being non empty non void strict unsplit gate`1=arity gate`2isBoolean ManySortedSign ex f, g being ManySortedSet of NAT st
( b1 = f . n & f . 0 = 1GateCircStr (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & g . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat
for S being non empty ManySortedSign
for z being set st S = f . n & z = g . n holds
( f . (n + 1) = S +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),z)) & g . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),z) ) ) )
end;
definition
let n be
Nat;
let x,
y be
FinSequence;
func n -BitSubtracterCirc (
x,
y)
-> strict gate`2=den Boolean Circuit of
n -BitSubtracterStr (
x,
y)
means :
Def2:
ex
f,
g,
h being
ManySortedSet of
NAT st
(
n -BitSubtracterStr (
x,
y)
= f . n &
it = g . n &
f . 0 = 1GateCircStr (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) &
g . 0 = 1GateCircuit (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) &
h . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for
n being
Nat for
S being non
empty ManySortedSign for
A being
non-empty MSAlgebra over
S for
z being
set st
S = f . n &
A = g . n &
z = h . n holds
(
f . (n + 1) = S +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),z)) &
g . (n + 1) = A +* (BitSubtracterWithBorrowCirc ((x . (n + 1)),(y . (n + 1)),z)) &
h . (n + 1) = BorrowOutput (
(x . (n + 1)),
(y . (n + 1)),
z) ) ) );
uniqueness
for b1, b2 being strict gate`2=den Boolean Circuit of n -BitSubtracterStr (x,y) st ex f, g, h being ManySortedSet of NAT st
( n -BitSubtracterStr (x,y) = f . n & b1 = g . n & f . 0 = 1GateCircStr (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & g . 0 = 1GateCircuit (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & h . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat
for S being non empty ManySortedSign
for A being non-empty MSAlgebra over S
for z being set st S = f . n & A = g . n & z = h . n holds
( f . (n + 1) = S +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),z)) & g . (n + 1) = A +* (BitSubtracterWithBorrowCirc ((x . (n + 1)),(y . (n + 1)),z)) & h . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),z) ) ) ) & ex f, g, h being ManySortedSet of NAT st
( n -BitSubtracterStr (x,y) = f . n & b2 = g . n & f . 0 = 1GateCircStr (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & g . 0 = 1GateCircuit (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & h . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat
for S being non empty ManySortedSign
for A being non-empty MSAlgebra over S
for z being set st S = f . n & A = g . n & z = h . n holds
( f . (n + 1) = S +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),z)) & g . (n + 1) = A +* (BitSubtracterWithBorrowCirc ((x . (n + 1)),(y . (n + 1)),z)) & h . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),z) ) ) ) holds
b1 = b2
existence
ex b1 being strict gate`2=den Boolean Circuit of n -BitSubtracterStr (x,y) ex f, g, h being ManySortedSet of NAT st
( n -BitSubtracterStr (x,y) = f . n & b1 = g . n & f . 0 = 1GateCircStr (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & g . 0 = 1GateCircuit (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & h . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat
for S being non empty ManySortedSign
for A being non-empty MSAlgebra over S
for z being set st S = f . n & A = g . n & z = h . n holds
( f . (n + 1) = S +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),z)) & g . (n + 1) = A +* (BitSubtracterWithBorrowCirc ((x . (n + 1)),(y . (n + 1)),z)) & h . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),z) ) ) )
end;
::
deftheorem Def2 defines
-BitSubtracterCirc FSCIRC_2:def 2 :
for n being Nat
for x, y being FinSequence
for b4 being strict gate`2=den Boolean Circuit of n -BitSubtracterStr (x,y) holds
( b4 = n -BitSubtracterCirc (x,y) iff ex f, g, h being ManySortedSet of NAT st
( n -BitSubtracterStr (x,y) = f . n & b4 = g . n & f . 0 = 1GateCircStr (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & g . 0 = 1GateCircuit (<*>,((0 -tuples_on BOOLEAN) --> TRUE)) & h . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat
for S being non empty ManySortedSign
for A being non-empty MSAlgebra over S
for z being set st S = f . n & A = g . n & z = h . n holds
( f . (n + 1) = S +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),z)) & g . (n + 1) = A +* (BitSubtracterWithBorrowCirc ((x . (n + 1)),(y . (n + 1)),z)) & h . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),z) ) ) ) );
definition
let n be
Nat;
let x,
y be
FinSequence;
set c =
[<*>,((0 -tuples_on BOOLEAN) --> TRUE)];
uniqueness
for b1, b2 being Element of InnerVertices (n -BitSubtracterStr (x,y)) st ex h being ManySortedSet of NAT st
( b1 = h . n & h . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat holds h . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),(h . n)) ) ) & ex h being ManySortedSet of NAT st
( b2 = h . n & h . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat holds h . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),(h . n)) ) ) holds
b1 = b2
existence
ex b1 being Element of InnerVertices (n -BitSubtracterStr (x,y)) ex h being ManySortedSet of NAT st
( b1 = h . n & h . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for n being Nat holds h . (n + 1) = BorrowOutput ((x . (n + 1)),(y . (n + 1)),(h . n)) ) )
end;
theorem Th1:
for
x,
y being
FinSequence for
f,
g,
h being
ManySortedSet of
NAT st
f . 0 = 1GateCircStr (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) &
g . 0 = 1GateCircuit (
<*>,
((0 -tuples_on BOOLEAN) --> TRUE)) &
h . 0 = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] & ( for
n being
Nat for
S being non
empty ManySortedSign for
A being
non-empty MSAlgebra over
S for
z being
set st
S = f . n &
A = g . n &
z = h . n holds
(
f . (n + 1) = S +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),z)) &
g . (n + 1) = A +* (BitSubtracterWithBorrowCirc ((x . (n + 1)),(y . (n + 1)),z)) &
h . (n + 1) = BorrowOutput (
(x . (n + 1)),
(y . (n + 1)),
z) ) ) holds
for
n being
Nat holds
(
n -BitSubtracterStr (
x,
y)
= f . n &
n -BitSubtracterCirc (
x,
y)
= g . n &
n -BitBorrowOutput (
x,
y)
= h . n )
theorem Th3:
for
a,
b being
FinSequence for
c being
set st
c = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] holds
( 1
-BitSubtracterStr (
a,
b)
= (1GateCircStr (<*>,((0 -tuples_on BOOLEAN) --> TRUE))) +* (BitSubtracterWithBorrowStr ((a . 1),(b . 1),c)) & 1
-BitSubtracterCirc (
a,
b)
= (1GateCircuit (<*>,((0 -tuples_on BOOLEAN) --> TRUE))) +* (BitSubtracterWithBorrowCirc ((a . 1),(b . 1),c)) & 1
-BitBorrowOutput (
a,
b)
= BorrowOutput (
(a . 1),
(b . 1),
c) )
theorem
for
a,
b,
c being
set st
c = [<*>,((0 -tuples_on BOOLEAN) --> TRUE)] holds
( 1
-BitSubtracterStr (
<*a*>,
<*b*>)
= (1GateCircStr (<*>,((0 -tuples_on BOOLEAN) --> TRUE))) +* (BitSubtracterWithBorrowStr (a,b,c)) & 1
-BitSubtracterCirc (
<*a*>,
<*b*>)
= (1GateCircuit (<*>,((0 -tuples_on BOOLEAN) --> TRUE))) +* (BitSubtracterWithBorrowCirc (a,b,c)) & 1
-BitBorrowOutput (
<*a*>,
<*b*>)
= BorrowOutput (
a,
b,
c) )
theorem Th5:
for
n being
Nat for
p,
q being
FinSeqLen of
n for
p1,
p2,
q1,
q2 being
FinSequence holds
(
n -BitSubtracterStr (
(p ^ p1),
(q ^ q1))
= n -BitSubtracterStr (
(p ^ p2),
(q ^ q2)) &
n -BitSubtracterCirc (
(p ^ p1),
(q ^ q1))
= n -BitSubtracterCirc (
(p ^ p2),
(q ^ q2)) &
n -BitBorrowOutput (
(p ^ p1),
(q ^ q1))
= n -BitBorrowOutput (
(p ^ p2),
(q ^ q2)) )
theorem
for
n being
Element of
NAT for
x,
y being
FinSeqLen of
n for
a,
b being
set holds
(
(n + 1) -BitSubtracterStr (
(x ^ <*a*>),
(y ^ <*b*>))
= (n -BitSubtracterStr (x,y)) +* (BitSubtracterWithBorrowStr (a,b,(n -BitBorrowOutput (x,y)))) &
(n + 1) -BitSubtracterCirc (
(x ^ <*a*>),
(y ^ <*b*>))
= (n -BitSubtracterCirc (x,y)) +* (BitSubtracterWithBorrowCirc (a,b,(n -BitBorrowOutput (x,y)))) &
(n + 1) -BitBorrowOutput (
(x ^ <*a*>),
(y ^ <*b*>))
= BorrowOutput (
a,
b,
(n -BitBorrowOutput (x,y))) )
theorem Th7:
for
n being
Nat for
x,
y being
FinSequence holds
(
(n + 1) -BitSubtracterStr (
x,
y)
= (n -BitSubtracterStr (x,y)) +* (BitSubtracterWithBorrowStr ((x . (n + 1)),(y . (n + 1)),(n -BitBorrowOutput (x,y)))) &
(n + 1) -BitSubtracterCirc (
x,
y)
= (n -BitSubtracterCirc (x,y)) +* (BitSubtracterWithBorrowCirc ((x . (n + 1)),(y . (n + 1)),(n -BitBorrowOutput (x,y)))) &
(n + 1) -BitBorrowOutput (
x,
y)
= BorrowOutput (
(x . (n + 1)),
(y . (n + 1)),
(n -BitBorrowOutput (x,y))) )
definition
let k,
n be
Nat;
assume that A1:
k >= 1
and A2:
k <= n
;
let x,
y be
FinSequence;
uniqueness
for b1, b2 being Element of InnerVertices (n -BitSubtracterStr (x,y)) st ex i being Element of NAT st
( k = i + 1 & b1 = BitSubtracterOutput ((x . k),(y . k),(i -BitBorrowOutput (x,y))) ) & ex i being Element of NAT st
( k = i + 1 & b2 = BitSubtracterOutput ((x . k),(y . k),(i -BitBorrowOutput (x,y))) ) holds
b1 = b2
;
existence
ex b1 being Element of InnerVertices (n -BitSubtracterStr (x,y)) ex i being Element of NAT st
( k = i + 1 & b1 = BitSubtracterOutput ((x . k),(y . k),(i -BitBorrowOutput (x,y))) )
end;
theorem Th12:
for
x,
y,
c being
set holds
InnerVertices (BorrowIStr (x,y,c)) = {[<*x,y*>,and2a],[<*y,c*>,and2],[<*x,c*>,and2a]}
theorem Th13:
for
x,
y,
c being
set st
x <> [<*y,c*>,and2] &
y <> [<*x,c*>,and2a] &
c <> [<*x,y*>,and2a] holds
InputVertices (BorrowIStr (x,y,c)) = {x,y,c}
theorem Th14:
for
x,
y,
c being
set holds
InnerVertices (BorrowStr (x,y,c)) = {[<*x,y*>,and2a],[<*y,c*>,and2],[<*x,c*>,and2a]} \/ {(BorrowOutput (x,y,c))}
theorem Th15:
for
x,
y,
c being
set st
x <> [<*y,c*>,and2] &
y <> [<*x,c*>,and2a] &
c <> [<*x,y*>,and2a] holds
InputVertices (BorrowStr (x,y,c)) = {x,y,c}
theorem Th16:
for
x,
y,
c being
set st
x <> [<*y,c*>,and2] &
y <> [<*x,c*>,and2a] &
c <> [<*x,y*>,and2a] &
c <> [<*x,y*>,'xor'] holds
InputVertices (BitSubtracterWithBorrowStr (x,y,c)) = {x,y,c}
theorem Th17:
for
x,
y,
c being
set holds
InnerVertices (BitSubtracterWithBorrowStr (x,y,c)) = ({[<*x,y*>,'xor'],(2GatesCircOutput (x,y,c,'xor'))} \/ {[<*x,y*>,and2a],[<*y,c*>,and2],[<*x,c*>,and2a]}) \/ {(BorrowOutput (x,y,c))}
Lm1:
for x, y, c being set
for s being State of (BorrowCirc (x,y,c))
for a1, a2, a3 being Element of BOOLEAN st a1 = s . x & a2 = s . y & a3 = s . c holds
( (Following s) . [<*x,y*>,and2a] = ('not' a1) '&' a2 & (Following s) . [<*y,c*>,and2] = a2 '&' a3 & (Following s) . [<*x,c*>,and2a] = ('not' a1) '&' a3 )
theorem Th22:
for
x,
y,
c being
set for
s being
State of
(BorrowCirc (x,y,c)) for
a1,
a2,
a3 being
Element of
BOOLEAN st
a1 = s . [<*x,y*>,and2a] &
a2 = s . [<*y,c*>,and2] &
a3 = s . [<*x,c*>,and2a] holds
(Following s) . (BorrowOutput (x,y,c)) = (a1 'or' a2) 'or' a3
Lm2:
for x, y, c being set st x <> [<*y,c*>,and2] & y <> [<*x,c*>,and2a] & c <> [<*x,y*>,and2a] holds
for s being State of (BorrowCirc (x,y,c))
for a1, a2, a3 being Element of BOOLEAN st a1 = s . x & a2 = s . y & a3 = s . c holds
( (Following (s,2)) . (BorrowOutput (x,y,c)) = ((('not' a1) '&' a2) 'or' (a2 '&' a3)) 'or' (('not' a1) '&' a3) & (Following (s,2)) . [<*x,y*>,and2a] = ('not' a1) '&' a2 & (Following (s,2)) . [<*y,c*>,and2] = a2 '&' a3 & (Following (s,2)) . [<*x,c*>,and2a] = ('not' a1) '&' a3 )
theorem Th23:
for
x,
y,
c being
set st
x <> [<*y,c*>,and2] &
y <> [<*x,c*>,and2a] &
c <> [<*x,y*>,and2a] holds
for
s being
State of
(BorrowCirc (x,y,c)) holds
Following (
s,2) is
stable
theorem
for
x,
y,
c being
set st
x <> [<*y,c*>,and2] &
y <> [<*x,c*>,and2a] &
c <> [<*x,y*>,and2a] &
c <> [<*x,y*>,'xor'] holds
for
s being
State of
(BitSubtracterWithBorrowCirc (x,y,c)) for
a1,
a2,
a3 being
Element of
BOOLEAN st
a1 = s . x &
a2 = s . y &
a3 = s . c holds
(
(Following (s,2)) . (BitSubtracterOutput (x,y,c)) = (a1 'xor' a2) 'xor' a3 &
(Following (s,2)) . (BorrowOutput (x,y,c)) = ((('not' a1) '&' a2) 'or' (a2 '&' a3)) 'or' (('not' a1) '&' a3) )
theorem Th25:
for
x,
y,
c being
set st
x <> [<*y,c*>,and2] &
y <> [<*x,c*>,and2a] &
c <> [<*x,y*>,and2a] &
c <> [<*x,y*>,'xor'] holds
for
s being
State of
(BitSubtracterWithBorrowCirc (x,y,c)) holds
Following (
s,2) is
stable
:: Definitions of n-Bit Full Subtracter Structure and Circuit
::------------------------------------------------------------