Package montgomery-hardware: Hardware Montgomery multiplication
Information
| name | montgomery-hardware |
| version | 1.0 |
| description | Hardware Montgomery multiplication |
| author | Joe Leslie-Hurd <joe@gilith.com> |
| license | MIT |
| requires | bool hardware montgomery-thm natural natural-bits set |
| show | Data.Bool Data.List Hardware Number.Natural Set |
Files
- Package tarball montgomery-hardware-1.0.tgz
- Theory source file montgomery-hardware.thy (included in the package tarball)
Defined Constants
- Hardware
- Montgomery
- Montgomery.doubleExp
- Montgomery.multiply
- Montgomery.multiply.compress
- Montgomery.multiply.reduce
- Montgomery
Theorems
⊦ ∀ld xs xc d0 ys yc d1 ks kc d2 ns nc jb d3 d4 rx ry rz dn zs zc t.
signal ld t ∧
Montgomery.multiply ld xs xc d0 ys yc d1 ks kc d2 ns nc jb d3 d4 rx ry
rz dn zs zc ⇒ ¬signal dn t
⊦ ∀r ld xs xc d0 ys yc d1 ks kc d2 ns nc jb d3 d4 rx ry rz dn zs zc t k.
Bus.width xs = r ∧ d3 ≤ d0 + (d1 + (d2 + (r + 1))) ∧
(∀i. i ≤ k ⇒ (signal ld (t + i) ⇔ i = 0)) ∧
Bits.toNatural (Bus.signal jb t) + (d0 + (d1 + (d2 + (r + 3)))) =
2 ↑ Bus.width jb + (Bus.width jb + d3) ∧
Montgomery.multiply ld xs xc d0 ys yc d1 ks kc d2 ns nc jb d3 d4 rx ry
rz dn zs zc ⇒
(signal dn (t + k) ⇔ d3 + k = d0 + (d1 + (d2 + (r + 2))))
⊦ ∀n r x xs xc d rx ry rz ys yc t.
Bus.width rx = r ∧ ¬(n = 0) ∧ Bits.width x ≤ r + 2 ∧
Bits.toNatural (Bus.signal xs t) +
2 * Bits.toNatural (Bus.signal xc t) = x ∧
Bus.signal xs (t + d) = Bus.signal xs t ∧
Bus.signal xc (t + d) = Bus.signal xc t ∧
Bits.toNatural (Bus.signal rx (t + d)) = 2 ↑ r mod n ∧
Bits.toNatural (Bus.signal ry (t + d)) = 2 * 2 ↑ r mod n ∧
Bits.toNatural (Bus.signal rz (t + d)) = 3 * 2 ↑ r mod n ∧
Montgomery.multiply.compress xs xc d rx ry rz ys yc ⇒
(Bits.toNatural (Bus.signal ys (t + d)) +
2 * Bits.toNatural (Bus.signal yc (t + d))) mod n = x mod n
⊦ ∀n r k x y ld xs xc d0 ys yc d1 ks kc d2 ns nc zs zc t.
Bus.width xs = r ∧ ¬(n = 0) ∧ Bits.width n ≤ r ∧
Bits.toNatural (Bus.signal xs t) +
2 * Bits.toNatural (Bus.signal xc t) = x ∧
(∀i.
d0 ≤ i ∧ i ≤ d0 + (r + 1) ⇒
Bits.toNatural (Bus.signal ys (t + i)) +
2 * Bits.toNatural (Bus.signal yc (t + i)) = y) ∧
Montgomery.multiply.reduce ld xs xc d0 ys yc d1 ks kc d2 ns nc zs zc ⇒
Bits.width x ≤ r + 2 ∧ Bits.width y ≤ r + 2 ∧
Bits.width (x * y) ≤ r + 2 + (r + 2) ∧
Bits.width (Montgomery.reduce n (2 ↑ (r + 2)) k (x * y)) ≤ r + 2
⊦ ∀xs xc d rx ry rz ys yc.
Montgomery.multiply.compress xs xc d rx ry rz ys yc ⇔
∃r nct ns nc nsd ncd rnl rnh rn xs0 xs1 xs2 xc0 xc1 xc2 ys0 ys1 yc0 yc1
rn0 rn1.
Bus.width xs = r + 2 ∧ Bus.width xc = r + 2 ∧ Bus.width rx = r + 1 ∧
Bus.width ry = r + 1 ∧ Bus.width rz = r + 1 ∧ Bus.width ys = r + 1 ∧
Bus.width yc = r + 1 ∧ Bus.width rnl = r + 1 ∧
Bus.width rnh = r + 1 ∧ Bus.width rn = r + 1 ∧ Bus.wire xs 0 xs0 ∧
Bus.sub xs 1 r xs1 ∧ Bus.wire xs (r + 1) xs2 ∧ Bus.sub xc 0 r xc0 ∧
Bus.wire xc r xc1 ∧ Bus.wire xc (r + 1) xc2 ∧ Bus.wire ys 0 ys0 ∧
Bus.sub ys 1 r ys1 ∧ Bus.wire yc 0 yc0 ∧ Bus.sub yc 1 r yc1 ∧
Bus.wire rn 0 rn0 ∧ Bus.sub rn 1 r rn1 ∧ adder2 xs2 xc1 ns nct ∧
or2 nct xc2 nc ∧ pipe ns d nsd ∧ pipe nc d ncd ∧
Bus.case1 nsd rx (Bus.ground (r + 1)) rnl ∧ Bus.case1 nsd rz ry rnh ∧
Bus.case1 ncd rnh rnl rn ∧ adder2 xs0 rn0 ys0 yc0 ∧
Bus.adder3 xs1 xc0 rn1 ys1 yc1
⊦ ∀ld xs xc d0 ys yc d1 ks kc d2 ns nc jb d3 d4 rx ry rz dn zs zc.
Montgomery.multiply ld xs xc d0 ys yc d1 ks kc d2 ns nc jb d3 d4 rx ry
rz dn zs zc ⇔
∃r jp jpd ps pc qsp qcp qsr qcr.
Bus.width xs = r + 1 ∧ Bus.width xc = r + 1 ∧ Bus.width ys = r + 1 ∧
Bus.width yc = r + 1 ∧ Bus.width ks = r + 2 ∧ Bus.width kc = r + 2 ∧
Bus.width ns = r ∧ Bus.width nc = r ∧ Bus.width rx = r + 1 ∧
Bus.width ry = r + 1 ∧ Bus.width rz = r + 1 ∧ Bus.width zs = r + 1 ∧
Bus.width zc = r + 1 ∧ Bus.width ps = r + 2 ∧ Bus.width pc = r + 2 ∧
Bus.width qsp = r + 2 ∧ Bus.width qcp = r + 2 ∧
Bus.width qsr = r + 2 ∧ Bus.width qcr = r + 2 ∧
Montgomery.multiply.reduce ld xs xc d0 ys yc d1 ks kc d2 ns nc ps
pc ∧ counterPulse ld jb jp ∧ pipe jp d3 jpd ∧
Bus.case1 jpd ps qsp qsr ∧ Bus.case1 jpd pc qcp qcr ∧ connect jp dn ∧
Montgomery.multiply.compress qsp qcp d4 rx ry rz zs zc ∧
Bus.delay qsr qsp ∧ Bus.delay qcr qcp
⊦ ∀n r s k x y ld xs xc d0 ys yc d1 ks kc d2 ns nc zs zc t.
Bus.width xs = r ∧ ¬(n = 0) ∧ Bits.width n ≤ r ∧
2 ↑ (r + 2) * s = k * n + 1 ∧
(∀i. i ≤ d1 + (d2 + (r + 1)) ⇒ (signal ld (t + i) ⇔ i = 0)) ∧
Bits.toNatural (Bus.signal xs t) +
2 * Bits.toNatural (Bus.signal xc t) = x ∧
(∀i.
d0 ≤ i ∧ i ≤ d0 + (r + 1) ⇒
Bits.toNatural (Bus.signal ys (t + i)) +
2 * Bits.toNatural (Bus.signal yc (t + i)) = y) ∧
(∀i.
d0 + d1 ≤ i ∧ i ≤ d0 + (d1 + (r + 1)) ⇒
Bits.toNatural (Bus.signal ks (t + i)) +
2 * Bits.toNatural (Bus.signal kc (t + i)) = k) ∧
(∀i.
d0 + (d1 + d2) ≤ i ∧ i ≤ d0 + (d1 + (d2 + (r + 1))) ⇒
Bits.toNatural (Bus.signal ns (t + i)) +
2 * Bits.toNatural (Bus.signal nc (t + i)) = n) ∧
Montgomery.multiply.reduce ld xs xc d0 ys yc d1 ks kc d2 ns nc zs zc ⇒
Bits.toNatural (Bus.signal zs (t + (d0 + (d1 + (d2 + (r + 2)))))) +
2 * Bits.toNatural (Bus.signal zc (t + (d0 + (d1 + (d2 + (r + 2)))))) =
Montgomery.reduce n (2 ↑ (r + 2)) k (x * y)
⊦ ∀ld mb xs xc d0 d1 ks kc d2 ns nc jb d3 d4 rx ry rz dn ys yc.
Montgomery.doubleExp ld mb xs xc d0 d1 ks kc d2 ns nc jb d3 d4 rx ry rz
dn ys yc ⇔
∃r sa sb jp ps pc qs qc sad sadd san sap saq sar sbd sbdd sbp sbq sbr
srdd jpn psq psr pcq pcr md mdn.
Bus.width xs = r + 1 ∧ Bus.width xc = r + 1 ∧ Bus.width ks = r + 2 ∧
Bus.width kc = r + 2 ∧ Bus.width ns = r ∧ Bus.width nc = r ∧
Bus.width rx = r + 1 ∧ Bus.width ry = r + 1 ∧ Bus.width rz = r + 1 ∧
Bus.width ys = r + 1 ∧ Bus.width yc = r + 1 ∧ Bus.width ps = r + 1 ∧
Bus.width pc = r + 1 ∧ Bus.width qs = r + 1 ∧ Bus.width qc = r + 1 ∧
Bus.width psq = r + 1 ∧ Bus.width psr = r + 1 ∧
Bus.width pcq = r + 1 ∧ Bus.width pcr = r + 1 ∧ not jp jpn ∧
not md mdn ∧ not sa san ∧ and2 sb jp sap ∧ and2 san sap saq ∧
or2 ld saq sar ∧ and2 sa mdn sbp ∧ case1 sb jpn sbp sbq ∧
or2 ld sbq sbr ∧ pipe sa (d3 + d4) sad ∧ delay sad sadd ∧
pipe sb (d3 + d4) sbd ∧ delay sbd sbdd ∧ and2 sadd sbdd srdd ∧
eventCounter srdd mb sadd md ∧
Montgomery.multiply sadd ps pc d0 ps pc d1 ks kc d2 ns nc jb d3 d4 rx
ry rz jp qs qc ∧ Bus.case1 sbd xs qs psq ∧
Bus.case1 sad psq ps psr ∧ Bus.case1 sbd xc qc pcq ∧
Bus.case1 sad pcq pc pcr ∧ nor2 sad sbd dn ∧ Bus.connect ps ys ∧
Bus.connect pc yc ∧ delay sar sa ∧ delay sbr sb ∧ Bus.delay psr ps ∧
Bus.delay pcr pc
⊦ ∀n r s k x y ld xs xc d0 ys yc d1 ks kc d2 ns nc jb d3 d4 rx ry rz dn zs
zc t.
Bus.width xs = r ∧ ¬(n = 0) ∧ Bits.width n ≤ r ∧
2 ↑ (r + 2) * s = k * n + 1 ∧ d3 ≤ d0 + (d1 + (d2 + (r + 1))) ∧
(∀i.
i ≤ d0 + (d1 + (d2 + (d4 + (r + 2)))) ⇒
(signal ld (t + i) ⇔ i = 0)) ∧
Bits.toNatural (Bus.signal xs t) +
2 * Bits.toNatural (Bus.signal xc t) = x ∧
(∀i.
d0 ≤ i ∧ i ≤ d0 + (r + 1) ⇒
Bits.toNatural (Bus.signal ys (t + i)) +
2 * Bits.toNatural (Bus.signal yc (t + i)) = y) ∧
(∀i.
d0 + d1 ≤ i ∧ i ≤ d0 + (d1 + (r + 1)) ⇒
Bits.toNatural (Bus.signal ks (t + i)) +
2 * Bits.toNatural (Bus.signal kc (t + i)) = k) ∧
(∀i.
d0 + (d1 + d2) ≤ i ∧ i ≤ d0 + (d1 + (d2 + (r + 1))) ⇒
Bits.toNatural (Bus.signal ns (t + i)) +
2 * Bits.toNatural (Bus.signal nc (t + i)) = n) ∧
Bits.toNatural (Bus.signal jb t) + (d0 + (d1 + (d2 + (r + 3)))) =
2 ↑ Bus.width jb + (Bus.width jb + d3) ∧
Bits.toNatural
(Bus.signal rx (t + (d0 + (d1 + (d2 + (d4 + (r + 3))))))) =
2 ↑ r mod n ∧
Bits.toNatural
(Bus.signal ry (t + (d0 + (d1 + (d2 + (d4 + (r + 3))))))) =
2 * 2 ↑ r mod n ∧
Bits.toNatural
(Bus.signal rz (t + (d0 + (d1 + (d2 + (d4 + (r + 3))))))) =
3 * 2 ↑ r mod n ∧
Montgomery.multiply ld xs xc d0 ys yc d1 ks kc d2 ns nc jb d3 d4 rx ry
rz dn zs zc ⇒
(Bits.toNatural
(Bus.signal zs (t + (d0 + (d1 + (d2 + (d4 + (r + 3))))))) +
2 *
Bits.toNatural
(Bus.signal zc (t + (d0 + (d1 + (d2 + (d4 + (r + 3)))))))) mod n =
x * y * s mod n
⊦ ∀n r s k m x ld mb xs xc d0 d1 ks kc d2 ns nc jb d3 d4 rx ry rz dn ys yc
t l.
∃d.
∀j.
Bus.width xs = r ∧ Bits.width n ≤ r ∧ 2 ↑ (r + 2) * s = k * n + 1 ∧
d3 ≤ d0 + (d1 + (d2 + (r + 1))) ∧ d3 + (d4 + 1) = l ∧
Bus.width mb + l ≤ d0 + (d1 + (d2 + (d4 + (r + 4)))) ∧
(∀i. i ≤ d + j ⇒ (signal ld (t + i) ⇔ i ≤ l)) ∧
Bits.toNatural (Bus.signal mb (t + (l + (l + 1)))) + m =
2 ↑ Bus.width mb + 1 ∧
(Bits.toNatural (Bus.signal xs (t + (l + l))) +
2 * Bits.toNatural (Bus.signal xc (t + (l + l)))) mod n =
x * 2 ↑ (r + 2) mod n ∧
(∀i.
i < d ⇒
Bits.toNatural (Bus.signal ks (t + (l + i))) +
2 * Bits.toNatural (Bus.signal kc (t + (l + i))) = k) ∧
(∀i.
i < d ⇒
Bits.toNatural (Bus.signal ns (t + (l + i))) +
2 * Bits.toNatural (Bus.signal nc (t + (l + i))) = n) ∧
(∀i.
i < d ⇒
Bits.toNatural (Bus.signal jb (t + (l + i))) +
(d0 + (d1 + (d2 + (r + 3)))) =
2 ↑ Bus.width jb + (Bus.width jb + d3)) ∧
(∀i.
i < d ⇒
Bits.toNatural (Bus.signal rx (t + (l + i))) = 2 ↑ r mod n) ∧
(∀i.
i < d ⇒
Bits.toNatural (Bus.signal ry (t + (l + i))) =
2 * 2 ↑ r mod n) ∧
(∀i.
i < d ⇒
Bits.toNatural (Bus.signal rz (t + (l + i))) =
3 * 2 ↑ r mod n) ∧
Montgomery.doubleExp ld mb xs xc d0 d1 ks kc d2 ns nc jb d3 d4 rx
ry rz dn ys yc ⇒
(∀i. i ≤ d + j ⇒ (signal dn (t + (l + i)) ⇔ d ≤ i)) ∧
(Bits.toNatural (Bus.signal ys (t + (l + (d + j)))) +
2 * Bits.toNatural (Bus.signal yc (t + (l + (d + j))))) mod n =
x ↑ 2 ↑ m * 2 ↑ (r + 2) mod n
⊦ ∀ld xs xc d0 ys yc d1 ks kc d2 ns nc zs zc.
Montgomery.multiply.reduce ld xs xc d0 ys yc d1 ks kc d2 ns nc zs zc ⇔
∃r pb ps pc pbp qb qs qc vb vs vc vt sa sb sc sd ms mc ld1 ld2 zs0 zs1
zs2 zc0 zc1 zc2 zc3 ps0 pc0 pb1 pbp0 pbp1 qb2 sa0 sa1 sa2 sa3 sa4 sa5
sb0 sb1 sb2 sd0 sd1 sd2 sd3 ms0 ms1 ms2 ms3 ms4 mc0 mc1 mc2 mc3 mc4
mw.
Bus.width xs = d1 + (d2 + (r + 2)) ∧
Bus.width xc = d1 + (d2 + (r + 2)) ∧
Bus.width ys = d1 + (d2 + (r + 2)) ∧
Bus.width yc = d1 + (d2 + (r + 2)) ∧
Bus.width ks = d1 + (d2 + (r + 3)) ∧
Bus.width kc = d1 + (d2 + (r + 3)) ∧
Bus.width ns = d1 + (d2 + (r + 1)) ∧
Bus.width nc = d1 + (d2 + (r + 1)) ∧
Bus.width zs = d1 + (d2 + (r + 3)) ∧
Bus.width zc = d1 + (d2 + (r + 3)) ∧
Bus.width ps = d1 + (d2 + (r + 2)) ∧
Bus.width pc = d1 + (d2 + (r + 2)) ∧ Bus.width pbp = d1 + (d2 + 1) ∧
Bus.width qs = d1 + (d2 + (r + 3)) ∧
Bus.width qc = d1 + (d2 + (r + 3)) ∧
Bus.width vs = d1 + (d2 + (r + 1)) ∧
Bus.width vc = d1 + (d2 + (r + 1)) ∧
Bus.width sa = d1 + (d2 + (r + 4)) ∧ Bus.width sb = r + 3 ∧
Bus.width sc = d1 + (d2 + (r + 1)) ∧
Bus.width sd = d1 + (d2 + (r + 2)) ∧
Bus.width ms = d1 + (d2 + (r + 3)) ∧
Bus.width mc = d1 + (d2 + (r + 3)) ∧
Bus.sub zs 0 (d1 + (d2 + 1)) zs0 ∧
Bus.sub zs (d1 + (d2 + 1)) (r + 1) zs1 ∧
Bus.wire zs (d1 + (d2 + (r + 2))) zs2 ∧ Bus.sub zc 0 (d1 + d2) zc0 ∧
Bus.wire zc (d1 + d2) zc1 ∧ Bus.sub zc (d1 + (d2 + 1)) (r + 1) zc2 ∧
Bus.wire zc (d1 + (d2 + (r + 2))) zc3 ∧ Bus.sub ps 0 (r + 4) ps0 ∧
Bus.sub pc 0 (r + 3) pc0 ∧ Bus.wire pbp d1 pb1 ∧
Bus.sub pbp 1 (d1 + d2) pbp0 ∧ Bus.reverse pbp0 pbp1 ∧
Bus.sub sa 0 (d1 + d2) sa0 ∧ Bus.sub sa 0 (d1 + (d2 + (r + 1))) sa1 ∧
Bus.sub sa (d1 + d2) (r + 4) sa2 ∧
Bus.wire sa (d1 + (d2 + (r + 1))) sa3 ∧
Bus.wire sa (d1 + (d2 + (r + 2))) sa4 ∧
Bus.wire sa (d1 + (d2 + (r + 3))) sa5 ∧ Bus.sub sb 0 (r + 1) sb0 ∧
Bus.wire sb (r + 1) sb1 ∧ Bus.wire sb (r + 2) sb2 ∧
Bus.wire sd 0 sd0 ∧ Bus.sub sd 0 (d1 + (d2 + (r + 1))) sd1 ∧
Bus.sub sd 1 (d1 + (d2 + (r + 1))) sd2 ∧
Bus.wire sd (d1 + (d2 + (r + 1))) sd3 ∧
Bus.sub ms 0 (d1 + (d2 + 1)) ms0 ∧
Bus.sub ms 0 (d1 + (d2 + (r + 1))) ms1 ∧
Bus.sub ms (d1 + (d2 + 1)) (r + 1) ms4 ∧
Bus.wire ms (d1 + (d2 + (r + 1))) ms2 ∧
Bus.wire ms (d1 + (d2 + (r + 2))) ms3 ∧ Bus.sub mc 0 (d1 + d2) mc0 ∧
Bus.sub mc 0 (d1 + (d2 + (r + 1))) mc1 ∧
Bus.sub mc (d1 + d2) (r + 1) mc2 ∧
Bus.wire mc (d1 + (d2 + (r + 1))) mc3 ∧
Bus.wire mc (d1 + (d2 + (r + 2))) mc4 ∧
SumCarry.multiplier ld xs xc d0 ys yc pb ps pc ∧
pipe ld (d0 + d1) ld1 ∧ Bus.pipe pb pbp ∧
Bus.multiplier ld1 pb1 ks kc qb qs qc ∧ pipe ld1 d2 ld2 ∧
pipe qb d2 qb2 ∧ Bus.multiplier ld2 qb2 ns nc vb vs vc ∧
sticky ld2 vb vt ∧ Bus.connect pbp1 sa0 ∧
Bus.adder3 sa1 sc sd1 ms1 mc1 ∧ adder2 sa3 sd3 ms2 mc3 ∧
connect sa4 ms3 ∧ connect sa5 mc4 ∧ Bus.connect ms0 zs0 ∧
Bus.connect mc0 zc0 ∧ connect ground zc1 ∧
Bus.adder3 sb0 ms4 mc2 zs1 zc2 ∧ adder3 sb1 ms3 mc3 zs2 mw ∧
or3 sb2 mc4 mw zc3 ∧ Bus.delay ps0 sa2 ∧ Bus.delay pc0 sb ∧
Bus.delay vs sc ∧ delay vt sd0 ∧ Bus.delay vc sd2
External Type Operators
- →
- bool
- Data
- List
- list
- List
- Hardware
- bus
- wire
- Number
- Natural
- natural
- Natural
- Set
- set
External Constants
- =
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∨
- ¬
- cond
- ⊥
- ⊤
- List
- ::
- length
- Bool
- Hardware
- adder2
- adder3
- and2
- case1
- connect
- counterPulse
- delay
- eventCounter
- ground
- nor2
- not
- or2
- or3
- pipe
- signal
- sticky
- xor2
- Bus
- Bus.adder3
- Bus.append
- Bus.case1
- Bus.connect
- Bus.delay
- Bus.ground
- Bus.multiplier
- Bus.nil
- Bus.pipe
- Bus.reverse
- Bus.signal
- Bus.single
- Bus.sub
- Bus.width
- Bus.wire
- SumCarry
- SumCarry.multiplier
- Number
- Natural
- *
- +
- <
- ≤
- ↑
- bit0
- bit1
- div
- fromBool
- mod
- suc
- zero
- Bits
- Bits.bit
- Bits.bound
- Bits.cons
- Bits.head
- Bits.shiftLeft
- Bits.shiftRight
- Bits.tail
- Bits.toNatural
- Bits.width
- Montgomery
- Montgomery.reduce
- Natural
- Set
- ∅
- disjoint
- finite
- fromPredicate
- insert
- ∩
- ∈
- size
- ⊆
- ∪
Assumptions
⊦ ⊤
⊦ ¬⊥ ⇔ ⊤
⊦ ¬⊤ ⇔ ⊥
⊦ bit0 0 = 0
⊦ size ∅ = 0
⊦ ∀t. t ⇒ t
⊦ ∀n. 0 ≤ n
⊦ ∀n. n ≤ n
⊦ ⊥ ⇔ ∀p. p
⊦ fromPredicate (λx. ⊥) = ∅
⊦ ∀x. ¬(x ∈ ∅)
⊦ ∀t. t ∨ ¬t
⊦ ∀t. ¬signal ground t
⊦ ∀n. n < suc n
⊦ ∀n. n ≤ suc n
⊦ (¬) = λp. p ⇒ ⊥
⊦ ∀a. ∃x. x = a
⊦ ∀t. (∀x. t) ⇔ t
⊦ ∀t. (∃x. t) ⇔ t
⊦ ∀t. (λx. t x) = t
⊦ (∀) = λp. p = λx. ⊤
⊦ ∀t. ¬¬t ⇔ t
⊦ ∀t. (⊤ ⇔ t) ⇔ t
⊦ ∀t. (t ⇔ ⊤) ⇔ t
⊦ ∀t. ⊥ ∧ t ⇔ ⊥
⊦ ∀t. ⊤ ∧ t ⇔ t
⊦ ∀t. t ∧ ⊥ ⇔ ⊥
⊦ ∀t. t ∧ ⊤ ⇔ t
⊦ ∀t. t ∧ t ⇔ t
⊦ ∀t. ⊥ ⇒ t ⇔ ⊤
⊦ ∀t. ⊤ ⇒ t ⇔ t
⊦ ∀t. t ⇒ ⊤ ⇔ ⊤
⊦ ∀t. ⊥ ∨ t ⇔ t
⊦ ∀t. ⊤ ∨ t ⇔ ⊤
⊦ ∀t. t ∨ ⊥ ⇔ t
⊦ ∀t. t ∨ ⊤ ⇔ ⊤
⊦ ∀t. t ∨ t ⇔ t
⊦ ∀x. Bus.append Bus.nil x = x
⊦ ∀n. ¬(suc n = 0)
⊦ ∀n. 0 * n = 0
⊦ ∀m. m * 0 = 0
⊦ ∀n. 0 + n = n
⊦ ∀m. m + 0 = m
⊦ ∀k. Bits.shiftLeft 0 k = 0
⊦ ∀t. (⊥ ⇔ t) ⇔ ¬t
⊦ ∀t. (t ⇔ ⊥) ⇔ ¬t
⊦ ∀t. t ⇒ ⊥ ⇔ ¬t
⊦ ∀w. Bus.width (Bus.single w) = 1
⊦ ∀n. bit1 n = suc (bit0 n)
⊦ ∀m. m ↑ 0 = 1
⊦ ∀m. m * 1 = m
⊦ ∀n. n ↑ 1 = n
⊦ ∀m. 1 * m = m
⊦ ∀m n. m ≤ m + n
⊦ ∀m n. n ≤ m + n
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀x. size (insert x ∅) = 1
⊦ ∀t. (t ⇔ ⊤) ∨ (t ⇔ ⊥)
⊦ ∀b. fromBool b = 0 ⇔ ¬b
⊦ ∀m. suc m = m + 1
⊦ ∀t1 t2. (if ⊥ then t1 else t2) = t2
⊦ ∀t1 t2. (if ⊤ then t1 else t2) = t1
⊦ ∀h t. Bits.head (Bits.cons h t) ⇔ h
⊦ ∀h t. Bits.tail (Bits.cons h t) = t
⊦ ∀b. fromBool b = if b then 1 else 0
⊦ ∀n. n < 2 ↑ Bits.width n
⊦ ∀n. 0 < n ⇔ ¬(n = 0)
⊦ ∀n. bit0 (suc n) = suc (suc (bit0 n))
⊦ ∀x y. x = y ⇔ y = x
⊦ ∀x y. x = y ⇒ y = x
⊦ ∀t1 t2. t1 ∨ t2 ⇔ t2 ∨ t1
⊦ ∀a b. (a ⇔ b) ⇒ a ⇒ b
⊦ ∀x t. length (Bus.signal x t) = Bus.width x
⊦ ∀m n. m * n = n * m
⊦ ∀m n. m + n = n + m
⊦ ∀m n. m < n ⇒ m ≤ n
⊦ ∀n t. Bits.toNatural (Bus.signal (Bus.ground n) t) = 0
⊦ ∀n. 2 * n = n + n
⊦ ∀l. Bits.toNatural l < 2 ↑ length l
⊦ ∀n i. Bits.bit n i ⇔ Bits.head (Bits.shiftRight n i)
⊦ ∀m n. m < n ⇒ ¬(m = n)
⊦ ∀m n. ¬(m < n) ⇔ n ≤ m
⊦ ∀m n. ¬(m ≤ n) ⇔ n < m
⊦ ∀m n. m < suc n ⇔ m ≤ n
⊦ ∀m n. suc m ≤ n ⇔ m < n
⊦ ∀m. m = 0 ∨ ∃n. m = suc n
⊦ ∀n. (∀i. ¬Bits.bit n i) ⇔ n = 0
⊦ (∧) = λp q. (λf. f p q) = λf. f ⊤ ⊤
⊦ ∀n. Bits.shiftLeft n 1 = 2 * n
⊦ ∀k. Bits.shiftLeft 1 k = 2 ↑ k
⊦ ∀n. ¬(n = 0) ⇒ 0 mod n = 0
⊦ ∀p. ¬(∀x. p x) ⇔ ∃x. ¬p x
⊦ ∀p. ¬(∃x. p x) ⇔ ∀x. ¬p x
⊦ (∃) = λp. ∀q. (∀x. p x ⇒ q) ⇒ q
⊦ ∀x y. x ∈ insert y ∅ ⇔ x = y
⊦ ∀t1 t2. ¬t1 ⇒ ¬t2 ⇔ t2 ⇒ t1
⊦ ∀h t. Bits.toNatural (h :: t) = Bits.cons h (Bits.toNatural t)
⊦ ∀m n. m + suc n = suc (m + n)
⊦ ∀n k. Bits.shiftRight n (suc k) = Bits.tail (Bits.shiftRight n k)
⊦ ∀m n. suc m + n = suc (m + n)
⊦ ∀m n. m < m + n ⇔ 0 < n
⊦ ∀m n. n < m + n ⇔ 0 < m
⊦ ∀m n. suc m = suc n ⇔ m = n
⊦ ∀m n. suc m < suc n ⇔ m < n
⊦ ∀m n. suc m ≤ suc n ⇔ m ≤ n
⊦ ∀m n. m + n = m ⇔ n = 0
⊦ ∀m n. m + n = n ⇔ m = 0
⊦ ∀k n. Bits.shiftLeft n k = 0 ⇔ n = 0
⊦ ∀m n. m + n ≤ m ⇔ n = 0
⊦ ∀n k. Bits.bound (Bits.bound n k) k = Bits.bound n k
⊦ ∀s t. disjoint s t ⇔ s ∩ t = ∅
⊦ ∀s t. finite t ∧ s ⊆ t ⇒ finite s
⊦ ∀n. finite { m. m | m ≤ n }
⊦ ∀t1 t2. ¬(t1 ∧ t2) ⇔ ¬t1 ∨ ¬t2
⊦ ∀t1 t2. ¬(t1 ∨ t2) ⇔ ¬t1 ∧ ¬t2
⊦ ∀x y. Bus.sub x 0 (Bus.width x) y ⇔ y = x
⊦ ∀w t.
Bits.toNatural (Bus.signal (Bus.single w) t) = fromBool (signal w t)
⊦ ∀m n. m * suc n = m + m * n
⊦ ∀m n. m ↑ suc n = m * m ↑ n
⊦ ∀m n. ¬(n = 0) ⇒ m mod n < n
⊦ ∀m n. Bits.width (m * n) ≤ Bits.width m + Bits.width n
⊦ ∀n k. Bits.bound n k = n ⇔ Bits.width n ≤ k
⊦ ∀m n. m ≤ n ⇔ ∃d. n = m + d
⊦ (∨) = λp q. ∀r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
⊦ ∀n k. Bits.shiftLeft n k = 2 ↑ k * n
⊦ ∀m n. m ≤ n ∧ n ≤ m ⇔ m = n
⊦ ∀n k. Bits.bound n k + Bits.shiftLeft (Bits.shiftRight n k) k = n
⊦ ∀m n. m < n ⇔ ∃d. n = m + suc d
⊦ ∀h t. Bits.cons h t = fromBool h + 2 * t
⊦ ∀p q. p ∨ (∃x. q x) ⇔ ∃x. p ∨ q x
⊦ ∀m n. m < suc n ⇔ m = n ∨ m < n
⊦ ∀n k. Bits.width n ≤ k ⇔ n < 2 ↑ k
⊦ ∀m n. ¬(m = 0) ⇒ m * n mod m = 0
⊦ ∀x y z. x = y ∧ y = z ⇒ x = z
⊦ ∀t1 t2 t3. (t1 ∧ t2) ∧ t3 ⇔ t1 ∧ t2 ∧ t3
⊦ ∀t1 t2 t3. (t1 ∨ t2) ∨ t3 ⇔ t1 ∨ t2 ∨ t3
⊦ ∀x y t. Bus.connect x y ⇒ Bus.signal y t = Bus.signal x t
⊦ ∀x y t. connect x y ⇒ (signal y t ⇔ signal x t)
⊦ ∀n k i. Bits.bit n (k + i) ⇔ Bits.bit (Bits.shiftRight n k) i
⊦ ∀m n p. m * (n * p) = m * n * p
⊦ ∀m n p. m + (n + p) = m + n + p
⊦ ∀n k1 k2.
Bits.shiftLeft n (k1 + k2) = Bits.shiftLeft (Bits.shiftLeft n k1) k2
⊦ ∀n k1 k2.
Bits.shiftRight n (k1 + k2) = Bits.shiftRight (Bits.shiftRight n k1) k2
⊦ ∀m n p. m + n = m + p ⇔ n = p
⊦ ∀p m n. m + p = n + p ⇔ m = n
⊦ ∀m n p. m + n < m + p ⇔ n < p
⊦ ∀m n p. n + m < p + m ⇔ n < p
⊦ ∀m n p. m + n ≤ m + p ⇔ n ≤ p
⊦ ∀m n p. n + m ≤ p + m ⇔ n ≤ p
⊦ ∀m n p. m < n ∧ n < p ⇒ m < p
⊦ ∀m n p. m < n ∧ n ≤ p ⇒ m < p
⊦ ∀m n p. m ≤ n ∧ n < p ⇒ m < p
⊦ ∀m n p. m ≤ n ∧ n ≤ p ⇒ m ≤ p
⊦ ∀s t. s ⊆ t ⇔ ∀x. x ∈ s ⇒ x ∈ t
⊦ ∀s t. (∀x. x ∈ s ⇔ x ∈ t) ⇔ s = t
⊦ ∀x k n y. Bus.sub x k n y ⇒ Bus.width y = n
⊦ ∀m n. m ≤ suc n ⇔ m = suc n ∨ m ≤ n
⊦ ∀m n. m * n = 0 ⇔ m = 0 ∨ n = 0
⊦ ∀m n. m + n = 0 ⇔ m = 0 ∧ n = 0
⊦ ∀x i w. Bus.wire x i w ⇔ Bus.sub x i 1 (Bus.single w)
⊦ ∀x y t. not x y ⇒ (signal y t ⇔ ¬signal x t)
⊦ ∀p. p 0 ∧ (∀n. p n ⇒ p (suc n)) ⇒ ∀n. p n
⊦ ∀n m. ¬(n = 0) ⇒ m mod n mod n = m mod n
⊦ ∀m n. m ↑ n = 0 ⇔ m = 0 ∧ ¬(n = 0)
⊦ ∀p x. x ∈ { y. y | p y } ⇔ p x
⊦ ∀x y n. Bus.reverse x y ∧ Bus.width x = n ⇒ Bus.width y = n
⊦ ∀n i k. Bits.bit (Bits.bound n k) i ⇔ i < k ∧ Bits.bit n i
⊦ ∀m n p. m * (n + p) = m * n + m * p
⊦ ∀m n p. m ↑ (n + p) = m ↑ n * m ↑ p
⊦ ∀m n p. (m + n) * p = m * p + n * p
⊦ ∀k n1 n2.
Bits.shiftLeft (n1 + n2) k = Bits.shiftLeft n1 k + Bits.shiftLeft n2 k
⊦ ∀n1 n2 k.
Bits.shiftRight (n1 + Bits.shiftLeft n2 k) k =
Bits.shiftRight n1 k + n2
⊦ ∀n j k.
Bits.shiftRight (Bits.bound n (j + k)) k =
Bits.bound (Bits.shiftRight n k) j
⊦ ∀s t x. x ∈ s ∩ t ⇔ x ∈ s ∧ x ∈ t
⊦ ∀s t x. x ∈ s ∪ t ⇔ x ∈ s ∨ x ∈ t
⊦ ∀p. (∀n. (∀m. m < n ⇒ p m) ⇒ p n) ⇒ ∀n. p n
⊦ ∀x y t. Bus.delay x y ⇒ Bus.signal y (t + 1) = Bus.signal x t
⊦ ∀x y k. Bus.sub x k 0 y ⇔ k ≤ Bus.width x ∧ y = Bus.nil
⊦ ∀w x t.
Bus.signal (Bus.append (Bus.single w) x) t =
signal w t :: Bus.signal x t
⊦ ∀x y t. delay x y ⇒ (signal y (t + 1) ⇔ signal x t)
⊦ ∀p q. (∀x. p x ∧ q x) ⇔ (∀x. p x) ∧ ∀x. q x
⊦ ∀p q. (∃x. p x) ∨ (∃x. q x) ⇔ ∃x. p x ∨ q x
⊦ ∀ld nb dn t. signal ld t ∧ counterPulse ld nb dn ⇒ ¬signal dn t
⊦ ∀m n. ¬(n = 0) ⇒ (m div n) * n + m mod n = m
⊦ ∀m n. m * n = 1 ⇔ m = 1 ∧ n = 1
⊦ ∀m n p. m * n = m * p ⇔ m = 0 ∨ n = p
⊦ ∀m n p. m * p = n * p ⇔ m = n ∨ p = 0
⊦ ∀m n p. m * n ≤ m * p ⇔ m = 0 ∨ n ≤ p
⊦ ∀m n p. m * p ≤ n * p ⇔ m ≤ n ∨ p = 0
⊦ ∀m n k.
Bits.bound (Bits.bound m k * Bits.bound n k) k = Bits.bound (m * n) k
⊦ ∀w d wd t. pipe w d wd ⇒ (signal wd (t + d) ⇔ signal w t)
⊦ ∀m n p. m * n < m * p ⇔ ¬(m = 0) ∧ n < p
⊦ ∀x y s c. adder2 x y s c ⇔ xor2 x y s ∧ and2 x y c
⊦ ∀x y z t. and2 x y z ⇒ (signal z t ⇔ signal x t ∧ signal y t)
⊦ ∀x y z t. or2 x y z ⇒ (signal z t ⇔ signal x t ∨ signal y t)
⊦ ∀n m p. ¬(n = 0) ⇒ m * (p mod n) mod n = m * p mod n
⊦ ∀n m p. ¬(n = 0) ⇒ (m mod n) * p mod n = m * p mod n
⊦ ∀x y z t. xor2 x y z ⇒ (signal z t ⇔ ¬(signal x t ⇔ signal y t))
⊦ ∀s t. finite s ∧ finite t ∧ disjoint s t ⇒ size (s ∪ t) = size s + size t
⊦ ∀x y t.
Bits.toNatural (Bus.signal (Bus.append x y) t) =
Bits.toNatural (Bus.signal x t) +
Bits.shiftLeft (Bits.toNatural (Bus.signal y t)) (Bus.width x)
⊦ ∀x y z t. nor2 x y z ⇒ (signal z t ⇔ ¬signal x t ∧ ¬signal y t)
⊦ ∀n m p. ¬(n = 0) ⇒ (m mod n) * (p mod n) mod n = m * p mod n
⊦ ∀n a b. ¬(n = 0) ⇒ (a mod n + b mod n) mod n = (a + b) mod n
⊦ ∀w x i xi t.
Bus.pipe w x ∧ Bus.wire x i xi ⇒ (signal xi (t + i) ⇔ signal w t)
⊦ ∀s x y z t.
Bus.case1 s x y z ⇒
Bus.signal z t = if signal s t then Bus.signal x t else Bus.signal y t
⊦ ∀s x y z t.
case1 s x y z ⇒
(signal z t ⇔ if signal s t then signal x t else signal y t)
⊦ ∀w x y z t.
or3 w x y z ⇒ (signal z t ⇔ signal w t ∨ signal x t ∨ signal y t)
⊦ ∀n x t.
(∀i xi. Bus.wire x i xi ⇒ (signal xi t ⇔ Bits.bit n i)) ⇒
Bits.toNatural (Bus.signal x t) = Bits.bound n (Bus.width x)
⊦ ∀x k n y i w.
Bus.sub x k n y ⇒ (Bus.wire y i w ⇔ i < n ∧ Bus.wire x (k + i) w)
⊦ ∀x y j yj.
Bus.reverse x y ∧ Bus.wire y j yj ⇒
∃i. i + (j + 1) = Bus.width x ∧ Bus.wire x i yj
⊦ ∀x m n. x ↑ m ≤ x ↑ n ⇔ if x = 0 then m = 0 ⇒ n = 0 else x = 1 ∨ m ≤ n
⊦ ∀x y z k m n.
Bus.sub x k m y ∧ Bus.sub x (k + m) n z ⇒
Bus.sub x k (m + n) (Bus.append y z)
⊦ ∀n r k m a.
¬(n = 0) ∧ ¬(r = 0) ∧ a ≤ r * m ⇒ Montgomery.reduce n r k a < m + n
⊦ ∀x y i xi yi xt yt.
Bus.wire x i xi ∧ Bus.wire y i yi ∧ Bus.signal x xt = Bus.signal y yt ⇒
(signal xi xt ⇔ signal yi yt)
⊦ ∀x y s c t.
adder2 x y s c ⇒
fromBool (signal x t) + fromBool (signal y t) =
fromBool (signal s t) + 2 * fromBool (signal c t)
⊦ ∀n r s k a.
¬(n = 0) ∧ r * s = k * n + 1 ⇒
Montgomery.reduce n r k a mod n = a * s mod n
⊦ ∀x y k n xs ys xt yt.
Bus.sub x k n xs ∧ Bus.sub y k n ys ∧
Bus.signal x xt = Bus.signal y yt ⇒ Bus.signal xs xt = Bus.signal ys yt
⊦ ∀x y z s c t.
Bus.adder3 x y z s c ⇒
Bits.toNatural (Bus.signal x t) +
(Bits.toNatural (Bus.signal y t) + Bits.toNatural (Bus.signal z t)) =
Bits.toNatural (Bus.signal s t) + 2 * Bits.toNatural (Bus.signal c t)
⊦ ∀x y z s c t.
adder3 x y z s c ⇒
fromBool (signal x t) +
(fromBool (signal y t) + fromBool (signal z t)) =
fromBool (signal s t) + 2 * fromBool (signal c t)
⊦ ∀ld w x t k.
(∀i. i ≤ k ⇒ (signal ld (t + i) ⇔ i = 0)) ∧ sticky ld w x ⇒
(signal x (t + k) ⇔ ∃i. i ≤ k ∧ signal w (t + i))
⊦ ∀x k n y.
Bus.sub x k n y ⇒
∃d p q.
Bus.width x = k + (n + d) ∧ Bus.sub x 0 k p ∧ Bus.sub x (k + n) d q ∧
x = Bus.append p (Bus.append y q)
⊦ ∀n r s k a.
2 ↑ r * s = k * n + 1 ⇒
Montgomery.reduce n (2 ↑ r) k a =
Bits.shiftRight a r +
(Bits.shiftRight (Bits.bound (a * k) r * n) r +
fromBool (¬(Bits.bound (a * (k * n)) r = 0)))
⊦ ∀n ld nb dn t k.
(∀i. i ≤ k ⇒ (signal ld (t + i) ⇔ i = 0)) ∧
Bits.toNatural (Bus.signal nb t) + (n + 2) =
2 ↑ Bus.width nb + Bus.width nb ∧ counterPulse ld nb dn ⇒
(signal dn (t + k) ⇔ k = n + 1)
⊦ ∀n ld nb inc dn t k.
(∀i. i ≤ k ⇒ (signal ld (t + i) ⇔ i = 0)) ∧
Bits.toNatural (Bus.signal nb t) + n = 2 ↑ Bus.width nb ∧
eventCounter ld nb inc dn ⇒
(signal dn (t + k) ⇔
n ≤ size { i. i | 0 < i ∧ i + Bus.width nb ≤ k ∧ signal inc (t + i) })
⊦ ∀x y ld xb ys yc zb zs zc t k.
(∀i.
i ≤ k ⇒
(signal ld (t + i) ⇔ i = 0) ∧ (signal xb (t + i) ⇔ Bits.bit x i) ∧
(Bits.bit x i ⇒
Bits.toNatural (Bus.signal ys (t + i)) +
2 * Bits.toNatural (Bus.signal yc (t + i)) = y)) ∧
Bus.multiplier ld xb ys yc zb zs zc ⇒
Bits.cons (signal zb (t + k))
(Bits.toNatural (Bus.signal zs (t + k)) +
2 * Bits.toNatural (Bus.signal zc (t + k))) =
Bits.shiftRight (Bits.bound x (k + 1) * y) k
⊦ ∀x y ld xs xc d ys yc zb zs zc t k.
(∀i. i ≤ k ⇒ (signal ld (t + i) ⇔ i = 0)) ∧
Bits.toNatural (Bus.signal xs t) +
2 * Bits.toNatural (Bus.signal xc t) = x ∧
(∀i.
i ≤ d + k ∧ d ≤ i ∧ i ≤ Bus.width xs + (d + 1) ⇒
Bits.toNatural (Bus.signal ys (t + i)) +
2 * Bits.toNatural (Bus.signal yc (t + i)) = y) ∧
SumCarry.multiplier ld xs xc d ys yc zb zs zc ⇒
Bits.cons (signal zb (t + (d + k)))
(Bits.toNatural (Bus.signal zs (t + (d + k))) +
2 * Bits.toNatural (Bus.signal zc (t + (d + k)))) =
Bits.shiftRight (Bits.bound x (k + 1) * y) k