lean4-htt/tests/lean/grind/countP.lean
Kim Morrison b2ea6b6a02
feat: initial @[grind] attributes for List/Array/Vector (#8136)
This PR adds an initial set of `@[grind]` annotations for
`List`/`Array`/`Vector`, enough to set up some regression tests using
`grind` in proofs about `List`. More annotations to follow.
2025-04-28 13:48:20 +00:00

22 lines
692 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.

variable {α : Type u} {l : List α} {P Q : α → Bool}
attribute [grind] List.countP_nil List.countP_cons
-- It would be really nice if we didn't need to `specialize` here!
theorem List.countP_le_countP (hpq : ∀ x ∈ l, P x → Q x) :
l.countP P ≤ l.countP Q := by
induction l with
| nil => grind
| cons x xs ih =>
specialize ih (by grind)
grind
theorem List.countP_lt_countP (hpq : ∀ x ∈ l, P x → Q x) (y:α) (hx: y ∈ l) (hxP : P y = false) (hxQ : Q y) :
l.countP P < l.countP Q := by
induction l with
| nil => grind
| cons x xs ih =>
have : xs.countP P ≤ xs.countP Q := countP_le_countP (by grind)
specialize ih (by grind)
grind