Skip to content

Commit

Permalink
fix: remove List.erase_of_forall_bne and replace with List.erase_eq_s…
Browse files Browse the repository at this point in the history
…elf_iff_forall_bne (#967)
  • Loading branch information
Seppel3210 authored and fgdorais committed Oct 1, 2024
1 parent de14411 commit fc68d86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Batteries/Data/Array/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ theorem eraseIdx_data_swap {l : Array α} (i : Nat) (lt : i + 1 < size l) :
| none =>
simp only [erase, h]
apply Eq.symm
apply List.erase_of_forall_bne
rw [←List.indexOf?_eq_none_iff, indexOf?_data, h, Option.map_none']
rw [List.erase_eq_self_iff_forall_bne, ←List.indexOf?_eq_none_iff, indexOf?_data,
h, Option.map_none']
| some i =>
simp only [erase, h]
rw [data_feraseIdx, ←List.eraseIdx_indexOf_eq_erase]
Expand Down
8 changes: 3 additions & 5 deletions Batteries/Data/List/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,9 @@ theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :

@[deprecated (since := "2024-04-22")] alias sublist.erase := Sublist.erase

theorem erase_of_forall_bne [BEq α] (a : α) (xs : List α) (h : ∀ (x : α), x ∈ xs → ¬x == a) :
xs.erase a = xs := by
rw [erase_eq_eraseP', eraseP_of_forall_not h]

-- TODO a version of the above theorem with LawfulBEq and ∉
theorem erase_eq_self_iff_forall_bne [BEq α] (a : α) (xs : List α) :
xs.erase a = xs ↔ ∀ (x : α), x ∈ xs → ¬x == a := by
rw [erase_eq_eraseP', eraseP_eq_self_iff]

/-! ### findIdx? -/

Expand Down

0 comments on commit fc68d86

Please sign in to comment.