Commit 69a0d29
proof(idris2): tighten Ephapax.IR.Decode to %default total (#96)
## Summary
Sixth file in the `%default partial` → `%default total` chain.
Companions: SExpr (#89), Stream (#90), Util (#91), Lexer (#93), AST
(#94).
Flip `%default partial → %default total`. Roughly 22 atomic
encode/decode helpers (the `baseToAtom`/`atomToBase` style maps,
`encodeLit`/`decodeLit`, `encodeTy`/`decodeTy`, `escape`/`unescape`,
`encodeParam`/`decodeParam`, etc.) are now provably total under the file
default.
## 7 `covering` markers retained
Two distinct Idris2 0.8.0 limits force this:
1. **`encodeExpr` / `decodeExpr`** — structural recursion runs through
`map encodeExpr es` and `traverse decodeExpr rest` for the `Block` case.
The recursion *is* structural via list head/tail induction on a `List
Expr`, but Idris2 SCT cannot trace the size decrease across the
`Functor` / `Traversable` dictionary call. Same root cause as the
existing `Show Expr` / `Eq Expr` `covering` markers in AST.idr (#94).
2. **`encodeDecl` / `decodeDecl` / `fromSExpr` / `toSExpr`** —
transitively call the two above; inherit `covering`.
3. **`encode`** — `encode = show . toSExpr` depends on
`Ephapax.IR.SExpr.show` totality, which lands in PR #89. After #89
merges, `encode` would still be `covering` from `toSExpr`.
`covering` is strictly stronger than the previous file default of
`partial` — no new escape. No `assert_total` / `believe_me`.
## Verification
```
$ IDRIS2_PREFIX=…/idris2/0.8.0 idris2 --check Ephapax/IR/Decode.idr
3/3: Building Ephapax.IR.Decode (Ephapax/IR/Decode.idr)
$ idris2 --check Ephapax/Parse/Parser.idr # downstream
6/6: Building Ephapax.Parse.Parser
$ idris2 --check Ephapax/Affine/Emit.idr # downstream
4/4: Building Ephapax.Affine.Emit
```
## Refs
- `#124` (proof-debt audit epic)
- `#134` (ephapax totality sub-issue)
- Companions: PR `#89` (SExpr), `#90` (Stream), `#91` (Util), `#93`
(Lexer), `#94` (AST)
## Test plan
- [x] `idris2 --check Ephapax/IR/Decode.idr` builds green under
`%default total`
- [x] Downstream Parse/Parser + Affine/Emit still build
- [ ] CI green
- [x] No `assert_*` / `believe_me`; only 7 deliberate `covering` markers
(justified above)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 52079a7 commit 69a0d29
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| |||
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
| 185 | + | |
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
| |||
273 | 275 | | |
274 | 276 | | |
275 | 277 | | |
| 278 | + | |
276 | 279 | | |
277 | 280 | | |
278 | 281 | | |
279 | 282 | | |
280 | 283 | | |
281 | 284 | | |
| 285 | + | |
282 | 286 | | |
283 | 287 | | |
284 | 288 | | |
| |||
291 | 295 | | |
292 | 296 | | |
293 | 297 | | |
| 298 | + | |
294 | 299 | | |
295 | 300 | | |
296 | 301 | | |
297 | 302 | | |
298 | 303 | | |
299 | 304 | | |
300 | 305 | | |
| 306 | + | |
301 | 307 | | |
302 | 308 | | |
303 | 309 | | |
304 | 310 | | |
305 | 311 | | |
| 312 | + | |
306 | 313 | | |
307 | 314 | | |
0 commit comments