lean4-htt/tests/lean/grind/sublist.lean
Kim Morrison 87152a3fae
feat: grind annotations for List.Sublist/IsInfix/IsPrefix/IsSuffix (#8497)
This PR adds preliminary grind annotations for
`List.Sublist`/`IsInfix`/`IsPrefix`/`IsSuffix`, along with test cases.
2025-05-27 12:56:43 +00:00

19 lines
741 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

open List
set_option grind.warning false
example (h : zs <+ ys) (w : xs ++ ys <+ zs) (h' : ¬xs = []) : False := by
fail_if_success grind
-- I'm not sure how to make progress here without manually adding that since `xs ≠ []`, it must be a `cons`.
have : ∃ y ys, xs = y :: ys := match xs, h' with | _ :: _, _ => by simp
grind (gen := 6)
example {xs ys zs : List α} (h : zs <+ ys) :
xs ++ ys <+ zs ↔ xs = [] ∧ ys = zs := by
constructor
· intro w
grind -- stuck, because of the failure of the example above.
-- An alternative idea would be to argue via inequalities about lengths,
-- but any grind pattern for `Sublist.length_le` seems to result in an explosion of useless facts.
· intro w
grind