Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions hardware/divider/GrowingWordDivision.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ any sequence of dividend bits the kept word, the sign and the quotient bits are
Core Lean 4 only.
-/

namespace colony
namespace Colony

/-- Exact non-restoring step: subtract while the remainder is non-negative, add back otherwise. -/
def stepZ (b r x : Int) : Int := if 0 ≤ r then 2 * r + x - b else 2 * r + x + b
Expand Down Expand Up @@ -261,7 +261,7 @@ theorem div_zero : ∀ (xs : List Bool) (H Q A : Int), 0 < H → 0 ≤ A → 2 *
have e : (2 * Q + 1 + 1) = (Q + 1) * 2 := by omega
rw [e, Int.mul_assoc, Int.mul_comm 2 (2 ^ xs.length)]

end colony
end Colony

#print axioms colony.div_correct
#print axioms colony.div_zero
#print axioms Colony.div_correct
#print axioms Colony.div_zero
2 changes: 1 addition & 1 deletion hardware/divider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ sh prove.sh 10
```

Yosys's SAT solver proves `udiv` equal to `/` and `%` for every `a` and every `b > 0`, and its `b = 0` outputs, at each width from 1 to 10. Widths 16, 32 and 64 are simulated against the operators.
`GrowingWordDivision.lean` proves the recurrence for every width in Lean 4, core library only: `colony.div_correct` states that for `0 < b <= 2^n` the rows return `a / b` and the remainder word is `a % b`. Run `lean GrowingWordDivision.lean`.
`GrowingWordDivision.lean` proves the recurrence for every width in Lean 4, core library only: `Colony.div_correct` states that for `0 < b <= 2^n` the rows return `a / b` and the remainder word is `a % b`. Run `lean GrowingWordDivision.lean`.

## Paid evaluation

Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_be_d32.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// CRC-32 (0x04C11DB7) over the first (4 - empty) bytes of data_in, starting from state_in. 206 LUT-6, 10 levels.
// Equal to (4 - empty) chained taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.REVERSE(1),.DATA_W(8),.DATA_OUT_EN(0)) steps,
// byte 0 = data_in[7:0] first. Bytes past the valid ones must be zero.
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_be_d32 (
input wire [31:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_be_d32_lut6.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// CRC-32 (0x04C11DB7) over the first (4 - empty) bytes of data_in, starting from state_in. 206 LUT-6, 10 levels.
// Equal to (4 - empty) chained taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.REVERSE(1),.DATA_W(8),.DATA_OUT_EN(0)) steps,
// byte 0 = data_in[7:0] first. Bytes past the valid ones must be zero.
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_be_d32_lut6 (
input wire [31:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_be_d64.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// CRC-32 (0x04C11DB7) over the first (8 - empty) bytes of data_in, starting from state_in. 348 LUT-6, 13 levels.
// Equal to (8 - empty) chained taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.REVERSE(1),.DATA_W(8),.DATA_OUT_EN(0)) steps,
// byte 0 = data_in[7:0] first. Bytes past the valid ones must be zero.
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_be_d64 (
input wire [63:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_be_d64_lut6.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// CRC-32 (0x04C11DB7) over the first (8 - empty) bytes of data_in, starting from state_in. 348 LUT-6, 13 levels.
// Equal to (8 - empty) chained taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.REVERSE(1),.DATA_W(8),.DATA_OUT_EN(0)) steps,
// byte 0 = data_in[7:0] first. Bytes past the valid ones must be zero.
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_be_d64_lut6 (
input wire [63:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_d16.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 16 data bits per word. 54 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(16),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(0)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_d16 (
input wire [15:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_d16_lut6.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 16 data bits per word. 54 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(16),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(0)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_d16_lut6 (
input wire [15:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_d32.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 32 data bits per word. 97 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(32),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(0)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_d32 (
input wire [31:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_d32_lut6.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 32 data bits per word. 97 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(32),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(0)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_d32_lut6 (
input wire [31:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_d64.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 64 data bits per word. 150 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(64),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(0)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_d64 (
input wire [63:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_d64_lut6.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 64 data bits per word. 150 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(64),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(0)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_d64_lut6 (
input wire [63:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_d8.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 8 data bits per word. 40 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(8),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(0)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_d8 (
input wire [7:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_d8_lut6.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 8 data bits per word. 40 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(8),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(0)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_d8_lut6 (
input wire [7:0] data_in,
input wire [31:0] state_in,
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_tx_d40.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 40 data bits per word, state_in = 0, STATE_SHIFT_POST = -24. 41 LUT-6, 2 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(40),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(-24)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_tx_d40 (
input wire [39:0] data_in,
output wire [31:0] state_out
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_tx_d40_lut6.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 40 data bits per word, state_in = 0, STATE_SHIFT_POST = -24. 41 LUT-6, 2 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(40),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(-24)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_tx_d40_lut6 (
input wire [39:0] data_in,
output wire [31:0] state_out
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_tx_d56.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 56 data bits per word, state_in = 0, STATE_SHIFT_POST = -24. 75 LUT-6, 2 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(56),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(-24)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_tx_d56 (
input wire [55:0] data_in,
output wire [31:0] state_out
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_tx_d56_lut6.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 56 data bits per word, state_in = 0, STATE_SHIFT_POST = -24. 75 LUT-6, 2 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(56),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(-24)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_tx_d56_lut6 (
input wire [55:0] data_in,
output wire [31:0] state_out
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_tx_d88.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 88 data bits per word, state_in = 0, STATE_SHIFT_POST = -24. 121 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(88),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(-24)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_tx_d88 (
input wire [87:0] data_in,
output wire [31:0] state_out
Expand Down
2 changes: 1 addition & 1 deletion hardware/linear/taxi/crc32_tx_d88_lut6.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// CRC-32 (0x04C11DB7), 88 data bits per word, state_in = 0, STATE_SHIFT_POST = -24. 121 LUT-6, 3 levels.
// Equal to taxi_lfsr #(.LFSR_W(32),.LFSR_POLY(32'h4c11db7),.LFSR_GALOIS(1),.LFSR_FEED_FORWARD(0),.REVERSE(1),.DATA_W(88),.DATA_IN_EN(1'b1),.DATA_OUT_EN(1'b0),.STATE_SHIFT_PRE(0),.STATE_SHIFT_POST(-24)).
// Generated by the colony.technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
// Generated by the Colony Technology linear-map compiler: https://github.com/lmtlssss/speedrunpapi/tree/main/hardware/linear
module crc32_tx_d88_lut6 (
input wire [87:0] data_in,
output wire [31:0] state_out
Expand Down
14 changes: 7 additions & 7 deletions hardware/multiplier/FoldDivision.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Fold division. D + eps = 2^P with eps small. A running value W = T * 2^(P+o) +
W' = L + T * eps * 2^o. The difference is T * D * 2^o, so T is a quotient digit at offset o.
Core Lean only.
-/
namespace colony.Fold
namespace Colony.Fold

/-- One fold removes exactly T * D * 2^o. -/
theorem step (P o T L eps D W W' : Nat) (hD : D + eps = 2 ^ P)
Expand Down Expand Up @@ -114,10 +114,10 @@ theorem select (a d Q : Nat) (hd : 0 < d) (h1 : Q * d ≤ a) (h2 : a < Q * d + 3
· refine (Nat.div_mod_unique hd).mpr ⟨?_, by omega⟩
rw [Nat.mul_add, Nat.mul_comm d Q]; omega

end colony.Fold
end Colony.Fold

#print axioms colony.Fold.invariant
#print axioms colony.Fold.fields
#print axioms colony.Fold.bound
#print axioms colony.Fold.last
#print axioms colony.Fold.select
#print axioms Colony.Fold.invariant
#print axioms Colony.Fold.fields
#print axioms Colony.Fold.bound
#print axioms Colony.Fold.last
#print axioms Colony.Fold.select
8 changes: 4 additions & 4 deletions hardware/multiplier/GrowingWordDivision.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ any sequence of dividend bits the kept word, the sign and the quotient bits are
Core Lean 4 only.
-/

namespace colony
namespace Colony

/-- Exact non-restoring step: subtract while the remainder is non-negative, add back otherwise. -/
def stepZ (b r x : Int) : Int := if 0 ≤ r then 2 * r + x - b else 2 * r + x + b
Expand Down Expand Up @@ -261,7 +261,7 @@ theorem div_zero : ∀ (xs : List Bool) (H Q A : Int), 0 < H → 0 ≤ A → 2 *
have e : (2 * Q + 1 + 1) = (Q + 1) * 2 := by omega
rw [e, Int.mul_assoc, Int.mul_comm 2 (2 ^ xs.length)]

end colony
end Colony

#print axioms colony.div_correct
#print axioms colony.div_zero
#print axioms Colony.div_correct
#print axioms Colony.div_zero
2 changes: 1 addition & 1 deletion hardware/multiplier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The 64 x 64 multiplier checks in 0.5 s and the 64-bit squarer in 0.3 s on an App

`independent_fold_checker.py` proves the fold divider from the netlist: the leading-zero count against a counter (ABC `cec`); every shifter LUT as a 4:1 select; the table on all 2,048 readings, with `0 <= 2^75 - M * dn < 2^65` for every `dn` under each reading; each heap as a polynomial identity over its wires, exact for the folds; each adder against a ripple adder (ABC `cec`); the bound `W' < 3 * 2^p` after each fold; the output selection. 4 s for 64 bits. `FoldDivision.lean` proves the fold step, the bound, `Q*b <= a < Q*b + 3b` after the last field and the selection among `R, R - b, R - 2b` for all integers. `test_fold.py` checks 8- and 9-bit builds on every input and removes minterms one at a time: 120 altered netlists, none accepted with a wrong result.

The two recurrences themselves are proved in Lean 4 for every width, core library only: `GrowingWordDivision.lean` (`colony.div_correct`: the rows return `a / b` and `a % b`; `colony.div_zero`) and `RetainedSignSqrt.lean` (`colony.sqrt_correct`: `Q*Q <= X < (Q+1)*(Q+1)`). Run `lean GrowingWordDivision.lean`; each checks in under three seconds. The netlist checkers prove every row equals its recurrence, and these files prove the recurrence.
The two recurrences themselves are proved in Lean 4 for every width, core library only: `GrowingWordDivision.lean` (`Colony.div_correct`: the rows return `a / b` and `a % b`; `Colony.div_zero`) and `RetainedSignSqrt.lean` (`Colony.sqrt_correct`: `Q*Q <= X < (Q+1)*(Q+1)`). Run `lean GrowingWordDivision.lean`; each checks in under three seconds. The netlist checkers prove every row equals its recurrence, and these files prove the recurrence.

`test_mul.py` runs exhaustive simulation at small widths and removes minterms one at a time: 191 altered 8-bit netlists, none accepted with a wrong product.

Expand Down
6 changes: 3 additions & 3 deletions hardware/multiplier/RetainedSignSqrt.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ signs, and takes the sign as the top bit. `sqrt_correct` shows the root bits sa
`Q * Q ≤ X < (Q + 1) * (Q + 1)` for every radicand given by its bit pairs. Core Lean 4 only.
-/

namespace colony
namespace Colony

/-- Exact step: `p` is the next pair of radicand bits, `Q` the root bits so far. -/
def stepS (r Q p : Int) : Int := if 0 ≤ r then 4 * r + p - (4 * Q + 1) else 4 * r + p + (4 * Q + 3)
Expand Down Expand Up @@ -179,6 +179,6 @@ theorem sqrt_correct (ps : List Int) (hps : ∀ p ∈ ps, 0 ≤ p ∧ p ≤ 3) :
· obtain ⟨h1, h2⟩ := hp (by omega)
constructor <;> omega

end colony
end Colony

#print axioms colony.sqrt_correct
#print axioms Colony.sqrt_correct
2 changes: 1 addition & 1 deletion hardware/threshold/abc_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A direct `cec reference delivered` is undecided: the two netlists share no internal
functions and SAT cannot bridge two different 1001-input counters. The chain inserts
hybrids H_h (tree blocks of height <= h in colony's redundant form, converted to binary
hybrids H_h (tree blocks of height <= h in Colony's redundant form, converted to binary
at the cut; plain binary addition above). Consecutive netlists differ by one local merge
rule, so ABC's SAT sweeping matches the block sums and each step is decided.
Equivalence is transitive, so the chain is a proof by the evaluator alone.
Expand Down
2 changes: 1 addition & 1 deletion hardware/threshold/bdd_threshold_check.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Certificate-free exact check: BLIF netlist == [popcount(A) >= T].
// Reduced ordered BDDs, variable order A[0] < A[1] < ... ; canonical form => pointer equality.
// Uses no derivation and no colony code. Build: c++ -O2 -std=c++17 bdd_threshold_check.cpp -o bddcheck
// Uses no derivation and no Colony code. Build: c++ -O2 -std=c++17 bdd_threshold_check.cpp -o bddcheck
#include <cstdio>
#include <cstdlib>
#include <cstdint>
Expand Down
2 changes: 1 addition & 1 deletion hardware/threshold/lean_proof.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Emit a Lean 4 proof that a threshold netlist equals [popcount >= T] for every input.

Input: BLIF netlist and its colony.lut-threshold.v1 derivation. Output: one self-contained .lean file
(core Lean only, no Mathlib). The Lean kernel, not colony code, is the judge:
(core Lean only, no Mathlib). The Lean kernel, not Colony code, is the judge:
- each LUT is a definition by its truth-table constant;
- each node identity is a lemma proved by exhaustive case split on its Boolean inputs;
- node identities are summed in chunks by `omega`; the final theorem is
Expand Down
2 changes: 1 addition & 1 deletion hardware/vendor/quartus-21.1.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

## Matched CRC comparison

| Width | Plain ALMs | colony ALMs | Plain MHz | colony MHz | ALM ratio colony / plain |
| Width | Plain ALMs | Colony ALMs | Plain MHz | Colony MHz | ALM ratio Colony / plain |
|--:|--:|--:|--:|--:|--:|
| 512 | 1081 | 1203 | 108.48 | 109.90 | 1.113× |
| 1024 | 2019 | 2112 | 109.75 | 108.47 | 1.046× |
Expand Down
2 changes: 1 addition & 1 deletion proofs/carry-frontier-4096/SUBMISSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The full packet is checked locally using:

All evidence is bound to the exact original bytes. The receipt has a
local ephemeral Ed25519 **laboratory** signature. It is not a production
colony certificate and establishes no third-party signer identity.
Colony certificate and establishes no third-party signer identity.

## Integration / claim boundary

Expand Down
2 changes: 1 addition & 1 deletion proofs/carry-frontier-4096/signature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schema": "colony.market-lab-signature.v1",
"signature_scope": "laboratory observation receipt",
"issuer": "colony independent local lab, ephemeral key",
"issuer": "Colony independent local lab, ephemeral key",
"signature_algorithm": "Ed25519",
"signer_key_id": "lab-sha256:99c8c73e879f43400",
"public_key_spki_base64": "MCowBQYDK2VwAyEAyyrfXhLuxVARYLFrCEmooIdfwrnNv1Wdtu5+bbWvCtQ=",
Expand Down
Loading
Loading