Commit db0e1b7
## Summary
Closes #43. PA021 ProofDrift was matching `sorry`/`oops` keywords inside
Isabelle prose constructs (docstrings discussing the keywords, not
invoking them), producing false positives.
## Evidence pattern (from the bug report)
| File:line | Match context |
|---|---|
| `Tropical_Kleene.thy:663` | `"zero @{text sorry}."` |
| `Tropical_Ordinal.thy:15` | `"with \<open>oops\<close> are..."` |
| `Tropical_Matrices_Clean.thy:24` | `"zero @{text sorry}."` |
| `Tropical_CNO.thy:29` | `text \<open>All sorry
placeholders...\<close>` |
The existing `strip_proof_comments` helper only handles `(* ... *)`
block comments — it left the three modern Isabelle prose constructs
intact, hence the FPs.
## Fix
New `strip_isabelle_prose` helper in `src/assail/analyzer.rs`, called
after `strip_proof_comments` in `analyze_isabelle`. Strips:
- **`@{text ...}` antiquotations** — brace-balanced (nested braces
handled).
- **Prose-block cartouches** following `chapter`, `section`,
`subsection`, `subsubsection`, `paragraph`, `text` keywords. Cartouches
(`\<open>...\<close>`) nest, so depth-counted.
Conservative: only cartouches that follow a recognised prose-block
keyword are stripped — string-literal cartouches inside tactics (rare)
stay visible. Word-boundary check on the keyword prevents
`mysection_lemma` from matching `section`.
## Regression coverage
8 new unit tests in `assail::analyzer::tests`:
1. `isabelle_strip_text_antiquotation_inside_block_comment` — case 1
2. `isabelle_strip_cartouche_after_text_keyword` — case 4
3. `isabelle_strip_section_cartouche` — case 2 (cartouche after
`section`)
4. `isabelle_strip_subsection_subsubsection_paragraph_chapter` —
parametrised over the other prose keywords
5. `isabelle_preserve_real_sorry_outside_prose` — **inverse invariant**:
a genuine `sorry` tactic still gets flagged
6. `isabelle_nested_cartouches` — `\<open>outer \<open>inner
sorry\<close>\<close>` handled by depth-counting
7. `isabelle_antiquotation_with_nested_braces` — `@{text "{ x = 1 }"}`
handled
8. `isabelle_keyword_not_at_word_boundary` — `mysection_lemma` does NOT
trip the `section` keyword
## Test plan
- [x] `cargo test --bin panic-attack --features signing,http` — 226
passed, 0 failed (218 existing + 8 new)
- [x] `cargo clippy --all-targets --features signing,http -- -D
warnings` — clean
- [x] `cargo fmt --check` — clean
- [x] GPG-signed commit
## Follow-ups (mentioned in the issue, **not** in scope here)
> Comparable Agda/Coq/Idris detectors should be re-audited for the same
blind spot.
Filed as out-of-scope for #43; can be tackled language-by-language in
follow-up PRs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7766c18 commit db0e1b7
1 file changed
Lines changed: 219 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3581 | 3581 | | |
3582 | 3582 | | |
3583 | 3583 | | |
3584 | | - | |
3585 | | - | |
| 3584 | + | |
| 3585 | + | |
| 3586 | + | |
| 3587 | + | |
| 3588 | + | |
| 3589 | + | |
| 3590 | + | |
3586 | 3591 | | |
3587 | 3592 | | |
3588 | 3593 | | |
| |||
5526 | 5531 | | |
5527 | 5532 | | |
5528 | 5533 | | |
| 5534 | + | |
| 5535 | + | |
| 5536 | + | |
| 5537 | + | |
| 5538 | + | |
| 5539 | + | |
| 5540 | + | |
| 5541 | + | |
| 5542 | + | |
| 5543 | + | |
| 5544 | + | |
| 5545 | + | |
| 5546 | + | |
| 5547 | + | |
| 5548 | + | |
| 5549 | + | |
| 5550 | + | |
| 5551 | + | |
| 5552 | + | |
| 5553 | + | |
| 5554 | + | |
| 5555 | + | |
| 5556 | + | |
| 5557 | + | |
| 5558 | + | |
| 5559 | + | |
| 5560 | + | |
| 5561 | + | |
| 5562 | + | |
| 5563 | + | |
| 5564 | + | |
| 5565 | + | |
| 5566 | + | |
| 5567 | + | |
| 5568 | + | |
| 5569 | + | |
| 5570 | + | |
| 5571 | + | |
| 5572 | + | |
| 5573 | + | |
| 5574 | + | |
| 5575 | + | |
| 5576 | + | |
| 5577 | + | |
| 5578 | + | |
| 5579 | + | |
| 5580 | + | |
| 5581 | + | |
| 5582 | + | |
| 5583 | + | |
| 5584 | + | |
| 5585 | + | |
| 5586 | + | |
| 5587 | + | |
| 5588 | + | |
| 5589 | + | |
| 5590 | + | |
| 5591 | + | |
| 5592 | + | |
| 5593 | + | |
| 5594 | + | |
| 5595 | + | |
| 5596 | + | |
| 5597 | + | |
| 5598 | + | |
| 5599 | + | |
| 5600 | + | |
| 5601 | + | |
| 5602 | + | |
| 5603 | + | |
| 5604 | + | |
| 5605 | + | |
| 5606 | + | |
| 5607 | + | |
| 5608 | + | |
| 5609 | + | |
| 5610 | + | |
| 5611 | + | |
| 5612 | + | |
| 5613 | + | |
| 5614 | + | |
| 5615 | + | |
| 5616 | + | |
| 5617 | + | |
| 5618 | + | |
| 5619 | + | |
| 5620 | + | |
| 5621 | + | |
| 5622 | + | |
| 5623 | + | |
| 5624 | + | |
| 5625 | + | |
| 5626 | + | |
| 5627 | + | |
| 5628 | + | |
| 5629 | + | |
| 5630 | + | |
| 5631 | + | |
| 5632 | + | |
| 5633 | + | |
| 5634 | + | |
| 5635 | + | |
| 5636 | + | |
| 5637 | + | |
| 5638 | + | |
| 5639 | + | |
| 5640 | + | |
| 5641 | + | |
| 5642 | + | |
| 5643 | + | |
| 5644 | + | |
| 5645 | + | |
| 5646 | + | |
| 5647 | + | |
| 5648 | + | |
| 5649 | + | |
| 5650 | + | |
| 5651 | + | |
| 5652 | + | |
| 5653 | + | |
| 5654 | + | |
| 5655 | + | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
5529 | 5661 | | |
5530 | 5662 | | |
5531 | 5663 | | |
| |||
5737 | 5869 | | |
5738 | 5870 | | |
5739 | 5871 | | |
| 5872 | + | |
| 5873 | + | |
| 5874 | + | |
| 5875 | + | |
| 5876 | + | |
| 5877 | + | |
| 5878 | + | |
| 5879 | + | |
| 5880 | + | |
| 5881 | + | |
| 5882 | + | |
| 5883 | + | |
| 5884 | + | |
| 5885 | + | |
| 5886 | + | |
| 5887 | + | |
| 5888 | + | |
| 5889 | + | |
| 5890 | + | |
| 5891 | + | |
| 5892 | + | |
| 5893 | + | |
| 5894 | + | |
| 5895 | + | |
| 5896 | + | |
| 5897 | + | |
| 5898 | + | |
| 5899 | + | |
| 5900 | + | |
| 5901 | + | |
| 5902 | + | |
| 5903 | + | |
| 5904 | + | |
| 5905 | + | |
| 5906 | + | |
| 5907 | + | |
| 5908 | + | |
| 5909 | + | |
| 5910 | + | |
| 5911 | + | |
| 5912 | + | |
| 5913 | + | |
| 5914 | + | |
| 5915 | + | |
| 5916 | + | |
| 5917 | + | |
| 5918 | + | |
| 5919 | + | |
| 5920 | + | |
| 5921 | + | |
| 5922 | + | |
| 5923 | + | |
| 5924 | + | |
| 5925 | + | |
| 5926 | + | |
| 5927 | + | |
| 5928 | + | |
| 5929 | + | |
| 5930 | + | |
| 5931 | + | |
| 5932 | + | |
| 5933 | + | |
| 5934 | + | |
| 5935 | + | |
| 5936 | + | |
| 5937 | + | |
| 5938 | + | |
| 5939 | + | |
| 5940 | + | |
| 5941 | + | |
| 5942 | + | |
| 5943 | + | |
| 5944 | + | |
| 5945 | + | |
| 5946 | + | |
| 5947 | + | |
| 5948 | + | |
| 5949 | + | |
| 5950 | + | |
| 5951 | + | |
| 5952 | + | |
| 5953 | + | |
| 5954 | + | |
| 5955 | + | |
| 5956 | + | |
5740 | 5957 | | |
5741 | 5958 | | |
5742 | 5959 | | |
| |||
0 commit comments