Skip to content

Commit 8d4d45c

Browse files
proof(SafeChecksum): DISCHARGE adler32ModIsLargestPrimeBelow2Pow16 via Refl (proven#90 #107 #119) (#122)
Round 17 of the [proven#107](#107) overly-cautious-OWED hunt, surfaced by the post-empirical re-audit. \`\`\`idris public export adler32ModIsLargestPrimeBelow2Pow16 : adler32Mod = 65521 adler32ModIsLargestPrimeBelow2Pow16 = Refl \`\`\` \`adler32Mod\` is \`public export = 65521 : Nat\` (SafeChecksum.idr L55-56). Empirically verified in \`/tmp/charrefl\` that Idris2 0.8.0 reduces Nat-literal equality regardless of magnitude (including \`1073741824 = 1073741824\`). Same shape as merged #109 (maxCompressionRatio, maxTotalSize) and #110 (maxNestingDepth). Refs #90 #107 #119 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3973139 commit 8d4d45c

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/Proven/SafeChecksum/Proofs.idr

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ public export
6262
crc32PolynomialIsIEEE : crc32Polynomial = 0xEDB88320
6363
crc32PolynomialIsIEEE = Refl
6464

65-
||| OWED: Adler-32 modulus is `65521`, the largest prime less than
66-
||| `2^16` (the choice is load-bearing — primality is what gives
67-
||| Adler-32 its error-detection properties). Held back by Idris2
68-
||| 0.8.0 not reducing `65521 : Nat` to `S (S (S … 0))` by Refl alone
69-
||| (literal Nat normalisation). Discharge once a `Data.Nat`
70-
||| reflective tactic is available, or refactor `adler32Mod` to
71-
||| `Bits32` like `crc32Polynomial`.
65+
||| DISCHARGED: Adler-32 modulus is `65521`. `adler32Mod` is
66+
||| `public export = 65521 : Nat` (SafeChecksum.idr L55-56). Both
67+
||| sides are the same Nat literal — Idris2 compares Nat literals via
68+
||| Integer representation without unary expansion, so `Refl` closes.
69+
||| Empirical verification: `the Nat 1073741824 = 1073741824 = Refl`
70+
||| works (`reference_idris2_0_8_0_reduction_map.md`). Same pattern as
71+
||| SafeArchive `maxCompressionRatioAnchor` (#109) and SafeCBOR
72+
||| `maxNestingDepthAnchor` (#110).
7273
public export
73-
0 adler32ModIsLargestPrimeBelow2Pow16 : adler32Mod = 65521
74+
adler32ModIsLargestPrimeBelow2Pow16 : adler32Mod = 65521
75+
adler32ModIsLargestPrimeBelow2Pow16 = Refl
7476

7577
--------------------------------------------------------------------------------
7678
-- `verifyX` is, by definition, `X == expected`

0 commit comments

Comments
 (0)