@@ -157,14 +157,6 @@ set_option linter.uppercaseLean3 false in
157157@ [deprecated (since := "2024-04-17" )]
158158alias eval₂_int_castRingHom_X := eval₂_intCastRingHom_X
159159
160- end CommSemiring
161-
162- section aeval
163-
164- variable [CommSemiring R] [Semiring A] [CommSemiring A'] [Semiring B]
165- variable [Algebra R A] [Algebra R A'] [Algebra R B]
166- variable {p q : R[X]} (x : A)
167-
168160/-- `Polynomial.eval₂` as an `AlgHom` for noncommutative algebras.
169161
170162This is `Polynomial.eval₂RingHom'` for `AlgHom`s. -/
@@ -173,6 +165,77 @@ def eval₂AlgHom' (f : A →ₐ[R] B) (b : B) (hf : ∀ a, Commute (f a) b) : A
173165 toRingHom := eval₂RingHom' f b hf
174166 commutes' _ := (eval₂_C _ _).trans (f.commutes _)
175167
168+ section Map
169+
170+ /-- `Polynomial.map` as an `AlgHom` for noncommutative algebras.
171+
172+ This is the algebra version of `Polynomial.mapRingHom`. -/
173+ def mapAlgHom (f : A →ₐ[R] B) : Polynomial A →ₐ[R] Polynomial B where
174+ toRingHom := mapRingHom f.toRingHom
175+ commutes' := by simp
176+
177+ @[simp]
178+ theorem coe_mapAlgHom (f : A →ₐ[R] B) : ⇑(mapAlgHom f) = map f :=
179+ rfl
180+
181+ @[simp]
182+ theorem mapAlgHom_id : mapAlgHom (AlgHom.id R A) = AlgHom.id R (Polynomial A) :=
183+ AlgHom.ext fun _x => map_id
184+
185+ @[simp]
186+ theorem mapAlgHom_coe_ringHom (f : A →ₐ[R] B) :
187+ ↑(mapAlgHom f : _ →ₐ[R] Polynomial B) = (mapRingHom ↑f : Polynomial A →+* Polynomial B) :=
188+ rfl
189+
190+ @[simp]
191+ theorem mapAlgHom_comp (C : Type z) [Semiring C] [Algebra R C] (f : B →ₐ[R] C) (g : A →ₐ[R] B) :
192+ (mapAlgHom f).comp (mapAlgHom g) = mapAlgHom (f.comp g) := by
193+ apply AlgHom.ext
194+ intro x
195+ simp [AlgHom.comp_algebraMap, map_map]
196+ congr
197+
198+ theorem mapAlgHom_eq_eval₂AlgHom'_CAlgHom (f : A →ₐ[R] B) : mapAlgHom f = eval₂AlgHom'
199+ (CAlgHom.comp f) X (fun a => (commute_X (C (f a))).symm) := by
200+ apply AlgHom.ext
201+ intro x
202+ congr
203+
204+ /-- If `A` and `B` are isomorphic as `R`-algebras, then so are their polynomial rings -/
205+ def mapAlgEquiv (f : A ≃ₐ[R] B) : Polynomial A ≃ₐ[R] Polynomial B :=
206+ AlgEquiv.ofAlgHom (mapAlgHom f.toAlgHom) (mapAlgHom f.symm.toAlgHom) (by simp) (by simp)
207+
208+ @[simp]
209+ theorem coe_mapAlgEquiv (f : A ≃ₐ[R] B) : ⇑(mapAlgEquiv f) = map f :=
210+ rfl
211+
212+ @[simp]
213+ theorem mapAlgEquiv_id : mapAlgEquiv (@AlgEquiv.refl R A _ _ _) = AlgEquiv.refl :=
214+ AlgEquiv.ext fun _x => map_id
215+
216+ @[simp]
217+ theorem mapAlgEquiv_coe_ringHom (f : A ≃ₐ[R] B) :
218+ ↑(mapAlgEquiv f : _ ≃ₐ[R] Polynomial B) = (mapRingHom ↑f : Polynomial A →+* Polynomial B) :=
219+ rfl
220+
221+ @[simp]
222+ theorem mapAlgEquiv_comp (C : Type z) [Semiring C] [Algebra R C] (f : A ≃ₐ[R] B) (g : B ≃ₐ[R] C) :
223+ (mapAlgEquiv f).trans (mapAlgEquiv g) = mapAlgEquiv (f.trans g) := by
224+ apply AlgEquiv.ext
225+ intro x
226+ simp [AlgEquiv.trans_apply, map_map]
227+ congr
228+
229+ end Map
230+
231+ end CommSemiring
232+
233+ section aeval
234+
235+ variable [CommSemiring R] [Semiring A] [CommSemiring A'] [Semiring B]
236+ variable [Algebra R A] [Algebra R A'] [Algebra R B]
237+ variable {p q : R[X]} (x : A)
238+
176239/-- Given a valuation `x` of the variable in an `R`-algebra `A`, `aeval R A x` is
177240the unique `R`-algebra homomorphism from `R[X]` to `A` sending `X` to `x`.
178241
0 commit comments