2026-07-03 07:44:40 +00:00
# Verifying Cryptography with Lean 4
**A hands-on curriculum for undergraduates with zero formal-verification
background** — from `1 + 1 = 2` to reading (and extending) real,
machine-checked proofs that production elliptic-curve code is correct.
This is the educational companion to a family of verification projects in
Accuracy sweep: bring the book to the proven four-tier apex state
The companion repos completed their signature apex (phases 1+2: four
button-enforced tiers up to "accept <=> decompress(R) = [k](-A)+[s]B as
points") and the scalar layer long ago crossed the kernel frontier - but
the book still taught the pre-campaign state, including one real
inaccuracy of the class coherence pass 3 purged from the repo READMEs:
ch12's apex section and audit-drill solution described the COFACTORED
equation (8sB = 8R + 8kA) with SIMD backends in the trusted base -
neither matches the proven certificates (canonical-R byte equality,
serial path pinned and proven, SHA-512 an oracle with NO assumed
properties).
Fixed:
- ch12: pyramid status diagram (scalar + signature rows now "done"),
the scalar-frontier paragraph (the wall was crossed, and how), the
apex section (future tense -> the proven four-tier statement, honest
trusted base), the "extend the pyramid" bullet (scalar -> pasta curve
layer; CONTRIBUTING files never existed - now points at the control
repo's METHOD/TIERS), exercise 12.2(c) solution (which lineage the
cofactored robustness belongs to), exercise 12.3 + solution (audit
the REAL certificate).
- ch01: framing diagram states the equation actually proven
(sB = R + kA from raw bytes, not the cofactored form).
- glossary: Cofactor entry says which verifiers check which equation.
- ch11: the companion repos' posture is stronger than the ideal-hash
example - no hash properties assumed at all, backend question
eliminated rather than assumed.
- ch08: extraction notes (one merged universe; extract-scalar.sh was
retired in coherence pass 3; SIMD scoped out, not assumed).
- repo tour appendix: floor plan, reading order (item 5 now tours the
apex capstone), Phase 3b described.
- README: companion table rows say "the complete pyramid" with the
four-tier apex; honesty ledger records this 2026-07-06 re-audit.
main.pdf rebuilt from the updated sources (106 pages, zero errors,
build-pass4.log retained).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 05:46:27 +00:00
which complete Ed25519 proof pyramids (from
2026-07-03 07:44:40 +00:00
[curve25519-dalek ](https://github.com/dalek-cryptography/curve25519-dalek )
Accuracy sweep: bring the book to the proven four-tier apex state
The companion repos completed their signature apex (phases 1+2: four
button-enforced tiers up to "accept <=> decompress(R) = [k](-A)+[s]B as
points") and the scalar layer long ago crossed the kernel frontier - but
the book still taught the pre-campaign state, including one real
inaccuracy of the class coherence pass 3 purged from the repo READMEs:
ch12's apex section and audit-drill solution described the COFACTORED
equation (8sB = 8R + 8kA) with SIMD backends in the trusted base -
neither matches the proven certificates (canonical-R byte equality,
serial path pinned and proven, SHA-512 an oracle with NO assumed
properties).
Fixed:
- ch12: pyramid status diagram (scalar + signature rows now "done"),
the scalar-frontier paragraph (the wall was crossed, and how), the
apex section (future tense -> the proven four-tier statement, honest
trusted base), the "extend the pyramid" bullet (scalar -> pasta curve
layer; CONTRIBUTING files never existed - now points at the control
repo's METHOD/TIERS), exercise 12.2(c) solution (which lineage the
cofactored robustness belongs to), exercise 12.3 + solution (audit
the REAL certificate).
- ch01: framing diagram states the equation actually proven
(sB = R + kA from raw bytes, not the cofactored form).
- glossary: Cofactor entry says which verifiers check which equation.
- ch11: the companion repos' posture is stronger than the ideal-hash
example - no hash properties assumed at all, backend question
eliminated rather than assumed.
- ch08: extraction notes (one merged universe; extract-scalar.sh was
retired in coherence pass 3; SIMD scoped out, not assumed).
- repo tour appendix: floor plan, reading order (item 5 now tours the
apex capstone), Phase 3b described.
- README: companion table rows say "the complete pyramid" with the
four-tier apex; honesty ledger records this 2026-07-06 re-audit.
main.pdf rebuilt from the updated sources (106 pages, zero errors,
build-pass4.log retained).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 05:46:27 +00:00
and three production forks — field, group law, scalars, and the signature
verifier itself) and the Pasta curves' field layer were machine-checked in
Lean 4 against models extracted from the actual Rust sources:
2026-07-03 07:44:40 +00:00
| Companion project | What is verified there |
|---|---|
Accuracy sweep: bring the book to the proven four-tier apex state
The companion repos completed their signature apex (phases 1+2: four
button-enforced tiers up to "accept <=> decompress(R) = [k](-A)+[s]B as
points") and the scalar layer long ago crossed the kernel frontier - but
the book still taught the pre-campaign state, including one real
inaccuracy of the class coherence pass 3 purged from the repo READMEs:
ch12's apex section and audit-drill solution described the COFACTORED
equation (8sB = 8R + 8kA) with SIMD backends in the trusted base -
neither matches the proven certificates (canonical-R byte equality,
serial path pinned and proven, SHA-512 an oracle with NO assumed
properties).
Fixed:
- ch12: pyramid status diagram (scalar + signature rows now "done"),
the scalar-frontier paragraph (the wall was crossed, and how), the
apex section (future tense -> the proven four-tier statement, honest
trusted base), the "extend the pyramid" bullet (scalar -> pasta curve
layer; CONTRIBUTING files never existed - now points at the control
repo's METHOD/TIERS), exercise 12.2(c) solution (which lineage the
cofactored robustness belongs to), exercise 12.3 + solution (audit
the REAL certificate).
- ch01: framing diagram states the equation actually proven
(sB = R + kA from raw bytes, not the cofactored form).
- glossary: Cofactor entry says which verifiers check which equation.
- ch11: the companion repos' posture is stronger than the ideal-hash
example - no hash properties assumed at all, backend question
eliminated rather than assumed.
- ch08: extraction notes (one merged universe; extract-scalar.sh was
retired in coherence pass 3; SIMD scoped out, not assumed).
- repo tour appendix: floor plan, reading order (item 5 now tours the
apex capstone), Phase 3b described.
- README: companion table rows say "the complete pyramid" with the
four-tier apex; honesty ledger records this 2026-07-06 re-audit.
main.pdf rebuilt from the updated sources (106 pages, zero errors,
build-pass4.log retained).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 05:46:27 +00:00
| [dalek-ed25519-verified ](https://github.com/saymrwulf/dalek-ed25519-verified ) | the complete pyramid, upstream dalek: field 𝔽ₚ + Edwards group law + scalar arithmetic mod ℓ + the four-tier signature apex (accept ⇔ decompress(R) = [k ](− A )+[s]B, hash opaque) |
| [anza-ed25519-verified ](https://github.com/saymrwulf/anza-ed25519-verified ) | the complete pyramid, Solana's fork, its own extraction |
| [risc0-ed25519-verified ](https://github.com/saymrwulf/risc0-ed25519-verified ) | the complete pyramid, RISC Zero's fork |
| [betrusted-ed25519-verified ](https://github.com/saymrwulf/betrusted-ed25519-verified ) | the complete pyramid, Betrusted's fork |
2026-07-03 07:44:40 +00:00
| [pasta-pallas-verified ](https://github.com/saymrwulf/pasta-pallas-verified ) | Pallas modulus primality (Lucas/Pratt), Montgomery foundations |
| [formal-verification-control ](https://github.com/saymrwulf/formal-verification-control ) | the method: invariants, terrain map, failure map, tooling |
## The book
book overhaul move 6: the Second Summit chapter + the book ends once
New Chapter 13, 'The Second Summit: A Hash-Based Pyramid' — SLH-DSA
(FIPS 205) as the transfer experiment for the whole method:
- opens on leaf 18 as the anomaly; correctness-vs-security across the
quantum divide ('a correct implementation of a broken lock is still a
broken lock')
- Lamport -> Winternitz chains with the checksum see-saw run twice on
real w=16 numbers, including a concrete failed forgery (480 -> 479,
digit 14 -> 13)
- FORS worked at napkin scale (k=2, a=2, one reuse = one forgery) and
real scale (28 of 57,344, exponent 14)
- the virtual hypertree: digest split 21/7/2 to the bit, the 54-bit
meter peeled 9 bits per layer, verification priced exactly (254 fixed
oracle calls; the see-saw itself caps a layer at 510, so worst case
3,824 — the naive 525*35 bound is unreachable, and the chapter says
why); ~2^72 to build vs ~2^12 to check
- the eleven certificates, the loop-to-fold bridges, the honest
'visible, not correct' boundary (no second semantics — and why the
natural move fails), the cone-growth table, the t_l/t_len naming
inversion told as the war story it was, the apex as an audit
invitation with the verbatim theorem named
- 'The leaf, live': leaf-vs-head precision ('plausible, and wrong
twice'), the three-clause self-reference ledger (attested machinery /
attested scheme / honest gap), one-command tryit
- six exercises with pathway'd solutions; checkpoint hands the
who-checks-them question to the finale
Structural: attestation renamed ch14 and now carries the book's single
ending (where-to-go, further reading, final reframe, prospective
checkpoint — moved from ch12); its two interior checkpoints demoted to
bigidea/tryit so the terminal checkpoint stands alone; opening now
receives ch13's baton. ch12 ends as a chapter. Front matter: three-summit
arc, fourteen-week plan, honest discussion-exercise count; ch01 promise
ladder extended to Chapters 13/14; glossary +5 entries (and the
pre-existing Hasse-bound misordering fixed); README fourteen chapters +
build.sh recipe.
Every constant verified against fips205-slhdsa-verified and
lean-transparency-log by four adversarial checkers; arithmetic
independently recomputed; didactic panel scored the chapter 9/8 —
the book's high-water mark. Build: 128 pages, zero unresolved refs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-08 08:39:08 +00:00
**[`main.pdf`](main.pdf)** — fourteen chapters + interlude + three
2026-08-07 14:00:54 +00:00
appendices, full color, built with LaTeX/TikZ from the sources in this
book overhaul move 6: the Second Summit chapter + the book ends once
New Chapter 13, 'The Second Summit: A Hash-Based Pyramid' — SLH-DSA
(FIPS 205) as the transfer experiment for the whole method:
- opens on leaf 18 as the anomaly; correctness-vs-security across the
quantum divide ('a correct implementation of a broken lock is still a
broken lock')
- Lamport -> Winternitz chains with the checksum see-saw run twice on
real w=16 numbers, including a concrete failed forgery (480 -> 479,
digit 14 -> 13)
- FORS worked at napkin scale (k=2, a=2, one reuse = one forgery) and
real scale (28 of 57,344, exponent 14)
- the virtual hypertree: digest split 21/7/2 to the bit, the 54-bit
meter peeled 9 bits per layer, verification priced exactly (254 fixed
oracle calls; the see-saw itself caps a layer at 510, so worst case
3,824 — the naive 525*35 bound is unreachable, and the chapter says
why); ~2^72 to build vs ~2^12 to check
- the eleven certificates, the loop-to-fold bridges, the honest
'visible, not correct' boundary (no second semantics — and why the
natural move fails), the cone-growth table, the t_l/t_len naming
inversion told as the war story it was, the apex as an audit
invitation with the verbatim theorem named
- 'The leaf, live': leaf-vs-head precision ('plausible, and wrong
twice'), the three-clause self-reference ledger (attested machinery /
attested scheme / honest gap), one-command tryit
- six exercises with pathway'd solutions; checkpoint hands the
who-checks-them question to the finale
Structural: attestation renamed ch14 and now carries the book's single
ending (where-to-go, further reading, final reframe, prospective
checkpoint — moved from ch12); its two interior checkpoints demoted to
bigidea/tryit so the terminal checkpoint stands alone; opening now
receives ch13's baton. ch12 ends as a chapter. Front matter: three-summit
arc, fourteen-week plan, honest discussion-exercise count; ch01 promise
ladder extended to Chapters 13/14; glossary +5 entries (and the
pre-existing Hasse-bound misordering fixed); README fourteen chapters +
build.sh recipe.
Every constant verified against fips205-slhdsa-verified and
lean-transparency-log by four adversarial checkers; arithmetic
independently recomputed; didactic panel scored the chapter 9/8 —
the book's high-water mark. Build: 128 pages, zero unresolved refs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-08 08:39:08 +00:00
repo (`./build.sh`, tectonic, no root needed). No prior Lean or formal
methods assumed; high-school algebra and a little programming suffice.
2026-07-03 07:44:40 +00:00
1. **Why Verify?** — the carry bug testing cannot find
2. **Meet Lean** — programs, types, inductive data
3. **Propositions as Types** — Curry– Howard: proofs *are* programs
4. **Tactics** — proving as a dialogue with the goal state
5. **Numbers and Automation** — `omega` , `ring` , `norm_num` , `decide` , and the `simp` discipline
6. **Modular Arithmetic** — clock worlds, fields, why 2²⁵⁵ − 19
7. **Primality Certificates** — convincing a paranoid kernel a 77-digit number is prime
8. **From Rust to Lean** — the Charon/Aeneas extraction pipeline
9. **The Denotation Bridge** — the commuting square at the heart of it all
Major didactic overhaul: pen-and-paper worked examples + in-book solution pathways, 2x volume (53 -> 106 pages)
- pen-and-paper worked examples in all 12 chapters, using the REAL
constants throughout: 2^-64 waiting-time arithmetic, headroom budgets,
hand type-checking, rfl traces, full goal-state boards, the column-sum
audit at 2^54, inverting 19 mod p via Euclid, the x19 fold at real
weights, denoting p itself (telescope), the 16p audit (8 fails by 151),
the 254+11 inversion-chain bookkeeping, the substitution test, sizing
the 28-vs-1000 extraction, cofactor/torsion arithmetic, and the full
Bernstein-Lange completeness derivation
- CORRECTNESS FIX: ch7 asserted a false factorization of p-1; replaced
with the computationally verified p-1 = 2^2 * 3 * 65147 * Q (Q 71-digit
prime), witness w=2 verified for all four Pratt conditions
- every chapter's exercises now followed immediately by 'Solutions and
pathways' (pathway first, then answer), incl. new exercises
- NEW Interlude: a complete two-clause verification done entirely by
hand, then mapped line-by-line onto the compiled Lean proof
- NEW appendices: A pen-and-paper toolkit (8 recipe cards + drills +
answers), B guided walkthroughs of every exercise-file hole, C tour of
the real repositories; plus glossary, instructor notes, 13-week plan
- preamble: worked-example box, solution macros, math-safe inline code
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 08:55:00 +00:00
— ** *Interlude*** — a complete verification, entirely by hand, then re-enacted in Lean line by line
2026-07-03 07:44:40 +00:00
10. **Verifying a Field** — the full campaign, told honestly (including the crash)
11. **Honesty and Axioms** — `#print axioms` , hollow certificates, trusted bases
12. **The Pyramid** — group law, scalars, signatures, and where you come in
book overhaul move 6: the Second Summit chapter + the book ends once
New Chapter 13, 'The Second Summit: A Hash-Based Pyramid' — SLH-DSA
(FIPS 205) as the transfer experiment for the whole method:
- opens on leaf 18 as the anomaly; correctness-vs-security across the
quantum divide ('a correct implementation of a broken lock is still a
broken lock')
- Lamport -> Winternitz chains with the checksum see-saw run twice on
real w=16 numbers, including a concrete failed forgery (480 -> 479,
digit 14 -> 13)
- FORS worked at napkin scale (k=2, a=2, one reuse = one forgery) and
real scale (28 of 57,344, exponent 14)
- the virtual hypertree: digest split 21/7/2 to the bit, the 54-bit
meter peeled 9 bits per layer, verification priced exactly (254 fixed
oracle calls; the see-saw itself caps a layer at 510, so worst case
3,824 — the naive 525*35 bound is unreachable, and the chapter says
why); ~2^72 to build vs ~2^12 to check
- the eleven certificates, the loop-to-fold bridges, the honest
'visible, not correct' boundary (no second semantics — and why the
natural move fails), the cone-growth table, the t_l/t_len naming
inversion told as the war story it was, the apex as an audit
invitation with the verbatim theorem named
- 'The leaf, live': leaf-vs-head precision ('plausible, and wrong
twice'), the three-clause self-reference ledger (attested machinery /
attested scheme / honest gap), one-command tryit
- six exercises with pathway'd solutions; checkpoint hands the
who-checks-them question to the finale
Structural: attestation renamed ch14 and now carries the book's single
ending (where-to-go, further reading, final reframe, prospective
checkpoint — moved from ch12); its two interior checkpoints demoted to
bigidea/tryit so the terminal checkpoint stands alone; opening now
receives ch13's baton. ch12 ends as a chapter. Front matter: three-summit
arc, fourteen-week plan, honest discussion-exercise count; ch01 promise
ladder extended to Chapters 13/14; glossary +5 entries (and the
pre-existing Hasse-bound misordering fixed); README fourteen chapters +
build.sh recipe.
Every constant verified against fips205-slhdsa-verified and
lean-transparency-log by four adversarial checkers; arithmetic
independently recomputed; didactic panel scored the chapter 9/8 —
the book's high-water mark. Build: 128 pages, zero unresolved refs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-08 08:39:08 +00:00
13. **The Second Summit** — a hash-based pyramid for the quantum era: SLH-DSA (FIPS 205), Winternitz chains and the checksum see-saw, the virtual hypertree, the eleven certificates and their cone-growth table, and leaf 18 live
14. **The Attestation Protocol** — what it takes to make "it is proven" checkable by a stranger; closes with *Go and touch the real thing* : a guided reading of the estate's **live transparency log** (ltl.zkdefi.org — 19 leaves, the four ed25519 pyramids at 44 certificates, the log's own Merkle proofs as leaf 17, and the first post-quantum leaf, SLH-DSA, as leaf 18), including the fifteen-minute verify-it-yourself exercise
2026-07-03 07:44:40 +00:00
Major didactic overhaul: pen-and-paper worked examples + in-book solution pathways, 2x volume (53 -> 106 pages)
- pen-and-paper worked examples in all 12 chapters, using the REAL
constants throughout: 2^-64 waiting-time arithmetic, headroom budgets,
hand type-checking, rfl traces, full goal-state boards, the column-sum
audit at 2^54, inverting 19 mod p via Euclid, the x19 fold at real
weights, denoting p itself (telescope), the 16p audit (8 fails by 151),
the 254+11 inversion-chain bookkeeping, the substitution test, sizing
the 28-vs-1000 extraction, cofactor/torsion arithmetic, and the full
Bernstein-Lange completeness derivation
- CORRECTNESS FIX: ch7 asserted a false factorization of p-1; replaced
with the computationally verified p-1 = 2^2 * 3 * 65147 * Q (Q 71-digit
prime), witness w=2 verified for all four Pratt conditions
- every chapter's exercises now followed immediately by 'Solutions and
pathways' (pathway first, then answer), incl. new exercises
- NEW Interlude: a complete two-clause verification done entirely by
hand, then mapped line-by-line onto the compiled Lean proof
- NEW appendices: A pen-and-paper toolkit (8 recipe cards + drills +
answers), B guided walkthroughs of every exercise-file hole, C tour of
the real repositories; plus glossary, instructor notes, 13-week plan
- preamble: worked-example box, solution macros, math-safe inline code
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 08:55:00 +00:00
Appendices: **A** — the pen-and-paper toolkit (recipe cards with drills);
**B** — guided walkthroughs of every exercise-file hole; **C** — a tour of
book overhaul move 6: the Second Summit chapter + the book ends once
New Chapter 13, 'The Second Summit: A Hash-Based Pyramid' — SLH-DSA
(FIPS 205) as the transfer experiment for the whole method:
- opens on leaf 18 as the anomaly; correctness-vs-security across the
quantum divide ('a correct implementation of a broken lock is still a
broken lock')
- Lamport -> Winternitz chains with the checksum see-saw run twice on
real w=16 numbers, including a concrete failed forgery (480 -> 479,
digit 14 -> 13)
- FORS worked at napkin scale (k=2, a=2, one reuse = one forgery) and
real scale (28 of 57,344, exponent 14)
- the virtual hypertree: digest split 21/7/2 to the bit, the 54-bit
meter peeled 9 bits per layer, verification priced exactly (254 fixed
oracle calls; the see-saw itself caps a layer at 510, so worst case
3,824 — the naive 525*35 bound is unreachable, and the chapter says
why); ~2^72 to build vs ~2^12 to check
- the eleven certificates, the loop-to-fold bridges, the honest
'visible, not correct' boundary (no second semantics — and why the
natural move fails), the cone-growth table, the t_l/t_len naming
inversion told as the war story it was, the apex as an audit
invitation with the verbatim theorem named
- 'The leaf, live': leaf-vs-head precision ('plausible, and wrong
twice'), the three-clause self-reference ledger (attested machinery /
attested scheme / honest gap), one-command tryit
- six exercises with pathway'd solutions; checkpoint hands the
who-checks-them question to the finale
Structural: attestation renamed ch14 and now carries the book's single
ending (where-to-go, further reading, final reframe, prospective
checkpoint — moved from ch12); its two interior checkpoints demoted to
bigidea/tryit so the terminal checkpoint stands alone; opening now
receives ch13's baton. ch12 ends as a chapter. Front matter: three-summit
arc, fourteen-week plan, honest discussion-exercise count; ch01 promise
ladder extended to Chapters 13/14; glossary +5 entries (and the
pre-existing Hasse-bound misordering fixed); README fourteen chapters +
build.sh recipe.
Every constant verified against fips205-slhdsa-verified and
lean-transparency-log by four adversarial checkers; arithmetic
independently recomputed; didactic panel scored the chapter 9/8 —
the book's high-water mark. Build: 128 pages, zero unresolved refs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-08 08:39:08 +00:00
the real repositories. Plus a glossary and a fourteen-week course plan.
Major didactic overhaul: pen-and-paper worked examples + in-book solution pathways, 2x volume (53 -> 106 pages)
- pen-and-paper worked examples in all 12 chapters, using the REAL
constants throughout: 2^-64 waiting-time arithmetic, headroom budgets,
hand type-checking, rfl traces, full goal-state boards, the column-sum
audit at 2^54, inverting 19 mod p via Euclid, the x19 fold at real
weights, denoting p itself (telescope), the 16p audit (8 fails by 151),
the 254+11 inversion-chain bookkeeping, the substitution test, sizing
the 28-vs-1000 extraction, cofactor/torsion arithmetic, and the full
Bernstein-Lange completeness derivation
- CORRECTNESS FIX: ch7 asserted a false factorization of p-1; replaced
with the computationally verified p-1 = 2^2 * 3 * 65147 * Q (Q 71-digit
prime), witness w=2 verified for all four Pratt conditions
- every chapter's exercises now followed immediately by 'Solutions and
pathways' (pathway first, then answer), incl. new exercises
- NEW Interlude: a complete two-clause verification done entirely by
hand, then mapped line-by-line onto the compiled Lean proof
- NEW appendices: A pen-and-paper toolkit (8 recipe cards + drills +
answers), B guided walkthroughs of every exercise-file hole, C tour of
the real repositories; plus glossary, instructor notes, 13-week plan
- preamble: worked-example box, solution macros, math-safe inline code
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 08:55:00 +00:00
The didactic machinery, deliberately heavy:
- **Pen-and-paper worked examples in every chapter** — computations with
the *real* constants (2²⁵⁵− 19, radix 2⁵¹, the fold constant 19, the
actual 254-squaring inversion chain, the true Pratt tree
p− 1 = 2²·3·65147·Q), because the real numbers carry the real arguments.
Highlights: inverting 19 modulo the 77-digit prime in five lines of
Euclid; a fully hand-checked primality certificate for 97; the × 19 fold
derived at the real weights; the 16p subtraction constant audited to the
bit (8 fails by 151); the complete Bernstein– Lange completeness chain.
- **Solutions immediately after every exercise set** — each one leads with
the *pathway* (how a person finds the answer) before the answer itself.
- Boxed **Big idea / Try it / Pitfall / Aha / Checkpoint** elements, TikZ
figures throughout.
Everything the book claims about the companion projects reflects their
actual, auditable state — including open frontiers.
2026-07-03 07:44:40 +00:00
## The exercises (they run!)
`exercises/ChNN.lean` are working files with `sorry` holes;
`solutions/ChNN.lean` are complete. **Every solution file compiles with
zero errors** against the pinned toolchain (Lean `v4.30.0-rc2` , Mathlib
`5450b53e` ); solutions to proof exercises contain no `sorry` .
Setup (one-time, ~5 min + Mathlib cache download):
```bash
# 1. install elan (Lean version manager) if you haven't:
curl https://elan.lean-lang.org/elan-init.sh -sSf | sh
# 2. fetch the Mathlib build cache (do NOT build Mathlib yourself):
cd verifying-crypto-with-lean
lake exe cache get
# 3. open the folder in VS Code with the "Lean 4" extension, or:
lake build Solutions # compiles all solution files as a check
```
Chapters 2– 4 need no Mathlib at all — you can start them with any Lean 4
install while the cache downloads.
move 7: the book's button — check-book.sh + check-book.py
The only source of 'ALL GREEN' for this repository. Rebuilds the PDF,
then verifies 93 countable claims printed in the book against reality
measured at run time:
- source hygiene: inputs<->files both directions, contiguous ch01..ch14,
every chapter (and the interlude) ends on its checkpoint, per-chapter
exercise count == solution count with hand-typed numbering N.1..N.k
- built PDF: >=100 pages, zero unresolved references, any page-count
claim in prose must equal pdfinfo
- internal congruence: chapter-count words in README/ch01 vs measured N
('spent twelve chapters' in ch13 is checked as a positional count, not
grepped as stale — the spelling-vs-property lesson, applied to the
checker itself); week-plan heading == max table row; the
discussion-exercise roster parsed from prose == measured set; the
SLH-DSA arithmetic recomputed from scratch (digest split 21/7/2, sig
7856, fixed 254, per-layer max 510 by brute force, worst 3824,
checksum digit examples) and each value required present in ch13
- cross-repo congruence: 19 leaves derived by property (six-digit
filenames + index fields — the entries/ glob counts 25); every
nineteen/19 claim in prose parsed and compared; leaves 13-16 subjects
+ 44 certs; leaves 12/17 = 61; leaves 0-11 = 16; leaf 18 = 11 certs,
apex cone kernel-3+5 oracles, ht cone f,h,t_l, four kernel-3-only
plumbing certs, all cones exact; first dual-signed head at size 14;
final head size == leaf count; ch13 parameter card == the const-generic
arguments parsed out of the extracted Funs.lean; ch07's 71-digit Q ==
P25519.lean digit for digit
Fails closed: a missing sibling repo is a FAILURE, not a skip;
BOOK_LOCAL_ONLY=1 skips cross-repo loudly and never prints ALL GREEN.
--selftest mutates copies of the sources seven ways (count drift,
deleted solution, one Q digit, leaf-count drift, arithmetic drift,
stray box after a checkpoint, plan/heading divergence) and requires each
to be caught BY ITS OWN CHECK, plus an unmutated control that must pass.
Full run: ALL GREEN (93 checks). Selftest: 8/8.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-08 12:16:30 +00:00
## The button
Like every repository in this estate, the book has one command that earns
its claims — and it is the only source of the words "ALL GREEN" here:
```bash
./check-book.sh
```
It rebuilds the PDF from the committed sources and then verifies ~90
countable claims printed in the book against reality measured at run
time: chapter and week-plan counts, exercise↔solution pairing per chapter,
every chapter ending on its checkpoint, the recomputed SLH-DSA arithmetic
(digest split, signature size, the 3,824-call worst case), the
transparency log's 19 leaves and per-leaf certificate counts, leaf 18's
axiom cones, the first dual-signed head at size 14, the extracted
SLH-DSA-SHA2-128s parameter card, and chapter 7's 71-digit Q — digit for
digit against `P25519.lean` . Numbers are parsed out of the prose and
compared to measurements, so editing either side alone turns the button
red. Cross-repo checks need the sibling estate repos checked out next to
this one (`BOOK_LOCAL_ONLY=1` skips them, loudly, and never prints ALL
GREEN). `./check-book.sh --selftest` mutates copies of the sources seven
ways and proves each mutation is caught by its own check.
2026-07-03 07:44:40 +00:00
## Building the book
book overhaul move 6: the Second Summit chapter + the book ends once
New Chapter 13, 'The Second Summit: A Hash-Based Pyramid' — SLH-DSA
(FIPS 205) as the transfer experiment for the whole method:
- opens on leaf 18 as the anomaly; correctness-vs-security across the
quantum divide ('a correct implementation of a broken lock is still a
broken lock')
- Lamport -> Winternitz chains with the checksum see-saw run twice on
real w=16 numbers, including a concrete failed forgery (480 -> 479,
digit 14 -> 13)
- FORS worked at napkin scale (k=2, a=2, one reuse = one forgery) and
real scale (28 of 57,344, exponent 14)
- the virtual hypertree: digest split 21/7/2 to the bit, the 54-bit
meter peeled 9 bits per layer, verification priced exactly (254 fixed
oracle calls; the see-saw itself caps a layer at 510, so worst case
3,824 — the naive 525*35 bound is unreachable, and the chapter says
why); ~2^72 to build vs ~2^12 to check
- the eleven certificates, the loop-to-fold bridges, the honest
'visible, not correct' boundary (no second semantics — and why the
natural move fails), the cone-growth table, the t_l/t_len naming
inversion told as the war story it was, the apex as an audit
invitation with the verbatim theorem named
- 'The leaf, live': leaf-vs-head precision ('plausible, and wrong
twice'), the three-clause self-reference ledger (attested machinery /
attested scheme / honest gap), one-command tryit
- six exercises with pathway'd solutions; checkpoint hands the
who-checks-them question to the finale
Structural: attestation renamed ch14 and now carries the book's single
ending (where-to-go, further reading, final reframe, prospective
checkpoint — moved from ch12); its two interior checkpoints demoted to
bigidea/tryit so the terminal checkpoint stands alone; opening now
receives ch13's baton. ch12 ends as a chapter. Front matter: three-summit
arc, fourteen-week plan, honest discussion-exercise count; ch01 promise
ladder extended to Chapters 13/14; glossary +5 entries (and the
pre-existing Hasse-bound misordering fixed); README fourteen chapters +
build.sh recipe.
Every constant verified against fips205-slhdsa-verified and
lean-transparency-log by four adversarial checkers; arithmetic
independently recomputed; didactic panel scored the chapter 9/8 —
the book's high-water mark. Build: 128 pages, zero unresolved refs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-08 08:39:08 +00:00
The repo's own recipe (tectonic, user-space, no root — installs itself on
first run):
```bash
./build.sh
```
Or any TeX Live ≥ 2023 with `tikz` , `tcolorbox` , `listings` , `lmodern` :
2026-07-03 07:44:40 +00:00
```bash
pdflatex main.tex & & pdflatex main.tex # twice for the TOC
```
## Honesty ledger
In the spirit of Chapter 11:
- All `solutions/*.lean` were compiled (and their `#eval` outputs checked
against their comments) at authoring time with the pinned versions above.
- Exercise templates compile with `sorry` warnings only.
- The book's claims about the companion projects (what is proven, what is
frontier) mirror those repos' own READMEs and TRUSTED-BASE ledgers at the
time of writing; the repos, not this book, are the source of truth.
Accuracy sweep: bring the book to the proven four-tier apex state
The companion repos completed their signature apex (phases 1+2: four
button-enforced tiers up to "accept <=> decompress(R) = [k](-A)+[s]B as
points") and the scalar layer long ago crossed the kernel frontier - but
the book still taught the pre-campaign state, including one real
inaccuracy of the class coherence pass 3 purged from the repo READMEs:
ch12's apex section and audit-drill solution described the COFACTORED
equation (8sB = 8R + 8kA) with SIMD backends in the trusted base -
neither matches the proven certificates (canonical-R byte equality,
serial path pinned and proven, SHA-512 an oracle with NO assumed
properties).
Fixed:
- ch12: pyramid status diagram (scalar + signature rows now "done"),
the scalar-frontier paragraph (the wall was crossed, and how), the
apex section (future tense -> the proven four-tier statement, honest
trusted base), the "extend the pyramid" bullet (scalar -> pasta curve
layer; CONTRIBUTING files never existed - now points at the control
repo's METHOD/TIERS), exercise 12.2(c) solution (which lineage the
cofactored robustness belongs to), exercise 12.3 + solution (audit
the REAL certificate).
- ch01: framing diagram states the equation actually proven
(sB = R + kA from raw bytes, not the cofactored form).
- glossary: Cofactor entry says which verifiers check which equation.
- ch11: the companion repos' posture is stronger than the ideal-hash
example - no hash properties assumed at all, backend question
eliminated rather than assumed.
- ch08: extraction notes (one merged universe; extract-scalar.sh was
retired in coherence pass 3; SIMD scoped out, not assumed).
- repo tour appendix: floor plan, reading order (item 5 now tours the
apex capstone), Phase 3b described.
- README: companion table rows say "the complete pyramid" with the
four-tier apex; honesty ledger records this 2026-07-06 re-audit.
main.pdf rebuilt from the updated sources (106 pages, zero errors,
build-pass4.log retained).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 05:46:27 +00:00
Re-audited 2026-07-06 after the signature apex reached its final
four-tier form (coherence pass 4): chapter 12's status diagram, apex
section, and audit-drill solution, chapter 11's boundary example,
chapter 8's extraction notes, the repo tour, and this table were
brought up to the proven state.
Didactic mentorship revision: the ratchet rule, stated and honored
The owner's requirement, now the book's explicit contract (new "ratchet
rule" box in chapter 1): every load-bearing idea is worked at least
twice - once at napkin scale (mod 13, inverses by scanning) and once at
REAL scale, the actual 77-digit Ed25519 constants printed in full with
no digits hidden and no artificial zeros; where raw size genuinely
exceeds paper (a 77-digit square root), the book says so and teaches
witness-auditing instead of pretending.
Socratic audit result: chapters 1-11 already honor the rule (verified
rung by rung - e.g. ch6 pairs the Z/12 clock with 19^-1 mod the real p;
ch7 pairs Pratt-for-97 with costing the real certificate; ch8 runs the
extracted model at the real envelope edge). The gaps were ch12's three
summit rungs, which had NO numeric examples at all. Filled:
- Group law: "running the addition law by hand - napkin curve, then the
real one". Doubling (2,4)->(10,11) mod 13 in full; then the real base
point with x1, y1 printed in 5-digit groups, the first machine step
certified as x1*y1 = q*p + u with the 77-digit witness q printed, and
the student auditing it by casting out nines AND elevens (both clocks
close: 3=3, 1=1). Lands on the real 2B coordinates.
- Scalars: the cycle felt on the napkin curve first (order 16, so
21P = 5P) before the real prime ell.
- Apex: "decompression, run twice". Encode/decode (10,11) as "(11,
even)" mod 13 - x^2 = 3/9 = 9, roots {3,10}, parity picks 10; then
the real compressed base point: all 32 bytes printed (58 66...66),
byte 31 = 0x66 sign-bit read, y_B printed in full, and the
no-shortcuts full-size hand verification 5*y_B - 4 = 4*p, both
78-digit sides printed for digit-by-digit comparison. The square
root honestly declared machine territory, with the witness-checked
certificate named.
- New paper exercise 12.4 (+pathway/solution): encode & decompress
3P = (6,10) solo - the wrong root lands on -3P, one bit doing real
cryptographic work.
Every printed constant machine-verified before typesetting (base point
on-curve, q*p+u exact, 5y-4 = 4p exact, 2B on-curve, toy order 16).
PDF rebuilt: 109 pages, zero errors. Honesty ledger records the
revision.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 07:31:11 +00:00
- Didactic revision (2026-07-06, same day): the book now states and keeps
a "ratchet rule" (chapter 1) — every load-bearing idea worked at napkin
scale AND at real scale with the full 77-digit constants printed,
nothing elided. Chapter 12 gained the missing rungs: the addition law
run by hand on a mod-13 curve and then on the real base point (with a
machine-supplied quotient witness audited by casting out nines and
elevens), the scalar cycle felt on the napkin curve, decompression run
twice (mod-13 sign-bit walk, then the real compressed base point:
byte-31 sign bit, and the full-size hand verification 5·y_B − 4 = 4·p,
every digit printed), plus a new paper exercise (12.4). Every printed
book overhaul move 6: the Second Summit chapter + the book ends once
New Chapter 13, 'The Second Summit: A Hash-Based Pyramid' — SLH-DSA
(FIPS 205) as the transfer experiment for the whole method:
- opens on leaf 18 as the anomaly; correctness-vs-security across the
quantum divide ('a correct implementation of a broken lock is still a
broken lock')
- Lamport -> Winternitz chains with the checksum see-saw run twice on
real w=16 numbers, including a concrete failed forgery (480 -> 479,
digit 14 -> 13)
- FORS worked at napkin scale (k=2, a=2, one reuse = one forgery) and
real scale (28 of 57,344, exponent 14)
- the virtual hypertree: digest split 21/7/2 to the bit, the 54-bit
meter peeled 9 bits per layer, verification priced exactly (254 fixed
oracle calls; the see-saw itself caps a layer at 510, so worst case
3,824 — the naive 525*35 bound is unreachable, and the chapter says
why); ~2^72 to build vs ~2^12 to check
- the eleven certificates, the loop-to-fold bridges, the honest
'visible, not correct' boundary (no second semantics — and why the
natural move fails), the cone-growth table, the t_l/t_len naming
inversion told as the war story it was, the apex as an audit
invitation with the verbatim theorem named
- 'The leaf, live': leaf-vs-head precision ('plausible, and wrong
twice'), the three-clause self-reference ledger (attested machinery /
attested scheme / honest gap), one-command tryit
- six exercises with pathway'd solutions; checkpoint hands the
who-checks-them question to the finale
Structural: attestation renamed ch14 and now carries the book's single
ending (where-to-go, further reading, final reframe, prospective
checkpoint — moved from ch12); its two interior checkpoints demoted to
bigidea/tryit so the terminal checkpoint stands alone; opening now
receives ch13's baton. ch12 ends as a chapter. Front matter: three-summit
arc, fourteen-week plan, honest discussion-exercise count; ch01 promise
ladder extended to Chapters 13/14; glossary +5 entries (and the
pre-existing Hasse-bound misordering fixed); README fourteen chapters +
build.sh recipe.
Every constant verified against fips205-slhdsa-verified and
lean-transparency-log by four adversarial checkers; arithmetic
independently recomputed; didactic panel scored the chapter 9/8 —
the book's high-water mark. Build: 128 pages, zero unresolved refs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-08 08:39:08 +00:00
constant was machine-verified before typesetting.
- The PDF in the repo is built from the committed sources by `./build.sh`
and recommitted alongside source changes; rebuild it yourself if you
don't trust binaries (good instinct), and you should get the same
fourteen-chapter book.
2026-07-03 10:54:51 +00:00
- The three named solution certificates were kernel-audited
(coherence pass 2, 2026-07-03): `Ch09.add_spec` depends on
`[propext, Classical.choice, Quot.sound]` ; `Ch09.mulVal_spec` and
`Ch12.addFixed_spec` on `[propext, Quot.sound]` only. The Interlude's
"compiled and axiom-audited" phrase shipped one pass before its audit
had actually been run — caught by the verification projects' own
coherence process and made true; recorded here in the spirit of
Chapter 11.