Commit 2c2e37e
## Summary
First slice of the proof-obligation catalogue's "ready-this-week" list.
Six semigroup/monoid laws over built-in operators (no stdlib dep),
asserted through the **tree-walking interpreter** — the source-level
oracle, backend-independent.
| # | Law |
|---|---|
| 1 | string `++` associativity: `(a ++ b) ++ c = a ++ (b ++ c)` |
| 2 | string `++` left unit: `"" ++ s = s` |
| 3 | string `++` right unit: `s ++ "" = s` |
| 4 | int `/` truncates positive: `5 / 2 = 2` |
| 5 | int `/` truncates negative (#478 source-level): `-5 / 2 = -2` |
| 6 | int `+` associativity: `(a + b) + c = a + (b + c)` |
## Why the interpreter is the right oracle
We assert what every backend **must preserve**, not what one backend
lowers to. The #478 fix's codegen invariant is already covered by the
`int_div` codegen-deno harness; this PR's case 5 asserts the
*source-level* invariant the codegen must respect — if the AS semantics
were ever changed (e.g. to floored division like Python), this would
catch it before any backend was even compiled.
## Test count
**363 / 363** (was 357). Runtime delta ≈ 50 ms. No flakes.
## Next batches
The catalogue's top-20 ready-this-week items continue with:
- Option / Result functor laws (`map(id) = id`, `map(f ∘ g) = map(f) ∘
map(g)`)
- Dict key uniqueness under insert/delete
- Bytes endianness round-trip
- JSON round-trip
- Hash stability on derived-`Hash` AST types
- Borrow-graph return-escape & NLL-last-use regression assertions
- Formatter idempotence
Each batch ships as one focused PR so reverts are surgical and the
proof-obligation tracking issue list (to be filed) maps 1:1.
## Stacked on #511
Base is `main`; the diff currently includes #511's changes because the
branch forks from `fix/cicd-foundational-2026-06-01`. Once #511 merges,
`git rebase main` patch-equivalent-skips the shared commits and this PR
shrinks to the 2-file delta.
## Test plan
- [x] `dune runtest` 363 / 363 green
- [x] All 6 new cases pass on local interpreter
- [ ] Same after #511 merges + rebase
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 03d7d67 commit 2c2e37e
2 files changed
Lines changed: 148 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
| 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 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
0 commit comments