lean4-htt/tests/lean/grind/list_problems.lean
Leonardo de Moura 551d6cf28b
feat: function composition normalization rules in grind (#7803)
This PR adds normalization rules for function composition to `grind`.
2025-04-03 17:00:25 +00:00

19 lines
734 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.

theorem getElem?_eq_some_iff {l : List α} : l[i]? = some a ↔ ∃ h : i < l.length, l[i] = a := by
induction l
· grind
· cases i
· -- Fails because of the issue:
-- [issue] failed to create E-match local theorem for
-- ∀ (x : 1 ≤ tail.length), ¬tail[0] = a
-- despite having asserted `1 ≤ tail.length `.
grind
· -- Similarly
grind
attribute [grind] List.getElem_append_left List.getElem_append_right
@[simp] theorem getElem_concat_length {l : List α} {a : α} {i : Nat} (h : i = l.length) (w) :
(l ++ [a])[i]'w = a := by
subst h; grind
-- [issue] failed to create E-match local theorem for
-- ∀ (h₁ : True), (l ++ [a])[l.length] = [a][l.length - l.length]