lean4-htt/tests/lean/run/grind_list_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

40 lines
1.2 KiB
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
variable {α} {l₁ l₂ l₃ l₄ l₅ : List α}
example : l₂ ++ l₄ ⊆ l₁ ++ l₂ ++ l₃ ++ l₄ ++ l₅ := by
grind
example : l₂ ++ l₄ <+ l₁ ++ l₂ ++ l₃ ++ l₄ ++ l₅ := by
grind
example : l₁ ++ l₂ <+: l₁ ++ (l₂ ++ l₃) := by
grind
example : l₂ ++ l₃ <:+ l₁ ++ l₂ ++ l₃ := by
grind
example : l₂ ++ l₃ <:+: l₁ ++ l₂ ++ l₃ ++ l₄ := by
grind
example (h : l₁ <:+: l₂) : l₁.filter p <:+: (l₂ ++ l₃).filter p := by
grind
example (h : l₁ <+: l₂) : l₁.map f <+: (l₂ ++ l₃).map f := by
grind
example (h : l₁ <+: l₂) : l₁.reverse <:+ xs ++ l₂.reverse := by grind
example (h : l₁ <+: l₂) : l₁.reverse <:+: xs ++ l₂.reverse := by grind
example (h : l₁ <:+: l₂) : l₁.reverse <:+: xs ++ l₂.reverse ++ ys := by grind
example (h : 8 ≤ xs.count 37) : replicate 7 37 <+ xs := by grind
-- Can we do this without unfolding `IsSuffix`?
example (h : replicate (n + 1) 37 <:+ xs) : n ≤ xs.count 37 := by grind [IsSuffix]
-- Can we do this without unfolding `IsInfix`?
example (h : replicate (n + 1) 37 <:+: xs) : n ≤ 2 * xs.count 37 := by grind [IsInfix]