chore: lower List/Array/Vector.mem_map simp priority (#6815)

This PR lowers the simp priority of `List/Array/Vector.mem_map`, as
downstream in Mathlib many lemmas currently need their priority raised
to fire before this.
This commit is contained in:
Kim Morrison 2025-01-28 23:23:24 +11:00 committed by GitHub
parent f9d3deaafe
commit eea2d49078
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View file

@ -1091,7 +1091,9 @@ theorem map_id'' {f : αα} (h : ∀ x, f x = x) (l : Array α) : map f l =
theorem map_singleton (f : α → β) (a : α) : map f #[a] = #[f a] := rfl
@[simp] theorem mem_map {f : α → β} {l : Array α} : b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b := by
-- We use a lower priority here as there are more specific lemmas in downstream libraries
-- which should be able to fire first.
@[simp 500] theorem mem_map {f : α → β} {l : Array α} : b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b := by
simp only [mem_def, toList_map, List.mem_map]
theorem exists_of_mem_map (h : b ∈ map f l) : ∃ a, a ∈ l ∧ f a = b := mem_map.1 h

View file

@ -1046,7 +1046,9 @@ theorem map_id'' {f : αα} (h : ∀ x, f x = x) (l : List α) : map f l =
theorem map_singleton (f : α → β) (a : α) : map f [a] = [f a] := rfl
@[simp] theorem mem_map {f : α → β} : ∀ {l : List α}, b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b
-- We use a lower priority here as there are more specific lemmas in downstream libraries
-- which should be able to fire first.
@[simp 500] theorem mem_map {f : α → β} : ∀ {l : List α}, b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b
| [] => by simp
| _ :: l => by simp [mem_map (l := l), eq_comm (a := b)]

View file

@ -1188,7 +1188,9 @@ theorem map_id'' {f : αα} (h : ∀ x, f x = x) (l : Vector α n) : map f
theorem map_singleton (f : α → β) (a : α) : map f #v[a] = #v[f a] := rfl
@[simp] theorem mem_map {f : α → β} {l : Vector α n} : b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b := by
-- We use a lower priority here as there are more specific lemmas in downstream libraries
-- which should be able to fire first.
@[simp 500] theorem mem_map {f : α → β} {l : Vector α n} : b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b := by
cases l
simp