Commit 4d37a81
feat(proof): backend-assurance harness for prim__strToCharList (2/4)
Final slice of epic #87 Tier C backend-assurance campaign. Closes the
4-primitive sequence after #129 (prim__eqChar, slice 1/4) and #139
(prim__strAppend + prim__strSubstr, slices 3/4 + 4/4). With this
slice merged, all 5 class-(J) believe_me axioms in
src/abi/Boj/SafetyLemmas.idr have external backend-assurance
evidence — modulo any future backend (JS, native, etc.) that would
need a fresh trusted-extraction argument.
Discharges external evidence for one class-(J) believe_me axiom:
:218 unpackLength : (s : String) -> length (unpack s) = length s
The in-language proof does NOT change. The %unsafe / believe_me site
stays in SafetyLemmas.idr. The harness shrinks the trusted base
from "we trust the backend" to "we read the backend lowering and
randomly tested the operation against the property".
Artefacts (matching the #129 / #139 template):
- elixir/test/backend_assurance/prim_str_to_char_list_test.exs
BEAM property tests via stream_data over UTF-8 binaries.
Properties: length preservation, empty-string corner, round-trip
identity (to_string ∘ to_charlist), charlist element-type sanity
(legal codepoints, no surrogates), + boundary table covering all
four UTF-8 encoding widths (ASCII / Latin-1 / CJK / astral).
- docs/backend-assurance/prim__strToCharList.md
Trusted-extraction prose: Chez (R6RS string->list + string-length,
§6.7 + §11.12) and BEAM (Elixir String.to_charlist/1 + String.length/1
over UTF-8, prefix-free codepoint counting).
- docs/backend-assurance/README.md
Coverage table flipped from _pending_ for prim__strToCharList.
- PROOF-NEEDS.md
Backend-assurance evidence column filled for unpackLength; class
column updated to "J ✓" marker indicating externally-validated
class-(J) status (convention introduced by #139). Site line
number corrected from :211 to :218 (the file has shifted since
the 2026-05-18 audit; the previous PR didn't sync this row).
The CI workflow .github/workflows/backend-assurance.yml already
path-filters on elixir/test/backend_assurance/** and
docs/backend-assurance/** so the new test module is picked up
automatically — no workflow change is needed.
Constraints honoured (from docs/backend-assurance/README.md):
- No new believe_me. External evidence only; the axiom stays.
- No in-language discharge. Ruled out by 2026-05-18 audit.
- Two backends. Chez argued from R6RS; BEAM exercised by tests.
- Honest framing. Surrogates excluded; normalisation out of scope
and documented; round-trip property guards against a backend
whose charlist conversion drops/duplicates codepoints in a way
that happens to preserve length.
Test plan:
- [ ] CI backend-assurance workflow: BEAM property tests green
- [x] elixir parse-check on the new test file (syntax-only)
- [x] BEAM operation smoke on boundary strings (9 strings:
empty, ASCII, Latin-1, CJK, astral, max codepoint, etc.) —
direct String.to_charlist/1 + String.length/1 + to_string
calls outside the test harness. All pass; round-trip
identity holds across all 9.
- [ ] CI: existing workflows unaffected (no path-filter collisions)
Note: this session could not run `mix test --only backend_assurance`
locally — the asdf elixir 1.18.4-otp-25 install on this machine is
empty (only .mix archives, no binary), and system elixir 1.14 fails
the project's `~> 1.15` requirement. Same gap pattern slices 1/4 and
3/4+4/4 followed; CI is the gate.
**Expected conflicts with #139** (open at PR time of this branch):
- docs/backend-assurance/README.md: this PR flips the
prim__strToCharList row; #139 flips the prim__strAppend and
prim__strSubstr rows. Different table rows, line-level conflict
only.
- PROOF-NEEDS.md: this PR updates row 3 (unpackLength) and the
remaining-axiomatic-surface row for unpackLength. #139 updates
rows 1/2/4/5 and the explanation paragraph introducing the
"J ✓" marker convention. Trivial to resolve — the changes are
in different rows.
- PROOF-NEEDS.md standing note "Primitives validated so far":
#139 bumps it to 3/4; once both merge, the bump should read 4/4
(or simpler, "campaign complete"). Reviewer please apply during
merge of whichever PR lands second.
The "J ✓" marker introduced by #139 is used here on row 3 even
though the explanation paragraph is contributed by #139 — the
convention's meaning is self-evident from the value alone, and
post-#139-merge the explanation is in place.
Refs #87 (Tier C backend-assurance campaign — closes the harness
sequence).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1a4e12e commit 4d37a81
4 files changed
Lines changed: 287 additions & 3 deletions
File tree
- docs/backend-assurance
- elixir/test/backend_assurance
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
Lines changed: 144 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
0 commit comments