Skip to content

Commit 1342b9e

Browse files
committed
feat(Function/Support): support of update (#11736)
Generalize 4 lemmas from `Finsupp` to `Function`.
1 parent 145460b commit 1342b9e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Mathlib/Algebra/Function/Support.lean

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,28 @@ theorem mulSupport_eq_iff {f : α → M} {s : Set α} :
8282
#align function.mul_support_eq_iff Function.mulSupport_eq_iff
8383
#align function.support_eq_iff Function.support_eq_iff
8484

85+
@[to_additive]
86+
theorem ext_iff_mulSupport {f g : α → M} :
87+
f = g ↔ f.mulSupport = g.mulSupport ∧ ∀ x ∈ f.mulSupport, f x = g x :=
88+
fun h ↦ h ▸ ⟨rfl, fun _ _ ↦ rfl⟩, fun ⟨h₁, h₂⟩ ↦ funext fun x ↦ by
89+
if hx : x ∈ f.mulSupport then exact h₂ x hx
90+
else rw [nmem_mulSupport.1 hx, nmem_mulSupport.1 (mt (Set.ext_iff.1 h₁ x).2 hx)]⟩
91+
92+
@[to_additive]
93+
theorem mulSupport_update_of_ne_one [DecidableEq α] (f : α → M) (x : α) {y : M} (hy : y ≠ 1) :
94+
mulSupport (update f x y) = insert x (mulSupport f) := by
95+
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
96+
97+
@[to_additive]
98+
theorem mulSupport_update_one [DecidableEq α] (f : α → M) (x : α) :
99+
mulSupport (update f x 1) = mulSupport f \ {x} := by
100+
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
101+
102+
@[to_additive]
103+
theorem mulSupport_update_eq_ite [DecidableEq α] [DecidableEq M] (f : α → M) (x : α) (y : M) :
104+
mulSupport (update f x y) = if y = 1 then mulSupport f \ {x} else insert x (mulSupport f) := by
105+
rcases eq_or_ne y 1 with rfl | hy <;> simp [mulSupport_update_one, mulSupport_update_of_ne_one, *]
106+
85107
@[to_additive]
86108
theorem mulSupport_extend_one_subset {f : α → M} {g : α → N} :
87109
mulSupport (f.extend g 1) ⊆ f '' mulSupport g :=

0 commit comments

Comments
 (0)