Commit 01c7c07
proof(SafeFile): DISCHARGE readTrackingMonotonic + writeTrackingMonotonic (#136)
## Summary
Discharge the last two OWED handle-tracking theorems in
`Proven.SafeFile.Proofs`:
- `readTrackingMonotonic : (Operations.updateAfterRead h
bytes).bytesRead >= h.bytesRead = True`
- `writeTrackingMonotonic : (Operations.updateAfterWrite h
bytes).bytesWritten >= h.bytesWritten = True`
The blocker per the OWED comment was "Idris2 0.8.0 doesn't reduce
record-update field projection through a function call". Verified that's
accurate (test harness at `/tmp/charrefl/src/TestNatGte.idr`), but the
fix is two-part:
1. **`Operations.idr`** — Flip both `updateAfterRead` /
`updateAfterWrite` from `export` to `public export` AND inline the
explicit `MkSafeHandle` constructor instead of the record-update sugar
(`{ bytesRead := ... } h`). Runtime semantics identical, but the
explicit constructor reduces definitionally under field projection at
type-check time.
2. **`Proofs.idr`** — Add helper `plusGteOriginal : (n, m : Nat) -> (n +
m) >= n = True` (induction on `n`, case-split on `m` only in the `Z`
branch). Discharge both theorems trivially.
## Verification
- `idris2 --check src/Proven/SafeFile/Operations.idr` → Exit 0
- `idris2 --check src/Proven/SafeFile/Proofs.idr` → Exit 0
- Empirical confirmation: `/tmp/charrefl/src/TestNatGte.idr` shows
record-update DOES NOT reduce; explicit-constructor DOES.
Zero `believe_me` / `postulate` / `idris_crash`. No external-caller
breakage (no uses outside `SafeFile/Proofs.idr` per estate grep).
Refs proven#90 (Phase 3 OWED triage), proven#107 (overly-cautious OWED
meta), proven#119 (paths-forward).
## Test plan
- [x] Local type-check `Operations.idr` clean
- [x] Local type-check `Proofs.idr` clean
- [ ] CI `idris2 --check proven.ipkg` green
- [ ] CI test suite green
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 48cc38c commit 01c7c07
2 files changed
Lines changed: 43 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
160 | 167 | | |
161 | | - | |
| 168 | + | |
| 169 | + | |
162 | 170 | | |
163 | 171 | | |
164 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
165 | 175 | | |
166 | | - | |
| 176 | + | |
| 177 | + | |
167 | 178 | | |
168 | 179 | | |
169 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
242 | 241 | | |
243 | 242 | | |
244 | 243 | | |
| |||
0 commit comments