Commit 9bb35ee
feat(proofs): Lean array typing — mirror Coq's T_Array/T_Lit_Array (#90)
## What
Closes the one **array-shaped Tier-1 gap** on the Lean side of the
formal development. AUDIT.md flagged it as *"exactly the Tier-1 item
still open on the Lean side"*; `WokeLang.lean` is now at parity with
`WokeLang.v` on arrays.
The `array` / `vArray` syntax already existed in Lean but had **no
typing rules**, so `induction` in `progress`/`preservation` never saw an
array case. This adds the rules and the operational semantics, with full
proof coverage.
## Changes (`docs/proofs/verification/WokeLang.lean`, +117 / −0 — purely
additive)
**Typing** (mirror of Coq `T_Array` / `T_Lit_Array`):
- `tArray` — `(∀ e ∈ es, HasType Γ e t) → HasType Γ (.array es) (.array
t)`
- `tArrayVal` — `(∀ v ∈ vs, HasType Γ (.lit v) t) → HasType Γ (.lit
(.vArray vs)) (.array t)`
**Evaluation** (mirror of `S_Array_step` / `S_Array_val` + panic
propagation):
- `sArrayStep` — reduce the left-most non-value element
- `sArrayVal` — normalise `.array (vs.map .lit)` to the literal value
`.lit (.vArray vs)`
- `sArrayErr` — propagate a panic out of an array (as the binop rules
do)
**Proofs** — `progress` and `preservation` extended to cover all three
step rules; helper lemmas `isLitB` + `array_split` (the analogue of
Coq's `array_elements_progress`).
## Verification
- `lean docs/proofs/verification/WokeLang.lean` → **exit 0, empty
output** (no errors, no warnings).
- **`sorry`-free and axiom-free** under Lean 4.30.0.
- Diff is **+117 / −0** on the proof file: existing theorems are
untouched; every change is a new constructor or a new case, so no
existing `cases`/`induction` becomes non-exhaustive.
- `WokeLang.v` (Coq) is **not modified**.
## Method note (vs. Coq)
Lean's `∀ e ∈ es` premise yields a **per-element induction hypothesis
directly** from `induction`, so — unlike the Coq proof — **no
well-founded recursion on an `expr_size` measure** is needed
(`array_split` does the pure-list decomposition; the IH answers
value-or-steps per element). A fully-evaluated array is *not* an
`IsValue` (it always steps via `sArrayVal` to the array literal), so
array equality reuses the generic `.lit`-equality rules after
normalisation rather than needing the extra array-equality step rules
Coq carries. `AUDIT.md` is updated to record the new parity.
> Branch note: `claude/sleepy-carson-bREoV` was based on current `main`
(it had been 9 commits behind). Its two prior commits — a Coq repair +
CI gate and a machine-readable state update — are fully superseded by
`main` (which already carries both CI gates, the repaired `WokeLang.v`,
and the binop-parity work). They are folded into history via a `-s ours`
merge (nothing rewritten or lost); the branch tree is a clean superset
of `main`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_013wg3Mtq2QFhYi4XVw1Z6z7
---
_Generated by [Claude
Code](https://claude.ai/code/session_013wg3Mtq2QFhYi4XVw1Z6z7)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 178786e commit 9bb35ee
2 files changed
Lines changed: 159 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| |||
151 | 153 | | |
152 | 154 | | |
153 | 155 | | |
154 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
155 | 183 | | |
156 | 184 | | |
157 | 185 | | |
| |||
178 | 206 | | |
179 | 207 | | |
180 | 208 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
185 | 219 | | |
186 | 220 | | |
187 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
38 | 49 | | |
39 | 50 | | |
40 | 51 | | |
| |||
221 | 232 | | |
222 | 233 | | |
223 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
224 | 247 | | |
225 | 248 | | |
226 | 249 | | |
| |||
332 | 355 | | |
333 | 356 | | |
334 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
335 | 372 | | |
336 | 373 | | |
337 | 374 | | |
| |||
386 | 423 | | |
387 | 424 | | |
388 | 425 | | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
389 | 460 | | |
390 | 461 | | |
391 | 462 | | |
| |||
838 | 909 | | |
839 | 910 | | |
840 | 911 | | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
841 | 938 | | |
842 | 939 | | |
843 | 940 | | |
| |||
1036 | 1133 | | |
1037 | 1134 | | |
1038 | 1135 | | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
1039 | 1156 | | |
1040 | 1157 | | |
1041 | 1158 | | |
| |||
0 commit comments