You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Bridges from the single-function body equivalence theorem to the remaining matched, arity-safe runtime-dispatch execution shape (`switchCaseBody`, `__has_selector`, and rollback shaping after the dispatch guards have been proved to pass).
49
+
Captures that executing a Yul statement list `body` with the `__has_selector`
50
+
variable set and dispatch-level fuel gives the same rollback-wrapped result as
51
+
executing `body` via the total `execYulStmts` wrapper (which uses `sizeOf`-adequate
52
+
fuel without the extra variable).
53
+
54
+
This axiom is purely Yul-level — it does not mention IR types, transactions, or
55
+
`resultsMatch`. It captures two sub-properties:
56
+
1.**Variable irrelevance**: `__has_selector` is not read by generated function
57
+
bodies, so setting it has no effect on execution.
58
+
2.**Fuel adequacy**: dispatch-level fuel (minus the guard prefix) is at least
59
+
`sizeOf body + 1`, which suffices for total execution.
50
60
51
61
**Why this is currently an axiom**:
52
-
This remains the last contract-level proof gap between body-level Yul equivalence and full selector-dispatch preservation, but the theorem surface is now smaller than before.
53
-
The checked theorem surface now requires both `DispatchGuardsSafe fn tx` and an explicit arity fact `fn.params.length ≤ tx.args.length`.
54
-
The short-calldata failure branch is no longer axiomatized: it is proved by the checked helper lemmas `execYulStmtsFuel_cons_continue`, `execYulStmtsFuel_cons_revert`, `exec_callvalueGuard_noop`, `exec_calldatasizeGuard_revert_of_short_noWrap`, `exec_switchCaseBody_revert_of_short`, and `SwitchCaseBodyBridge_short`.
55
-
What remains axiomatized is only the matched-case bridge from `interpretYulRuntime fn.body ...` to executing the full `switchCaseBody fn` wrapper after the value guard and calldata-size guard are known to pass.
56
-
The remaining blocker is therefore narrower and local: proving the success-path prefix normalization around the leading dispatch comment, optional `callvalueGuard`, and successful `calldatasizeGuard` no-op so the proof can hand control to the already-checked body equivalence theorem without an axiom.
62
+
Variable irrelevance requires showing that `fn.body` never reads `__has_selector`,
63
+
and fuel adequacy requires a monotonicity property over execution fuel. Both are
64
+
understood but not yet mechanized.
57
65
58
-
**Risk**: Medium.
66
+
The former `SwitchCaseBodyBridge` axiom has been decomposed: the guard-prefix
67
+
stepping (comment, optional `callvalueGuard`, `calldatasizeGuard`) is now fully
68
+
proved by `exec_switchCaseBody_continue_of_long`, and `SwitchCaseBodyBridge`
69
+
itself is now a theorem that composes the proved guard stepping with this axiom.
70
+
The short-calldata failure branch was already proved by
71
+
`exec_switchCaseBody_revert_of_short` and `SwitchCaseBodyBridge_short`.
72
+
73
+
**Risk**: Low. This axiom is purely Yul-level and strictly narrower than its
@@ -453,9 +469,13 @@ scoped to contracts that use the module.
453
469
454
470
The repository removed prior axioms related to IR and Yul expression and statement equivalence and address injectivity by making interpreters total and by using a bounded-nat `Address` representation.
455
471
456
-
These removals reduced prior axiom debt. The Layer 3 switch-case bridge still has
457
-
a small explicit preservation-side axiom boundary for dispatch-step normalization
458
-
and case-body bridging; those active axioms are tracked above.
472
+
These removals reduced prior axiom debt. The monolithic `SwitchCaseBodyBridge`
473
+
axiom was decomposed: the guard-prefix stepping is now fully proved by
474
+
`exec_switchCaseBody_continue_of_long`, the short-calldata case by
475
+
`exec_switchCaseBody_revert_of_short` and `SwitchCaseBodyBridge_short`, and
476
+
`SwitchCaseBodyBridge` is now a theorem. The remaining axiom
477
+
`SwitchCaseBodyBridge_body` is purely Yul-level and captures only variable
478
+
irrelevance and fuel adequacy; those active axioms are tracked above.
459
479
460
480
## Non-Axiom: Arithmetic Semantics
461
481
@@ -488,4 +508,4 @@ Any commit that adds, removes, renames, or moves an axiom must update this file
0 commit comments