@@ -600,6 +600,23 @@ theorem support_update_ne_zero [DecidableEq α] (h : b ≠ 0) :
600
600
congr; apply Subsingleton.elim
601
601
#align finsupp.support_update_ne_zero Finsupp.support_update_ne_zero
602
602
603
+ theorem support_update_subset [DecidableEq α] [DecidableEq M] :
604
+ support (f.update a b) ⊆ insert a f.support := by
605
+ rw [support_update]
606
+ split_ifs
607
+ · exact (erase_subset _ _).trans (subset_insert _ _)
608
+ · rfl
609
+
610
+ theorem update_comm (f : α →₀ M) {a₁ a₂ : α} (h : a₁ ≠ a₂) (m₁ m₂ : M) :
611
+ update (update f a₁ m₁) a₂ m₂ = update (update f a₂ m₂) a₁ m₁ :=
612
+ letI := Classical.decEq α
613
+ FunLike.coe_injective <| Function.update_comm h _ _ _
614
+
615
+ @[simp] theorem update_idem (f : α →₀ M) (a : α) (b c : M) :
616
+ update (update f a b) a c = update f a c :=
617
+ letI := Classical.decEq α
618
+ FunLike.coe_injective <| Function.update_idem _ _ _
619
+
603
620
end Update
604
621
605
622
/-! ### Declarations about `erase` -/
@@ -673,6 +690,28 @@ theorem erase_zero (a : α) : erase a (0 : α →₀ M) = 0 := by
673
690
classical rw [← support_eq_empty, support_erase, support_zero, erase_empty]
674
691
#align finsupp.erase_zero Finsupp.erase_zero
675
692
693
+ theorem erase_eq_update_zero (f : α →₀ M) (a : α) : f.erase a = update f a 0 :=
694
+ letI := Classical.decEq α
695
+ ext fun _ => (Function.update_apply _ _ _ _).symm
696
+
697
+ -- The name matches `Finset.erase_insert_of_ne`
698
+ theorem erase_update_of_ne (f : α →₀ M) {a a' : α} (ha : a ≠ a') (b : M) :
699
+ erase a (update f a' b) = update (erase a f) a' b := by
700
+ rw [erase_eq_update_zero, erase_eq_update_zero, update_comm _ ha]
701
+
702
+ -- not `simp` as `erase_of_not_mem_support` can prove this
703
+ theorem erase_idem (f : α →₀ M) (a : α) :
704
+ erase a (erase a f) = erase a f := by
705
+ rw [erase_eq_update_zero, erase_eq_update_zero, update_idem]
706
+
707
+ @[simp] theorem update_erase_eq_update (f : α →₀ M) (a : α) (b : M) :
708
+ update (erase a f) a b = update f a b := by
709
+ rw [erase_eq_update_zero, update_idem]
710
+
711
+ @[simp] theorem erase_update_eq_erase (f : α →₀ M) (a : α) (b : M) :
712
+ erase a (update f a b) = erase a f := by
713
+ rw [erase_eq_update_zero, erase_eq_update_zero, update_idem]
714
+
676
715
end Erase
677
716
678
717
/-! ### Declarations about `onFinset` -/
0 commit comments