Commit 833f394
authored
## Summary
Closes the open obligation left by PR #111 (issue #113). Two substantive
corrections + the closure proof.
## 1. Semantic-bug fix to PR #111 model
The previous `stripLineCommentBody` returned `nl :: rest` where `rest`
was the ORIGINAL TAIL — meaning only the FIRST comment in the input was
stripped. **The Rust pass at `src/assail/analyzer.rs:931` strips ALL
comments.** New model uses mutual recursion: `stripLineCommentBody`
calls back into `stripLineComments` at each preserved newline, so the
entire input is processed in one pass.
## 2. Closure proof —
```idris
bodyIsFixedPoint : (cs : List Char) ->
stripLineComments (stripLineCommentBody cs) = stripLineCommentBody cs
```
Proved by **mutual induction** with `stripLineCommentsIdempotent`. Two
constructor cases:
- `c == nl`: body returns `nl :: stripLineComments rest`. Outer strip on
that = `nl :: stripLineComments (stripLineComments rest)` = `nl ::
stripLineComments rest` by the main IH on `rest`. ✓
- `c /= nl`: body returns `sp :: stripLineCommentBody rest`. Outer strip
on that = `sp :: stripLineComments (stripLineCommentBody rest)` = `sp ::
stripLineCommentBody rest` by the body IH on `rest`. ✓
## 3. No `believe_me` / `assert_total` / holes
Idris2's totality checker validates the mutual recursion: both functions
consume strictly-smaller inputs on each call.
## New sanity check
`sanityTwoComments` specifically exercises the case PR #111's broken
single-comment model would have failed:
```
"//a\n//b" → " \n " (both comments stripped, newline preserved)
```
## PROOF-NEEDS.md changes
- 'Completed Proofs' row for `Stripping.idr` updated to reflect the
multi-comment correction + slash-slash Qed.
- 'What Still Needs Proving' Layer-1.0 row collapsed:
`stripIsIdentityOnStrippedBody` is now Qed; only the block / strings /
composition / position-preservation slice remains, recorded under issue
#114.
## Refs
- PROOF-PROGRAMME.md row 1 (Layer 1.0)
- PR #111 (the foundation this closes)
- Issue #113 (the obligation — closes)
- Issue #114 (the next Layer-1.0 slice — remains open)
1 parent d5f3a4f commit 833f394
2 files changed
Lines changed: 188 additions & 190 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 22 | + | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
| |||
0 commit comments