Skip to content

Commit 2359c9a

Browse files
committed
docs: document Layer 3 prerequisite (execIRStmtFuel)
Critical finding: Layer 3 statement proofs are blocked by fundamental architectural issue that must be resolved first. Problem: - execIRStmt is marked 'partial' (unprovable in Lean) - execYulStmtFuel uses fuel parameter (provable) - Cannot prove equivalence between partial and total functions - All theorem stubs in StatementEquivalence.lean need 'sorry' Solution: - Add execIRStmtFuel: fuel-parametric version of execIRStmt - Mirror structure of execYulStmtFuel - Update execIRStmtsFuel to use it - Prove adequacy: fuel version equals partial version - Update theorem stubs to use fuel versions Impact: - BLOCKS all 8 statement proofs until resolved - Estimated 1 week of work to implement - Once complete, statement proofs become straightforward Updates to roadmap: - Added item #0: "Add execIRStmtFuel" as prerequisite - Marked as blocker for items #1-8 - Added detailed explanation section - Updated effort estimates (3-5 weeks total, up from 2-4) - Updated status count (0/10 instead of 0/9) This explains why StatementEquivalence.lean has all 'sorry' statements - the proof infrastructure wasn't complete yet! Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 91406bb commit 2359c9a

1 file changed

Lines changed: 73 additions & 17 deletions

File tree

docs/ROADMAP.md

Lines changed: 73 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,25 @@ Here's what stands between current state (92%) and full completion (100%):
2626

2727
### 🔴 **Layer 3 Statement Proofs** (THE Critical Path)
2828
**What**: Prove 9 theorems showing IR → Yul compilation correctness
29-
**Status**: 0/9 complete (8 statement proofs + 1 composition)
29+
**Status**: 0/10 complete (1 prerequisite + 8 statement proofs + 1 composition)
3030
**Impact**: 92% → 98% (statements) → 100% (composition)
31-
**Effort**: 2-4 weeks
32-
**Parallelizable**: Yes! All 8 statement proofs are independent
33-
34-
| # | Statement | Difficulty | Effort | Status |
35-
|---|-----------|------------|--------|--------|
36-
| 1 | Variable Assignment | Low | 1h | ⚪ TODO |
37-
| 2 | Storage Load | Low | 1h | ⚪ TODO |
38-
| 3 | Storage Store | Low | 1h | ⚪ TODO |
39-
| 4 | Mapping Load | Medium | 2-4h | ⚪ TODO |
40-
| 5 | Mapping Store | Medium | 2-4h | ⚪ TODO |
41-
| 6 | Conditional (if) | Medium-High | 4-8h | ⚪ TODO |
42-
| 7 | Return | Low | 1-2h | ⚪ TODO |
43-
| 8 | Revert | Low-Medium | 2-3h | ⚪ TODO |
44-
| 9 | **Composition** | High | 1-2d | ⚪ TODO |
31+
**Effort**: 3-5 weeks (1 week prerequisite + 2-4 weeks proofs)
32+
**Parallelizable**: Yes! All 8 statement proofs are independent (after prerequisite)
33+
34+
⚠️ **PREREQUISITE**: Add `execIRStmtFuel` before statement proofs can begin
35+
36+
| # | Statement | Difficulty | Effort | Status | Blocker |
37+
|---|-----------|------------|--------|--------|---------|
38+
| 0 | **Add execIRStmtFuel** | **Medium** | **1w** |**TODO** | **BLOCKS ALL** |
39+
| 1 | Variable Assignment | Low | 1h | ⚪ TODO | Needs #0 |
40+
| 2 | Storage Load | Low | 1h | ⚪ TODO | Needs #0 |
41+
| 3 | Storage Store | Low | 1h | ⚪ TODO | Needs #0 |
42+
| 4 | Mapping Load | Medium | 2-4h | ⚪ TODO | Needs #0 |
43+
| 5 | Mapping Store | Medium | 2-4h | ⚪ TODO | Needs #0 |
44+
| 6 | Conditional (if) | Medium-High | 4-8h | ⚪ TODO | Needs #0 |
45+
| 7 | Return | Low | 1-2h | ⚪ TODO | Needs #0 |
46+
| 8 | Revert | Low-Medium | 2-3h | ⚪ TODO | Needs #0 |
47+
| 9 | **Composition** | High | 1-2d | ⚪ TODO | Needs #1-8 |
4548

4649
### 🟡 **Trust Reduction** (3 Components)
4750
**What**: Eliminate or verify all trusted components
@@ -93,10 +96,63 @@ Complete the final verification layer proving **IR → Yul correctness**. This i
9396
- Fuel-parametric execution models
9497
- Smoke tests demonstrating equivalence for specific cases
9598

96-
**🔄 Pending Work**: 9 theorems remaining
97-
- **8 statement-level equivalence proofs** (parallelizable, independent)
99+
**🔄 Pending Work**: 10 items remaining
100+
- **1 PREREQUISITE**: Add `execIRStmtFuel` (blocks all statement proofs)
101+
- **8 statement-level equivalence proofs** (parallelizable, independent, after prerequisite)
98102
- **1 composition theorem** (depends on all 8 statement proofs)
99103

104+
### ⚠️ Prerequisite: Add `execIRStmtFuel`
105+
106+
**Status**: ⚪ BLOCKED - Must be completed before any statement proofs
107+
108+
**Problem**: Current theorem stubs cannot be proven because:
109+
- `execIRStmt` is marked `partial` in `IRInterpreter.lean`
110+
- Lean cannot reason about `partial` functions in proofs
111+
- Cannot unfold, case-split, or prove properties about them
112+
113+
**Example of the issue**:
114+
```lean
115+
theorem assign_equiv :
116+
execResultsAligned selector
117+
(execIRStmt irState stmt) -- ← partial (unprovable!)
118+
(execYulStmtFuel fuel yulState stmt) -- ← total with fuel (provable)
119+
```
120+
121+
**Solution**: Add fuel-parametric version of `execIRStmt`:
122+
123+
```lean
124+
def execIRStmtFuel (fuel : Nat) (state : IRState) (stmt : YulStmt) : IRExecResult :=
125+
match fuel, stmt with
126+
| 0, _ => .revert state -- Out of fuel
127+
| Nat.succ fuel', .assign name value =>
128+
match evalIRExpr state value with
129+
| some v => .continue (state.setVar name v)
130+
| none => .revert state
131+
| Nat.succ fuel', .let_ name value =>
132+
match evalIRExpr state value with
133+
| some v => .continue (state.setVar name v)
134+
| none => .revert state
135+
-- ... (pattern for all statement types)
136+
```
137+
138+
**Required Work**:
139+
1. Add `execIRStmtFuel` to `Compiler/Proofs/YulGeneration/Equivalence.lean`
140+
2. Mirror the structure of `execYulStmtFuel` from `Semantics.lean`
141+
3. Handle all statement cases: assign, let, expr (sstore/sload/etc), if, switch, block
142+
4. Update `execIRStmtsFuel` to call `execIRStmtFuel` instead of `execIRStmt`
143+
5. Prove adequacy theorem: `execIRStmtFuel (sizeOf stmt + 1) s stmt = execIRStmt s stmt`
144+
6. Update `StatementEquivalence.lean` theorem stubs to use `execIRStmtFuel`
145+
146+
**Estimated Effort**: 1 week
147+
- Day 1-2: Implement `execIRStmtFuel` with all cases
148+
- Day 3-4: Update `execIRStmtsFuel` and test
149+
- Day 5: Prove adequacy theorem
150+
- Day 6-7: Update theorem stubs and verify compilation
151+
152+
**Impact**: Unblocks all 8 statement proofs
153+
154+
**Note**: This is why `StatementEquivalence.lean` currently has all `sorry` statements - the proof infrastructure wasn't complete yet!
155+
100156
### Required Theorems
101157

102158
The core blocker is proving this theorem:

0 commit comments

Comments
 (0)