Commit 9545564
proof(xml-7-44): discharge Xml744.Attribute proof debts
Two PROOF_TODO sites in `Xml744.Attribute` blocked the toolkit build
on Idris2 0.8.0:
1. `attrName s = case decEq (isValidName s) True of ...` — `decEq` for
`Bool` is not in scope with the current imports. Replace with the
`with proof` form, which binds `prf : isValidName s = True` directly
in the matched branch and discharges `MkAttrName`'s auto-implicit.
2. `unsafeAttrName s = cast (MkAttrName s)` — never compiled (no
matching `Cast` instance; `MkAttrName` requires the validity proof
to construct). Change `unsafeAttrName` to take the proof as an
auto-implicit, so it can only be called on strings whose validity
Idris2 can verify at elaboration time. `Refl` discharges the proof
for any literal (or compile-time-reducible string), matching the
existing comment that this constructor "use only for known-good
literals".
`wAttr` previously routed through `unsafeAttrName` on a `("w:" ++ n)`
runtime string. Bump its signature to `(n : String) -> {auto prf :
isValidName ("w:" ++ n) = True} -> String -> XmlAttr` so the callers'
literal `n` lets the elaborator reduce both the concatenation and
`isValidName` to `True`. All four existing `wAttr` call sites pass
literals (`"id"`, `"author"`, `"date"`, `"initials"`).
Promote `isNameStartChar`, `isNameChar`, and `isValidName` from
`export` to `public export` so cross-module callers see the
definitions and the elaborator can reduce them. Without this the
proofs only discharge inside `Xml744.Attribute` itself.
Build outcome: 3/6 → Attribute compiles; all 9 exports check `is
total`; no `assert_total` / `assert_smaller` / `believe_me` /
`PROOF_TODO` / `idris_crash` remain in the file.
Build still red downstream in `Xml744.Element` (parallel `decEq` /
`cast` debts plus untreated mutual-recursion totality) — separate
follow-up, not in scope for this branch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5157bba commit 9545564
1 file changed
Lines changed: 33 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
19 | | - | |
20 | | - | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
32 | 44 | | |
33 | 45 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
39 | 55 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 56 | + | |
| 57 | + | |
44 | 58 | | |
45 | 59 | | |
46 | 60 | | |
| |||
77 | 91 | | |
78 | 92 | | |
79 | 93 | | |
80 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
81 | 99 | | |
82 | | - | |
| 100 | + | |
83 | 101 | | |
84 | 102 | | |
85 | 103 | | |
| |||
0 commit comments