Skip to content

Commit

Permalink
feat(MvPolynomial): commuting the variables of mv-polynomials of mv-p…
Browse files Browse the repository at this point in the history
…olynomials

From GrowthInGroups (LeanCamCombi)

Co-authored-by: Andrew Yang
  • Loading branch information
YaelDillies committed Jan 3, 2025
1 parent 0571c82 commit 6498c65
Showing 1 changed file with 39 additions and 6 deletions.
45 changes: 39 additions & 6 deletions Mathlib/Algebra/MvPolynomial/Equiv.lean
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ theorem iterToSum_X (b : S₁) : iterToSum R S₁ S₂ (X b) = X (Sum.inl b) :=
theorem iterToSum_C_X (c : S₂) : iterToSum R S₁ S₂ (C (X c)) = X (Sum.inr c) :=
Eq.trans (eval₂_C _ _ (X c)) (eval₂_X _ _ _)

variable (σ)

variable (σ) in
/-- The algebra isomorphism between multivariable polynomials in no variables
and the ground ring. -/
@[simps!]
Expand All @@ -196,7 +195,7 @@ def isEmptyAlgEquiv [he : IsEmpty σ] : MvPolynomial σ R ≃ₐ[R] R :=
ext i m
exact IsEmpty.elim' he i)

variable {R S₁ σ} in
variable {R S₁} in
@[simp]
lemma aeval_injective_iff_of_isEmpty [IsEmpty σ] [CommSemiring S₁] [Algebra R S₁] {f : σ → S₁} :
Function.Injective (aeval f : MvPolynomial σ R →ₐ[R] S₁) ↔
Expand All @@ -207,13 +206,23 @@ lemma aeval_injective_iff_of_isEmpty [IsEmpty σ] [CommSemiring S₁] [Algebra R
rw [this, ← Injective.of_comp_iff' _ (@isEmptyAlgEquiv R σ _ _).bijective]
rfl

section isEmptyRingEquiv
variable [IsEmpty σ]

variable (σ) in
/-- The ring isomorphism between multivariable polynomials in no variables
and the ground ring. -/
@[simps!]

Check failure on line 215 in Mathlib/Algebra/MvPolynomial/Equiv.lean

View workflow job for this annotation

GitHub Actions / Build

MvPolynomial.isEmptyRingEquiv_symm_apply_toFun Left-hand side simplifies from

Check failure on line 215 in Mathlib/Algebra/MvPolynomial/Equiv.lean

View workflow job for this annotation

GitHub Actions / Build

MvPolynomial.isEmptyRingEquiv_symm_apply_support Left-hand side simplifies from
def isEmptyRingEquiv [IsEmpty σ] : MvPolynomial σ R ≃+* R :=
(isEmptyAlgEquiv R σ).toRingEquiv
def isEmptyRingEquiv : MvPolynomial σ R ≃+* R := (isEmptyAlgEquiv R σ).toRingEquiv

@[simp] lemma isEmptyRingEquiv_toRingHom : (isEmptyRingEquiv R σ).symm.toRingHom = C := rfl

Check failure on line 218 in Mathlib/Algebra/MvPolynomial/Equiv.lean

View workflow job for this annotation

GitHub Actions / Build

MvPolynomial.isEmptyRingEquiv_toRingHom Left-hand side simplifies from
@[simp] lemma isEmptyRingEquiv_symm_apply (r : R) : (isEmptyRingEquiv R σ).symm r = C r := rfl

variable {σ}
lemma isEmptyRingEquiv_eq_coeff_zero {σ R : Type*} [CommSemiring R] [IsEmpty σ] {x} :
isEmptyRingEquiv R σ x = x.coeff 0 := by
obtain ⟨x, rfl⟩ := (isEmptyRingEquiv R σ).symm.surjective x; simp

end isEmptyRingEquiv

/-- A helper function for `sumRingEquiv`. -/
@[simps]
Expand Down Expand Up @@ -267,6 +276,30 @@ lemma sumAlgEquiv_comp_rename_inl :
ext i
simp

section commAlgEquiv
variable {R S₁ S₂ : Type*} [CommSemiring R]

variable (R S₁ S₂) in
/-- The algebra isomorphism between multivariable polynomials in variables `S₁` of multivariable
polynomials in variables `S₂` and multivariable polynomials in variables `S₂` of multivariable
polynomials in variables `S₁`. -/
noncomputable
def commAlgEquiv : MvPolynomial S₁ (MvPolynomial S₂ R) ≃ₐ[R] MvPolynomial S₂ (MvPolynomial S₁ R) :=
(sumAlgEquiv R S₁ S₂).symm.trans <| (renameEquiv _ (.sumComm S₁ S₂)).trans (sumAlgEquiv R S₂ S₁)

lemma commAlgEquiv_C (p) : commAlgEquiv R S₁ S₂ (.C p) = .map C p := by
suffices (commAlgEquiv R S₁ S₂).toAlgHom.comp
(IsScalarTower.toAlgHom R (MvPolynomial S₂ R) _) = mapAlgHom (Algebra.ofId _ _) by
exact DFunLike.congr_fun this p
ext x : 1
simp [commAlgEquiv]

lemma commAlgEquiv_C_X (i) : commAlgEquiv R S₁ S₂ (.C (.X i)) = .X i := by simp [commAlgEquiv_C]

lemma commAlgEquiv_X (i) : commAlgEquiv R S₁ S₂ (.X i) = .C (.X i) := by simp [commAlgEquiv]

end commAlgEquiv

section

-- this speeds up typeclass search in the lemma below
Expand Down

0 comments on commit 6498c65

Please sign in to comment.