state
stringlengths 0
159k
| srcUpToTactic
stringlengths 387
167k
| nextTactic
stringlengths 3
9k
| declUpToTactic
stringlengths 22
11.5k
| declId
stringlengths 38
95
| decl
stringlengths 16
1.89k
| file_tag
stringlengths 17
73
|
---|---|---|---|---|---|---|
F : Type u_1
α✝ : Type u_2
β : Type u_3
γ : Type u_4
x✝¹ : NonAssocSemiring α✝
x✝ : NonAssocSemiring β
α : Type u_5
inst✝ : NonAssocSemiring α
⊢ α →+* α | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
| refine' { toFun := _root_.id.. } | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
| Mathlib.Algebra.Ring.Hom.Defs.631_0.KyHvVYrIs9pW9ZQ | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α | Mathlib_Algebra_Ring_Hom_Defs |
case refine'_1
F : Type u_1
α✝ : Type u_2
β : Type u_3
γ : Type u_4
x✝¹ : NonAssocSemiring α✝
x✝ : NonAssocSemiring β
α : Type u_5
inst✝ : NonAssocSemiring α
⊢ _root_.id 1 = 1 | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> | intros | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> | Mathlib.Algebra.Ring.Hom.Defs.631_0.KyHvVYrIs9pW9ZQ | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α | Mathlib_Algebra_Ring_Hom_Defs |
case refine'_2
F : Type u_1
α✝ : Type u_2
β : Type u_3
γ : Type u_4
x✝¹ : NonAssocSemiring α✝
x✝ : NonAssocSemiring β
α : Type u_5
inst✝ : NonAssocSemiring α
⊢ ∀ (x y : α),
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } (x * y) =
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } x *
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } y | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> | intros | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> | Mathlib.Algebra.Ring.Hom.Defs.631_0.KyHvVYrIs9pW9ZQ | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α | Mathlib_Algebra_Ring_Hom_Defs |
case refine'_3
F : Type u_1
α✝ : Type u_2
β : Type u_3
γ : Type u_4
x✝¹ : NonAssocSemiring α✝
x✝ : NonAssocSemiring β
α : Type u_5
inst✝ : NonAssocSemiring α
⊢ OneHom.toFun
(↑{ toOneHom := { toFun := _root_.id, map_one' := ?refine'_1 },
map_mul' :=
(_ :
∀ (x y : α),
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } (x * y) =
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } x *
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } y) })
0 =
0 | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> | intros | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> | Mathlib.Algebra.Ring.Hom.Defs.631_0.KyHvVYrIs9pW9ZQ | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α | Mathlib_Algebra_Ring_Hom_Defs |
case refine'_4
F : Type u_1
α✝ : Type u_2
β : Type u_3
γ : Type u_4
x✝¹ : NonAssocSemiring α✝
x✝ : NonAssocSemiring β
α : Type u_5
inst✝ : NonAssocSemiring α
⊢ ∀ (x y : α),
OneHom.toFun
(↑{ toOneHom := { toFun := _root_.id, map_one' := ?refine'_1 },
map_mul' :=
(_ :
∀ (x y : α),
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } (x * y) =
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } x *
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } y) })
(x + y) =
OneHom.toFun
(↑{ toOneHom := { toFun := _root_.id, map_one' := ?refine'_1 },
map_mul' :=
(_ :
∀ (x y : α),
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } (x * y) =
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } x *
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } y) })
x +
OneHom.toFun
(↑{ toOneHom := { toFun := _root_.id, map_one' := ?refine'_1 },
map_mul' :=
(_ :
∀ (x y : α),
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } (x * y) =
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } x *
OneHom.toFun { toFun := _root_.id, map_one' := ?refine'_1 } y) })
y | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> | intros | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> | Mathlib.Algebra.Ring.Hom.Defs.631_0.KyHvVYrIs9pW9ZQ | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α | Mathlib_Algebra_Ring_Hom_Defs |
case refine'_1
F : Type u_1
α✝ : Type u_2
β : Type u_3
γ : Type u_4
x✝¹ : NonAssocSemiring α✝
x✝ : NonAssocSemiring β
α : Type u_5
inst✝ : NonAssocSemiring α
⊢ _root_.id 1 = 1 | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> | rfl | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> | Mathlib.Algebra.Ring.Hom.Defs.631_0.KyHvVYrIs9pW9ZQ | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α | Mathlib_Algebra_Ring_Hom_Defs |
case refine'_2
F : Type u_1
α✝ : Type u_2
β : Type u_3
γ : Type u_4
x✝² : NonAssocSemiring α✝
x✝¹ : NonAssocSemiring β
α : Type u_5
inst✝ : NonAssocSemiring α
x✝ y✝ : α
⊢ OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } (x✝ * y✝) =
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } x✝ *
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } y✝ | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> | rfl | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> | Mathlib.Algebra.Ring.Hom.Defs.631_0.KyHvVYrIs9pW9ZQ | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α | Mathlib_Algebra_Ring_Hom_Defs |
case refine'_3
F : Type u_1
α✝ : Type u_2
β : Type u_3
γ : Type u_4
x✝¹ : NonAssocSemiring α✝
x✝ : NonAssocSemiring β
α : Type u_5
inst✝ : NonAssocSemiring α
⊢ OneHom.toFun
(↑{ toOneHom := { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) },
map_mul' :=
(_ :
∀ (x y : α),
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } (x * y) =
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } (x * y)) })
0 =
0 | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> | rfl | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> | Mathlib.Algebra.Ring.Hom.Defs.631_0.KyHvVYrIs9pW9ZQ | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α | Mathlib_Algebra_Ring_Hom_Defs |
case refine'_4
F : Type u_1
α✝ : Type u_2
β : Type u_3
γ : Type u_4
x✝² : NonAssocSemiring α✝
x✝¹ : NonAssocSemiring β
α : Type u_5
inst✝ : NonAssocSemiring α
x✝ y✝ : α
⊢ OneHom.toFun
(↑{ toOneHom := { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) },
map_mul' :=
(_ :
∀ (x y : α),
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } (x * y) =
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } (x * y)) })
(x✝ + y✝) =
OneHom.toFun
(↑{ toOneHom := { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) },
map_mul' :=
(_ :
∀ (x y : α),
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } (x * y) =
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } (x * y)) })
x✝ +
OneHom.toFun
(↑{ toOneHom := { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) },
map_mul' :=
(_ :
∀ (x y : α),
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } (x * y) =
OneHom.toFun { toFun := _root_.id, map_one' := (_ : _root_.id 1 = _root_.id 1) } (x * y)) })
y✝ | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> | rfl | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> | Mathlib.Algebra.Ring.Hom.Defs.631_0.KyHvVYrIs9pW9ZQ | /-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α | Mathlib_Algebra_Ring_Hom_Defs |
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
x✝² : NonAssocSemiring α
x✝¹ : NonAssocSemiring β
x✝ : NonAssocSemiring γ
g : β →+* γ
f : α →+* β
src✝ : α →ₙ+* γ := NonUnitalRingHom.comp (toNonUnitalRingHom g) (toNonUnitalRingHom f)
⊢ (⇑g ∘ ⇑f) 1 = 1 | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> rfl
#align ring_hom.id RingHom.id
instance : Inhabited (α →+* α) :=
⟨id α⟩
@[simp]
theorem id_apply (x : α) : RingHom.id α x = x :=
rfl
#align ring_hom.id_apply RingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align ring_hom.coe_add_monoid_hom_id RingHom.coe_addMonoidHom_id
@[simp]
theorem coe_monoidHom_id : (id α : α →* α) = MonoidHom.id α :=
rfl
#align ring_hom.coe_monoid_hom_id RingHom.coe_monoidHom_id
variable {_ : NonAssocSemiring γ}
/-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by | simp | /-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by | Mathlib.Algebra.Ring.Hom.Defs.656_0.KyHvVYrIs9pW9ZQ | /-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ | Mathlib_Algebra_Ring_Hom_Defs |
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
x✝² : NonAssocSemiring α
x✝¹ : NonAssocSemiring β
x✝ : NonAssocSemiring γ
g : β →+* γ
f₁ f₂ : α →+* β
hg : Injective ⇑g
h : comp g f₁ = comp g f₂
x : α
⊢ g (f₁ x) = g (f₂ x) | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> rfl
#align ring_hom.id RingHom.id
instance : Inhabited (α →+* α) :=
⟨id α⟩
@[simp]
theorem id_apply (x : α) : RingHom.id α x = x :=
rfl
#align ring_hom.id_apply RingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align ring_hom.coe_add_monoid_hom_id RingHom.coe_addMonoidHom_id
@[simp]
theorem coe_monoidHom_id : (id α : α →* α) = MonoidHom.id α :=
rfl
#align ring_hom.coe_monoid_hom_id RingHom.coe_monoidHom_id
variable {_ : NonAssocSemiring γ}
/-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by simp }
#align ring_hom.comp RingHom.comp
/-- Composition of semiring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonAssocSemiring δ} (f : α →+* β) (g : β →+* γ) (h : γ →+* δ) :
(h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align ring_hom.comp_assoc RingHom.comp_assoc
@[simp]
theorem coe_comp (hnp : β →+* γ) (hmn : α →+* β) : (hnp.comp hmn : α → γ) = hnp ∘ hmn :=
rfl
#align ring_hom.coe_comp RingHom.coe_comp
theorem comp_apply (hnp : β →+* γ) (hmn : α →+* β) (x : α) :
(hnp.comp hmn : α → γ) x = hnp (hmn x) :=
rfl
#align ring_hom.comp_apply RingHom.comp_apply
@[simp]
theorem comp_id (f : α →+* β) : f.comp (id α) = f :=
ext fun _ => rfl
#align ring_hom.comp_id RingHom.comp_id
@[simp]
theorem id_comp (f : α →+* β) : (id β).comp f = f :=
ext fun _ => rfl
#align ring_hom.id_comp RingHom.id_comp
instance : Monoid (α →+* α) where
one := id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
theorem one_def : (1 : α →+* α) = id α :=
rfl
#align ring_hom.one_def RingHom.one_def
theorem mul_def (f g : α →+* α) : f * g = f.comp g :=
rfl
#align ring_hom.mul_def RingHom.mul_def
@[simp]
theorem coe_one : ⇑(1 : α →+* α) = _root_.id :=
rfl
#align ring_hom.coe_one RingHom.coe_one
@[simp]
theorem coe_mul (f g : α →+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align ring_hom.coe_mul RingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →+* γ} {f : α →+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => RingHom.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align ring_hom.cancel_right RingHom.cancel_right
@[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => RingHom.ext fun x => hg <| by | rw [← comp_apply, h, comp_apply] | @[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => RingHom.ext fun x => hg <| by | Mathlib.Algebra.Ring.Hom.Defs.718_0.KyHvVYrIs9pW9ZQ | @[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ | Mathlib_Algebra_Ring_Hom_Defs |
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : CommRing β
f : β →+ α
h : ∀ (x : β), f (x * x) = f x * f x
h_two : 2 ≠ 0
h_one : f 1 = 1
x y : β
⊢ OneHom.toFun { toFun := f.toFun, map_one' := h_one } (x * y) =
OneHom.toFun { toFun := f.toFun, map_one' := h_one } x * OneHom.toFun { toFun := f.toFun, map_one' := h_one } y | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> rfl
#align ring_hom.id RingHom.id
instance : Inhabited (α →+* α) :=
⟨id α⟩
@[simp]
theorem id_apply (x : α) : RingHom.id α x = x :=
rfl
#align ring_hom.id_apply RingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align ring_hom.coe_add_monoid_hom_id RingHom.coe_addMonoidHom_id
@[simp]
theorem coe_monoidHom_id : (id α : α →* α) = MonoidHom.id α :=
rfl
#align ring_hom.coe_monoid_hom_id RingHom.coe_monoidHom_id
variable {_ : NonAssocSemiring γ}
/-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by simp }
#align ring_hom.comp RingHom.comp
/-- Composition of semiring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonAssocSemiring δ} (f : α →+* β) (g : β →+* γ) (h : γ →+* δ) :
(h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align ring_hom.comp_assoc RingHom.comp_assoc
@[simp]
theorem coe_comp (hnp : β →+* γ) (hmn : α →+* β) : (hnp.comp hmn : α → γ) = hnp ∘ hmn :=
rfl
#align ring_hom.coe_comp RingHom.coe_comp
theorem comp_apply (hnp : β →+* γ) (hmn : α →+* β) (x : α) :
(hnp.comp hmn : α → γ) x = hnp (hmn x) :=
rfl
#align ring_hom.comp_apply RingHom.comp_apply
@[simp]
theorem comp_id (f : α →+* β) : f.comp (id α) = f :=
ext fun _ => rfl
#align ring_hom.comp_id RingHom.comp_id
@[simp]
theorem id_comp (f : α →+* β) : (id β).comp f = f :=
ext fun _ => rfl
#align ring_hom.id_comp RingHom.id_comp
instance : Monoid (α →+* α) where
one := id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
theorem one_def : (1 : α →+* α) = id α :=
rfl
#align ring_hom.one_def RingHom.one_def
theorem mul_def (f g : α →+* α) : f * g = f.comp g :=
rfl
#align ring_hom.mul_def RingHom.mul_def
@[simp]
theorem coe_one : ⇑(1 : α →+* α) = _root_.id :=
rfl
#align ring_hom.coe_one RingHom.coe_one
@[simp]
theorem coe_mul (f g : α →+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align ring_hom.coe_mul RingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →+* γ} {f : α →+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => RingHom.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align ring_hom.cancel_right RingHom.cancel_right
@[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => RingHom.ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align ring_hom.cancel_left RingHom.cancel_left
end RingHom
namespace AddMonoidHom
variable [CommRing α] [IsDomain α] [CommRing β] (f : β →+ α)
-- Porting note: there's some disagreement over the naming scheme here.
-- This could perhaps be `mkRingHom_of_mul_self_of_two_ne_zero`.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/naming.20conventions/near/315558410
/-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
| have hxy := h (x + y) | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
| Mathlib.Algebra.Ring.Hom.Defs.733_0.KyHvVYrIs9pW9ZQ | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α | Mathlib_Algebra_Ring_Hom_Defs |
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : CommRing β
f : β →+ α
h : ∀ (x : β), f (x * x) = f x * f x
h_two : 2 ≠ 0
h_one : f 1 = 1
x y : β
hxy : f ((x + y) * (x + y)) = f (x + y) * f (x + y)
⊢ OneHom.toFun { toFun := f.toFun, map_one' := h_one } (x * y) =
OneHom.toFun { toFun := f.toFun, map_one' := h_one } x * OneHom.toFun { toFun := f.toFun, map_one' := h_one } y | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> rfl
#align ring_hom.id RingHom.id
instance : Inhabited (α →+* α) :=
⟨id α⟩
@[simp]
theorem id_apply (x : α) : RingHom.id α x = x :=
rfl
#align ring_hom.id_apply RingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align ring_hom.coe_add_monoid_hom_id RingHom.coe_addMonoidHom_id
@[simp]
theorem coe_monoidHom_id : (id α : α →* α) = MonoidHom.id α :=
rfl
#align ring_hom.coe_monoid_hom_id RingHom.coe_monoidHom_id
variable {_ : NonAssocSemiring γ}
/-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by simp }
#align ring_hom.comp RingHom.comp
/-- Composition of semiring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonAssocSemiring δ} (f : α →+* β) (g : β →+* γ) (h : γ →+* δ) :
(h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align ring_hom.comp_assoc RingHom.comp_assoc
@[simp]
theorem coe_comp (hnp : β →+* γ) (hmn : α →+* β) : (hnp.comp hmn : α → γ) = hnp ∘ hmn :=
rfl
#align ring_hom.coe_comp RingHom.coe_comp
theorem comp_apply (hnp : β →+* γ) (hmn : α →+* β) (x : α) :
(hnp.comp hmn : α → γ) x = hnp (hmn x) :=
rfl
#align ring_hom.comp_apply RingHom.comp_apply
@[simp]
theorem comp_id (f : α →+* β) : f.comp (id α) = f :=
ext fun _ => rfl
#align ring_hom.comp_id RingHom.comp_id
@[simp]
theorem id_comp (f : α →+* β) : (id β).comp f = f :=
ext fun _ => rfl
#align ring_hom.id_comp RingHom.id_comp
instance : Monoid (α →+* α) where
one := id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
theorem one_def : (1 : α →+* α) = id α :=
rfl
#align ring_hom.one_def RingHom.one_def
theorem mul_def (f g : α →+* α) : f * g = f.comp g :=
rfl
#align ring_hom.mul_def RingHom.mul_def
@[simp]
theorem coe_one : ⇑(1 : α →+* α) = _root_.id :=
rfl
#align ring_hom.coe_one RingHom.coe_one
@[simp]
theorem coe_mul (f g : α →+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align ring_hom.coe_mul RingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →+* γ} {f : α →+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => RingHom.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align ring_hom.cancel_right RingHom.cancel_right
@[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => RingHom.ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align ring_hom.cancel_left RingHom.cancel_left
end RingHom
namespace AddMonoidHom
variable [CommRing α] [IsDomain α] [CommRing β] (f : β →+ α)
-- Porting note: there's some disagreement over the naming scheme here.
-- This could perhaps be `mkRingHom_of_mul_self_of_two_ne_zero`.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/naming.20conventions/near/315558410
/-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
| rw [mul_add, add_mul, add_mul, f.map_add, f.map_add, f.map_add, f.map_add, h x, h y, add_mul,
mul_add, mul_add, ← sub_eq_zero, add_comm (f x * f x + f (y * x)), ← sub_sub, ← sub_sub,
← sub_sub, mul_comm y x, mul_comm (f y) (f x)] at hxy | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
| Mathlib.Algebra.Ring.Hom.Defs.733_0.KyHvVYrIs9pW9ZQ | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α | Mathlib_Algebra_Ring_Hom_Defs |
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : CommRing β
f : β →+ α
h : ∀ (x : β), f (x * x) = f x * f x
h_two : 2 ≠ 0
h_one : f 1 = 1
x y : β
hxy : f (x * y) + f y * f y + (f x * f x + f (x * y)) - f x * f x - f x * f y - f x * f y - f y * f y = 0
⊢ OneHom.toFun { toFun := f.toFun, map_one' := h_one } (x * y) =
OneHom.toFun { toFun := f.toFun, map_one' := h_one } x * OneHom.toFun { toFun := f.toFun, map_one' := h_one } y | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> rfl
#align ring_hom.id RingHom.id
instance : Inhabited (α →+* α) :=
⟨id α⟩
@[simp]
theorem id_apply (x : α) : RingHom.id α x = x :=
rfl
#align ring_hom.id_apply RingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align ring_hom.coe_add_monoid_hom_id RingHom.coe_addMonoidHom_id
@[simp]
theorem coe_monoidHom_id : (id α : α →* α) = MonoidHom.id α :=
rfl
#align ring_hom.coe_monoid_hom_id RingHom.coe_monoidHom_id
variable {_ : NonAssocSemiring γ}
/-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by simp }
#align ring_hom.comp RingHom.comp
/-- Composition of semiring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonAssocSemiring δ} (f : α →+* β) (g : β →+* γ) (h : γ →+* δ) :
(h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align ring_hom.comp_assoc RingHom.comp_assoc
@[simp]
theorem coe_comp (hnp : β →+* γ) (hmn : α →+* β) : (hnp.comp hmn : α → γ) = hnp ∘ hmn :=
rfl
#align ring_hom.coe_comp RingHom.coe_comp
theorem comp_apply (hnp : β →+* γ) (hmn : α →+* β) (x : α) :
(hnp.comp hmn : α → γ) x = hnp (hmn x) :=
rfl
#align ring_hom.comp_apply RingHom.comp_apply
@[simp]
theorem comp_id (f : α →+* β) : f.comp (id α) = f :=
ext fun _ => rfl
#align ring_hom.comp_id RingHom.comp_id
@[simp]
theorem id_comp (f : α →+* β) : (id β).comp f = f :=
ext fun _ => rfl
#align ring_hom.id_comp RingHom.id_comp
instance : Monoid (α →+* α) where
one := id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
theorem one_def : (1 : α →+* α) = id α :=
rfl
#align ring_hom.one_def RingHom.one_def
theorem mul_def (f g : α →+* α) : f * g = f.comp g :=
rfl
#align ring_hom.mul_def RingHom.mul_def
@[simp]
theorem coe_one : ⇑(1 : α →+* α) = _root_.id :=
rfl
#align ring_hom.coe_one RingHom.coe_one
@[simp]
theorem coe_mul (f g : α →+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align ring_hom.coe_mul RingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →+* γ} {f : α →+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => RingHom.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align ring_hom.cancel_right RingHom.cancel_right
@[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => RingHom.ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align ring_hom.cancel_left RingHom.cancel_left
end RingHom
namespace AddMonoidHom
variable [CommRing α] [IsDomain α] [CommRing β] (f : β →+ α)
-- Porting note: there's some disagreement over the naming scheme here.
-- This could perhaps be `mkRingHom_of_mul_self_of_two_ne_zero`.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/naming.20conventions/near/315558410
/-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
rw [mul_add, add_mul, add_mul, f.map_add, f.map_add, f.map_add, f.map_add, h x, h y, add_mul,
mul_add, mul_add, ← sub_eq_zero, add_comm (f x * f x + f (y * x)), ← sub_sub, ← sub_sub,
← sub_sub, mul_comm y x, mul_comm (f y) (f x)] at hxy
| simp only [add_assoc, add_sub_assoc, add_sub_cancel'_right] at hxy | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
rw [mul_add, add_mul, add_mul, f.map_add, f.map_add, f.map_add, f.map_add, h x, h y, add_mul,
mul_add, mul_add, ← sub_eq_zero, add_comm (f x * f x + f (y * x)), ← sub_sub, ← sub_sub,
← sub_sub, mul_comm y x, mul_comm (f y) (f x)] at hxy
| Mathlib.Algebra.Ring.Hom.Defs.733_0.KyHvVYrIs9pW9ZQ | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α | Mathlib_Algebra_Ring_Hom_Defs |
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : CommRing β
f : β →+ α
h : ∀ (x : β), f (x * x) = f x * f x
h_two : 2 ≠ 0
h_one : f 1 = 1
x y : β
hxy : f (x * y) + (f (x * y) - f x * f y - f x * f y) = 0
⊢ OneHom.toFun { toFun := f.toFun, map_one' := h_one } (x * y) =
OneHom.toFun { toFun := f.toFun, map_one' := h_one } x * OneHom.toFun { toFun := f.toFun, map_one' := h_one } y | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> rfl
#align ring_hom.id RingHom.id
instance : Inhabited (α →+* α) :=
⟨id α⟩
@[simp]
theorem id_apply (x : α) : RingHom.id α x = x :=
rfl
#align ring_hom.id_apply RingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align ring_hom.coe_add_monoid_hom_id RingHom.coe_addMonoidHom_id
@[simp]
theorem coe_monoidHom_id : (id α : α →* α) = MonoidHom.id α :=
rfl
#align ring_hom.coe_monoid_hom_id RingHom.coe_monoidHom_id
variable {_ : NonAssocSemiring γ}
/-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by simp }
#align ring_hom.comp RingHom.comp
/-- Composition of semiring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonAssocSemiring δ} (f : α →+* β) (g : β →+* γ) (h : γ →+* δ) :
(h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align ring_hom.comp_assoc RingHom.comp_assoc
@[simp]
theorem coe_comp (hnp : β →+* γ) (hmn : α →+* β) : (hnp.comp hmn : α → γ) = hnp ∘ hmn :=
rfl
#align ring_hom.coe_comp RingHom.coe_comp
theorem comp_apply (hnp : β →+* γ) (hmn : α →+* β) (x : α) :
(hnp.comp hmn : α → γ) x = hnp (hmn x) :=
rfl
#align ring_hom.comp_apply RingHom.comp_apply
@[simp]
theorem comp_id (f : α →+* β) : f.comp (id α) = f :=
ext fun _ => rfl
#align ring_hom.comp_id RingHom.comp_id
@[simp]
theorem id_comp (f : α →+* β) : (id β).comp f = f :=
ext fun _ => rfl
#align ring_hom.id_comp RingHom.id_comp
instance : Monoid (α →+* α) where
one := id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
theorem one_def : (1 : α →+* α) = id α :=
rfl
#align ring_hom.one_def RingHom.one_def
theorem mul_def (f g : α →+* α) : f * g = f.comp g :=
rfl
#align ring_hom.mul_def RingHom.mul_def
@[simp]
theorem coe_one : ⇑(1 : α →+* α) = _root_.id :=
rfl
#align ring_hom.coe_one RingHom.coe_one
@[simp]
theorem coe_mul (f g : α →+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align ring_hom.coe_mul RingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →+* γ} {f : α →+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => RingHom.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align ring_hom.cancel_right RingHom.cancel_right
@[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => RingHom.ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align ring_hom.cancel_left RingHom.cancel_left
end RingHom
namespace AddMonoidHom
variable [CommRing α] [IsDomain α] [CommRing β] (f : β →+ α)
-- Porting note: there's some disagreement over the naming scheme here.
-- This could perhaps be `mkRingHom_of_mul_self_of_two_ne_zero`.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/naming.20conventions/near/315558410
/-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
rw [mul_add, add_mul, add_mul, f.map_add, f.map_add, f.map_add, f.map_add, h x, h y, add_mul,
mul_add, mul_add, ← sub_eq_zero, add_comm (f x * f x + f (y * x)), ← sub_sub, ← sub_sub,
← sub_sub, mul_comm y x, mul_comm (f y) (f x)] at hxy
simp only [add_assoc, add_sub_assoc, add_sub_cancel'_right] at hxy
| rw [sub_sub, ← two_mul, ← add_sub_assoc, ← two_mul, ← mul_sub, mul_eq_zero (M₀ := α),
sub_eq_zero, or_iff_not_imp_left] at hxy | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
rw [mul_add, add_mul, add_mul, f.map_add, f.map_add, f.map_add, f.map_add, h x, h y, add_mul,
mul_add, mul_add, ← sub_eq_zero, add_comm (f x * f x + f (y * x)), ← sub_sub, ← sub_sub,
← sub_sub, mul_comm y x, mul_comm (f y) (f x)] at hxy
simp only [add_assoc, add_sub_assoc, add_sub_cancel'_right] at hxy
| Mathlib.Algebra.Ring.Hom.Defs.733_0.KyHvVYrIs9pW9ZQ | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α | Mathlib_Algebra_Ring_Hom_Defs |
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : CommRing β
f : β →+ α
h : ∀ (x : β), f (x * x) = f x * f x
h_two : 2 ≠ 0
h_one : f 1 = 1
x y : β
hxy : ¬2 = 0 → f (x * y) = f x * f y
⊢ OneHom.toFun { toFun := f.toFun, map_one' := h_one } (x * y) =
OneHom.toFun { toFun := f.toFun, map_one' := h_one } x * OneHom.toFun { toFun := f.toFun, map_one' := h_one } y | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> rfl
#align ring_hom.id RingHom.id
instance : Inhabited (α →+* α) :=
⟨id α⟩
@[simp]
theorem id_apply (x : α) : RingHom.id α x = x :=
rfl
#align ring_hom.id_apply RingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align ring_hom.coe_add_monoid_hom_id RingHom.coe_addMonoidHom_id
@[simp]
theorem coe_monoidHom_id : (id α : α →* α) = MonoidHom.id α :=
rfl
#align ring_hom.coe_monoid_hom_id RingHom.coe_monoidHom_id
variable {_ : NonAssocSemiring γ}
/-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by simp }
#align ring_hom.comp RingHom.comp
/-- Composition of semiring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonAssocSemiring δ} (f : α →+* β) (g : β →+* γ) (h : γ →+* δ) :
(h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align ring_hom.comp_assoc RingHom.comp_assoc
@[simp]
theorem coe_comp (hnp : β →+* γ) (hmn : α →+* β) : (hnp.comp hmn : α → γ) = hnp ∘ hmn :=
rfl
#align ring_hom.coe_comp RingHom.coe_comp
theorem comp_apply (hnp : β →+* γ) (hmn : α →+* β) (x : α) :
(hnp.comp hmn : α → γ) x = hnp (hmn x) :=
rfl
#align ring_hom.comp_apply RingHom.comp_apply
@[simp]
theorem comp_id (f : α →+* β) : f.comp (id α) = f :=
ext fun _ => rfl
#align ring_hom.comp_id RingHom.comp_id
@[simp]
theorem id_comp (f : α →+* β) : (id β).comp f = f :=
ext fun _ => rfl
#align ring_hom.id_comp RingHom.id_comp
instance : Monoid (α →+* α) where
one := id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
theorem one_def : (1 : α →+* α) = id α :=
rfl
#align ring_hom.one_def RingHom.one_def
theorem mul_def (f g : α →+* α) : f * g = f.comp g :=
rfl
#align ring_hom.mul_def RingHom.mul_def
@[simp]
theorem coe_one : ⇑(1 : α →+* α) = _root_.id :=
rfl
#align ring_hom.coe_one RingHom.coe_one
@[simp]
theorem coe_mul (f g : α →+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align ring_hom.coe_mul RingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →+* γ} {f : α →+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => RingHom.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align ring_hom.cancel_right RingHom.cancel_right
@[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => RingHom.ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align ring_hom.cancel_left RingHom.cancel_left
end RingHom
namespace AddMonoidHom
variable [CommRing α] [IsDomain α] [CommRing β] (f : β →+ α)
-- Porting note: there's some disagreement over the naming scheme here.
-- This could perhaps be `mkRingHom_of_mul_self_of_two_ne_zero`.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/naming.20conventions/near/315558410
/-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
rw [mul_add, add_mul, add_mul, f.map_add, f.map_add, f.map_add, f.map_add, h x, h y, add_mul,
mul_add, mul_add, ← sub_eq_zero, add_comm (f x * f x + f (y * x)), ← sub_sub, ← sub_sub,
← sub_sub, mul_comm y x, mul_comm (f y) (f x)] at hxy
simp only [add_assoc, add_sub_assoc, add_sub_cancel'_right] at hxy
rw [sub_sub, ← two_mul, ← add_sub_assoc, ← two_mul, ← mul_sub, mul_eq_zero (M₀ := α),
sub_eq_zero, or_iff_not_imp_left] at hxy
| exact hxy h_two | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
rw [mul_add, add_mul, add_mul, f.map_add, f.map_add, f.map_add, f.map_add, h x, h y, add_mul,
mul_add, mul_add, ← sub_eq_zero, add_comm (f x * f x + f (y * x)), ← sub_sub, ← sub_sub,
← sub_sub, mul_comm y x, mul_comm (f y) (f x)] at hxy
simp only [add_assoc, add_sub_assoc, add_sub_cancel'_right] at hxy
rw [sub_sub, ← two_mul, ← add_sub_assoc, ← two_mul, ← mul_sub, mul_eq_zero (M₀ := α),
sub_eq_zero, or_iff_not_imp_left] at hxy
| Mathlib.Algebra.Ring.Hom.Defs.733_0.KyHvVYrIs9pW9ZQ | /-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α | Mathlib_Algebra_Ring_Hom_Defs |
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : CommRing β
f : β →+ α
h : ∀ (x : β), f (x * x) = f x * f x
h_two : 2 ≠ 0
h_one : f 1 = 1
⊢ ↑(mkRingHomOfMulSelfOfTwoNeZero f h h_two h_one) = f | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> rfl
#align ring_hom.id RingHom.id
instance : Inhabited (α →+* α) :=
⟨id α⟩
@[simp]
theorem id_apply (x : α) : RingHom.id α x = x :=
rfl
#align ring_hom.id_apply RingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align ring_hom.coe_add_monoid_hom_id RingHom.coe_addMonoidHom_id
@[simp]
theorem coe_monoidHom_id : (id α : α →* α) = MonoidHom.id α :=
rfl
#align ring_hom.coe_monoid_hom_id RingHom.coe_monoidHom_id
variable {_ : NonAssocSemiring γ}
/-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by simp }
#align ring_hom.comp RingHom.comp
/-- Composition of semiring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonAssocSemiring δ} (f : α →+* β) (g : β →+* γ) (h : γ →+* δ) :
(h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align ring_hom.comp_assoc RingHom.comp_assoc
@[simp]
theorem coe_comp (hnp : β →+* γ) (hmn : α →+* β) : (hnp.comp hmn : α → γ) = hnp ∘ hmn :=
rfl
#align ring_hom.coe_comp RingHom.coe_comp
theorem comp_apply (hnp : β →+* γ) (hmn : α →+* β) (x : α) :
(hnp.comp hmn : α → γ) x = hnp (hmn x) :=
rfl
#align ring_hom.comp_apply RingHom.comp_apply
@[simp]
theorem comp_id (f : α →+* β) : f.comp (id α) = f :=
ext fun _ => rfl
#align ring_hom.comp_id RingHom.comp_id
@[simp]
theorem id_comp (f : α →+* β) : (id β).comp f = f :=
ext fun _ => rfl
#align ring_hom.id_comp RingHom.id_comp
instance : Monoid (α →+* α) where
one := id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
theorem one_def : (1 : α →+* α) = id α :=
rfl
#align ring_hom.one_def RingHom.one_def
theorem mul_def (f g : α →+* α) : f * g = f.comp g :=
rfl
#align ring_hom.mul_def RingHom.mul_def
@[simp]
theorem coe_one : ⇑(1 : α →+* α) = _root_.id :=
rfl
#align ring_hom.coe_one RingHom.coe_one
@[simp]
theorem coe_mul (f g : α →+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align ring_hom.coe_mul RingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →+* γ} {f : α →+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => RingHom.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align ring_hom.cancel_right RingHom.cancel_right
@[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => RingHom.ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align ring_hom.cancel_left RingHom.cancel_left
end RingHom
namespace AddMonoidHom
variable [CommRing α] [IsDomain α] [CommRing β] (f : β →+ α)
-- Porting note: there's some disagreement over the naming scheme here.
-- This could perhaps be `mkRingHom_of_mul_self_of_two_ne_zero`.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/naming.20conventions/near/315558410
/-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
rw [mul_add, add_mul, add_mul, f.map_add, f.map_add, f.map_add, f.map_add, h x, h y, add_mul,
mul_add, mul_add, ← sub_eq_zero, add_comm (f x * f x + f (y * x)), ← sub_sub, ← sub_sub,
← sub_sub, mul_comm y x, mul_comm (f y) (f x)] at hxy
simp only [add_assoc, add_sub_assoc, add_sub_cancel'_right] at hxy
rw [sub_sub, ← two_mul, ← add_sub_assoc, ← two_mul, ← mul_sub, mul_eq_zero (M₀ := α),
sub_eq_zero, or_iff_not_imp_left] at hxy
exact hxy h_two }
#align add_monoid_hom.mk_ring_hom_of_mul_self_of_two_ne_zero AddMonoidHom.mkRingHomOfMulSelfOfTwoNeZero
@[simp]
theorem coe_fn_mkRingHomOfMulSelfOfTwoNeZero (h h_two h_one) :
(f.mkRingHomOfMulSelfOfTwoNeZero h h_two h_one : β → α) = f :=
rfl
#align add_monoid_hom.coe_fn_mk_ring_hom_of_mul_self_of_two_ne_zero AddMonoidHom.coe_fn_mkRingHomOfMulSelfOfTwoNeZero
-- Porting note: `simp` can prove this
-- @[simp]
theorem coe_addMonoidHom_mkRingHomOfMulSelfOfTwoNeZero (h h_two h_one) :
(f.mkRingHomOfMulSelfOfTwoNeZero h h_two h_one : β →+ α) = f := by
| ext | theorem coe_addMonoidHom_mkRingHomOfMulSelfOfTwoNeZero (h h_two h_one) :
(f.mkRingHomOfMulSelfOfTwoNeZero h h_two h_one : β →+ α) = f := by
| Mathlib.Algebra.Ring.Hom.Defs.759_0.KyHvVYrIs9pW9ZQ | theorem coe_addMonoidHom_mkRingHomOfMulSelfOfTwoNeZero (h h_two h_one) :
(f.mkRingHomOfMulSelfOfTwoNeZero h h_two h_one : β →+ α) = f | Mathlib_Algebra_Ring_Hom_Defs |
case h
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝² : CommRing α
inst✝¹ : IsDomain α
inst✝ : CommRing β
f : β →+ α
h : ∀ (x : β), f (x * x) = f x * f x
h_two : 2 ≠ 0
h_one : f 1 = 1
x✝ : β
⊢ ↑(mkRingHomOfMulSelfOfTwoNeZero f h h_two h_one) x✝ = f x✝ | /-
Copyright (c) 2019 Amelia Livingston. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Amelia Livingston, Jireh Loreaux
-/
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Ring.Basic
import Mathlib.Data.Pi.Algebra
#align_import algebra.hom.ring from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
/-!
# Homomorphisms of semirings and rings
This file defines bundled homomorphisms of (non-unital) semirings and rings. As with monoid and
groups, we use the same structure `RingHom a β`, a.k.a. `α →+* β`, for both types of homomorphisms.
## Main definitions
* `NonUnitalRingHom`: Non-unital (semi)ring homomorphisms. Additive monoid homomorphism which
preserve multiplication.
* `RingHom`: (Semi)ring homomorphisms. Monoid homomorphisms which are also additive monoid
homomorphism.
## Notations
* `→ₙ+*`: Non-unital (semi)ring homs
* `→+*`: (Semi)ring homs
## Implementation notes
* There's a coercion from bundled homs to fun, and the canonical notation is to
use the bundled hom as a function via this coercion.
* There is no `SemiringHom` -- the idea is that `RingHom` is used.
The constructor for a `RingHom` between semirings needs a proof of `map_zero`,
`map_one` and `map_add` as well as `map_mul`; a separate constructor
`RingHom.mk'` will construct ring homs between rings from monoid homs given
only a proof that addition is preserved.
## Tags
`RingHom`, `SemiringHom`
-/
open Function
variable {F α β γ : Type*}
/-- Bundled non-unital semiring homomorphisms `α →ₙ+* β`; use this for bundled non-unital ring
homomorphisms too.
When possible, instead of parametrizing results over `(f : α →ₙ+* β)`,
you should parametrize over `(F : Type*) [NonUnitalRingHomClass F α β] (f : F)`.
When you extend this structure, make sure to extend `NonUnitalRingHomClass`. -/
structure NonUnitalRingHom (α β : Type*) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends α →ₙ* β, α →+ β
#align non_unital_ring_hom NonUnitalRingHom
/-- `α →ₙ+* β` denotes the type of non-unital ring homomorphisms from `α` to `β`. -/
infixr:25 " →ₙ+* " => NonUnitalRingHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as a semigroup
homomorphism `α →ₙ* β`. The `simp`-normal form is `(f : α →ₙ* β)`. -/
add_decl_doc NonUnitalRingHom.toMulHom
#align non_unital_ring_hom.to_mul_hom NonUnitalRingHom.toMulHom
/-- Reinterpret a non-unital ring homomorphism `f : α →ₙ+* β` as an additive
monoid homomorphism `α →+ β`. The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc NonUnitalRingHom.toAddMonoidHom
#align non_unital_ring_hom.to_add_monoid_hom NonUnitalRingHom.toAddMonoidHom
section NonUnitalRingHomClass
/-- `NonUnitalRingHomClass F α β` states that `F` is a type of non-unital (semi)ring
homomorphisms. You should extend this class when you extend `NonUnitalRingHom`. -/
class NonUnitalRingHomClass (F : Type*) (α β : outParam (Type*)) [NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β] extends MulHomClass F α β, AddMonoidHomClass F α β
#align non_unital_ring_hom_class NonUnitalRingHomClass
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β] [NonUnitalRingHomClass F α β]
/-- Turn an element of a type `F` satisfying `NonUnitalRingHomClass F α β` into an actual
`NonUnitalRingHom`. This is declared as the default coercion from `F` to `α →ₙ+* β`. -/
@[coe]
def NonUnitalRingHomClass.toNonUnitalRingHom (f : F) : α →ₙ+* β :=
{ (f : α →ₙ* β), (f : α →+ β) with }
/-- Any type satisfying `NonUnitalRingHomClass` can be cast into `NonUnitalRingHom` via
`NonUnitalRingHomClass.toNonUnitalRingHom`. -/
instance : CoeTC F (α →ₙ+* β) :=
⟨NonUnitalRingHomClass.toNonUnitalRingHom⟩
end NonUnitalRingHomClass
namespace NonUnitalRingHom
section coe
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
instance : NonUnitalRingHomClass (α →ₙ+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := NonUnitalRingHom.map_add'
map_zero := NonUnitalRingHom.map_zero'
map_mul f := f.map_mul'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly. -/
-- instance : CoeFun (α →ₙ+* β) fun _ => α → β :=
-- ⟨fun f => f.toFun⟩
-- Porting note: removed due to new `coe` in Lean4
#noalign non_unital_ring_hom.to_fun_eq_coe
#noalign non_unital_ring_hom.coe_mk
#noalign non_unital_ring_hom.coe_coe
initialize_simps_projections NonUnitalRingHom (toFun → apply)
@[simp]
theorem coe_toMulHom (f : α →ₙ+* β) : ⇑f.toMulHom = f :=
rfl
#align non_unital_ring_hom.coe_to_mul_hom NonUnitalRingHom.coe_toMulHom
@[simp]
theorem coe_mulHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →ₙ* β) = ⟨f, h₁⟩ :=
rfl
#align non_unital_ring_hom.coe_mul_hom_mk NonUnitalRingHom.coe_mulHom_mk
theorem coe_toAddMonoidHom (f : α →ₙ+* β) : ⇑f.toAddMonoidHom = f := rfl
#align non_unital_ring_hom.coe_to_add_monoid_hom NonUnitalRingHom.coe_toAddMonoidHom
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃) :
((⟨⟨f, h₁⟩, h₂, h₃⟩ : α →ₙ+* β) : α →+ β) = ⟨⟨f, h₂⟩, h₃⟩ :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_mk NonUnitalRingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : α →ₙ+* β :=
{ f.toMulHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align non_unital_ring_hom.copy NonUnitalRingHom.copy
@[simp]
theorem coe_copy (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align non_unital_ring_hom.coe_copy NonUnitalRingHom.coe_copy
theorem copy_eq (f : α →ₙ+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align non_unital_ring_hom.copy_eq NonUnitalRingHom.copy_eq
end coe
section
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
variable (f : α →ₙ+* β) {x y : α}
@[ext]
theorem ext ⦃f g : α →ₙ+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align non_unital_ring_hom.ext NonUnitalRingHom.ext
theorem ext_iff {f g : α →ₙ+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align non_unital_ring_hom.ext_iff NonUnitalRingHom.ext_iff
@[simp]
theorem mk_coe (f : α →ₙ+* β) (h₁ h₂ h₃) : NonUnitalRingHom.mk (MulHom.mk f h₁) h₂ h₃ = f :=
ext fun _ => rfl
#align non_unital_ring_hom.mk_coe NonUnitalRingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective fun f : α →ₙ+* β => (f : α →+ β) :=
fun _ _ h => ext <| FunLike.congr_fun (F := α →+ β) h
#align non_unital_ring_hom.coe_add_monoid_hom_injective NonUnitalRingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_mulHom_injective : Injective fun f : α →ₙ+* β => (f : α →ₙ* β) := fun _ _ h =>
ext <| MulHom.congr_fun h
#align non_unital_ring_hom.coe_mul_hom_injective NonUnitalRingHom.coe_mulHom_injective
end
variable [NonUnitalNonAssocSemiring α] [NonUnitalNonAssocSemiring β]
/-- The identity non-unital ring homomorphism from a non-unital semiring to itself. -/
protected def id (α : Type*) [NonUnitalNonAssocSemiring α] : α →ₙ+* α := by
refine' { toFun := id.. } <;> intros <;> rfl
#align non_unital_ring_hom.id NonUnitalRingHom.id
instance : Zero (α →ₙ+* β) :=
⟨{ toFun := 0, map_mul' := fun _ _ => (mul_zero (0 : β)).symm, map_zero' := rfl,
map_add' := fun _ _ => (add_zero (0 : β)).symm }⟩
instance : Inhabited (α →ₙ+* β) :=
⟨0⟩
@[simp]
theorem coe_zero : ⇑(0 : α →ₙ+* β) = 0 :=
rfl
#align non_unital_ring_hom.coe_zero NonUnitalRingHom.coe_zero
@[simp]
theorem zero_apply (x : α) : (0 : α →ₙ+* β) x = 0 :=
rfl
#align non_unital_ring_hom.zero_apply NonUnitalRingHom.zero_apply
@[simp]
theorem id_apply (x : α) : NonUnitalRingHom.id α x = x :=
rfl
#align non_unital_ring_hom.id_apply NonUnitalRingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (NonUnitalRingHom.id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align non_unital_ring_hom.coe_add_monoid_hom_id NonUnitalRingHom.coe_addMonoidHom_id
@[simp]
theorem coe_mulHom_id : (NonUnitalRingHom.id α : α →ₙ* α) = MulHom.id α :=
rfl
#align non_unital_ring_hom.coe_mul_hom_id NonUnitalRingHom.coe_mulHom_id
variable [NonUnitalNonAssocSemiring γ]
/-- Composition of non-unital ring homomorphisms is a non-unital ring homomorphism. -/
def comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : α →ₙ+* γ :=
{ g.toMulHom.comp f.toMulHom, g.toAddMonoidHom.comp f.toAddMonoidHom with }
#align non_unital_ring_hom.comp NonUnitalRingHom.comp
/-- Composition of non-unital ring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonUnitalNonAssocSemiring δ} (f : α →ₙ+* β) (g : β →ₙ+* γ)
(h : γ →ₙ+* δ) : (h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align non_unital_ring_hom.comp_assoc NonUnitalRingHom.comp_assoc
@[simp]
theorem coe_comp (g : β →ₙ+* γ) (f : α →ₙ+* β) : ⇑(g.comp f) = g ∘ f :=
rfl
#align non_unital_ring_hom.coe_comp NonUnitalRingHom.coe_comp
@[simp]
theorem comp_apply (g : β →ₙ+* γ) (f : α →ₙ+* β) (x : α) : g.comp f x = g (f x) :=
rfl
#align non_unital_ring_hom.comp_apply NonUnitalRingHom.comp_apply
variable (g : β →ₙ+* γ) (f : α →ₙ+* β)
@[simp]
theorem coe_comp_addMonoidHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
AddMonoidHom.mk ⟨g ∘ f, (g.comp f).map_zero'⟩ (g.comp f).map_add' = (g : β →+ γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_add_monoid_hom NonUnitalRingHom.coe_comp_addMonoidHom
@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f :=
rfl
#align non_unital_ring_hom.coe_comp_mul_hom NonUnitalRingHom.coe_comp_mulHom
@[simp]
theorem comp_zero (g : β →ₙ+* γ) : g.comp (0 : α →ₙ+* β) = 0 := by
ext
simp
#align non_unital_ring_hom.comp_zero NonUnitalRingHom.comp_zero
@[simp]
theorem zero_comp (f : α →ₙ+* β) : (0 : β →ₙ+* γ).comp f = 0 := by
ext
rfl
#align non_unital_ring_hom.zero_comp NonUnitalRingHom.zero_comp
@[simp]
theorem comp_id (f : α →ₙ+* β) : f.comp (NonUnitalRingHom.id α) = f :=
ext fun _ => rfl
#align non_unital_ring_hom.comp_id NonUnitalRingHom.comp_id
@[simp]
theorem id_comp (f : α →ₙ+* β) : (NonUnitalRingHom.id β).comp f = f :=
ext fun _ => rfl
#align non_unital_ring_hom.id_comp NonUnitalRingHom.id_comp
instance : MonoidWithZero (α →ₙ+* α) where
one := NonUnitalRingHom.id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
zero := 0
mul_zero := comp_zero
zero_mul := zero_comp
theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α :=
rfl
#align non_unital_ring_hom.one_def NonUnitalRingHom.one_def
@[simp]
theorem coe_one : ⇑(1 : α →ₙ+* α) = id :=
rfl
#align non_unital_ring_hom.coe_one NonUnitalRingHom.coe_one
theorem mul_def (f g : α →ₙ+* α) : f * g = f.comp g :=
rfl
#align non_unital_ring_hom.mul_def NonUnitalRingHom.mul_def
@[simp]
theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right
@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_left NonUnitalRingHom.cancel_left
end NonUnitalRingHom
/-- Bundled semiring homomorphisms; use this for bundled ring homomorphisms too.
This extends from both `MonoidHom` and `MonoidWithZeroHom` in order to put the fields in a
sensible order, even though `MonoidWithZeroHom` already extends `MonoidHom`. -/
structure RingHom (α : Type*) (β : Type*) [NonAssocSemiring α] [NonAssocSemiring β] extends
α →* β, α →+ β, α →ₙ+* β, α →*₀ β
#align ring_hom RingHom
/-- `α →+* β` denotes the type of ring homomorphisms from `α` to `β`. -/
infixr:25 " →+* " => RingHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid with zero homomorphism `α →*₀ β`.
The `simp`-normal form is `(f : α →*₀ β)`. -/
add_decl_doc RingHom.toMonoidWithZeroHom
#align ring_hom.to_monoid_with_zero_hom RingHom.toMonoidWithZeroHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a monoid homomorphism `α →* β`.
The `simp`-normal form is `(f : α →* β)`. -/
add_decl_doc RingHom.toMonoidHom
#align ring_hom.to_monoid_hom RingHom.toMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as an additive monoid homomorphism `α →+ β`.
The `simp`-normal form is `(f : α →+ β)`. -/
add_decl_doc RingHom.toAddMonoidHom
#align ring_hom.to_add_monoid_hom RingHom.toAddMonoidHom
/-- Reinterpret a ring homomorphism `f : α →+* β` as a non-unital ring homomorphism `α →ₙ+* β`. The
`simp`-normal form is `(f : α →ₙ+* β)`. -/
add_decl_doc RingHom.toNonUnitalRingHom
#align ring_hom.to_non_unital_ring_hom RingHom.toNonUnitalRingHom
section RingHomClass
/-- `RingHomClass F α β` states that `F` is a type of (semi)ring homomorphisms.
You should extend this class when you extend `RingHom`.
This extends from both `MonoidHomClass` and `MonoidWithZeroHomClass` in
order to put the fields in a sensible order, even though
`MonoidWithZeroHomClass` already extends `MonoidHomClass`. -/
class RingHomClass (F : Type*) (α β : outParam (Type*)) [NonAssocSemiring α]
[NonAssocSemiring β] extends MonoidHomClass F α β, AddMonoidHomClass F α β,
MonoidWithZeroHomClass F α β
#align ring_hom_class RingHomClass
set_option linter.deprecated false in
/-- Ring homomorphisms preserve `bit1`. -/
@[simp] lemma map_bit1 [NonAssocSemiring α] [NonAssocSemiring β] [RingHomClass F α β]
(f : F) (a : α) : (f (bit1 a) : β) = bit1 (f a) := by simp [bit1]
#align map_bit1 map_bit1
-- Porting note: marked `{}` rather than `[]` to prevent dangerous instances
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} [RingHomClass F α β]
/-- Turn an element of a type `F` satisfying `RingHomClass F α β` into an actual
`RingHom`. This is declared as the default coercion from `F` to `α →+* β`. -/
@[coe]
def RingHomClass.toRingHom (f : F) : α →+* β :=
{ (f : α →* β), (f : α →+ β) with }
/-- Any type satisfying `RingHomClass` can be cast into `RingHom` via `RingHomClass.toRingHom`. -/
instance : CoeTC F (α →+* β) :=
⟨RingHomClass.toRingHom⟩
instance (priority := 100) RingHomClass.toNonUnitalRingHomClass : NonUnitalRingHomClass F α β :=
{ ‹RingHomClass F α β› with }
#align ring_hom_class.to_non_unital_ring_hom_class RingHomClass.toNonUnitalRingHomClass
end RingHomClass
namespace RingHom
section coe
/-!
Throughout this section, some `Semiring` arguments are specified with `{}` instead of `[]`.
See note [implicit instance arguments].
-/
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
instance instRingHomClass : RingHomClass (α →+* β) α β where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
apply FunLike.coe_injective'
exact h
map_add := RingHom.map_add'
map_zero := RingHom.map_zero'
map_mul f := f.map_mul'
map_one f := f.map_one'
-- Porting note:
-- These helper instances are unhelpful in Lean 4, so omitting:
-- /-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
-- directly.
-- -/
-- instance : CoeFun (α →+* β) fun _ => α → β :=
-- ⟨RingHom.toFun⟩
initialize_simps_projections RingHom (toFun → apply)
-- Porting note: is this lemma still needed in Lean4?
-- Porting note: because `f.toFun` really means `f.toMonoidHom.toOneHom.toFun` and
-- `toMonoidHom_eq_coe` wants to simplify `f.toMonoidHom` to `(↑f : M →* N)`, this can't
-- be a simp lemma anymore
-- @[simp]
theorem toFun_eq_coe (f : α →+* β) : f.toFun = f :=
rfl
#align ring_hom.to_fun_eq_coe RingHom.toFun_eq_coe
@[simp]
theorem coe_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_mk RingHom.coe_mk
@[simp]
theorem coe_coe {F : Type*} [RingHomClass F α β] (f : F) : ((f : α →+* β) : α → β) = f :=
rfl
#align ring_hom.coe_coe RingHom.coe_coe
attribute [coe] RingHom.toMonoidHom
instance coeToMonoidHom : Coe (α →+* β) (α →* β) :=
⟨RingHom.toMonoidHom⟩
#align ring_hom.has_coe_monoid_hom RingHom.coeToMonoidHom
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_monoid_hom
@[simp]
theorem toMonoidHom_eq_coe (f : α →+* β) : f.toMonoidHom = f :=
rfl
#align ring_hom.to_monoid_hom_eq_coe RingHom.toMonoidHom_eq_coe
-- Porting note: this can't be a simp lemma anymore
-- @[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →+* β) : (f.toMonoidWithZeroHom : α → β) = f := by
rfl
#align ring_hom.to_monoid_with_zero_hom_eq_coe RingHom.toMonoidWithZeroHom_eq_coe
@[simp]
theorem coe_monoidHom_mk (f : α →* β) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : α →+* β) : α →* β) = f :=
rfl
#align ring_hom.coe_monoid_hom_mk RingHom.coe_monoidHom_mk
-- Porting note: `dsimp only` can prove this
#noalign ring_hom.coe_add_monoid_hom
@[simp]
theorem toAddMonoidHom_eq_coe (f : α →+* β) : f.toAddMonoidHom = f :=
rfl
#align ring_hom.to_add_monoid_hom_eq_coe RingHom.toAddMonoidHom_eq_coe
@[simp]
theorem coe_addMonoidHom_mk (f : α → β) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨f, h₁⟩, h₂⟩, h₃, h₄⟩ : α →+* β) : α →+ β) = ⟨⟨f, h₃⟩, h₄⟩ :=
rfl
#align ring_hom.coe_add_monoid_hom_mk RingHom.coe_addMonoidHom_mk
/-- Copy of a `RingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
def copy (f : α →+* β) (f' : α → β) (h : f' = f) : α →+* β :=
{ f.toMonoidWithZeroHom.copy f' h, f.toAddMonoidHom.copy f' h with }
#align ring_hom.copy RingHom.copy
@[simp]
theorem coe_copy (f : α →+* β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align ring_hom.coe_copy RingHom.coe_copy
theorem copy_eq (f : α →+* β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
FunLike.ext' h
#align ring_hom.copy_eq RingHom.copy_eq
end coe
section
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β} (f : α →+* β) {x y : α}
theorem congr_fun {f g : α →+* β} (h : f = g) (x : α) : f x = g x :=
FunLike.congr_fun h x
#align ring_hom.congr_fun RingHom.congr_fun
theorem congr_arg (f : α →+* β) {x y : α} (h : x = y) : f x = f y :=
FunLike.congr_arg f h
#align ring_hom.congr_arg RingHom.congr_arg
theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=
FunLike.coe_injective h
#align ring_hom.coe_inj RingHom.coe_inj
@[ext]
theorem ext ⦃f g : α →+* β⦄ : (∀ x, f x = g x) → f = g :=
FunLike.ext _ _
#align ring_hom.ext RingHom.ext
theorem ext_iff {f g : α →+* β} : f = g ↔ ∀ x, f x = g x :=
FunLike.ext_iff
#align ring_hom.ext_iff RingHom.ext_iff
@[simp]
theorem mk_coe (f : α →+* β) (h₁ h₂ h₃ h₄) : RingHom.mk ⟨⟨f, h₁⟩, h₂⟩ h₃ h₄ = f :=
ext fun _ => rfl
#align ring_hom.mk_coe RingHom.mk_coe
theorem coe_addMonoidHom_injective : Injective (fun f : α →+* β => (f : α →+ β)) := fun _ _ h =>
ext <| FunLike.congr_fun (F := α →+ β) h
#align ring_hom.coe_add_monoid_hom_injective RingHom.coe_addMonoidHom_injective
set_option linter.deprecated false in
theorem coe_monoidHom_injective : Injective (fun f : α →+* β => (f : α →* β)) := fun _ _ h =>
ext <| MonoidHom.congr_fun h
#align ring_hom.coe_monoid_hom_injective RingHom.coe_monoidHom_injective
/-- Ring homomorphisms map zero to zero. -/
protected theorem map_zero (f : α →+* β) : f 0 = 0 :=
map_zero f
#align ring_hom.map_zero RingHom.map_zero
/-- Ring homomorphisms map one to one. -/
protected theorem map_one (f : α →+* β) : f 1 = 1 :=
map_one f
#align ring_hom.map_one RingHom.map_one
/-- Ring homomorphisms preserve addition. -/
protected theorem map_add (f : α →+* β) : ∀ a b, f (a + b) = f a + f b :=
map_add f
#align ring_hom.map_add RingHom.map_add
/-- Ring homomorphisms preserve multiplication. -/
protected theorem map_mul (f : α →+* β) : ∀ a b, f (a * b) = f a * f b :=
map_mul f
#align ring_hom.map_mul RingHom.map_mul
@[simp]
theorem map_ite_zero_one {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 0 1) = ite p 0 1 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_zero_one RingHom.map_ite_zero_one
@[simp]
theorem map_ite_one_zero {F : Type*} [RingHomClass F α β] (f : F) (p : Prop) [Decidable p] :
f (ite p 1 0) = ite p 1 0 := by
split_ifs with h <;> simp [h]
#align ring_hom.map_ite_one_zero RingHom.map_ite_one_zero
/-- `f : α →+* β` has a trivial codomain iff `f 1 = 0`. -/
theorem codomain_trivial_iff_map_one_eq_zero : (0 : β) = 1 ↔ f 1 = 0 := by rw [map_one, eq_comm]
#align ring_hom.codomain_trivial_iff_map_one_eq_zero RingHom.codomain_trivial_iff_map_one_eq_zero
/-- `f : α →+* β` has a trivial codomain iff it has a trivial range. -/
theorem codomain_trivial_iff_range_trivial : (0 : β) = 1 ↔ ∀ x, f x = 0 :=
f.codomain_trivial_iff_map_one_eq_zero.trans
⟨fun h x => by rw [← mul_one x, map_mul, h, mul_zero], fun h => h 1⟩
#align ring_hom.codomain_trivial_iff_range_trivial RingHom.codomain_trivial_iff_range_trivial
/-- `f : α →+* β` doesn't map `1` to `0` if `β` is nontrivial -/
theorem map_one_ne_zero [Nontrivial β] : f 1 ≠ 0 :=
mt f.codomain_trivial_iff_map_one_eq_zero.mpr zero_ne_one
#align ring_hom.map_one_ne_zero RingHom.map_one_ne_zero
/-- If there is a homomorphism `f : α →+* β` and `β` is nontrivial, then `α` is nontrivial. -/
theorem domain_nontrivial [Nontrivial β] : Nontrivial α :=
⟨⟨1, 0, mt (fun h => show f 1 = 0 by rw [h, map_zero]) f.map_one_ne_zero⟩⟩
#align ring_hom.domain_nontrivial RingHom.domain_nontrivial
theorem codomain_trivial (f : α →+* β) [h : Subsingleton α] : Subsingleton β :=
(subsingleton_or_nontrivial β).resolve_right fun _ =>
not_nontrivial_iff_subsingleton.mpr h f.domain_nontrivial
#align ring_hom.codomain_trivial RingHom.codomain_trivial
end
/-- Ring homomorphisms preserve additive inverse. -/
protected theorem map_neg [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x : α) : f (-x) = -f x :=
map_neg f x
#align ring_hom.map_neg RingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
protected theorem map_sub [NonAssocRing α] [NonAssocRing β] (f : α →+* β) (x y : α) :
f (x - y) = f x - f y :=
map_sub f x y
#align ring_hom.map_sub RingHom.map_sub
/-- Makes a ring homomorphism from a monoid homomorphism of rings which preserves addition. -/
def mk' [NonAssocSemiring α] [NonAssocRing β] (f : α →* β)
(map_add : ∀ a b, f (a + b) = f a + f b) : α →+* β :=
{ AddMonoidHom.mk' f map_add, f with }
#align ring_hom.mk' RingHom.mk'
variable {_ : NonAssocSemiring α} {_ : NonAssocSemiring β}
/-- The identity ring homomorphism from a semiring to itself. -/
def id (α : Type*) [NonAssocSemiring α] : α →+* α := by
refine' { toFun := _root_.id.. } <;> intros <;> rfl
#align ring_hom.id RingHom.id
instance : Inhabited (α →+* α) :=
⟨id α⟩
@[simp]
theorem id_apply (x : α) : RingHom.id α x = x :=
rfl
#align ring_hom.id_apply RingHom.id_apply
@[simp]
theorem coe_addMonoidHom_id : (id α : α →+ α) = AddMonoidHom.id α :=
rfl
#align ring_hom.coe_add_monoid_hom_id RingHom.coe_addMonoidHom_id
@[simp]
theorem coe_monoidHom_id : (id α : α →* α) = MonoidHom.id α :=
rfl
#align ring_hom.coe_monoid_hom_id RingHom.coe_monoidHom_id
variable {_ : NonAssocSemiring γ}
/-- Composition of ring homomorphisms is a ring homomorphism. -/
def comp (g : β →+* γ) (f : α →+* β) : α →+* γ :=
{ g.toNonUnitalRingHom.comp f.toNonUnitalRingHom with toFun := g ∘ f, map_one' := by simp }
#align ring_hom.comp RingHom.comp
/-- Composition of semiring homomorphisms is associative. -/
theorem comp_assoc {δ} {_ : NonAssocSemiring δ} (f : α →+* β) (g : β →+* γ) (h : γ →+* δ) :
(h.comp g).comp f = h.comp (g.comp f) :=
rfl
#align ring_hom.comp_assoc RingHom.comp_assoc
@[simp]
theorem coe_comp (hnp : β →+* γ) (hmn : α →+* β) : (hnp.comp hmn : α → γ) = hnp ∘ hmn :=
rfl
#align ring_hom.coe_comp RingHom.coe_comp
theorem comp_apply (hnp : β →+* γ) (hmn : α →+* β) (x : α) :
(hnp.comp hmn : α → γ) x = hnp (hmn x) :=
rfl
#align ring_hom.comp_apply RingHom.comp_apply
@[simp]
theorem comp_id (f : α →+* β) : f.comp (id α) = f :=
ext fun _ => rfl
#align ring_hom.comp_id RingHom.comp_id
@[simp]
theorem id_comp (f : α →+* β) : (id β).comp f = f :=
ext fun _ => rfl
#align ring_hom.id_comp RingHom.id_comp
instance : Monoid (α →+* α) where
one := id α
mul := comp
mul_one := comp_id
one_mul := id_comp
mul_assoc f g h := comp_assoc _ _ _
theorem one_def : (1 : α →+* α) = id α :=
rfl
#align ring_hom.one_def RingHom.one_def
theorem mul_def (f g : α →+* α) : f * g = f.comp g :=
rfl
#align ring_hom.mul_def RingHom.mul_def
@[simp]
theorem coe_one : ⇑(1 : α →+* α) = _root_.id :=
rfl
#align ring_hom.coe_one RingHom.coe_one
@[simp]
theorem coe_mul (f g : α →+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align ring_hom.coe_mul RingHom.coe_mul
@[simp]
theorem cancel_right {g₁ g₂ : β →+* γ} {f : α →+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => RingHom.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align ring_hom.cancel_right RingHom.cancel_right
@[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => RingHom.ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
#align ring_hom.cancel_left RingHom.cancel_left
end RingHom
namespace AddMonoidHom
variable [CommRing α] [IsDomain α] [CommRing β] (f : β →+ α)
-- Porting note: there's some disagreement over the naming scheme here.
-- This could perhaps be `mkRingHom_of_mul_self_of_two_ne_zero`.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/naming.20conventions/near/315558410
/-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h : ∀ x, f (x * x) = f x * f x) (h_two : (2 : α) ≠ 0)
(h_one : f 1 = 1) : β →+* α :=
{ f with
map_one' := h_one,
map_mul' := fun x y => by
have hxy := h (x + y)
rw [mul_add, add_mul, add_mul, f.map_add, f.map_add, f.map_add, f.map_add, h x, h y, add_mul,
mul_add, mul_add, ← sub_eq_zero, add_comm (f x * f x + f (y * x)), ← sub_sub, ← sub_sub,
← sub_sub, mul_comm y x, mul_comm (f y) (f x)] at hxy
simp only [add_assoc, add_sub_assoc, add_sub_cancel'_right] at hxy
rw [sub_sub, ← two_mul, ← add_sub_assoc, ← two_mul, ← mul_sub, mul_eq_zero (M₀ := α),
sub_eq_zero, or_iff_not_imp_left] at hxy
exact hxy h_two }
#align add_monoid_hom.mk_ring_hom_of_mul_self_of_two_ne_zero AddMonoidHom.mkRingHomOfMulSelfOfTwoNeZero
@[simp]
theorem coe_fn_mkRingHomOfMulSelfOfTwoNeZero (h h_two h_one) :
(f.mkRingHomOfMulSelfOfTwoNeZero h h_two h_one : β → α) = f :=
rfl
#align add_monoid_hom.coe_fn_mk_ring_hom_of_mul_self_of_two_ne_zero AddMonoidHom.coe_fn_mkRingHomOfMulSelfOfTwoNeZero
-- Porting note: `simp` can prove this
-- @[simp]
theorem coe_addMonoidHom_mkRingHomOfMulSelfOfTwoNeZero (h h_two h_one) :
(f.mkRingHomOfMulSelfOfTwoNeZero h h_two h_one : β →+ α) = f := by
ext
| rfl | theorem coe_addMonoidHom_mkRingHomOfMulSelfOfTwoNeZero (h h_two h_one) :
(f.mkRingHomOfMulSelfOfTwoNeZero h h_two h_one : β →+ α) = f := by
ext
| Mathlib.Algebra.Ring.Hom.Defs.759_0.KyHvVYrIs9pW9ZQ | theorem coe_addMonoidHom_mkRingHomOfMulSelfOfTwoNeZero (h h_two h_one) :
(f.mkRingHomOfMulSelfOfTwoNeZero h h_two h_one : β →+ α) = f | Mathlib_Algebra_Ring_Hom_Defs |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
⊢ IsCyclotomicExtension {n} A B ↔ (∃ r, IsPrimitiveRoot r ↑n) ∧ ∀ (x : B), x ∈ adjoin A {b | b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by | simp [IsCyclotomicExtension_iff] | /-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by | Mathlib.NumberTheory.Cyclotomic.Basic.102_0.xReI1DeVvechFQU | /-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension ∅ A B
⊢ ⊥ = ⊤ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
| simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h | /-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
| Mathlib.NumberTheory.Cyclotomic.Basic.109_0.xReI1DeVvechFQU | /-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension {1} A B
x : B
⊢ x ∈ ⊥ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
| simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x | /-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
| Mathlib.NumberTheory.Cyclotomic.Basic.114_0.xReI1DeVvechFQU | /-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ⊥ = ⊤
⊢ IsCyclotomicExtension ∅ A B | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
| refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩ | /-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
| Mathlib.NumberTheory.Cyclotomic.Basic.122_0.xReI1DeVvechFQU | /-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ⊥ = ⊤
s : ℕ+
hs : s ∈ ∅
⊢ ∃ r, IsPrimitiveRoot r ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by | simp at hs | /-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by | Mathlib.NumberTheory.Cyclotomic.Basic.122_0.xReI1DeVvechFQU | /-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ⊥ = ⊤
x : B
hx : x ∈ ⊤
⊢ x ∈ adjoin A {b | ∃ n ∈ ∅, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
| rw [← h] at hx | /-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
| Mathlib.NumberTheory.Cyclotomic.Basic.122_0.xReI1DeVvechFQU | /-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ⊥ = ⊤
x : B
hx : x ∈ ⊥
⊢ x ∈ adjoin A {b | ∃ n ∈ ∅, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
| simpa using hx | /-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
| Mathlib.NumberTheory.Cyclotomic.Basic.122_0.xReI1DeVvechFQU | /-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
⊢ IsCyclotomicExtension (S ∪ T) A C | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
| refine' ⟨fun hn => _, fun x => _⟩ | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
| Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
n✝ : ℕ+
hn : n✝ ∈ S ∪ T
⊢ ∃ r, IsPrimitiveRoot r ↑n✝ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· | cases' hn with hn hn | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· | Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inl
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
n✝ : ℕ+
hn : n✝ ∈ S
⊢ ∃ r, IsPrimitiveRoot r ↑n✝ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· | obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· | Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inl.intro
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
n✝ : ℕ+
hn : n✝ ∈ S
b : B
hb : IsPrimitiveRoot b ↑n✝
⊢ ∃ r, IsPrimitiveRoot r ↑n✝ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
| refine' ⟨algebraMap B C b, _⟩ | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
| Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inl.intro
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
n✝ : ℕ+
hn : n✝ ∈ S
b : B
hb : IsPrimitiveRoot b ↑n✝
⊢ IsPrimitiveRoot ((algebraMap B C) b) ↑n✝ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
| exact hb.map_of_injective h | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
| Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inr
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
n✝ : ℕ+
hn : n✝ ∈ T
⊢ ∃ r, IsPrimitiveRoot r ↑n✝ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· | exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· | Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
x : C
⊢ x ∈ adjoin A {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· | refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· | Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
x : C
b : B
⊢ (algebraMap B C) b ∈ adjoin A {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· | let f := IsScalarTower.toAlgHom A B C | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· | Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
x : C
b : B
f : B →ₐ[A] C := IsScalarTower.toAlgHom A B C
⊢ (algebraMap B C) b ∈ adjoin A {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
| have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩ | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
| Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
x : C
b : B
f : B →ₐ[A] C := IsScalarTower.toAlgHom A B C
hb : f b ∈ Subalgebra.map f (adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1})
⊢ (algebraMap B C) b ∈ adjoin A {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
| rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
| Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
x : C
b : B
f : B →ₐ[A] C := IsScalarTower.toAlgHom A B C
hb : (algebraMap B C) b ∈ adjoin A (⇑f '' {b | ∃ a ∈ S, b ^ ↑a = 1})
⊢ (algebraMap B C) b ∈ adjoin A {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
| refine' adjoin_mono (fun y hy => _) hb | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
| Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
x : C
b : B
f : B →ₐ[A] C := IsScalarTower.toAlgHom A B C
hb : (algebraMap B C) b ∈ adjoin A (⇑f '' {b | ∃ a ∈ S, b ^ ↑a = 1})
y : C
hy : y ∈ ⇑f '' {b | ∃ a ∈ S, b ^ ↑a = 1}
⊢ y ∈ {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
| obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
| Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2.intro.intro.intro
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
x : C
b : B
f : B →ₐ[A] C := IsScalarTower.toAlgHom A B C
hb : (algebraMap B C) b ∈ adjoin A (⇑f '' {b | ∃ a ∈ S, b ^ ↑a = 1})
y : C
b₁ : B
h₁ : f b₁ = y
n : ℕ+
hn : n ∈ S ∧ b₁ ^ ↑n = 1
⊢ y ∈ {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
| exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩ | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
| Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : Algebra A B
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
C : Type w
inst✝³ : CommRing C
inst✝² : Algebra A C
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
hS : IsCyclotomicExtension S A B
hT : IsCyclotomicExtension T B C
h : Function.Injective ⇑(algebraMap B C)
x : C
b : B
f : B →ₐ[A] C := IsScalarTower.toAlgHom A B C
hb : (algebraMap B C) b ∈ adjoin A (⇑f '' {b | ∃ a ∈ S, b ^ ↑a = 1})
y : C
b₁ : B
h₁ : f b₁ = y
n : ℕ+
hn : n ∈ S ∧ b₁ ^ ↑n = 1
⊢ y ^ ↑n = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by | rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one] | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by | Mathlib.NumberTheory.Cyclotomic.Basic.134_0.xReI1DeVvechFQU | /-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
⊢ IsCyclotomicExtension S A B ↔ S = ∅ ∨ S = {1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
| constructor | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
| Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mp
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
⊢ IsCyclotomicExtension S A B → S = ∅ ∨ S = {1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· | rintro ⟨hprim, -⟩ | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· | Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mp.mk
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
hprim : ∀ {n : ℕ+}, n ∈ S → ∃ r, IsPrimitiveRoot r ↑n
⊢ S = ∅ ∨ S = {1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
| rw [← subset_singleton_iff_eq] | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
| Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mp.mk
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
hprim : ∀ {n : ℕ+}, n ∈ S → ∃ r, IsPrimitiveRoot r ↑n
⊢ S ⊆ {1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
| intro t ht | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
| Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mp.mk
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
hprim : ∀ {n : ℕ+}, n ∈ S → ∃ r, IsPrimitiveRoot r ↑n
t : ℕ+
ht : t ∈ S
⊢ t ∈ {1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
| obtain ⟨ζ, hζ⟩ := hprim ht | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
| Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mp.mk.intro
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
hprim : ∀ {n : ℕ+}, n ∈ S → ∃ r, IsPrimitiveRoot r ↑n
t : ℕ+
ht : t ∈ S
ζ : B
hζ : IsPrimitiveRoot ζ ↑t
⊢ t ∈ {1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
| rw [mem_singleton_iff, ← PNat.coe_eq_one_iff] | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
| Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mp.mk.intro
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
hprim : ∀ {n : ℕ+}, n ∈ S → ∃ r, IsPrimitiveRoot r ↑n
t : ℕ+
ht : t ∈ S
ζ : B
hζ : IsPrimitiveRoot ζ ↑t
⊢ ↑t = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
| exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ) | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
| Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mpr
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
⊢ S = ∅ ∨ S = {1} → IsCyclotomicExtension S A B | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· | rintro (rfl | rfl) | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· | Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mpr.inl
n : ℕ+
T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
⊢ IsCyclotomicExtension ∅ A B | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· | exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩ | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· | Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
x : B
⊢ x ∈ adjoin A {b | ∃ n ∈ ∅, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by | convert (mem_top (R := A) : x ∈ ⊤) | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by | Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mpr.inr
n : ℕ+
T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
⊢ IsCyclotomicExtension {1} A B | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· | rw [iff_singleton] | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· | Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
case mpr.inr
n : ℕ+
T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
⊢ (∃ r, IsPrimitiveRoot r ↑1) ∧ ∀ (x : B), x ∈ adjoin A {b | b ^ ↑1 = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
| exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩ | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
| Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁶ : CommRing A
inst✝⁵ : CommRing B
inst✝⁴ : Algebra A B
inst✝³ : Field K
inst✝² : Field L
inst✝¹ : Algebra K L
inst✝ : Subsingleton B
x : B
⊢ x ∈ adjoin A {b | b ^ ↑1 = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by | convert (mem_top (R := A) : x ∈ ⊤) | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by | Mathlib.NumberTheory.Cyclotomic.Basic.156_0.xReI1DeVvechFQU | @[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
⊢ IsCyclotomicExtension T (↥(adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1})) B | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
| have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
| Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
⊢ {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} = {b | ∃ n ∈ S, b ^ ↑n = 1} ∪ {b | ∃ n ∈ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
| refine' le_antisymm _ _ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
| Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
⊢ {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} ≤ {b | ∃ n ∈ S, b ^ ↑n = 1} ∪ {b | ∃ n ∈ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· | rintro x ⟨n, hn₁ | hn₂, hnpow⟩ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· | Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.intro.intro.inl
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
x : B
n : ℕ+
hnpow : x ^ ↑n = 1
hn₁ : n ∈ S
⊢ x ∈ {b | ∃ n ∈ S, b ^ ↑n = 1} ∪ {b | ∃ n ∈ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· | left | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· | Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.intro.intro.inl.h
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
x : B
n : ℕ+
hnpow : x ^ ↑n = 1
hn₁ : n ∈ S
⊢ x ∈ {b | ∃ n ∈ S, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; | exact ⟨n, hn₁, hnpow⟩ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; | Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.intro.intro.inr
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
x : B
n : ℕ+
hnpow : x ^ ↑n = 1
hn₂ : n ∈ T
⊢ x ∈ {b | ∃ n ∈ S, b ^ ↑n = 1} ∪ {b | ∃ n ∈ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· | right | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· | Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.intro.intro.inr.h
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
x : B
n : ℕ+
hnpow : x ^ ↑n = 1
hn₂ : n ∈ T
⊢ x ∈ {b | ∃ n ∈ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; | exact ⟨n, hn₂, hnpow⟩ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; | Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
⊢ {b | ∃ n ∈ S, b ^ ↑n = 1} ∪ {b | ∃ n ∈ T, b ^ ↑n = 1} ≤ {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· | rintro x (⟨n, hn⟩ | ⟨n, hn⟩) | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· | Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2.inl.intro
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
x : B
n : ℕ+
hn : n ∈ S ∧ x ^ ↑n = 1
⊢ x ∈ {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· | exact ⟨n, Or.inl hn.1, hn.2⟩ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· | Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2.inr.intro
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
x : B
n : ℕ+
hn : n ∈ T ∧ x ^ ↑n = 1
⊢ x ∈ {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· | exact ⟨n, Or.inr hn.1, hn.2⟩ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· | Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
this : {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} = {b | ∃ n ∈ S, b ^ ↑n = 1} ∪ {b | ∃ n ∈ T, b ^ ↑n = 1}
⊢ IsCyclotomicExtension T (↥(adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1})) B | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
| refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
| Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension (S ∪ T) A B
this : {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} = {b | ∃ n ∈ S, b ^ ↑n = 1} ∪ {b | ∃ n ∈ T, b ^ ↑n = 1}
b : B
⊢ b ∈ adjoin ↥(adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1}) {b | ∃ n ∈ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
| replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
| Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
this : {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1} = {b | ∃ n ∈ S, b ^ ↑n = 1} ∪ {b | ∃ n ∈ T, b ^ ↑n = 1}
b : B
h : b ∈ adjoin A {b | ∃ n ∈ S ∪ T, b ^ ↑n = 1}
⊢ b ∈ adjoin ↥(adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1}) {b | ∃ n ∈ T, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
| rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
| Mathlib.NumberTheory.Cyclotomic.Basic.173_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension T A B
hS : S ⊆ T
⊢ IsCyclotomicExtension S A ↥(adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1}) | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
| refine' ⟨@fun n hn => _, fun b => _⟩ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
| Mathlib.NumberTheory.Cyclotomic.Basic.193_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension T A B
hS : S ⊆ T
n : ℕ+
hn : n ∈ S
⊢ ∃ r, IsPrimitiveRoot r ↑n | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· | obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn) | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· | Mathlib.NumberTheory.Cyclotomic.Basic.193_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.intro
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension T A B
hS : S ⊆ T
n : ℕ+
hn : n ∈ S
b : B
hb : IsPrimitiveRoot b ↑n
⊢ ∃ r, IsPrimitiveRoot r ↑n | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
| refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩ | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
| Mathlib.NumberTheory.Cyclotomic.Basic.193_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.intro
n✝ : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension T A B
hS : S ⊆ T
n : ℕ+
hn : n ∈ S
b : B
hb : IsPrimitiveRoot b ↑n
⊢ IsPrimitiveRoot { val := b, property := (_ : b ∈ ↑(adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1})) } ↑n | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
| rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk] | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
| Mathlib.NumberTheory.Cyclotomic.Basic.193_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension T A B
hS : S ⊆ T
b : ↥(adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1})
⊢ b ∈ adjoin A {b | ∃ n ∈ S, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· | convert mem_top (R := A) (x := b) | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· | Mathlib.NumberTheory.Cyclotomic.Basic.193_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) | Mathlib_NumberTheory_Cyclotomic_Basic |
case h.e'_5
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension T A B
hS : S ⊆ T
b : ↥(adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1})
⊢ adjoin A {b | ∃ n ∈ S, b ^ ↑n = 1} = ⊤ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
| rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq] | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
| Mathlib.NumberTheory.Cyclotomic.Basic.193_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) | Mathlib_NumberTheory_Cyclotomic_Basic |
case h.e'_5
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : IsCyclotomicExtension T A B
hS : S ⊆ T
b : ↥(adjoin A {b | ∃ a ∈ S, b ^ ↑a = 1})
⊢ adjoin A {b | ∃ n ∈ S, b ^ ↑n = 1} = adjoin A {a | ∃ a_1 ∈ S, ↑a ^ ↑a_1 = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
| norm_cast | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
| Mathlib.NumberTheory.Cyclotomic.Basic.193_0.xReI1DeVvechFQU | /-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
⊢ IsCyclotomicExtension (S ∪ {n}) A B | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
| refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
s : ℕ+
hs : s ∈ S ∪ {n}
⊢ ∃ r, IsPrimitiveRoot r ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· | rw [mem_union, mem_singleton_iff] at hs | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· | Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
s : ℕ+
hs : s ∈ S ∨ s = n
⊢ ∃ r, IsPrimitiveRoot r ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
| obtain hs | rfl := hs | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inl
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
s : ℕ+
hs : s ∈ S
⊢ ∃ r, IsPrimitiveRoot r ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· | exact H.exists_prim_root hs | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· | Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inr
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
s : ℕ+
h : ∀ s_1 ∈ S, s ∣ s_1
⊢ ∃ r, IsPrimitiveRoot r ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· | obtain ⟨m, hm⟩ := hS | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· | Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inr.intro
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
H : IsCyclotomicExtension S A B
s : ℕ+
h : ∀ s_1 ∈ S, s ∣ s_1
m : ℕ+
hm : m ∈ S
⊢ ∃ r, IsPrimitiveRoot r ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
| obtain ⟨x, rfl⟩ := h m hm | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inr.intro.intro
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
H : IsCyclotomicExtension S A B
s : ℕ+
h : ∀ s_1 ∈ S, s ∣ s_1
x : ℕ+
hm : s * x ∈ S
⊢ ∃ r, IsPrimitiveRoot r ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
| obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inr.intro.intro.intro
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
H : IsCyclotomicExtension S A B
s : ℕ+
h : ∀ s_1 ∈ S, s ∣ s_1
x : ℕ+
hm : s * x ∈ S
ζ : B
hζ : IsPrimitiveRoot ζ ↑(s * x)
⊢ ∃ r, IsPrimitiveRoot r ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
| refine' ⟨ζ ^ (x : ℕ), _⟩ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1.inr.intro.intro.intro
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
H : IsCyclotomicExtension S A B
s : ℕ+
h : ∀ s_1 ∈ S, s ∣ s_1
x : ℕ+
hm : s * x ∈ S
ζ : B
hζ : IsPrimitiveRoot ζ ↑(s * x)
⊢ IsPrimitiveRoot (ζ ^ ↑x) ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
| convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s) | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case h.e'_4
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
H : IsCyclotomicExtension S A B
s : ℕ+
h : ∀ s_1 ∈ S, s ∣ s_1
x : ℕ+
hm : s * x ∈ S
ζ : B
hζ : IsPrimitiveRoot ζ ↑(s * x)
⊢ ↑s = ↑(s * x) / ↑x | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
| simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos] | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
⊢ adjoin A {b | ∃ n_1 ∈ S ∪ {n}, b ^ ↑n_1 = 1} = ⊤ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· | refine' _root_.eq_top_iff.2 _ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· | Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
⊢ ⊤ ≤ adjoin A {b | ∃ n_1 ∈ S ∪ {n}, b ^ ↑n_1 = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
| rw [← ((iff_adjoin_eq_top S A B).1 H).2] | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
⊢ adjoin A {b | ∃ n ∈ S, b ^ ↑n = 1} ≤ adjoin A {b | ∃ n_1 ∈ S ∪ {n}, b ^ ↑n_1 = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
| refine' adjoin_mono fun x hx => _ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
x : B
hx : x ∈ {b | ∃ n ∈ S, b ^ ↑n = 1}
⊢ x ∈ {b | ∃ n_1 ∈ S ∪ {n}, b ^ ↑n_1 = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
| simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
x : B
hx : ∃ n ∈ S, x ^ ↑n = 1
⊢ ∃ n_1, (n_1 = n ∨ n_1 ∈ S) ∧ x ^ ↑n_1 = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
| obtain ⟨m, hm⟩ := hx | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2.intro
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension S A B
x : B
m : ℕ+
hm : m ∈ S ∧ x ^ ↑m = 1
⊢ ∃ n_1, (n_1 = n ∨ n_1 ∈ S) ∧ x ^ ↑n_1 = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
| exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
| Mathlib.NumberTheory.Cyclotomic.Basic.209_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
⊢ IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
| refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
| Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_1
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension (S ∪ {n}) A B
s : ℕ+
hs : s ∈ S
⊢ ∃ r, IsPrimitiveRoot r ↑s | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· | exact H.exists_prim_root (subset_union_left _ _ hs) | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· | Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension (S ∪ {n}) A B
⊢ adjoin A {b | ∃ n ∈ S, b ^ ↑n = 1} = ⊤ | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· | rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2] | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· | Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension (S ∪ {n}) A B
⊢ adjoin A {b | ∃ n_1 ∈ S ∪ {n}, b ^ ↑n_1 = 1} ≤ adjoin A {b | ∃ n ∈ S, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
| refine' adjoin_mono fun x hx => _ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
| Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension (S ∪ {n}) A B
x : B
hx : x ∈ {b | ∃ n_1 ∈ S ∪ {n}, b ^ ↑n_1 = 1}
⊢ x ∈ {b | ∃ n ∈ S, b ^ ↑n = 1} | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
| simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
| Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension (S ∪ {n}) A B
x : B
hx : ∃ n_1, (n_1 = n ∨ n_1 ∈ S) ∧ x ^ ↑n_1 = 1
⊢ ∃ n ∈ S, x ^ ↑n = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
| obtain ⟨m, rfl | hm, hxpow⟩ := hx | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
| Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2.intro.intro.inl
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hS : Set.Nonempty S
x : B
m : ℕ+
hxpow : x ^ ↑m = 1
h : ∀ s ∈ S, m ∣ s
H : IsCyclotomicExtension (S ∪ {m}) A B
⊢ ∃ n ∈ S, x ^ ↑n = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· | obtain ⟨y, hy⟩ := hS | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· | Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2.intro.intro.inl.intro
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
x : B
m : ℕ+
hxpow : x ^ ↑m = 1
h : ∀ s ∈ S, m ∣ s
H : IsCyclotomicExtension (S ∪ {m}) A B
y : ℕ+
hy : y ∈ S
⊢ ∃ n ∈ S, x ^ ↑n = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· obtain ⟨y, hy⟩ := hS
| refine' ⟨y, ⟨hy, _⟩⟩ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· obtain ⟨y, hy⟩ := hS
| Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2.intro.intro.inl.intro
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
x : B
m : ℕ+
hxpow : x ^ ↑m = 1
h : ∀ s ∈ S, m ∣ s
H : IsCyclotomicExtension (S ∪ {m}) A B
y : ℕ+
hy : y ∈ S
⊢ x ^ ↑y = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· obtain ⟨y, hy⟩ := hS
refine' ⟨y, ⟨hy, _⟩⟩
| obtain ⟨z, rfl⟩ := h y hy | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· obtain ⟨y, hy⟩ := hS
refine' ⟨y, ⟨hy, _⟩⟩
| Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2.intro.intro.inl.intro.intro
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
x : B
m : ℕ+
hxpow : x ^ ↑m = 1
h : ∀ s ∈ S, m ∣ s
H : IsCyclotomicExtension (S ∪ {m}) A B
z : ℕ+
hy : m * z ∈ S
⊢ x ^ ↑(m * z) = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· obtain ⟨y, hy⟩ := hS
refine' ⟨y, ⟨hy, _⟩⟩
obtain ⟨z, rfl⟩ := h y hy
| simp only [PNat.mul_coe, pow_mul, hxpow, one_pow] | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· obtain ⟨y, hy⟩ := hS
refine' ⟨y, ⟨hy, _⟩⟩
obtain ⟨z, rfl⟩ := h y hy
| Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
case refine'_2.intro.intro.inr
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
h : ∀ s ∈ S, n ∣ s
hS : Set.Nonempty S
H : IsCyclotomicExtension (S ∪ {n}) A B
x : B
m : ℕ+
hxpow : x ^ ↑m = 1
hm : m ∈ S
⊢ ∃ n ∈ S, x ^ ↑n = 1 | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· obtain ⟨y, hy⟩ := hS
refine' ⟨y, ⟨hy, _⟩⟩
obtain ⟨z, rfl⟩ := h y hy
simp only [PNat.mul_coe, pow_mul, hxpow, one_pow]
· | exact ⟨m, ⟨hm, hxpow⟩⟩ | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· obtain ⟨y, hy⟩ := hS
refine' ⟨y, ⟨hy, _⟩⟩
obtain ⟨z, rfl⟩ := h y hy
simp only [PNat.mul_coe, pow_mul, hxpow, one_pow]
· | Mathlib.NumberTheory.Cyclotomic.Basic.231_0.xReI1DeVvechFQU | /-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |
n : ℕ+
S T : Set ℕ+
A : Type u
B : Type v
K : Type w
L : Type z
inst✝⁵ : CommRing A
inst✝⁴ : CommRing B
inst✝³ : Algebra A B
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
⊢ IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {1}) A B | /-
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
/-!
# Cyclotomic extensions
Let `A` and `B` be commutative rings with `Algebra A B`. For `S : Set ℕ+`, we define a class
`IsCyclotomicExtension S A B` expressing the fact that `B` is obtained from `A` by adding `n`-th
primitive roots of unity, for all `n ∈ S`.
## Main definitions
* `IsCyclotomicExtension S A B` : means that `B` is obtained from `A` by adding `n`-th primitive
roots of unity, for all `n ∈ S`.
* `CyclotomicField`: given `n : ℕ+` and a field `K`, we define `CyclotomicField n K` as the
splitting field of `cyclotomic n K`. If `n` is nonzero in `K`, it has the instance
`IsCyclotomicExtension {n} K (CyclotomicField n K)`.
* `CyclotomicRing` : if `A` is a domain with fraction field `K` and `n : ℕ+`, we define
`CyclotomicRing n A K` as the `A`-subalgebra of `CyclotomicField n K` generated by the roots of
`X ^ n - 1`. If `n` is nonzero in `A`, it has the instance
`IsCyclotomicExtension {n} A (CyclotomicRing n A K)`.
## Main results
* `IsCyclotomicExtension.trans` : if `IsCyclotomicExtension S A B` and
`IsCyclotomicExtension T B C`, then `IsCyclotomicExtension (S ∪ T) A C` if
`Function.Injective (algebraMap B C)`.
* `IsCyclotomicExtension.union_right` : given `IsCyclotomicExtension (S ∪ T) A B`, then
`IsCyclotomicExtension T (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }) B`.
* `IsCyclotomicExtension.union_left` : given `IsCyclotomicExtension T A B` and `S ⊆ T`, then
`IsCyclotomicExtension S A (adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 })`.
* `IsCyclotomicExtension.finite` : if `S` is finite and `IsCyclotomicExtension S A B`, then
`B` is a finite `A`-algebra.
* `IsCyclotomicExtension.numberField` : a finite cyclotomic extension of a number field is a
number field.
* `IsCyclotomicExtension.splitting_field_X_pow_sub_one` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `X ^ n - 1`.
* `IsCyclotomicExtension.splitting_field_cyclotomic` : if `IsCyclotomicExtension {n} K L`,
then `L` is the splitting field of `cyclotomic n K`.
## Implementation details
Our definition of `IsCyclotomicExtension` is very general, to allow rings of any characteristic
and infinite extensions, but it will mainly be used in the case `S = {n}` and for integral domains.
All results are in the `IsCyclotomicExtension` namespace.
Note that some results, for example `IsCyclotomicExtension.trans`,
`IsCyclotomicExtension.finite`, `IsCyclotomicExtension.numberField`,
`IsCyclotomicExtension.finiteDimensional`, `IsCyclotomicExtension.isGalois` and
`CyclotomicField.algebraBase` are lemmas, but they can be made local instances. Some of them are
included in the `Cyclotomic` locale.
-/
open Polynomial Algebra FiniteDimensional Set
open scoped BigOperators
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
/-- Given an `A`-algebra `B` and `S : Set ℕ+`, we define `IsCyclotomicExtension S A B` requiring
that there is an `n`-th primitive root of unity in `B` for all `n ∈ S` and that `B` is generated
over `A` by the roots of `X ^ n - 1`. -/
@[mk_iff]
class IsCyclotomicExtension : Prop where
/-- For all `n ∈ S`, there exists a primitive `n`-th root of unity in `B`. -/
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
/-- The `n`-th roots of unity, for `n ∈ S`, generate `B` as an `A`-algebra. -/
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
/-- A reformulation of `IsCyclotomicExtension` that uses `⊤`. -/
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
/-- A reformulation of `IsCyclotomicExtension` in the case `S` is a singleton. -/
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} :=
by simp [IsCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
/-- If `IsCyclotomicExtension ∅ A B`, then the image of `A` in `B` equals `B`. -/
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, IsCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
/-- If `IsCyclotomicExtension {1} A B`, then the image of `A` in `B` equals `B`. -/
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((IsCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
/-- If `(⊥ : SubAlgebra A B) = ⊤`, then `IsCyclotomicExtension ∅ A B`. -/
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine' (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => _⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
/-- Transitivity of cyclotomic extensions. -/
theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by
refine' ⟨fun hn => _, fun x => _⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine' ⟨algebraMap B C b, _⟩
exact hb.map_of_injective h
· exact ((IsCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine' adjoin_induction (((IsCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => _)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
· let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((IsCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine' adjoin_mono (fun y hy => _) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
#align is_cyclotomic_extension.trans IsCyclotomicExtension.trans
@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
constructor
· rintro ⟨hprim, -⟩
rw [← subset_singleton_iff_eq]
intro t ht
obtain ⟨ζ, hζ⟩ := hprim ht
rw [mem_singleton_iff, ← PNat.coe_eq_one_iff]
exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ)
· rintro (rfl | rfl)
-- Porting note: `R := A` was not needed.
· exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
· rw [iff_singleton]
exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩,
fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
#align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `S ∪ T`, then `B`
is a cyclotomic extension of `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` given by
roots of unity of order in `T`. -/
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] :
IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} =
{b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪
{b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by
refine' le_antisymm _ _
· rintro x ⟨n, hn₁ | hn₂, hnpow⟩
· left; exact ⟨n, hn₁, hnpow⟩
· right; exact ⟨n, hn₂, hnpow⟩
· rintro x (⟨n, hn⟩ | ⟨n, hn⟩)
· exact ⟨n, Or.inl hn.1, hn.2⟩
· exact ⟨n, Or.inr hn.1, hn.2⟩
refine' ⟨fun hn => ((IsCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => _⟩
replace h := ((IsCyclotomicExtension_iff _ _ _).1 h).2 b
rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
#align is_cyclotomic_extension.union_right IsCyclotomicExtension.union_right
/-- If `B` is a cyclotomic extension of `A` given by roots of unity of order in `T` and `S ⊆ T`,
then `adjoin A { b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1 }` is a cyclotomic extension of `B`
given by roots of unity of order in `S`. -/
theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) :
IsCyclotomicExtension S A (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) := by
refine' ⟨@fun n hn => _, fun b => _⟩
· obtain ⟨b, hb⟩ := ((IsCyclotomicExtension_iff _ _ _).1 h).1 (hS hn)
refine' ⟨⟨b, subset_adjoin ⟨n, hn, hb.pow_eq_one⟩⟩, _⟩
rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk]
· convert mem_top (R := A) (x := b)
rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq]
norm_cast
#align is_cyclotomic_extension.union_left IsCyclotomicExtension.union_left
variable {n S}
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` implies
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem of_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) [H : IsCyclotomicExtension S A B] :
IsCyclotomicExtension (S ∪ {n}) A B := by
refine' (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩
· rw [mem_union, mem_singleton_iff] at hs
obtain hs | rfl := hs
· exact H.exists_prim_root hs
· obtain ⟨m, hm⟩ := hS
obtain ⟨x, rfl⟩ := h m hm
obtain ⟨ζ, hζ⟩ := H.exists_prim_root hm
refine' ⟨ζ ^ (x : ℕ), _⟩
convert hζ.pow_of_dvd x.ne_zero (dvd_mul_left (x : ℕ) s)
simp only [PNat.mul_coe, Nat.mul_div_left, PNat.pos]
· refine' _root_.eq_top_iff.2 _
rw [← ((iff_adjoin_eq_top S A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, hm⟩ := hx
exact ⟨m, ⟨Or.inr hm.1, hm.2⟩⟩
#align is_cyclotomic_extension.of_union_of_dvd IsCyclotomicExtension.of_union_of_dvd
/-- If `∀ s ∈ S, n ∣ s` and `S` is not empty, then `IsCyclotomicExtension S A B` if and only if
`IsCyclotomicExtension (S ∪ {n}) A B`. -/
theorem iff_union_of_dvd (h : ∀ s ∈ S, n ∣ s) (hS : S.Nonempty) :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {n}) A B := by
refine'
⟨fun H => of_union_of_dvd A B h hS, fun H => (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => _, _⟩⟩
· exact H.exists_prim_root (subset_union_left _ _ hs)
· rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2]
refine' adjoin_mono fun x hx => _
simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢
obtain ⟨m, rfl | hm, hxpow⟩ := hx
· obtain ⟨y, hy⟩ := hS
refine' ⟨y, ⟨hy, _⟩⟩
obtain ⟨z, rfl⟩ := h y hy
simp only [PNat.mul_coe, pow_mul, hxpow, one_pow]
· exact ⟨m, ⟨hm, hxpow⟩⟩
#align is_cyclotomic_extension.iff_union_of_dvd IsCyclotomicExtension.iff_union_of_dvd
variable (n S)
/-- `IsCyclotomicExtension S A B` is equivalent to `IsCyclotomicExtension (S ∪ {1}) A B`. -/
theorem iff_union_singleton_one :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {1}) A B := by
| obtain hS | rfl := S.eq_empty_or_nonempty.symm | /-- `IsCyclotomicExtension S A B` is equivalent to `IsCyclotomicExtension (S ∪ {1}) A B`. -/
theorem iff_union_singleton_one :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {1}) A B := by
| Mathlib.NumberTheory.Cyclotomic.Basic.251_0.xReI1DeVvechFQU | /-- `IsCyclotomicExtension S A B` is equivalent to `IsCyclotomicExtension (S ∪ {1}) A B`. -/
theorem iff_union_singleton_one :
IsCyclotomicExtension S A B ↔ IsCyclotomicExtension (S ∪ {1}) A B | Mathlib_NumberTheory_Cyclotomic_Basic |