Skip to content

Commit 97b64b3

Browse files
committed
Update SORRY_REDUCTION_PLAN.md: 4 → 3 sorries (93% reduction)
- Record sorry #4 elimination (setMappingPackedWord singleton) - Record TYPESIG_SORRY reduction progress - Update remaining sorry line numbers and analysis - Add TYPESIG_SORRY status table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 16e3af7 commit 97b64b3

1 file changed

Lines changed: 29 additions & 22 deletions

File tree

docs/SORRY_REDUCTION_PLAN.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Sorry Reduction Plan — Pass 5
22

3-
## Current State (as of commit 08b717e3)
3+
## Current State (as of commit 8a589c04)
44

5-
**Active `sorry`**: 4 (all in `GenericInduction.lean`)
6-
**TYPESIG_SORRY blocks**: ~57 commented-out theorems with broken type signatures
5+
**Active `sorry`**: 3 (all in `GenericInduction.lean`)
6+
**TYPESIG_SORRY blocks**: ~20 commented-out theorems with broken type signatures
77
**Build status**: Green (compiles with warnings only)
88

99
## Progress (Pass 5)
@@ -22,33 +22,33 @@
2222
| `66236a18` | 6 | Add keccak axiom `solidityMappingSlot_add_wordOffset_lt_evmModulus` + prove 4 mapping slot wordOffset≠0 sorries (−4) |
2323
| `7dee40c3` | 5 | Prove aliasSlots TYPESIG_SORRY chain: 3 theorems uncommented (−1) |
2424
| `08b717e3` | 4 | Add ExprCompileCore bitwise constructors, prove exprCompileCore_of_exprTouchesUnsupportedContractSurface (−1) |
25+
| `faaf81e5` | 4 | Remove 7 dead-code TYPESIG_SORRY blocks, uncomment 2 setStorage blocks, uncomment 2 exceptMappingWrites blocks (TYPESIG reduction only) |
26+
| `8a589c04` | 3 | Prove compiledStmtStep_setMappingPackedWord compileOk + eliminate sorry #4 (singleton) (−1) |
2527

26-
## Remaining 4 Sorries — Architecturally Blocked
28+
## Remaining 3 Sorries — Architecturally Blocked
2729

2830
Every remaining sorry depends on fundamental design issues that cannot be resolved
2931
by proof work alone. They require either upstream code changes, new axioms, or
3032
substantial proof infrastructure.
3133

32-
### 1. Identifier shapes (line 5982)
34+
### 1. Identifier shapes (line 5993)
3335
**Theorem**: `validateIdentifierShapes_fieldName_avoidReservedCompilerPrefix`
3436
**Blocker**: Claims no field name starts with `"__"`, but `__immutable_*` fields are
3537
explicitly allowed by the validation pipeline.
3638
**Fix**: Thread stronger field-shape classification that distinguishes mutable vs
3739
immutable fields through the generic induction scope invariant.
3840

39-
### 2. setMappingPackedWord (line 7467)
41+
### 2. setMappingPackedWord preserves (line 7604)
4042
**Theorem**: `compiledStmtStep_setMappingPackedWord_singleSlot_of_slotSafety_preserves`
4143
**Blocker**: Requires proving a 5-statement IR block body executes correctly, plus a
4244
bitwise identity (`storedIR = packedWordWrite`) bridging IR-level Nat operations with
4345
Uint256-level `packedWordWrite`. Three proof attempts were made:
44-
- **Attempt 1**: Explicit state chain with raw `Nat.land`/`Nat.xor` — 6 errors including
45-
notation mismatches (`&&&` vs `Nat.land`) and getVar/setVar resolution failures.
46-
- **Attempt 2**: Restructured with fuel decomposition (`obtain ⟨ef, rfl⟩`) and concrete
47-
`Nat.succ` fuel — timed out at 200k heartbeats on `simpa [compiledIR] using hslack`,
48-
`simp [YulStmt.block.sizeOf_spec]`, and `set state1 := ...`.
49-
- **Attempt 3**: Considered increased heartbeats (800k) and early `by_cases` on
50-
`wordOffset == 0` to avoid conditional terms, but fundamental timeout on term-level
51-
`sizeOf` computation with abstract subexpressions remains.
46+
- **Attempt 1**: Explicit state chain with raw `Nat.land`/`Nat.xor` — notation mismatches
47+
and getVar/setVar resolution failures.
48+
- **Attempt 2**: Fuel decomposition with concrete `Nat.succ` — timed out at 200k heartbeats
49+
on `sizeOf` computation with abstract subexpressions.
50+
- **Attempt 3**: Increased heartbeats + `by_cases` on `wordOffset == 0` — fundamental
51+
timeout on term-level sizeOf with conditionals remains.
5252
**Root causes**:
5353
1. `execIRStmts` requires `Nat.succ` fuel at each cons, needing explicit fuel
5454
decomposition that triggers `sizeOf` computation timeouts.
@@ -60,18 +60,24 @@ Uint256-level `packedWordWrite`. Three proof attempts were made:
6060
packed word block body execution with its own `maxHeartbeats` budget. This isolates
6161
the expensive term reduction. The bitwise identity also needs a separate lemma.
6262

63-
### 3. setStorageAddr — Address modulus (line 9944)
63+
### 3. setStorageAddr — Address modulus (line 10000)
6464
**Theorem**: `stmtListGenericCore_singleton_setStorageAddr_singleSlot`
6565
**Blocker**: Depends on `compiledStmtStep_setStorageAddr_singleSlot_preserves` (TYPESIG_SORRY
66-
at line 6134). That theorem needs `runtimeStateMatchesIR_writeAddressSlot` which requires
66+
at line 6150). That theorem needs `runtimeStateMatchesIR_writeAddressSlot` which requires
6767
`value < Address.modulus` (2^160), but `evalExpr` only gives `< evmModulus` (2^256).
6868
Source semantics truncates to 160 bits via `wordToAddress` but IR stores full 256 bits.
6969
**Fix**: Either add a truncation step in the IR compilation of address storage, or
7070
add a hypothesis that the value is already within address range.
7171

72-
### 4. setMappingPackedWord singleton (line 10548)
73-
**Theorem**: `stmtListGenericCore_singleton_setMappingPackedWordSingle_of_slotSafety`
74-
**Blocker**: Depends on #2 being resolved first (the `_preserves` theorem it wraps).
72+
## TYPESIG_SORRY Status
73+
74+
| Group | Lines | Status | Blocker |
75+
|-------|-------|--------|---------|
76+
| mstore/tstore scope | 2838, 3860 | Blocked | Need `StmtListScopeCore` constructors |
77+
| setStorageAddr | 6150, 6196 | Blocked | Address.modulus (sorry #3) |
78+
| validateIdentifierShapes chain | 9289, 9345 | Blocked | sorry #1 |
79+
| ExceptMappingWrites chain | 11560, 11593, 11615, 11656 | Blocked | `SupportedStmtListMappingWriteSlotSafety` structure commented out (line 10159) |
80+
| Catalog assembly | 14830+ (9 blocks) | Dead code | Commented-out catalog infrastructure |
7581

7682
## Root Causes Summary
7783

@@ -80,16 +86,17 @@ add a hypothesis that the value is already within address range.
8086
| ~~Keccak FFI opaque output bounds~~ | ~~#3, #5, #6, #7~~ | ~~RESOLVED: added axiom~~ |
8187
| ~~TYPESIG_SORRY dependency (aliasSlots)~~ | ~~#8~~ | ~~RESOLVED: proved chain~~ |
8288
| ~~ExprCompileCore missing constructors~~ | ~~#1~~ | ~~RESOLVED: added constructors~~ |
83-
| `execIRStmts` 5-stmt block + bitwise identity | #2, #4 | Dedicated helper theorem + bitwise lemma |
89+
| ~~setMappingPackedWord singleton~~ | ~~#4~~ | ~~RESOLVED: proved compileOk + chained~~ |
90+
| `execIRStmts` 5-stmt block + bitwise identity | #2 | Dedicated helper theorem + bitwise lemma |
8491
| `__immutable_*` field prefix | #1 | Validation pipeline change |
8592
| Address modulus semantic mismatch | #3 | IR compilation change or hypothesis |
8693

8794
## Conclusion
8895

89-
The sorry count has been reduced from 44 to 4 (91% reduction). The remaining 4 sorries
96+
The sorry count has been reduced from 44 to 3 (93% reduction). The remaining 3 sorries
9097
fall into three categories:
9198

92-
1. **Proof infrastructure needed** (#2, #4): The `setMappingPackedWord` proof requires a
99+
1. **Proof infrastructure needed** (#2): The `setMappingPackedWord_preserves` proof requires a
93100
dedicated helper theorem for the 5-statement block body execution (to isolate the
94101
expensive `sizeOf`/fuel computation within its own heartbeat budget) plus a bitwise
95102
identity lemma bridging IR and Uint256 operations. This is the most tractable remaining

0 commit comments

Comments
 (0)