lean4-htt/tests/lean/run/grind_cases.lean
Leonardo de Moura 189f5d41fb
feat: case splitting in grind (#6717)
This PR introduces a new feature that allows users to specify which
inductive datatypes the `grind` tactic should perform case splits on.
The configuration option `splitIndPred` is now set to `false` by
default. The attribute `[grind cases]` is used to mark inductive
datatypes and predicates that `grind` may case split on during the
search. Additionally, the attribute `[grind cases eager]` can be used to
mark datatypes and predicates for case splitting both during
pre-processing and the search.

Users can also write `grind [HasType]` or `grind [cases HasType]` to
instruct `grind` to perform case splitting on the inductive predicate
`HasType` in a specific instance. Similarly, `grind [-Or]` can be used
to instruct `grind` not to case split on disjunctions.

Co-authored-by: Leonardo de Moura <leodemoura@amazon.com>
2025-01-20 22:44:56 +00:00

31 lines
704 B
Text

/--
error: invalid `[grind cases eager]`, `List` is not a non-recursive inductive datatype or an alias for one
-/
#guard_msgs (error) in
attribute [grind cases eager] List
attribute [grind cases] List
attribute [grind] Prod
/--
error: invalid `[grind cases]`, `id` is not an inductive datatype or an alias for one
-/
#guard_msgs (error) in
attribute [grind cases] id
/--
error: invalid `[grind cases eager]`, `id` is not a non-recursive inductive datatype or an alias for one
-/
#guard_msgs (error) in
attribute [grind cases eager] id
example : True := by
grind [-List]
/--
error: `Array` is not marked with the `[grind]` attribute
-/
#guard_msgs (error) in
example : True := by
grind [-Array]