Commit 0f837ee
feat(proofs): fully prove SwitchCaseBodyBridge, reduce axiom count 3→2 (#1557)
* refactor(proofs): decompose SwitchCaseBodyBridge axiom into proved theorem + narrower axiom
Replace the `SwitchCaseBodyBridge` axiom with:
1. `exec_switchCaseBody_continue_of_long` (proved theorem) — when dispatch
guards are safe and calldata arity is sufficient, the guard prefix
(comment + optional callvalue guard + calldatasize guard) of
`switchCaseBody fn` steps through as a no-op, reducing execution to
`fn.body` in the same state.
2. `SwitchCaseBodyBridge_body` (narrower axiom) — purely Yul-level: executing
a statement list with `__has_selector` set and dispatch fuel gives the same
rollback-wrapped result as total `execYulStmts` execution. Captures variable
irrelevance and fuel adequacy without mentioning IR types.
3. `SwitchCaseBodyBridge` (proved theorem) — composes the above two pieces to
match the original axiom interface used by `yulCodegen_preserves_semantics`.
The active axiom count remains at 4, but the trusted surface is strictly
smaller: the new axiom is purely Yul-level and does not mention
`IRFunction`, `IRTransaction`, `execIRFunction`, `resultsMatch`, or
`interpretYulRuntime`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: allowlist new SwitchCaseBodyBridge decomposition proofs
Add `exec_switchCaseBody_continue_of_long` and `SwitchCaseBodyBridge`
to the proof length allowlist. Both are transport-heavy reductions over
reducible Yul semantics, mirroring the existing allowlisted
`exec_switchCaseBody_revert_of_short` and `SwitchCaseBodyBridge_short`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(proofs): decompose SwitchCaseBodyBridge_body into two independent axioms
Split the `SwitchCaseBodyBridge_body` axiom into two independent,
narrower axioms and make `SwitchCaseBodyBridge_body` a proved theorem
composing them:
1. `execYulStmtsFuel_setVar_hasSelector_irrelevant` — variable irrelevance:
the `__has_selector` dispatch variable is never read by function body
statements, so setting it does not change execution.
2. `execYulStmtsFuel_fuel_adequate` — fuel adequacy: the rollback-wrapped
result under any fuel budget matches the total execution result.
Both axioms are purely Yul-level and do not mention IR types. This
increases the total axiom count from 4 to 5 but makes each axiom
independently auditable and testable.
AXIOMS.md updated with correct numbering (1-5) and trust summary.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(proofs): fully prove SwitchCaseBodyBridge and sizeOf_buildSwitch_ge_switchCases
Eliminate the SwitchCaseBodyBridge axiom entirely by proving all structural
sizeOf bounds mechanically. The key additions:
- sizeOf_lt_of_mem: list membership implies strictly smaller sizeOf
- sizeOf_switchCaseBody_ge: switchCaseBody fn has sizeOf ≥ fn.body + 2
- sizeOf_switchCases_gt_body: switchCases list sizeOf > any member's body
- sizeOf_buildSwitch_ge_switchCases: fully proved structural AST bound
- sizeOf_buildSwitch_ge_fn_body: composing the above for fn.body + 12
SwitchCaseBodyBridge is now a proved theorem threading a fuel precondition
(hFuelAdequate : fuel ≥ sizeOf fn.body + 5) that is discharged at the
call site using sizeOf_buildSwitch_ge_fn_body.
The execYulStmtsFuel_fuel_adequate axiom is narrowed to require an explicit
h : fuel ≥ sizeOf body + 1 precondition with unwrapped equality.
Axiom count in Preservation.lean: 3 → 2.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: root <root@agent.gazella-vector.ts.net>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent f026ac0 commit 0f837ee
4 files changed
Lines changed: 377 additions & 26 deletions
File tree
- Compiler/Proofs/YulGeneration
- artifacts
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | | - | |
| 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 | + | |
59 | 99 | | |
60 | | - | |
| 100 | + | |
61 | 101 | | |
62 | 102 | | |
63 | 103 | | |
| |||
117 | 157 | | |
118 | 158 | | |
119 | 159 | | |
120 | | - | |
| 160 | + | |
121 | 161 | | |
122 | 162 | | |
123 | 163 | | |
| |||
453 | 493 | | |
454 | 494 | | |
455 | 495 | | |
456 | | - | |
457 | | - | |
458 | | - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
459 | 513 | | |
460 | 514 | | |
461 | 515 | | |
462 | 516 | | |
463 | 517 | | |
464 | 518 | | |
465 | 519 | | |
466 | | - | |
| 520 | + | |
467 | 521 | | |
468 | 522 | | |
469 | 523 | | |
| |||
488 | 542 | | |
489 | 543 | | |
490 | 544 | | |
491 | | - | |
| 545 | + | |
0 commit comments