:: Stability of Parallel 4-2 Compressor Circuits
:: by Katsumi Wasaki
::
:: Received November 5, 2026
:: Copyright (c) 2026 Association of Mizar Users
:: (Stowarzyszenie Uzytkownikow Mizara, Bialystok, Poland).
:: This code can be distributed under the GNU General Public Licence
:: version 3.0 or later, or the Creative Commons Attribution-ShareAlike
:: License version 4.0 or later, subject to the binding interpretation
:: detailed in file COPYING.interpretation.
:: See COPYING.GPL and COPYING.CC-BY-SA for the full text of these
:: licenses, or see http://www.gnu.org/licenses/gpl.html and
:: http://creativecommons.org/licenses/by-sa/4.0/.
environ
vocabularies NUMBERS, NAT_1, FINSEQ_1, CIRCCOMB, CARD_1, FINSEQ_2, MARGREL1,
FUNCOP_1, XBOOLEAN, STRUCT_0, XBOOLE_0, MSUALG_1, PBOOLE, FUNCT_1,
ARYTM_3, FUNCT_4, GFACIRC1, LATTICES, CIRCUIT1, RELAT_1, SUBSET_1,
MSAFREE2, XXREAL_0, FACIRC_1, TWOSCOMP, FSM_1, CIRCUIT2, FTACELL1,
FTACELL2, PARTFUN1;
notations TARSKI, XBOOLE_0, ENUMSET1, XTUPLE_0, SUBSET_1, XCMPLX_0, RELAT_1,
CARD_1, STRUCT_0, FUNCT_1, FUNCT_2, FINSEQ_1, FUNCOP_1, FINSEQ_2, PBOOLE,
FUNCT_4, CARD_3, FUNCT_7, ORDINAL1, NAT_1, MARGREL1, MSUALG_1, MSAFREE2,
CIRCUIT1, CIRCUIT2, CIRCCOMB, FACIRC_1, TWOSCOMP, FACIRC_2, GFACIRC1,
FTACELL1, PARTFUN1, NUMBERS, XXREAL_0;
constructors ENUMSET1, CIRCCOMB, CIRCUIT1, CIRCUIT2, FACIRC_1, TWOSCOMP,
GFACIRC1, FTACELL1, PARTFUN1, FUNCT_4, CARD_3, XREAL_0, RELSET_1,
XTUPLE_0, XCMPLX_0, XXREAL_0, NAT_1, NUMBERS, FUNCT_7, XFAMILY, FUNCT_1,
BINARITH;
registrations XBOOLE_0, RELAT_1, FUNCT_1, ORDINAL1, XREAL_0, NAT_1, FINSEQ_1,
MARGREL1, STRUCT_0, CIRCCOMB, FACIRC_1, CIRCCMB2, FACIRC_2, MSAFREE2,
FINSET_1, CARD_1, XTUPLE_0, CARD_3;
requirements NUMERALS, REAL, BOOLE, SUBSET, ARITHM;
begin :: 1. Stability of a Parallel 4-2 Compressor Circuit (TYPE-0)
::------------------------------------------------
:: Component Symbol & Architecture
::
:: Each column of the parallel 4-2 compressor is realized by two GFA stages,
:: where the lateral carry-out $z_{k+1}$ is produced solely by stage 1 and
:: is independent of stage 2. This crucial topological feature prevents carry
:: rippling through the second stage and bounds the settling delay to a
:: constant $T = 4$.
::
:: k-th Column 4-2 Compressor Cell (BitFTA)
::
:: a_k b_k c_k d_k
:: | | | |
:: +--*-------*-------*--+ |
:: | Stage-1 GFA (0/1) | |
:: +--*---------------*--+ |
:: | | |
:: | s1_k | c1_k |
:: | +-------------> z_{k+1} (lateral carry-out)
:: | |
:: v v
:: +--*---------------*-----------------*--+
:: | Stage-2 GFA (0/2) <------------- z_k (lateral carry-in)
:: +--*---------------*--------------------+
:: | |
:: v v
:: Sum_k Carry_k
::
:: Composition : n-bit Cascade composed with +* over a FALSE-constant base
:: gate S0
::
::------------------------------------------------
:: Wavefront Decomposition
::
:: Column k-1 Column k Column k+1
:: a_k-1 b_k-1 c_k-1 a_k b_k c_k a_k+1 b_k+1 c_k+1
:: | | | | | | | | |
:: +-*-----*-----*-+ +-*-----*-----*-+ +-*-----*-----*-+
:: | Stage-1 GFA | | Stage-1 GFA | | Stage-1 GFA | Layer 1
:: +-----*----*----+ +-----*----*----+ +-----*----*----+ 2 steps
:: | | | | | |
:: s1 z_k s1 z_k+1 s1 z_k+2
::z_k-1 | '--------------. | '--------------. | '------>
:: | | d_k-1 | | d_k | | d_k+1
:: | | | | | | | | |
:: v v v v v v v v v
:: +-*---*----*----+ +-*---*----*----+ +-*---*----*----+
:: | Stage-2 GFA | | Stage-2 GFA | | Stage-2 GFA | Layer 2
:: +-----*----*----+ +-----*----*----+ +-----*----*----+ 2 steps
:: | | | | | |
:: v v v v v v
:: S_k-1 C_k-1 S_k C_k S_k+1 C_k+1
::
::------------------------------------------------
::------------------------------------------------
:: Definitions of n-depth FTA Structure and Circuit (TYPE-0)
::------------------------------------------------
:: Signature of the n-bit 4-2 compressor: a FALSE base gate followed by
:: n BitFTA0 stage cells composed with +*, each fed the running carry.
definition
let n
be Nat;
let ap,bp,cp,dp
be FinSequence;
func n-BitFTA0Str(ap,bp,cp,dp) ->
unsplit gate`
1=arity gate`
2isBoolean non void strict
non empty ManySortedSign means
:: FTACELL2:def 1
ex f,h
being ManySortedSet
of NAT st
it = f.n & f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for n
being Nat, S
being non empty ManySortedSign, z
be set
st S = f.n & z = h.n
holds
f.(n+
1) = S +* BitFTA0Str(ap.(n+
1), bp.(n+
1), cp.(n+
1), dp.(n+
1), z) &
h.(n+
1) = BitFTA0CarryOutput(ap.(n+
1), bp.(n+
1), cp.(n+
1), dp.(n+
1), z);
end;
:: Boolean circuit (MSAlgebra) realizing the n-bit compressor signature.
definition
let n
be Nat;
let ap,bp,cp,dp
be FinSequence;
func n-BitFTA0Circ(ap,bp,cp,dp) ->
Boolean gate`
2=den strict Circuit
of n-BitFTA0Str(ap,bp,cp,dp) means
:: FTACELL2:def 2
ex f,g,h
being ManySortedSet
of NAT st
n-BitFTA0Str(ap,bp,cp,dp) = f.n & it = g.n &
f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
g.
0 =
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for n
being Nat, S
being non empty ManySortedSign,
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 +* BitFTA0Str(ap.(n+
1), bp.(n+
1), cp.(n+
1), dp.(n+
1), z) &
g.(n+
1) = A +* BitFTA0Circ(ap.(n+
1), bp.(n+
1), cp.(n+
1), dp.(n+
1), z) &
h.(n+
1) = BitFTA0CarryOutput(ap.(n+
1), bp.(n+
1), cp.(n+
1), dp.(n+
1), z);
end;
:: Carry-out signal vertex after n stages (head of the carry stream).
definition
let n
be Nat;
let ap,bp,cp,dp
be FinSequence;
func n-BitFTA0CarryOutput(ap,bp,cp,dp) ->
Element
of InnerVertices (n-BitFTA0Str(ap,bp,cp,dp)) means
:: FTACELL2:def 3
ex h
being ManySortedSet
of NAT st
it = h.n & h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for n
being Nat
holds
h.(n+
1) = BitFTA0CarryOutput(ap.(n+
1), bp.(n+
1), cp.(n+
1), dp.(n+
1), h.n);
end;
::-----------------------------------------------
:: Properties of n-depth FTA Structure and Circuit (TYPE-0)
::-----------------------------------------------
:: Characterization of the recursion: any (structure, circuit, carry)
:: streams satisfying the defining recurrence agree with
:: n-BitFTA0Str / n-BitFTA0Circ / n-BitFTA0CarryOutput at index n.
theorem :: FTACELL2:1
for ap,bp,cp,dp
being FinSequence, f,g,h
being ManySortedSet
of NAT st
f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
g.
0 =
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for n
being Nat, S
being non empty ManySortedSign,
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 +* BitFTA0Str(ap.(n+
1),bp.(n+
1),cp.(n+
1),dp.(n+
1), z) &
g.(n+
1) = A +* BitFTA0Circ(ap.(n+
1),bp.(n+
1),cp.(n+
1),dp.(n+
1), z) &
h.(n+
1) = BitFTA0CarryOutput(ap.(n+
1),bp.(n+
1),cp.(n+
1),dp.(n+
1), z)
for n
being Nat
holds
n-BitFTA0Str(ap,bp,cp,dp) = f.n & n-BitFTA0Circ(ap,bp,cp,dp) = g.n &
n-BitFTA0CarryOutput(ap,bp,cp,dp) = h.n;
:: Base case: the 0-bit structure, circuit and carry are all the FALSE
:: constant gate (resp. its algebra / output vertex).
theorem :: FTACELL2:2
for ap,bp,cp,dp
being FinSequence
holds
0-BitFTA0Str(ap,bp,cp,dp) =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
0-BitFTA0Circ(ap,bp,cp,dp)
=
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
0-BitFTA0CarryOutput(ap,bp,cp,dp) = [<*>, (
0-tuples_on BOOLEAN)-->FALSE];
:: One-step unfolding: the (n+1)-stage structure, circuit and carry are
:: the n-stage ones composed with one further BitFTA0 cell that is fed the
:: n-stage carry output.
theorem :: FTACELL2:3
for n
be Nat
for ap,bp,cp,dp
being FinSequence
holds
(n+
1)-BitFTA0Str(ap,bp,cp,dp) = n-BitFTA0Str(ap,bp,cp,dp) +*
BitFTA0Str(ap.(n+
1),bp.(n+
1),cp.(n+
1),dp.(n+
1),
n-BitFTA0CarryOutput(ap,bp,cp,dp)) &
(n+
1)-BitFTA0Circ(ap,bp,cp,dp) = n-BitFTA0Circ(ap,bp,cp,dp) +*
BitFTA0Circ(ap.(n+
1),bp.(n+
1),cp.(n+
1),dp.(n+
1),
n-BitFTA0CarryOutput(ap,bp,cp,dp)) &
(n+
1)-BitFTA0CarryOutput(ap,bp,cp,dp) =
BitFTA0CarryOutput(ap.(n+
1),bp.(n+
1),cp.(n+
1),dp.(n+
1),
n-BitFTA0CarryOutput(ap,bp,cp,dp));
:: The carry output remains stable from T=2 onward.
theorem :: FTACELL2:4 :: Th4
for ap,bp,cp
being non pair set
for dp,cin
being set
for s
being State
of BitFTA0Circ(ap,bp,cp,dp,cin)
for k
being Nat st k >=
2 holds
Following(s,k).BitFTA0CarryOutput(ap,bp,cp,dp,cin)
= Following(s,
2).BitFTA0CarryOutput(ap,bp,cp,dp,cin);
::--------------------------------
:: Wavefront Layer Decomposition (TYPE-0)
::--------------------------------
:: Layer 1 = parallel composition of all stage-1 GFAs (independent,
:: 2-step stable). Layer 2 = parallel composition of all stage-2 GFAs
:: (reads Layer-1 adder outputs + previous carry). Notes: the row is
:: C(n) = Layer1(n) +* Layer2(n), so CIRCCMB2:19 gives 2+2 = 4.
:: Wavefront Layer 1 Structure (n-depth) : stage-1 GFAs
definition
let n
be Nat;
let ap,bp,cp
be FinSequence;
func n-BitFTA0Layer1Str(ap,bp,cp) ->
unsplit gate`
1=arity gate`
2isBoolean non void strict
non empty ManySortedSign means
:: FTACELL2:def 4
ex f
being ManySortedSet
of NAT st
it = f.n & f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
for k
being Nat, S
being non empty ManySortedSign st S = f.k
holds f.(k+
1) = S +* BitGFA0Str(ap.(k+
1), bp.(k+
1), cp.(k+
1));
end;
:: Wavefront Layer 1 Circuit (n-depth) : stage-1 GFAs
definition
let n
be Nat;
let ap,bp,cp
be FinSequence;
func n-BitFTA0Layer1Circ(ap,bp,cp) ->
Boolean gate`
2=den strict Circuit
of n-BitFTA0Layer1Str(ap,bp,cp) means
:: FTACELL2:def 5
ex f,g
being ManySortedSet
of NAT st
n-BitFTA0Layer1Str(ap,bp,cp) = f.n & it = g.n &
f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
g.
0 =
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
for k
being Nat, S
being non empty ManySortedSign,
A
being non-empty MSAlgebra over S st S = f.k & A = g.k
holds
f.(k+
1) = S +* BitGFA0Str(ap.(k+
1), bp.(k+
1), cp.(k+
1)) &
g.(k+
1) = A +* BitGFA0Circ(ap.(k+
1), bp.(k+
1), cp.(k+
1));
end;
:: Wavefront Layer 2 Structure (n-depth) : stage-2 GFAs + carry stream
definition
let n
be Nat;
let ap,bp,cp,dp
be FinSequence;
func n-BitFTA0Layer2Str(ap,bp,cp,dp) ->
unsplit gate`
1=arity gate`
2isBoolean non void strict
non empty ManySortedSign means
:: FTACELL2:def 6
ex g,h
being ManySortedSet
of NAT st
it = g.n & g.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for k
being Nat, S
being non empty ManySortedSign, z
being set
st S = g.k & z = h.k
holds
g.(k+
1) = S +* BitGFA0Str(
GFA0AdderOutput(ap.(k+
1), bp.(k+
1), cp.(k+
1)), z, dp.(k+
1)) &
h.(k+
1) = GFA0CarryOutput(ap.(k+
1), bp.(k+
1), cp.(k+
1));
end;
:: Wavefront Layer 2 Circuit (n-depth) : stage-2 GFAs + carry stream
definition
let n
be Nat;
let ap,bp,cp,dp
be FinSequence;
func n-BitFTA0Layer2Circ(ap,bp,cp,dp) ->
Boolean gate`
2=den strict Circuit
of n-BitFTA0Layer2Str(ap,bp,cp,dp)
means
:: FTACELL2:def 7
ex f,g,h
being ManySortedSet
of NAT st
n-BitFTA0Layer2Str(ap,bp,cp,dp) = f.n & it = g.n &
f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
g.
0 =
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for k
being Nat, S
being non empty ManySortedSign,
A
being non-empty MSAlgebra over S, z
being set
st S = f.k & A = g.k & z = h.k
holds
f.(k+
1) = S +* BitGFA0Str(
GFA0AdderOutput(ap.(k+
1), bp.(k+
1), cp.(k+
1)), z, dp.(k+
1)) &
g.(k+
1) = A +* BitGFA0Circ(
GFA0AdderOutput(ap.(k+
1), bp.(k+
1), cp.(k+
1)), z, dp.(k+
1)) &
h.(k+
1) = GFA0CarryOutput(ap.(k+
1), bp.(k+
1), cp.(k+
1));
end;
:: Main proposition - Two-Layer Circuit Composition (Structure-level)
theorem :: FTACELL2:5
for n
being Nat
for ap,bp,cp,dp
being FinSequence
holds
n-BitFTA0Str(ap,bp,cp,dp) = (n-BitFTA0Layer1Str(ap,bp,cp))
+* (n-BitFTA0Layer2Str(ap,bp,cp,dp));
:: Main proposition - Two-Layer Circuit Composition (Circuit level)
:: Circ +* (CIRCCOMB:def 4) is partial, so no congruence-rewrite through it
:: (unlike Str, Th5). Both base and step are closed by Sorts/Charact
:: extensionality reduced to the map-level rearrange LmF (CIRCCOMB:23 idiom).
theorem :: FTACELL2:6
for n
being Nat
for ap,bp,cp,dp
being FinSequence
holds
n-BitFTA0Circ(ap,bp,cp,dp) = (n-BitFTA0Layer1Circ(ap,bp,cp))
+* (n-BitFTA0Layer2Circ(ap,bp,cp,dp));
:: Feed-forward disjointness : Layer 1 inputs miss Layer 2 gates.
theorem :: FTACELL2:7
for n
being Nat
for ap,bp,cp,dp
being nonpair-yielding FinSequence
holds InputVertices (n-BitFTA0Layer1Str(ap,bp,cp))
misses InnerVertices (n-BitFTA0Layer2Str(ap,bp,cp,dp));
::-----------------------------------------------------------
:: Layer 1 (parallel stage-1 GFAs) stabilizes in 2 steps.
:: Each stage-1 cell is 2-stable (GFACIRC1:40) and the cells are
:: mutually independent, so the parallel-max rule (CIRCCMB2:24) gives 2.
::-----------------------------------------------------------
theorem :: FTACELL2:8
for n
being Nat
for ap,bp,cp
being nonpair-yielding FinSequence
for s
being State
of n-BitFTA0Layer1Circ(ap,bp,cp)
holds Following(s,
2)
is stable;
:: The FALSE constant gate recomputes its output to FALSE in one
:: step, in any circuit containing it as a gate.
theorem :: FTACELL2:9
for S
being unsplit gate`
1=arity gate`
2isBoolean non void
non empty ManySortedSign
for A
being Boolean gate`
2=den non-empty Circuit
of S
st [<*>,(
0-tuples_on BOOLEAN)-->FALSE]
in InnerVertices S
for s
being State
of A
holds
(Following s).[<*>,(
0-tuples_on BOOLEAN)-->FALSE] = FALSE;
:: Layer 2 stabilizes in 2 steps from any state where the FALSE
:: base output vertex is already settled. The k = 0 cell composes
:: by cascade with n1 = 0 (the settled base is already stable);
:: later cells compose in parallel.
theorem :: FTACELL2:10
for n
being Nat
for ap,bp,cp,dp
being nonpair-yielding FinSequence
for s
being State
of n-BitFTA0Layer2Circ(ap,bp,cp,dp)
st s.[<*>,(
0-tuples_on BOOLEAN)-->FALSE] = FALSE
holds Following(s,
2)
is stable;
::--------------------------------
:: Stability of n-depth FTA Circuit (TYPE-0)
::--------------------------------
theorem :: FTACELL2:11 :: Th11
for n
being Nat
for ap,bp,cp,dp
being nonpair-yielding FinSeqLen
of n
for s
being State
of n-BitFTA0Circ(ap,bp,cp,dp)
holds Following(s,
4)
is stable;
begin :: 2. Stability of a Parallel 4-2 Compressor Circuit (TYPE-1)
::------------------------------------------------
:: Definitions of n-depth FTA Structure and Circuit (TYPE-1)
::------------------------------------------------
:: Signature of the n-bit 4-2 compressor (TYPE-1): a FALSE base gate
:: followed by n BitFTA1 stage cells composed with +*, each fed the
:: running carry. TYPE-1 negates the second and fourth addends.
definition
let n
be Nat;
let ap,bm,cp,dm
be FinSequence;
func n-BitFTA1Str(ap,bm,cp,dm) ->
unsplit gate`
1=arity gate`
2isBoolean non void strict
non empty ManySortedSign means
:: FTACELL2:def 8
ex f,h
being ManySortedSet
of NAT st
it = f.n & f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for n
being Nat, S
being non empty ManySortedSign, z
be set
st S = f.n & z = h.n
holds
f.(n+
1) = S +* BitFTA1Str(ap.(n+
1), bm.(n+
1), cp.(n+
1), dm.(n+
1), z) &
h.(n+
1) = BitFTA1CarryOutput(ap.(n+
1), bm.(n+
1), cp.(n+
1), dm.(n+
1), z);
end;
:: Boolean circuit (MSAlgebra) realizing the n-bit TYPE-1 signature.
definition
let n
be Nat;
let ap,bm,cp,dm
be FinSequence;
func n-BitFTA1Circ(ap,bm,cp,dm) ->
Boolean gate`
2=den strict Circuit
of n-BitFTA1Str(ap,bm,cp,dm) means
:: FTACELL2:def 9
ex f,g,h
being ManySortedSet
of NAT st
n-BitFTA1Str(ap,bm,cp,dm) = f.n & it = g.n &
f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
g.
0 =
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for n
being Nat, S
being non empty ManySortedSign,
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 +* BitFTA1Str(ap.(n+
1), bm.(n+
1), cp.(n+
1), dm.(n+
1), z) &
g.(n+
1) = A +* BitFTA1Circ(ap.(n+
1), bm.(n+
1), cp.(n+
1), dm.(n+
1), z) &
h.(n+
1) = BitFTA1CarryOutput(ap.(n+
1), bm.(n+
1), cp.(n+
1), dm.(n+
1), z);
end;
:: Carry-out signal vertex after n stages (head of the carry stream).
definition
let n
be Nat;
let ap,bm,cp,dm
be FinSequence;
func n-BitFTA1CarryOutput(ap,bm,cp,dm) ->
Element
of InnerVertices (n-BitFTA1Str(ap,bm,cp,dm)) means
:: FTACELL2:def 10
ex h
being ManySortedSet
of NAT st
it = h.n & h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for n
being Nat
holds
h.(n+
1) = BitFTA1CarryOutput(ap.(n+
1), bm.(n+
1), cp.(n+
1), dm.(n+
1), h.n);
end;
::-----------------------------------------------
:: Properties of n-depth FTA Structure and Circuit (TYPE-1)
::-----------------------------------------------
:: Characterization of the recursion: any (structure, circuit, carry)
:: streams satisfying the defining recurrence agree with
:: n-BitFTA1Str / n-BitFTA1Circ / n-BitFTA1CarryOutput at index n.
theorem :: FTACELL2:12
for ap,bm,cp,dm
being FinSequence, f,g,h
being ManySortedSet
of NAT st
f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
g.
0 =
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for n
being Nat, S
being non empty ManySortedSign,
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 +* BitFTA1Str(ap.(n+
1),bm.(n+
1),cp.(n+
1),dm.(n+
1), z) &
g.(n+
1) = A +* BitFTA1Circ(ap.(n+
1),bm.(n+
1),cp.(n+
1),dm.(n+
1), z) &
h.(n+
1) = BitFTA1CarryOutput(ap.(n+
1),bm.(n+
1),cp.(n+
1),dm.(n+
1), z)
for n
being Nat
holds
n-BitFTA1Str(ap,bm,cp,dm) = f.n & n-BitFTA1Circ(ap,bm,cp,dm) = g.n &
n-BitFTA1CarryOutput(ap,bm,cp,dm) = h.n;
:: Base case: the 0-bit structure, circuit and carry are all the FALSE
:: constant gate (resp. its algebra / output vertex).
theorem :: FTACELL2:13
for ap,bm,cp,dm
being FinSequence
holds
0-BitFTA1Str(ap,bm,cp,dm) =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
0-BitFTA1Circ(ap,bm,cp,dm)
=
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
0-BitFTA1CarryOutput(ap,bm,cp,dm) = [<*>, (
0-tuples_on BOOLEAN)-->FALSE];
:: One-step unfolding: the (n+1)-stage structure, circuit and carry are
:: the n-stage ones composed with one further BitFTA1 cell that is fed the
:: n-stage carry output.
theorem :: FTACELL2:14
for n
be Nat
for ap,bm,cp,dm
being FinSequence
holds
(n+
1)-BitFTA1Str(ap,bm,cp,dm) = n-BitFTA1Str(ap,bm,cp,dm) +*
BitFTA1Str(ap.(n+
1),bm.(n+
1),cp.(n+
1),dm.(n+
1),
n-BitFTA1CarryOutput(ap,bm,cp,dm)) &
(n+
1)-BitFTA1Circ(ap,bm,cp,dm) = n-BitFTA1Circ(ap,bm,cp,dm) +*
BitFTA1Circ(ap.(n+
1),bm.(n+
1),cp.(n+
1),dm.(n+
1),
n-BitFTA1CarryOutput(ap,bm,cp,dm)) &
(n+
1)-BitFTA1CarryOutput(ap,bm,cp,dm) =
BitFTA1CarryOutput(ap.(n+
1),bm.(n+
1),cp.(n+
1),dm.(n+
1),
n-BitFTA1CarryOutput(ap,bm,cp,dm));
:: The carry output remains stable from T=2 onward.
theorem :: FTACELL2:15 :: Th15
for ap,bm,cp
being non pair set
for dm,cin
being set
for s
being State
of BitFTA1Circ(ap,bm,cp,dm,cin)
for k
being Nat st k >=
2 holds
Following(s,k).BitFTA1CarryOutput(ap,bm,cp,dm,cin)
= Following(s,
2).BitFTA1CarryOutput(ap,bm,cp,dm,cin);
::------------------------------------------------
:: Wavefront Layer Decomposition (TYPE-1)
:: Layer 1 collects the stage-1 cells BitGFA1Str(a,b,c) of every column;
:: layer 2 collects the stage-2 cells, which for TYPE-1 are BitGFA2Str
:: applied to the stage-1 sum, the lateral carry and the fourth addend.
::------------------------------------------------
:: Wavefront Layer 1 Structure (n-depth) : stage-1 GFA1s
definition
let n
be Nat;
let ap,bm,cp
be FinSequence;
func n-BitFTA1Layer1Str(ap,bm,cp) ->
unsplit gate`
1=arity gate`
2isBoolean non void strict
non empty ManySortedSign means
:: FTACELL2:def 11
ex f
being ManySortedSet
of NAT st
it = f.n & f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
for k
being Nat, S
being non empty ManySortedSign st S = f.k
holds f.(k+
1) = S +* BitGFA1Str(ap.(k+
1), bm.(k+
1), cp.(k+
1));
end;
:: Wavefront Layer 1 Circuit (n-depth) : stage-1 GFA1s
definition
let n
be Nat;
let ap,bm,cp
be FinSequence;
func n-BitFTA1Layer1Circ(ap,bm,cp) ->
Boolean gate`
2=den strict Circuit
of n-BitFTA1Layer1Str(ap,bm,cp) means
:: FTACELL2:def 12
ex f,g
being ManySortedSet
of NAT st
n-BitFTA1Layer1Str(ap,bm,cp) = f.n & it = g.n &
f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
g.
0 =
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
for k
being Nat, S
being non empty ManySortedSign,
A
being non-empty MSAlgebra over S st S = f.k & A = g.k
holds
f.(k+
1) = S +* BitGFA1Str(ap.(k+
1), bm.(k+
1), cp.(k+
1)) &
g.(k+
1) = A +* BitGFA1Circ(ap.(k+
1), bm.(k+
1), cp.(k+
1));
end;
:: Wavefront Layer 2 Structure (n-depth) : stage-2 GFA2s + carry stream
definition
let n
be Nat;
let ap,bm,cp,dm
be FinSequence;
func n-BitFTA1Layer2Str(ap,bm,cp,dm) ->
unsplit gate`
1=arity gate`
2isBoolean non void strict
non empty ManySortedSign means
:: FTACELL2:def 13
ex g,h
being ManySortedSet
of NAT st
it = g.n & g.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for k
being Nat, S
being non empty ManySortedSign, z
being set
st S = g.k & z = h.k
holds
g.(k+
1) = S +* BitGFA2Str(
GFA1AdderOutput(ap.(k+
1), bm.(k+
1), cp.(k+
1)), z, dm.(k+
1)) &
h.(k+
1) = GFA1CarryOutput(ap.(k+
1), bm.(k+
1), cp.(k+
1));
end;
:: Wavefront Layer 2 Circuit (n-depth) : stage-2 GFA2s + carry stream
definition
let n
be Nat;
let ap,bm,cp,dm
be FinSequence;
func n-BitFTA1Layer2Circ(ap,bm,cp,dm) ->
Boolean gate`
2=den strict Circuit
of n-BitFTA1Layer2Str(ap,bm,cp,dm)
means
:: FTACELL2:def 14
ex f,g,h
being ManySortedSet
of NAT st
n-BitFTA1Layer2Str(ap,bm,cp,dm) = f.n & it = g.n &
f.
0 =
1GateCircStr(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
g.
0 =
1GateCircuit(<*>,(
0-tuples_on BOOLEAN)-->FALSE) &
h.
0 = [<*>, (
0-tuples_on BOOLEAN)-->FALSE] &
for k
being Nat, S
being non empty ManySortedSign,
A
being non-empty MSAlgebra over S, z
being set
st S = f.k & A = g.k & z = h.k
holds
f.(k+
1) = S +* BitGFA2Str(
GFA1AdderOutput(ap.(k+
1), bm.(k+
1), cp.(k+
1)), z, dm.(k+
1)) &
g.(k+
1) = A +* BitGFA2Circ(
GFA1AdderOutput(ap.(k+
1), bm.(k+
1), cp.(k+
1)), z, dm.(k+
1)) &
h.(k+
1) = GFA1CarryOutput(ap.(k+
1), bm.(k+
1), cp.(k+
1));
end;
:: Main proposition - Two-Layer Circuit Composition (Structure-level)
theorem :: FTACELL2:16
for n
being Nat
for ap,bm,cp,dm
being FinSequence
holds
n-BitFTA1Str(ap,bm,cp,dm) = (n-BitFTA1Layer1Str(ap,bm,cp))
+* (n-BitFTA1Layer2Str(ap,bm,cp,dm));
:: Main proposition - Two-Layer Circuit Composition (Circuit level)
:: Circ +* (CIRCCOMB:def 4) is partial, so no congruence-rewrite through it
:: (unlike Str, Th16). Both base and step are closed by Sorts/Charact
:: extensionality reduced to the map-level rearrange LmF (CIRCCOMB:23 idiom).
theorem :: FTACELL2:17
for n
being Nat
for ap,bm,cp,dm
being FinSequence
holds
n-BitFTA1Circ(ap,bm,cp,dm) = (n-BitFTA1Layer1Circ(ap,bm,cp))
+* (n-BitFTA1Layer2Circ(ap,bm,cp,dm));
:: Feed-forward disjointness : Layer 1 inputs miss Layer 2 gates.
theorem :: FTACELL2:18
for n
being Nat
for ap,bm,cp,dm
being nonpair-yielding FinSequence
holds InputVertices (n-BitFTA1Layer1Str(ap,bm,cp))
misses InnerVertices (n-BitFTA1Layer2Str(ap,bm,cp,dm));
::-----------------------------------------------------------
:: Layer 1 (parallel stage-1 GFA1s) stabilizes in 2 steps.
:: Each stage-1 cell is 2-stable (GFACIRC1:72) and the cells are
:: mutually independent, so the parallel-max rule (CIRCCMB2:24) gives 2.
::-----------------------------------------------------------
theorem :: FTACELL2:19
for n
being Nat
for ap,bm,cp
being nonpair-yielding FinSequence
for s
being State
of n-BitFTA1Layer1Circ(ap,bm,cp)
holds Following(s,
2)
is stable;
:: Layer 2 stabilizes in 2 steps from any state where the FALSE
:: base output vertex is already settled. The k = 0 cell composes
:: by cascade with n1 = 0 (the settled base is already stable);
:: later cells compose in parallel.
theorem :: FTACELL2:20
for n
being Nat
for ap,bm,cp,dm
being nonpair-yielding FinSequence
for s
being State
of n-BitFTA1Layer2Circ(ap,bm,cp,dm)
st s.[<*>,(
0-tuples_on BOOLEAN)-->FALSE] = FALSE
holds Following(s,
2)
is stable;
::--------------------------------
:: Stability of n-depth FTA Circuit (TYPE-1)
::--------------------------------
theorem :: FTACELL2:21 :: Th21
for n
being Nat
for ap,bm,cp,dm
being nonpair-yielding FinSeqLen
of n
for s
being State
of n-BitFTA1Circ(ap,bm,cp,dm)
holds Following(s,
4)
is stable;