|
| 1 | +/- |
| 2 | +Copyright (c) 2025 Xavier Généreux. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: María Inés de Frutos Fernández, Xavier Généreux |
| 5 | +-/ |
| 6 | +import Mathlib.Algebra.SkewMonoidAlgebra.Basic |
| 7 | +/-! |
| 8 | +# Modifying skew monoid algebra at exactly one point |
| 9 | +
|
| 10 | +This file contains basic results on updating/erasing an element of a skew monoid algebras using |
| 11 | +one point of the domain. |
| 12 | +-/ |
| 13 | + |
| 14 | +noncomputable section |
| 15 | + |
| 16 | +namespace SkewMonoidAlgebra |
| 17 | + |
| 18 | +variable {k G H : Type*} |
| 19 | + |
| 20 | +section erase |
| 21 | + |
| 22 | +variable {M α : Type*} [AddCommMonoid M] (a a' : α) (b : M) (f : SkewMonoidAlgebra M α) |
| 23 | + |
| 24 | +/-- |
| 25 | +Given an element `f` of a skew monoid algebra, `erase a f` is an element with the same coefficients |
| 26 | +as `f` except at `a` where the coefficient is `0`. |
| 27 | +If `a` is not in the support of `f` then `erase a f = f`. -/ |
| 28 | +@[simps] def erase : SkewMonoidAlgebra M α →+ SkewMonoidAlgebra M α where |
| 29 | + toFun f := ⟨f.toFinsupp.erase a⟩ |
| 30 | + map_zero' := by simp |
| 31 | + map_add' := by simp |
| 32 | + |
| 33 | +@[simp] |
| 34 | +theorem support_erase [DecidableEq α] : (f.erase a).support = f.support.erase a := by |
| 35 | + ext; simp [erase] |
| 36 | + |
| 37 | +@[simp] |
| 38 | +theorem coeff_erase_same : (f.erase a).coeff a = 0 := by |
| 39 | + simp [erase] |
| 40 | + |
| 41 | +variable {a a'} in |
| 42 | +@[simp] |
| 43 | +theorem coeff_erase_ne (h : a' ≠ a) : (f.erase a).coeff a' = f.coeff a' := by |
| 44 | + simp [erase, h] |
| 45 | + |
| 46 | +@[simp] |
| 47 | +theorem erase_single : erase a (single a b) = 0 := by |
| 48 | + simp [erase] |
| 49 | + |
| 50 | +theorem coeff_erase_apply [DecidableEq α] : |
| 51 | + (f.erase a).coeff a' = if a' = a then 0 else f.coeff a' := |
| 52 | + ite_congr rfl (fun _ ↦ rfl) (fun _ ↦ rfl) |
| 53 | + |
| 54 | +theorem single_add_erase (a : α) (f : SkewMonoidAlgebra M α) : |
| 55 | + single a (f.coeff a) + f.erase a = f := by |
| 56 | + apply toFinsupp_injective |
| 57 | + rw [single, ← toFinsupp_apply, toFinsupp_add, erase_apply_toFinsupp, |
| 58 | + Finsupp.single_add_erase] |
| 59 | + |
| 60 | +@[elab_as_elim] |
| 61 | +theorem induction {p : SkewMonoidAlgebra M α → Prop} (f : SkewMonoidAlgebra M α) (h0 : p 0) |
| 62 | + (ha : ∀ (a b) (f : SkewMonoidAlgebra M α), a ∉ f.support → b ≠ 0 → p f → p (single a b + f)) : |
| 63 | + p f := |
| 64 | + suffices ∀ (s) (f : SkewMonoidAlgebra M α), f.support = s → p f from this _ _ rfl |
| 65 | + fun s ↦ |
| 66 | + Finset.cons_induction_on s (fun f hf ↦ by rwa [support_eq_empty.1 hf]) fun a s has ih f hf ↦ by |
| 67 | + suffices p (single a (f.coeff a) + f.erase a) by rwa [single_add_erase] at this |
| 68 | + classical |
| 69 | + apply ha |
| 70 | + · rw [support_erase, Finset.mem_erase] |
| 71 | + exact fun H ↦ H.1 rfl |
| 72 | + · simp only [← mem_support_iff, hf, Finset.mem_cons_self] |
| 73 | + · apply ih |
| 74 | + rw [support_erase, hf, Finset.erase_cons] |
| 75 | + |
| 76 | +end erase |
| 77 | + |
| 78 | +section update |
| 79 | + |
| 80 | +variable {M α : Type*} [AddCommMonoid M] (f : SkewMonoidAlgebra M α) (a a' : α) (b : M) |
| 81 | + |
| 82 | +/-- Replace the coefficent of an element `f` of a skew monoid algebra at a given point `a : α` by |
| 83 | +a given value `b : M`. |
| 84 | +If `b = 0`, this amounts to removing `a` from the support of `f`. |
| 85 | +Otherwise, if `a` was not in the `support` of `f`, it is added to it. -/ |
| 86 | +@[simps] def update : SkewMonoidAlgebra M α := |
| 87 | + ⟨f.toFinsupp.update a b⟩ |
| 88 | + |
| 89 | +@[simp] |
| 90 | +theorem update_self : f.update a (f.coeff a) = f := by |
| 91 | + rcases f with ⟨f⟩ |
| 92 | + apply toFinsupp_injective |
| 93 | + simp |
| 94 | + |
| 95 | +@[simp] |
| 96 | +theorem zero_update : update 0 a b = single a b := by |
| 97 | + simp [update] |
| 98 | + |
| 99 | +theorem support_update [DecidableEq α] [DecidableEq M] : |
| 100 | + support (f.update a b) = if b = 0 then f.support.erase a else insert a f.support := by |
| 101 | + aesop (add norm [update, Finsupp.support_update_ne_zero]) |
| 102 | + |
| 103 | +theorem coeff_update [DecidableEq α] : (f.update a b).coeff = Function.update f.coeff a b := by |
| 104 | + simp only [coeff, update, Finsupp.update, Finsupp.coe_mk] |
| 105 | + congr! |
| 106 | + |
| 107 | +theorem coeff_update_apply [DecidableEq α] : |
| 108 | + (f.update a b).coeff a' = if a' = a then b else f.coeff a' := by |
| 109 | + rw [coeff_update, Function.update_apply] |
| 110 | + |
| 111 | +@[simp] |
| 112 | +theorem coeff_update_same [DecidableEq α] : (f.update a b).coeff a = b := by |
| 113 | + rw [f.coeff_update_apply, if_pos rfl] |
| 114 | + |
| 115 | +variable {a a'} in |
| 116 | +@[simp] |
| 117 | +theorem coeff_update_ne [DecidableEq α] (h : a' ≠ a) : (f.update a b).coeff a' = f.coeff a' := by |
| 118 | + rw [f.coeff_update_apply, if_neg h] |
| 119 | + |
| 120 | +theorem update_eq_erase_add_single [DecidableEq α] : f.update a b = f.erase a + single a b := by |
| 121 | + ext x; by_cases hx : x = a <;> aesop (add norm coeff_single_apply) |
| 122 | + |
| 123 | +@[simp] |
| 124 | +theorem update_zero_eq_erase [DecidableEq α] : f.update a 0 = f.erase a := by |
| 125 | + ext; simp [coeff_update_apply, coeff_erase_apply] |
| 126 | + |
| 127 | +end update |
| 128 | + |
| 129 | +end SkewMonoidAlgebra |
0 commit comments