File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -595,12 +595,13 @@ theorem findIdx?_eq_none_of_findIdx?_eq_none {xs : Array α} {p q : α → Bool}
595595 rcases xs with ⟨xs⟩
596596 simpa using List.findIdx?_eq_none_of_findIdx?_eq_none (by simpa using w)
597597
598- @[grind =]
599598theorem findIdx_eq_getD_findIdx ? {xs : Array α} {p : α → Bool} :
600599 xs.findIdx p = (xs.findIdx? p).getD xs.size := by
601600 rcases xs with ⟨xs⟩
602601 simp [List.findIdx_eq_getD_findIdx?]
603602
603+ grind_pattern findIdx_eq_getD_findIdx? => xs.findIdx p, xs.findIdx? p
604+
604605theorem findIdx ?_eq_some_le_of_findIdx ?_eq_some {xs : Array α} {p q : α → Bool} (w : ∀ x ∈ xs, p x → q x) {i : Nat}
605606 (h : xs.findIdx? p = some i) : ∃ j, j ≤ i ∧ xs.findIdx? q = some j := by
606607 rcases xs with ⟨xs⟩
Original file line number Diff line number Diff line change @@ -1700,7 +1700,7 @@ Examples:
17001700 | [], n => n
17011701 | a :: l, n => bif p a then n else go l (n + 1 )
17021702
1703- @[simp] theorem findIdx_nil {p : α → Bool} : [].findIdx p = 0 := rfl
1703+ @ [simp, grind = ] theorem findIdx_nil {p : α → Bool} : [].findIdx p = 0 := rfl
17041704
17051705/-! ### idxOf -/
17061706
Original file line number Diff line number Diff line change @@ -980,7 +980,6 @@ theorem IsInfix.findIdx?_eq_none {l₁ l₂ : List α} {p : α → Bool} (h : l
980980grind_pattern IsInfix.findIdx?_eq_none => l₁ <:+: l₂, l₁.findIdx? p
981981grind_pattern IsInfix.findIdx?_eq_none => l₁ <:+: l₂, l₂.findIdx? p
982982
983- @[grind =]
984983theorem findIdx_eq_getD_findIdx ? {xs : List α} {p : α → Bool} :
985984 xs.findIdx p = (xs.findIdx? p).getD xs.length := by
986985 induction xs with
@@ -989,6 +988,8 @@ theorem findIdx_eq_getD_findIdx? {xs : List α} {p : α → Bool} :
989988 simp only [findIdx_cons, findIdx?_cons]
990989 split <;> simp_all
991990
991+ grind_pattern findIdx_eq_getD_findIdx? => xs.findIdx p, xs.findIdx? p
992+
992993@[simp] theorem findIdx ?_subtype {p : α → Prop } {l : List { x // p x }}
993994 {f : { x // p x } → Bool} {g : α → Bool} (hf : ∀ x h, f ⟨x, h⟩ = g x) :
994995 l.findIdx? f = l.unattach.findIdx? g := by
Original file line number Diff line number Diff line change @@ -103,16 +103,10 @@ info: instantiating `Array.back?_empty` triggers 17 additional `grind` theorem i
103103---
104104info: instantiating `Array.count_empty` triggers 19 additional `grind` theorem instantiations
105105---
106- info: instantiating `Array.findIdx_empty` triggers 20 additional `grind` theorem instantiations
107- ---
108- info: instantiating `Array.findIdx_singleton` triggers 16 additional `grind` theorem instantiations
109- ---
110106info: Try this:
111107 [ apply ] #grind_lint check (min := 15) in Array
112108 #grind_lint inspect Array.back?_empty
113109 #grind_lint inspect Array.count_empty
114- #grind_lint inspect Array.findIdx_empty
115- #grind_lint inspect Array.findIdx_singleton
116110-/
117111#guard_msgs in
118112#grind_lint check (min := 15 ) in Array
You can’t perform that action at this time.
0 commit comments