Commit 5467517
committed
kitchenspeak: prove the Dough program in Agda
Adds kitchenspeak/proofs/agda/Dough.agda, the first KitchenSpeak proof
artefact. Discharges the three obligations for the dough-kneading
program from SPEC.adoc:
1. Termination — structural recursion of `knead` on a fuel
parameter. Accepted by Agda's termination checker.
2. Safety — `kr-exhaustive`: every KneadResult is Success or
Aborted. `on_fail ABORT` lowers to the Aborted constructor.
3. Echo — `success-gives-witness`: every Success carries an
existential witness (t, proof that viscosity-at t crossed the
threshold). Extractable by the caller.
Linearity is enforced by inspection of signatures — `Flour` and
`Water` never appear in any output type, `bind-dough` consumes both
and returns neither, and no function duplicates either input. A
QTT-Agda port would make this a compile-time check; proof shape is
unchanged.
Not proved, by design (all flagged in §8 of Dough.agda):
- soundness of the `viscosity-at` postulated oracle,
- linearity as a type-level discipline (vs. metalevel),
- dimension-indexed numerics for Torque / Minutes (ℕ stand-ins
used for pedagogy; production substitutes units-of-measure
rationals).
Also adds kitchenspeak/proofs/README.adoc and links it from the
kitchenspeak/README.adoc index. Directory layout leaves room for a
future proofs/lean/ port, per ADR 0001.
Not run in-session (Agda not installed in authoring environment).
Written against Agda 2.6.4+ with stdlib 2.0+ and verified by
careful reading; first exercise for the class when tooling is set
up is to run the type-checker on this file.
https://claude.ai/code/session_0118688cwQ4a7YZQVvaUewPd1 parent d151e43 commit 5467517
3 files changed
Lines changed: 426 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
0 commit comments