lean4-htt/src/Init
Kim Morrison a6ed0d640d
feat: add #guard_panic command and substring option for #guard_msgs (#11908)
This PR adds two features to the message testing commands:

## `#guard_panic` command

A new `#guard_panic` command that succeeds if the nested command
produces a panic message. Unlike `#guard_msgs`, it does not check the
exact message content, only that a panic occurred.

This is useful for testing commands that are expected to panic, where
the exact panic message text may be volatile. It is particularly useful
when minimizing a panic discovered "in the wild", while ensuring the
panic behaviour is preserved.

## `substring := true` option for `#guard_msgs`

Adds a `substring := true` option to `#guard_msgs` that checks if the
docstring appears as a substring of the output (after whitespace
normalization), rather than requiring an exact match. This is useful
when you only care about part of the message.

Example:
```lean
/-- Unknown identifier -/
#guard_msgs (substring := true) in
example : α := x
```

## Refactoring

Also refactors `runAndCollectMessages` as a shared helper function used
by both `#guard_msgs` and `#guard_panic`.

🤖 Prepared with Claude Code

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 01:34:49 +00:00
..
Control feat: MPL specs for loops over iterators (#11693) 2025-12-17 09:36:44 +00:00
Data feat: add guards for grind patterns for getElem?_eq_none theorems (#11761) 2026-01-05 08:55:02 +00:00
Grind feat: add [grind norm] and [grind unfold] attributes (#11776) 2025-12-23 03:54:35 +00:00
GrindInstances feat: improves Fin n support in grind (#11319) 2025-11-22 06:51:25 +00:00
Internal refactor: make CCPO class Prop-valued (#11425) 2025-12-04 13:33:36 +00:00
Meta chore: rename Substring to Substring.Raw (#11154) 2025-11-16 09:30:04 +00:00
Omega chore: deprecate more duplications (#11004) 2025-10-30 05:58:29 +00:00
System feat: MonadAttach (#11532) 2025-12-16 18:57:00 +00:00
BinderNameHint.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
BinderPredicates.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
ByCases.lean chore: deprecate more duplications (#11004) 2025-10-30 05:58:29 +00:00
Classical.lean feat: grind_pattern for Exists.choose_spec (#11316) 2025-11-22 02:19:00 +00:00
Coe.lean doc: fix typo in Init.Coe module docstring (#11567) 2025-12-10 08:48:55 +00:00
Control.lean feat: MonadAttach (#11532) 2025-12-16 18:57:00 +00:00
Conv.lean feat: add enter [in patt] syntax (#10081) 2025-08-23 17:16:53 +00:00
Core.lean feat: @[suggest_for] annotations for prompting easy-to-miss names (#11554) 2025-12-10 22:50:45 +00:00
Data.lean chore: more reorganization of strings (#10928) 2025-10-23 11:56:11 +00:00
Dynamic.lean perf: do not export opaque bodies (#10119) 2025-08-27 20:59:59 +00:00
Ext.lean chore: add deprecations for duplicated theorems (#10967) 2025-10-29 05:26:16 +00:00
GetElem.lean feat: add guards for grind patterns for getElem?_eq_none theorems (#11761) 2026-01-05 08:55:02 +00:00
Grind.lean feat: Field norm num (#11350) 2025-11-25 19:47:31 +00:00
GrindInstances.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Guard.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
Hints.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Internal.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
LawfulBEqTactics.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
MacroTrace.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Meta.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
MetaTypes.lean feat: add TransparencyMode.none (#11810) 2025-12-27 03:10:17 +00:00
MethodSpecsSimp.lean feat: @[method_specs_simp] in Init (#10407) 2025-09-16 10:27:33 +00:00
Notation.lean feat: add #guard_panic command and substring option for #guard_msgs (#11908) 2026-01-07 01:34:49 +00:00
NotationExtra.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
Omega.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Prelude.lean feat: simplifier for Sym (#11856) 2026-01-01 04:34:50 +00:00
PropLemmas.lean chore: remove ≥6 month old deprecations (#11627) 2025-12-12 10:40:04 +00:00
RCases.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
ShareCommon.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
SimpLemmas.lean fix: performance issue when elaborating match-expressions with many literals (#9372) 2025-07-15 03:52:23 +00:00
Simproc.lean chore: more module system fixes and improvements from Mathlib porting (#10655) 2025-10-08 11:30:09 +00:00
SizeOf.lean chore: rename Substring to Substring.Raw (#11154) 2025-11-16 09:30:04 +00:00
SizeOfLemmas.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
Syntax.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
System.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Tactics.lean feat: add with_unfolding_none tactic (#11880) 2026-01-03 08:36:51 +00:00
TacticsExtra.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
Task.lean fix: revert the waitAny refactoring (#11000) 2025-10-29 08:27:16 +00:00
Try.lean feat: exact? +grind and exact? +try? discharger options (#11469) 2025-12-02 06:31:56 +00:00
Util.lean chore: reorganize Init imports around strings (#10289) 2025-09-07 17:09:14 +00:00
WF.lean feat: port Batteries.WF for executable well-founded fixpoints (#11620) 2025-12-12 18:22:54 +00:00
WFComputable.lean feat: port Batteries.WF for executable well-founded fixpoints (#11620) 2025-12-12 18:22:54 +00:00
WFExtrinsicFix.lean feat: remove Finite conditions from iterator consumers relying on a new fixpoint combinator (#11038) 2025-12-08 16:03:22 +00:00
WFTactics.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
While.lean fix: move the monad argument for ForIn, ForIn', and ForM (#10204) 2025-11-25 12:20:37 +00:00