Commit 5157bba
proof(xml-7-44): make Xml744.Escape.exfiltrate provably total
The `replaceAll` worker inside `exfiltrate` used three `assert_total`
escapes (`strHead`, `head`, `tail`) on Idris2 0.7 stdlib, and the
intermediate refactor that removed them broke the termination check
(recursion through `pack $ drop ...` is not structurally smaller).
Rewrite the worker as `replaceAllChars : Nat -> List Char -> ...` with
a fuel parameter sized to `length (unpack str)`. Each recursive step
consumes ≥ 1 char of the third argument so fuel is never the binding
constraint — it simply makes termination structurally obvious to
Idris2's checker, matching the Nat-fueled pattern used in the ephapax
totality campaign.
`idris2 --check Xml744/Escape.idr` reports all four exported names
(`exfiltrate`, `infiltrate`, `infiltrateAttr`, `makeSafe`) as `total`,
with no `assert_total` / `assert_smaller` / `believe_me` left in the
file.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3ed5c3c commit 5157bba
1 file changed
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
61 | 75 | | |
62 | 76 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 77 | + | |
| 78 | + | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| |||
0 commit comments