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
case inr.ih.intro F : Type u_1 E : Type u_2 inst✝³ : Field F inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite (IntermediateField F E) K : IntermediateField F E this : FiniteDimensional F E h✝ : Infinite F β α : E ⊢ ∃ α_1, F⟮α_1⟯ = restrictScalars F (↥F⟮α⟯)⟮β⟯
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩
simp_rw [adjoin_simple_adjoin_simple, eq_comm]
theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩
Mathlib.FieldTheory.PrimitiveElement.294_0.R5HND7n71i1v1rZ
theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K
Mathlib_FieldTheory_PrimitiveElement
case inr.ih.intro F : Type u_1 E : Type u_2 inst✝³ : Field F inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite (IntermediateField F E) K : IntermediateField F E this : FiniteDimensional F E h✝ : Infinite F β α : E ⊢ ∃ α_1, F⟮α, β⟯ = F⟮α_1⟯
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm]
exact primitive_element_inf_aux_of_finite_intermediateField F α β
theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm]
Mathlib.FieldTheory.PrimitiveElement.294_0.R5HND7n71i1v1rZ
theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E h : ∃ α, F⟮α⟯ = ⊤ ⊢ FiniteDimensional F E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by
obtain ⟨α, hprim⟩ := h
theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by
Mathlib.FieldTheory.PrimitiveElement.305_0.R5HND7n71i1v1rZ
theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E α : E hprim : F⟮α⟯ = ⊤ ⊢ FiniteDimensional F E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h
have hfin := adjoin.finiteDimensional (halg α).isIntegral
theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h
Mathlib.FieldTheory.PrimitiveElement.305_0.R5HND7n71i1v1rZ
theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E α : E hprim : F⟮α⟯ = ⊤ hfin : FiniteDimensional F ↥F⟮α⟯ ⊢ FiniteDimensional F E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral
rw [hprim] at hfin
theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral
Mathlib.FieldTheory.PrimitiveElement.305_0.R5HND7n71i1v1rZ
theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E α : E hprim : F⟮α⟯ = ⊤ hfin : FiniteDimensional F ↥⊤ ⊢ FiniteDimensional F E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin
exact topEquiv.toLinearEquiv.finiteDimensional
theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin
Mathlib.FieldTheory.PrimitiveElement.305_0.R5HND7n71i1v1rZ
theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E h : ∃ α, F⟮α⟯ = ⊤ ⊢ Finite (IntermediateField F E)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by
haveI := finiteDimensional_of_exists_primitive_element F E halg h
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E h : ∃ α, F⟮α⟯ = ⊤ this : FiniteDimensional F E ⊢ Finite (IntermediateField F E)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h
obtain ⟨α, hprim⟩ := h
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ ⊢ Finite (IntermediateField F E)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F`
let f : F[X] := minpoly F α
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F`
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α ⊢ Finite (IntermediateField F E)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α
let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) }
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } ⊢ Finite (IntermediateField F E)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors
have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α)
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } hfin : Finite G ⊢ Finite (IntermediateField F E)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f`
let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f`
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } hfin : Finite G K : IntermediateField F E ⊢ Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α) ∣ Polynomial.map (algebraMap F E) f
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by
convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α)
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
case h.e'_4 F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } hfin : Finite G K : IntermediateField F E ⊢ Polynomial.map (algebraMap F E) f = Polynomial.map (algebraMap (↥K) E) (Polynomial.map (algebraMap F ↥K) (minpoly F α))
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α)
rw [Polynomial.map_map]
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α)
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
case h.e'_4 F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } hfin : Finite G K : IntermediateField F E ⊢ Polynomial.map (algebraMap F E) f = Polynomial.map (RingHom.comp (algebraMap (↥K) E) (algebraMap F ↥K)) (minpoly F α)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map];
rfl
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map];
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } hfin : Finite G g : IntermediateField F E → G := fun K => { val := Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α), property := (_ : Monic (Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α)) ∧ Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α) ∣ Polynomial.map (algebraMap F E) f) } ⊢ Finite (IntermediateField F E)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective
have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } hfin : Finite G g : IntermediateField F E → G := fun K => { val := Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α), property := (_ : Monic (Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α)) ∧ Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α) ∣ Polynomial.map (algebraMap F E) f) } K K' : IntermediateField F E heq : g K = g K' ⊢ K = K'
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by
rw [Subtype.mk.injEq] at heq
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } hfin : Finite G g : IntermediateField F E → G := fun K => { val := Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α), property := (_ : Monic (Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α)) ∧ Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α) ∣ Polynomial.map (algebraMap F E) f) } K K' : IntermediateField F E heq : Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α) = Polynomial.map (algebraMap (↥K') E) (minpoly (↥K') α) ⊢ K = K'
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq
apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } hfin : Finite G g : IntermediateField F E → G := fun K => { val := Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α), property := (_ : Monic (Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α)) ∧ Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α) ∣ Polynomial.map (algebraMap F E) f) } K K' : IntermediateField F E heq : adjoin F ↑(frange (Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α))) = adjoin F ↑(frange (Polynomial.map (algebraMap (↥K') E) (minpoly (↥K') α))) ⊢ K = K'
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq
simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 E : Type u_2 inst✝² : Field F inst✝¹ : Field E inst✝ : Algebra F E halg : Algebra.IsAlgebraic F E this : FiniteDimensional F E α : E hprim : F⟮α⟯ = ⊤ f : F[X] := minpoly F α G : Type u_2 := { g // Monic g ∧ g ∣ Polynomial.map (algebraMap F E) f } hfin : Finite G g : IntermediateField F E → G := fun K => { val := Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α), property := (_ : Monic (Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α)) ∧ Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α) ∣ Polynomial.map (algebraMap F E) f) } hinj : Function.Injective g ⊢ Finite (IntermediateField F E)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields
exact Finite.of_injective g hinj
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields
Mathlib.FieldTheory.PrimitiveElement.313_0.R5HND7n71i1v1rZ
theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E)
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝⁷ : Field F inst✝⁶ : Field E inst✝⁵ : Algebra F E inst✝⁴ : FiniteDimensional F E inst✝³ : IsSeparable F E K : Type u_3 inst✝² : Field K inst✝¹ : IsAlgClosed K inst✝ : Algebra F K ⊢ Fintype.card (E →ₐ[F] K) = finrank F E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by
convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm
@[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by
Mathlib.FieldTheory.PrimitiveElement.352_0.R5HND7n71i1v1rZ
@[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E L : Type u_3 inst✝¹ : Field L inst✝ : Algebra F L hL : ∀ (x : E), Splits (algebraMap F L) (minpoly F x) ⊢ Fintype.card (E →ₐ[F] L) = finrank F E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by
rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL]
@[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by
Mathlib.FieldTheory.PrimitiveElement.359_0.R5HND7n71i1v1rZ
@[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 E : Type u_2 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E L : Type u_3 inst✝¹ : Field L inst✝ : Algebra F L hL : ∀ (x : E), Splits (algebraMap F L) (minpoly F x) ⊢ Fintype.card (E →ₐ[F] AlgebraicClosure L) = finrank F E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL]
convert AlgHom.card F E (AlgebraicClosure L)
@[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL]
Mathlib.FieldTheory.PrimitiveElement.359_0.R5HND7n71i1v1rZ
@[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝⁸ : Field F✝ inst✝⁷ : Field E✝ inst✝⁶ : Algebra F✝ E✝ inst✝⁵ : FiniteDimensional F✝ E✝ inst✝⁴ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝³ : Field F inst✝² : Field E inst✝¹ : Algebra F E inst✝ : FiniteDimensional F E α : E ⊢ F⟮α⟯ = ⊤ ↔ natDegree (minpoly F α) = finrank F E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by
rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E]
theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by
Mathlib.FieldTheory.PrimitiveElement.375_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝⁸ : Field F✝ inst✝⁷ : Field E✝ inst✝⁶ : Algebra F✝ E✝ inst✝⁵ : FiniteDimensional F✝ E✝ inst✝⁴ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝³ : Field F inst✝² : Field E inst✝¹ : Algebra F E inst✝ : FiniteDimensional F E α : E ⊢ F⟮α⟯ = ⊤ ↔ finrank F ↥F⟮α⟯ = finrank F ↥⊤
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E]
refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩
theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E]
Mathlib.FieldTheory.PrimitiveElement.375_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝⁸ : Field F✝ inst✝⁷ : Field E✝ inst✝⁶ : Algebra F✝ E✝ inst✝⁵ : FiniteDimensional F✝ E✝ inst✝⁴ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝³ : Field F inst✝² : Field E inst✝¹ : Algebra F E inst✝ : FiniteDimensional F E α : E h : F⟮α⟯ = ⊤ ⊢ finrank F ↥F⟮α⟯ = finrank F ↥⊤
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩
exact congr_arg (fun K : IntermediateField F E => finrank F K) h
theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩
Mathlib.FieldTheory.PrimitiveElement.375_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝⁸ : Field F✝ inst✝⁷ : Field E✝ inst✝⁶ : Algebra F✝ E✝ inst✝⁵ : FiniteDimensional F✝ E✝ inst✝⁴ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝³ : Field F inst✝² : Field E inst✝¹ : Algebra F E inst✝ : FiniteDimensional F E α : E ⊢ F⟮α⟯ = ⊤ ↔ degree (minpoly F α) = ↑(finrank F E)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by
rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq]
theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by
Mathlib.FieldTheory.PrimitiveElement.381_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝⁸ : Field F✝ inst✝⁷ : Field E✝ inst✝⁶ : Algebra F✝ E✝ inst✝⁵ : FiniteDimensional F✝ E✝ inst✝⁴ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝³ : Field F inst✝² : Field E inst✝¹ : Algebra F E inst✝ : FiniteDimensional F E α : E ⊢ minpoly F α ≠ 0
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq]
exact minpoly.ne_zero_of_finite F α
theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq]
Mathlib.FieldTheory.PrimitiveElement.381_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝¹¹ : Field F✝ inst✝¹⁰ : Field E✝ inst✝⁹ : Algebra F✝ E✝ inst✝⁸ : FiniteDimensional F✝ E✝ inst✝⁷ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E A : Type u_5 inst✝¹ : Field A inst✝ : Algebra F A hA : ∀ (x : E), Splits (algebraMap F A) (minpoly F x) α : E ⊢ F⟮α⟯ = ⊤ ↔ Function.Injective fun φ => φ α
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq] exact minpoly.ne_zero_of_finite F α variable [IsSeparable F E] (A : Type*) [Field A] [Algebra F A] (hA : ∀ x : E, (minpoly F x).Splits (algebraMap F A)) theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by
classical simp_rw [primitive_element_iff_minpoly_natDegree_eq, ← card_rootSet_eq_natDegree (K := A) (IsSeparable.separable F α) (hA _), ← toFinset_card, ← (Algebra.IsAlgebraic.of_finite F E).range_eval_eq_rootSet_minpoly_of_splits _ hA α, ← AlgHom.card_of_splits F E A hA, Fintype.card, toFinset_range, Finset.card_image_iff, Finset.coe_univ, ← injective_iff_injOn_univ]
theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by
Mathlib.FieldTheory.PrimitiveElement.389_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝¹¹ : Field F✝ inst✝¹⁰ : Field E✝ inst✝⁹ : Algebra F✝ E✝ inst✝⁸ : FiniteDimensional F✝ E✝ inst✝⁷ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E A : Type u_5 inst✝¹ : Field A inst✝ : Algebra F A hA : ∀ (x : E), Splits (algebraMap F A) (minpoly F x) α : E ⊢ F⟮α⟯ = ⊤ ↔ Function.Injective fun φ => φ α
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq] exact minpoly.ne_zero_of_finite F α variable [IsSeparable F E] (A : Type*) [Field A] [Algebra F A] (hA : ∀ x : E, (minpoly F x).Splits (algebraMap F A)) theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by classical
simp_rw [primitive_element_iff_minpoly_natDegree_eq, ← card_rootSet_eq_natDegree (K := A) (IsSeparable.separable F α) (hA _), ← toFinset_card, ← (Algebra.IsAlgebraic.of_finite F E).range_eval_eq_rootSet_minpoly_of_splits _ hA α, ← AlgHom.card_of_splits F E A hA, Fintype.card, toFinset_range, Finset.card_image_iff, Finset.coe_univ, ← injective_iff_injOn_univ]
theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by classical
Mathlib.FieldTheory.PrimitiveElement.389_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝¹¹ : Field F✝ inst✝¹⁰ : Field E✝ inst✝⁹ : Algebra F✝ E✝ inst✝⁸ : FiniteDimensional F✝ E✝ inst✝⁷ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E A : Type u_5 inst✝¹ : Field A inst✝ : Algebra F A hA : ∀ (x : E), Splits (algebraMap F A) (minpoly F x) α : E φ : E →ₐ[F] A ⊢ F⟮α⟯ = ⊤ ↔ ∀ (ψ : E →ₐ[F] A), φ α = ψ α → φ = ψ
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq] exact minpoly.ne_zero_of_finite F α variable [IsSeparable F E] (A : Type*) [Field A] [Algebra F A] (hA : ∀ x : E, (minpoly F x).Splits (algebraMap F A)) theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by classical simp_rw [primitive_element_iff_minpoly_natDegree_eq, ← card_rootSet_eq_natDegree (K := A) (IsSeparable.separable F α) (hA _), ← toFinset_card, ← (Algebra.IsAlgebraic.of_finite F E).range_eval_eq_rootSet_minpoly_of_splits _ hA α, ← AlgHom.card_of_splits F E A hA, Fintype.card, toFinset_range, Finset.card_image_iff, Finset.coe_univ, ← injective_iff_injOn_univ] theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by
refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by
Mathlib.FieldTheory.PrimitiveElement.398_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝¹¹ : Field F✝ inst✝¹⁰ : Field E✝ inst✝⁹ : Algebra F✝ E✝ inst✝⁸ : FiniteDimensional F✝ E✝ inst✝⁷ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E A : Type u_5 inst✝¹ : Field A inst✝ : Algebra F A hA : ∀ (x : E), Splits (algebraMap F A) (minpoly F x) α : E φ : E →ₐ[F] A h : ∀ (ψ : E →ₐ[F] A), φ α = ψ α → φ = ψ ⊢ finrank (↥F⟮α⟯) E = finrank (↥⊤) E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq] exact minpoly.ne_zero_of_finite F α variable [IsSeparable F E] (A : Type*) [Field A] [Algebra F A] (hA : ∀ x : E, (minpoly F x).Splits (algebraMap F A)) theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by classical simp_rw [primitive_element_iff_minpoly_natDegree_eq, ← card_rootSet_eq_natDegree (K := A) (IsSeparable.separable F α) (hA _), ← toFinset_card, ← (Algebra.IsAlgebraic.of_finite F E).range_eval_eq_rootSet_minpoly_of_splits _ hA α, ← AlgHom.card_of_splits F E A hA, Fintype.card, toFinset_range, Finset.card_image_iff, Finset.coe_univ, ← injective_iff_injOn_univ] theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩
letI : Algebra F⟮α⟯ A := (φ.comp F⟮α⟯.val).toAlgebra
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩
Mathlib.FieldTheory.PrimitiveElement.398_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝¹¹ : Field F✝ inst✝¹⁰ : Field E✝ inst✝⁹ : Algebra F✝ E✝ inst✝⁸ : FiniteDimensional F✝ E✝ inst✝⁷ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E A : Type u_5 inst✝¹ : Field A inst✝ : Algebra F A hA : ∀ (x : E), Splits (algebraMap F A) (minpoly F x) α : E φ : E →ₐ[F] A h : ∀ (ψ : E →ₐ[F] A), φ α = ψ α → φ = ψ this : Algebra (↥F⟮α⟯) A := RingHom.toAlgebra ↑(AlgHom.comp φ (val F⟮α⟯)) ⊢ finrank (↥F⟮α⟯) E = finrank (↥⊤) E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq] exact minpoly.ne_zero_of_finite F α variable [IsSeparable F E] (A : Type*) [Field A] [Algebra F A] (hA : ∀ x : E, (minpoly F x).Splits (algebraMap F A)) theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by classical simp_rw [primitive_element_iff_minpoly_natDegree_eq, ← card_rootSet_eq_natDegree (K := A) (IsSeparable.separable F α) (hA _), ← toFinset_card, ← (Algebra.IsAlgebraic.of_finite F E).range_eval_eq_rootSet_minpoly_of_splits _ hA α, ← AlgHom.card_of_splits F E A hA, Fintype.card, toFinset_range, Finset.card_image_iff, Finset.coe_univ, ← injective_iff_injOn_univ] theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩ letI : Algebra F⟮α⟯ A := (φ.comp F⟮α⟯.val).toAlgebra
haveI := isSeparable_tower_top_of_isSeparable F F⟮α⟯ E
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩ letI : Algebra F⟮α⟯ A := (φ.comp F⟮α⟯.val).toAlgebra
Mathlib.FieldTheory.PrimitiveElement.398_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝¹¹ : Field F✝ inst✝¹⁰ : Field E✝ inst✝⁹ : Algebra F✝ E✝ inst✝⁸ : FiniteDimensional F✝ E✝ inst✝⁷ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E A : Type u_5 inst✝¹ : Field A inst✝ : Algebra F A hA : ∀ (x : E), Splits (algebraMap F A) (minpoly F x) α : E φ : E →ₐ[F] A h : ∀ (ψ : E →ₐ[F] A), φ α = ψ α → φ = ψ this✝ : Algebra (↥F⟮α⟯) A := RingHom.toAlgebra ↑(AlgHom.comp φ (val F⟮α⟯)) this : IsSeparable (↥F⟮α⟯) E ⊢ finrank (↥F⟮α⟯) E = finrank (↥⊤) E
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq] exact minpoly.ne_zero_of_finite F α variable [IsSeparable F E] (A : Type*) [Field A] [Algebra F A] (hA : ∀ x : E, (minpoly F x).Splits (algebraMap F A)) theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by classical simp_rw [primitive_element_iff_minpoly_natDegree_eq, ← card_rootSet_eq_natDegree (K := A) (IsSeparable.separable F α) (hA _), ← toFinset_card, ← (Algebra.IsAlgebraic.of_finite F E).range_eval_eq_rootSet_minpoly_of_splits _ hA α, ← AlgHom.card_of_splits F E A hA, Fintype.card, toFinset_range, Finset.card_image_iff, Finset.coe_univ, ← injective_iff_injOn_univ] theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩ letI : Algebra F⟮α⟯ A := (φ.comp F⟮α⟯.val).toAlgebra haveI := isSeparable_tower_top_of_isSeparable F F⟮α⟯ E
rw [IntermediateField.finrank_top, ← AlgHom.card_of_splits _ _ A, Fintype.card_eq_one_iff]
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩ letI : Algebra F⟮α⟯ A := (φ.comp F⟮α⟯.val).toAlgebra haveI := isSeparable_tower_top_of_isSeparable F F⟮α⟯ E
Mathlib.FieldTheory.PrimitiveElement.398_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝¹¹ : Field F✝ inst✝¹⁰ : Field E✝ inst✝⁹ : Algebra F✝ E✝ inst✝⁸ : FiniteDimensional F✝ E✝ inst✝⁷ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E A : Type u_5 inst✝¹ : Field A inst✝ : Algebra F A hA : ∀ (x : E), Splits (algebraMap F A) (minpoly F x) α : E φ : E →ₐ[F] A h : ∀ (ψ : E →ₐ[F] A), φ α = ψ α → φ = ψ this✝ : Algebra (↥F⟮α⟯) A := RingHom.toAlgebra ↑(AlgHom.comp φ (val F⟮α⟯)) this : IsSeparable (↥F⟮α⟯) E ⊢ ∃ x, ∀ (y : E →ₐ[↥F⟮α⟯] A), y = x
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq] exact minpoly.ne_zero_of_finite F α variable [IsSeparable F E] (A : Type*) [Field A] [Algebra F A] (hA : ∀ x : E, (minpoly F x).Splits (algebraMap F A)) theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by classical simp_rw [primitive_element_iff_minpoly_natDegree_eq, ← card_rootSet_eq_natDegree (K := A) (IsSeparable.separable F α) (hA _), ← toFinset_card, ← (Algebra.IsAlgebraic.of_finite F E).range_eval_eq_rootSet_minpoly_of_splits _ hA α, ← AlgHom.card_of_splits F E A hA, Fintype.card, toFinset_range, Finset.card_image_iff, Finset.coe_univ, ← injective_iff_injOn_univ] theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩ letI : Algebra F⟮α⟯ A := (φ.comp F⟮α⟯.val).toAlgebra haveI := isSeparable_tower_top_of_isSeparable F F⟮α⟯ E rw [IntermediateField.finrank_top, ← AlgHom.card_of_splits _ _ A, Fintype.card_eq_one_iff] ·
exact ⟨{ __ := φ, commutes' := fun _ ↦ rfl }, fun ψ ↦ AlgHom.restrictScalars_injective F <| Eq.symm <| h _ (ψ.commutes <| AdjoinSimple.gen F α).symm⟩
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩ letI : Algebra F⟮α⟯ A := (φ.comp F⟮α⟯.val).toAlgebra haveI := isSeparable_tower_top_of_isSeparable F F⟮α⟯ E rw [IntermediateField.finrank_top, ← AlgHom.card_of_splits _ _ A, Fintype.card_eq_one_iff] ·
Mathlib.FieldTheory.PrimitiveElement.398_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ
Mathlib_FieldTheory_PrimitiveElement
F✝ : Type u_1 E✝ : Type u_2 inst✝¹¹ : Field F✝ inst✝¹⁰ : Field E✝ inst✝⁹ : Algebra F✝ E✝ inst✝⁸ : FiniteDimensional F✝ E✝ inst✝⁷ : IsSeparable F✝ E✝ F : Type u_3 E : Type u_4 inst✝⁶ : Field F inst✝⁵ : Field E inst✝⁴ : Algebra F E inst✝³ : FiniteDimensional F E inst✝² : IsSeparable F E A : Type u_5 inst✝¹ : Field A inst✝ : Algebra F A hA : ∀ (x : E), Splits (algebraMap F A) (minpoly F x) α : E φ : E →ₐ[F] A h : ∀ (ψ : E →ₐ[F] A), φ α = ψ α → φ = ψ this✝ : Algebra (↥F⟮α⟯) A := RingHom.toAlgebra ↑(AlgHom.comp φ (val F⟮α⟯)) this : IsSeparable (↥F⟮α⟯) E ⊢ ∀ (x : E), Splits (algebraMap (↥F⟮α⟯) A) (minpoly (↥F⟮α⟯) x)
/- Copyright (c) 2020 Thomas Browning, Patrick Lutz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning, Patrick Lutz -/ import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" /-! # Primitive Element Theorem In this file we prove the primitive element theorem. ## Main results - `exists_primitive_element`: a finite separable extension `E / F` has a primitive element, i.e. there is an `α : E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. - `exists_primitive_element_iff_finite_intermediateField`: a finite extension `E / F` has a primitive element if and only if there exist only finitely many intermediate fields between `E` and `F`. ## Implementation notes In declaration names, `primitive_element` abbreviates `adjoin_simple_eq_top`: it stands for the statement `F⟮α⟯ = (⊤ : Subalgebra F E)`. We did not add an extra declaration `IsPrimitiveElement F α := F⟮α⟯ = (⊤ : Subalgebra F E)` because this requires more unfolding without much obvious benefit. ## Tags primitive element, separable field extension, separable extension, intermediate field, adjoin, exists_adjoin_simple_eq_top -/ noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E] /-! ### Primitive element theorem for finite fields -/ /-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α apply eq_top_iff.mpr rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n #align field.exists_primitive_element_of_finite_top Field.exists_primitive_element_of_finite_top /-- Primitive element theorem for finite dimensional extension of a finite field. -/ theorem exists_primitive_element_of_finite_bot [Finite F] [FiniteDimensional F E] : ∃ α : E, F⟮α⟯ = ⊤ := haveI : Finite E := finite_of_finite F E exists_primitive_element_of_finite_top F E #align field.exists_primitive_element_of_finite_bot Field.exists_primitive_element_of_finite_bot end PrimitiveElementFinite /-! ### Primitive element theorem for infinite fields -/ section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E] /-- This is the heart of the proof of the primitive element theorem. It shows that if `F` is infinite and `α` and `β` are separable over `F` then `F⟮α, β⟯` is generated by a single element. -/ theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ · use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) · have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr #align field.primitive_element_inf_aux Field.primitive_element_inf_aux -- If `F` is infinite and `E/F` has only finitely many intermediate fields, then for any -- `α` and `β` in `E`, `F⟮α, β⟯` is generated by a single element. -- Marked as private since it's a special case of -- `exists_primitive_element_of_finite_intermediateField`. private theorem primitive_element_inf_aux_of_finite_intermediateField [Finite (IntermediateField F E)] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by let f : F → IntermediateField F E := fun x ↦ F⟮α + x • β⟯ obtain ⟨x, y, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite f use α + x • β apply le_antisymm · rw [adjoin_le_iff] have αxβ_in_K : α + x • β ∈ F⟮α + x • β⟯ := mem_adjoin_simple_self F _ have αyβ_in_K : α + y • β ∈ F⟮α + y • β⟯ := mem_adjoin_simple_self F _ simp only [← heq] at αyβ_in_K have β_in_K := sub_mem αxβ_in_K αyβ_in_K rw [show (α + x • β) - (α + y • β) = (x - y) • β by rw [sub_smul]; abel1] at β_in_K replace β_in_K := smul_mem _ β_in_K (x := (x - y)⁻¹) rw [smul_smul, inv_mul_eq_div, div_self (sub_ne_zero.2 hneq), one_smul] at β_in_K have α_in_K : α ∈ F⟮α + x • β⟯ := by convert ← sub_mem αxβ_in_K (smul_mem _ β_in_K) apply add_sub_cancel rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) end PrimitiveElementInf variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section SeparableAssumption variable [FiniteDimensional F E] [IsSeparable F E] /-- **Primitive element theorem**: a finite separable field extension `E` of `F` has a primitive element, i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`. -/ theorem exists_primitive_element : ∃ α : E, F⟮α⟯ = ⊤ := by rcases isEmpty_or_nonempty (Fintype F) with (F_inf | ⟨⟨F_finite⟩⟩) · let P : IntermediateField F E → Prop := fun K => ∃ α : E, F⟮α⟯ = K have base : P ⊥ := ⟨0, adjoin_zero⟩ have ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F) := by intro K β hK cases' hK with α hK rw [← hK, adjoin_simple_adjoin_simple] haveI : Infinite F := isEmpty_fintype.mp F_inf cases' primitive_element_inf_aux F α β with γ hγ exact ⟨γ, hγ.symm⟩ exact induction_on_adjoin P base ih ⊤ · exact exists_primitive_element_of_finite_bot F E #align field.exists_primitive_element Field.exists_primitive_element /-- Alternative phrasing of primitive element theorem: a finite separable field extension has a basis `1, α, α^2, ..., α^n`. See also `exists_primitive_element`. -/ noncomputable def powerBasisOfFiniteOfSeparable : PowerBasis F E := let α := (exists_primitive_element F E).choose let pb := adjoin.powerBasis (IsSeparable.isIntegral F α) have e : F⟮α⟯ = ⊤ := (exists_primitive_element F E).choose_spec pb.map ((IntermediateField.equivOfEq e).trans IntermediateField.topEquiv) #align field.power_basis_of_finite_of_separable Field.powerBasisOfFiniteOfSeparable end SeparableAssumption section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] replace hm : 0 < m := Nat.pos_of_ne_zero hm obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero · rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq theorem finiteDimensional_of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (isAlgebraic_of_finite_intermediateField F E x).isIntegral have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional theorem exists_primitive_element_of_finite_intermediateField [Finite (IntermediateField F E)] (K : IntermediateField F E) : ∃ α : E, F⟮α⟯ = K := by haveI := finiteDimensional_of_finite_intermediateField F E rcases finite_or_infinite F with (_ | _) · obtain ⟨α, h⟩ := exists_primitive_element_of_finite_bot F K exact ⟨α, by simpa only [lift_adjoin_simple, lift_top] using congr_arg lift h⟩ · apply induction_on_adjoin (fun K ↦ ∃ α : E, F⟮α⟯ = K) ⟨0, adjoin_zero⟩ rintro K β ⟨α, rfl⟩ simp_rw [adjoin_simple_adjoin_simple, eq_comm] exact primitive_element_inf_aux_of_finite_intermediateField F α β theorem finiteDimensional_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : FiniteDimensional F E := by obtain ⟨α, hprim⟩ := h have hfin := adjoin.finiteDimensional (halg α).isIntegral rw [hprim] at hfin exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields theorem finite_intermediateField_of_exists_primitive_element (halg : Algebra.IsAlgebraic F E) (h : ∃ α : E, F⟮α⟯ = ⊤) : Finite (IntermediateField F E) := by haveI := finiteDimensional_of_exists_primitive_element F E halg h obtain ⟨α, hprim⟩ := h -- Let `f` be the minimal polynomial of `α ∈ E` over `F` let f : F[X] := minpoly F α let G := { g : E[X] // g.Monic ∧ g ∣ f.map (algebraMap F E) } -- Then `f` has only finitely many monic factors have hfin : Finite G := @Finite.of_fintype _ <| fintypeSubtypeMonicDvd (f.map (algebraMap F E)) <| map_ne_zero (minpoly.ne_zero_of_finite F α) -- If `K` is an intermediate field of `E/F`, let `g` be the minimal polynomial of `α` over `K` -- which is a monic factor of `f` let g : IntermediateField F E → G := fun K ↦ ⟨(minpoly K α).map (algebraMap K E), (minpoly.monic <| .of_finite K α).map _, by convert Polynomial.map_dvd (algebraMap K E) (minpoly.dvd_map_of_isScalarTower F K α) rw [Polynomial.map_map]; rfl⟩ -- The map `K ↦ g` is injective have hinj : Function.Injective g := fun K K' heq ↦ by rw [Subtype.mk.injEq] at heq apply_fun fun f : E[X] ↦ adjoin F (f.frange : Set E) at heq simpa only [adjoin_minpoly_coeff_of_exists_primitive_element F hprim] using heq -- Therefore there are only finitely many intermediate fields exact Finite.of_injective g hinj /-- **Steinitz theorem**: an algebraic extension `E` of `F` has a primitive element (i.e. there is an `α ∈ E` such that `F⟮α⟯ = (⊤ : Subalgebra F E)`) if and only if there exist only finitely many intermediate fields between `E` and `F`. -/ theorem exists_primitive_element_iff_finite_intermediateField : (Algebra.IsAlgebraic F E ∧ ∃ α : E, F⟮α⟯ = ⊤) ↔ Finite (IntermediateField F E) := ⟨fun ⟨halg, h⟩ ↦ finite_intermediateField_of_exists_primitive_element F E halg h, fun _ ↦ ⟨isAlgebraic_of_finite_intermediateField F E, exists_primitive_element_of_finite_intermediateField F E _⟩⟩ end FiniteIntermediateField end Field variable (F E : Type*) [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] [IsSeparable F E] @[simp] theorem AlgHom.card (K : Type*) [Field K] [IsAlgClosed K] [Algebra F K] : Fintype.card (E →ₐ[F] K) = finrank F E := by convert (AlgHom.card_of_powerBasis (L := K) (Field.powerBasisOfFiniteOfSeparable F E) (IsSeparable.separable _ _) (IsAlgClosed.splits_codomain _)).trans (PowerBasis.finrank _).symm #align alg_hom.card AlgHom.card @[simp] theorem AlgHom.card_of_splits (L : Type*) [Field L] [Algebra F L] (hL : ∀ x : E, (minpoly F x).Splits (algebraMap F L)) : Fintype.card (E →ₐ[F] L) = finrank F E := by rw [← Fintype.ofEquiv_card <| Algebra.IsAlgebraic.algHomEquivAlgHomOfSplits (AlgebraicClosure L) (Algebra.IsAlgebraic.of_finite F E) _ hL] convert AlgHom.card F E (AlgebraicClosure L) section iff namespace Field open FiniteDimensional IntermediateField Polynomial Algebra Set variable (F : Type*) {E : Type*} [Field F] [Field E] [Algebra F E] [FiniteDimensional F E] theorem primitive_element_iff_minpoly_natDegree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).natDegree = finrank F E := by rw [← adjoin.finrank (IsIntegral.of_finite F α), ← finrank_top F E] refine ⟨fun h => ?_, fun h => eq_of_le_of_finrank_eq le_top h⟩ exact congr_arg (fun K : IntermediateField F E => finrank F K) h theorem primitive_element_iff_minpoly_degree_eq (α : E) : F⟮α⟯ = ⊤ ↔ (minpoly F α).degree = finrank F E := by rw [degree_eq_iff_natDegree_eq, primitive_element_iff_minpoly_natDegree_eq] exact minpoly.ne_zero_of_finite F α variable [IsSeparable F E] (A : Type*) [Field A] [Algebra F A] (hA : ∀ x : E, (minpoly F x).Splits (algebraMap F A)) theorem primitive_element_iff_algHom_eq_of_eval' (α : E) : F⟮α⟯ = ⊤ ↔ Function.Injective fun φ : E →ₐ[F] A ↦ φ α := by classical simp_rw [primitive_element_iff_minpoly_natDegree_eq, ← card_rootSet_eq_natDegree (K := A) (IsSeparable.separable F α) (hA _), ← toFinset_card, ← (Algebra.IsAlgebraic.of_finite F E).range_eval_eq_rootSet_minpoly_of_splits _ hA α, ← AlgHom.card_of_splits F E A hA, Fintype.card, toFinset_range, Finset.card_image_iff, Finset.coe_univ, ← injective_iff_injOn_univ] theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩ letI : Algebra F⟮α⟯ A := (φ.comp F⟮α⟯.val).toAlgebra haveI := isSeparable_tower_top_of_isSeparable F F⟮α⟯ E rw [IntermediateField.finrank_top, ← AlgHom.card_of_splits _ _ A, Fintype.card_eq_one_iff] · exact ⟨{ __ := φ, commutes' := fun _ ↦ rfl }, fun ψ ↦ AlgHom.restrictScalars_injective F <| Eq.symm <| h _ (ψ.commutes <| AdjoinSimple.gen F α).symm⟩ ·
exact fun x ↦ (IsIntegral.of_finite F x).minpoly_splits_tower_top (hA x)
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by refine ⟨fun h ψ hψ ↦ (Field.primitive_element_iff_algHom_eq_of_eval' F A hA α).mp h hψ, fun h ↦ eq_of_le_of_finrank_eq' le_top ?_⟩ letI : Algebra F⟮α⟯ A := (φ.comp F⟮α⟯.val).toAlgebra haveI := isSeparable_tower_top_of_isSeparable F F⟮α⟯ E rw [IntermediateField.finrank_top, ← AlgHom.card_of_splits _ _ A, Fintype.card_eq_one_iff] · exact ⟨{ __ := φ, commutes' := fun _ ↦ rfl }, fun ψ ↦ AlgHom.restrictScalars_injective F <| Eq.symm <| h _ (ψ.commutes <| AdjoinSimple.gen F α).symm⟩ ·
Mathlib.FieldTheory.PrimitiveElement.398_0.R5HND7n71i1v1rZ
theorem primitive_element_iff_algHom_eq_of_eval (α : E) (φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ
Mathlib_FieldTheory_PrimitiveElement
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax X Y : J f : X ⟶ Y ⊢ ((Functor.const J).obj (of ↑{u | ∀ {i j : J} (f : i ⟶ j), (F.map f) (u i) = u j})).map f ≫ (fun j => ContinuousMap.mk fun u => ↑u j) Y = (fun j => ContinuousMap.mk fun u => ↑u j) X ≫ F.map f
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?!
dsimp
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?!
Mathlib.Topology.Category.TopCat.Limits.Basic.46_0.lEtiPsL1dQihFhl
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax X Y : J f : X ⟶ Y ⊢ (𝟙 (of { x // ∀ {i j : J} (f : i ⟶ j), (F.map f) (x i) = x j }) ≫ ContinuousMap.mk fun u => ↑u Y) = (ContinuousMap.mk fun u => ↑u X) ≫ F.map f
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp
rw [Category.id_comp]
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp
Mathlib.Topology.Category.TopCat.Limits.Basic.46_0.lEtiPsL1dQihFhl
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax X Y : J f : X ⟶ Y ⊢ (ContinuousMap.mk fun u => ↑u Y) = (ContinuousMap.mk fun u => ↑u X) ≫ F.map f
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp]
apply ContinuousMap.ext
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp]
Mathlib.Topology.Category.TopCat.Limits.Basic.46_0.lEtiPsL1dQihFhl
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt
Mathlib_Topology_Category_TopCat_Limits_Basic
case h J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax X Y : J f : X ⟶ Y ⊢ ∀ (a : { x // ∀ {i j : J} (f : i ⟶ j), (F.map f) (x i) = x j }), (ContinuousMap.mk fun u => ↑u Y) a = ((ContinuousMap.mk fun u => ↑u X) ≫ F.map f) a
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext
intro a
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext
Mathlib.Topology.Category.TopCat.Limits.Basic.46_0.lEtiPsL1dQihFhl
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt
Mathlib_Topology_Category_TopCat_Limits_Basic
case h J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax X Y : J f : X ⟶ Y a : { x // ∀ {i j : J} (f : i ⟶ j), (F.map f) (x i) = x j } ⊢ (ContinuousMap.mk fun u => ↑u Y) a = ((ContinuousMap.mk fun u => ↑u X) ≫ F.map f) a
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a
exact (a.2 f).symm
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a
Mathlib.Topology.Category.TopCat.Limits.Basic.46_0.lEtiPsL1dQihFhl
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F x : ↑S.pt i✝ j✝ : J f : i✝ ⟶ j✝ ⊢ (F.map f) ((fun j => (S.π.app j) x) i✝) = (fun j => (S.π.app j) x) j✝
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by
dsimp
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F x : ↑S.pt i✝ j✝ : J f : i✝ ⟶ j✝ ⊢ (F.map f) ((S.π.app i✝) x) = (S.π.app j✝) x
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp
erw [← S.w f]
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F x : ↑S.pt i✝ j✝ : J f : i✝ ⟶ j✝ ⊢ (F.map f) ((S.π.app i✝) x) = (S.π.app i✝ ≫ F.map f) x
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f]
rfl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f]
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F x : ↑S.pt i j : J f : i ⟶ j ⊢ (F.map f) ((fun j => (S.π.app j) x) i) = (fun j => (S.π.app j) x) j
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by
dsimp
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F x : ↑S.pt i j : J f : i ⟶ j ⊢ (F.map f) ((S.π.app i) x) = (S.π.app j) x
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp
rw [← S.w f]
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F x : ↑S.pt i j : J f : i ⟶ j ⊢ (F.map f) ((S.π.app i) x) = (S.π.app i ≫ F.map f) x
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f]
rfl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f]
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F m : S.pt ⟶ (limitCone F).pt h : ∀ (j : J), m ≫ (limitCone F).π.app j = S.π.app j ⊢ m = (fun S => ContinuousMap.mk fun x => { val := fun j => (S.π.app j) x, property := (_ : ∀ {i j : J} (f : i ⟶ j), (F.map f) ((fun j => (S.π.app j) x) i) = (fun j => (S.π.app j) x) j) }) S
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by
apply ContinuousMap.ext
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
case h J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F m : S.pt ⟶ (limitCone F).pt h : ∀ (j : J), m ≫ (limitCone F).π.app j = S.π.app j ⊢ ∀ (a : ↑S.pt), m a = ((fun S => ContinuousMap.mk fun x => { val := fun j => (S.π.app j) x, property := (_ : ∀ {i j : J} (f : i ⟶ j), (F.map f) ((fun j => (S.π.app j) x) i) = (fun j => (S.π.app j) x) j) }) S) a
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext;
intros a
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext;
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
case h J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F m : S.pt ⟶ (limitCone F).pt h : ∀ (j : J), m ≫ (limitCone F).π.app j = S.π.app j a : ↑S.pt ⊢ m a = ((fun S => ContinuousMap.mk fun x => { val := fun j => (S.π.app j) x, property := (_ : ∀ {i j : J} (f : i ⟶ j), (F.map f) ((fun j => (S.π.app j) x) i) = (fun j => (S.π.app j) x) j) }) S) a
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a;
apply Subtype.ext
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a;
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
case h.a J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F m : S.pt ⟶ (limitCone F).pt h : ∀ (j : J), m ≫ (limitCone F).π.app j = S.π.app j a : ↑S.pt ⊢ ↑(m a) = ↑(((fun S => ContinuousMap.mk fun x => { val := fun j => (S.π.app j) x, property := (_ : ∀ {i j : J} (f : i ⟶ j), (F.map f) ((fun j => (S.π.app j) x) i) = (fun j => (S.π.app j) x) j) }) S) a)
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext;
funext j
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext;
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
case h.a.h J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F m : S.pt ⟶ (limitCone F).pt h : ∀ (j : J), m ≫ (limitCone F).π.app j = S.π.app j a : ↑S.pt j : J ⊢ ↑(m a) j = ↑(((fun S => ContinuousMap.mk fun x => { val := fun j => (S.π.app j) x, property := (_ : ∀ {i j : J} (f : i ⟶ j), (F.map f) ((fun j => (S.π.app j) x) i) = (fun j => (S.π.app j) x) j) }) S) a) j
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j
dsimp
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
case h.a.h J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F m : S.pt ⟶ (limitCone F).pt h : ∀ (j : J), m ≫ (limitCone F).π.app j = S.π.app j a : ↑S.pt j : J ⊢ ↑(m a) j = (S.π.app j) a
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp
rw [← h]
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
case h.a.h J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax S : Cone F m : S.pt ⟶ (limitCone F).pt h : ∀ (j : J), m ≫ (limitCone F).π.app j = S.π.app j a : ↑S.pt j : J ⊢ ↑(m a) j = (m ≫ (limitCone F).π.app j) a
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h]
rfl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h]
Mathlib.Topology.Category.TopCat.Limits.Basic.82_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax ⊢ IsLimit (limitConeInfi F)
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by
refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by
Mathlib.Topology.Category.TopCat.Limits.Basic.105_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cone F v : ↑s.pt ⊢ (fun j => (forget.mapCone s).π.app j v) ∈ Functor.sections (F ⋙ forget)
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ ·
dsimp [Functor.sections]
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ ·
Mathlib.Topology.Category.TopCat.Limits.Basic.105_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cone F v : ↑s.pt ⊢ ∀ {j j' : J} (f : j ⟶ j'), forget.map (F.map f) (forget.map (s.π.app j) v) = forget.map (s.π.app j') v
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections]
intro _ _ _
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections]
Mathlib.Topology.Category.TopCat.Limits.Basic.105_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cone F v : ↑s.pt j✝ j'✝ : J f✝ : j✝ ⟶ j'✝ ⊢ forget.map (F.map f✝) (forget.map (s.π.app j✝) v) = forget.map (s.π.app j'✝) v
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _
rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe]
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _
Mathlib.Topology.Category.TopCat.Limits.Basic.105_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cone F v : ↑s.pt j✝ j'✝ : J f✝ : j✝ ⟶ j'✝ ⊢ (((Functor.const J).obj s.pt).map f✝ ≫ s.π.app j'✝) v = (s.π.app j'✝) v
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe]
dsimp
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe]
Mathlib.Topology.Category.TopCat.Limits.Basic.105_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cone F v : ↑s.pt j✝ j'✝ : J f✝ : j✝ ⟶ j'✝ ⊢ (𝟙 s.pt ≫ s.π.app j'✝) v = (s.π.app j'✝) v
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp
rw [Category.id_comp]
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp
Mathlib.Topology.Category.TopCat.Limits.Basic.105_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_2 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cone F ⊢ Continuous fun v => { val := fun j => (forget.mapCone s).π.app j v, property := (_ : (fun j => (forget.mapCone s).π.app j v) ∈ Functor.sections (F ⋙ forget)) }
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] ·
exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _))
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] ·
Mathlib.Topology.Category.TopCat.Limits.Basic.105_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_3 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cone F ⊢ forget.map ((fun s => ContinuousMap.mk fun v => { val := fun j => (forget.mapCone s).π.app j v, property := (_ : (fun j => (forget.mapCone s).π.app j v) ∈ Functor.sections (F ⋙ forget)) }) s) = IsLimit.lift (Types.limitConeIsLimit (F ⋙ forget)) (forget.mapCone s)
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) ·
rfl
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) ·
Mathlib.Topology.Category.TopCat.Limits.Basic.105_0.lEtiPsL1dQihFhl
/-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F)
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax ⊢ IsColimit (colimitCocone F)
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by
refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by
Mathlib.Topology.Category.TopCat.Limits.Basic.166_0.lEtiPsL1dQihFhl
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cocone F ⊢ ∀ (a b : (j : J) × (F ⋙ forget).obj j), Types.Quot.Rel (F ⋙ forget) a b → (fun p => (forget.mapCocone s).ι.app p.fst p.snd) a = (fun p => (forget.mapCocone s).ι.app p.fst p.snd) b
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ ·
intro _ _ ⟨_, h⟩
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ ·
Mathlib.Topology.Category.TopCat.Limits.Basic.166_0.lEtiPsL1dQihFhl
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cocone F a✝ b✝ : (j : J) × (F ⋙ forget).obj j w✝ : a✝.fst ⟶ b✝.fst h : b✝.snd = (F ⋙ forget).map w✝ a✝.snd ⊢ (fun p => (forget.mapCocone s).ι.app p.fst p.snd) a✝ = (fun p => (forget.mapCocone s).ι.app p.fst p.snd) b✝
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩
dsimp
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩
Mathlib.Topology.Category.TopCat.Limits.Basic.166_0.lEtiPsL1dQihFhl
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cocone F a✝ b✝ : (j : J) × (F ⋙ forget).obj j w✝ : a✝.fst ⟶ b✝.fst h : b✝.snd = (F ⋙ forget).map w✝ a✝.snd ⊢ forget.map (s.ι.app a✝.fst) a✝.snd = forget.map (s.ι.app b✝.fst) b✝.snd
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp
rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality]
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp
Mathlib.Topology.Category.TopCat.Limits.Basic.166_0.lEtiPsL1dQihFhl
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cocone F a✝ b✝ : (j : J) × (F ⋙ forget).obj j w✝ : a✝.fst ⟶ b✝.fst h : b✝.snd = (F ⋙ forget).map w✝ a✝.snd ⊢ forget.map (s.ι.app a✝.fst) a✝.snd = forget.map (s.ι.app a✝.fst ≫ ((Functor.const J).obj s.pt).map w✝) a✝.snd
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality]
dsimp
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality]
Mathlib.Topology.Category.TopCat.Limits.Basic.166_0.lEtiPsL1dQihFhl
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_1 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cocone F a✝ b✝ : (j : J) × (F ⋙ forget).obj j w✝ : a✝.fst ⟶ b✝.fst h : b✝.snd = (F ⋙ forget).map w✝ a✝.snd ⊢ forget.map (s.ι.app a✝.fst) a✝.snd = forget.map (s.ι.app a✝.fst ≫ 𝟙 s.pt) a✝.snd
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp
rw [Category.comp_id]
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp
Mathlib.Topology.Category.TopCat.Limits.Basic.166_0.lEtiPsL1dQihFhl
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_2 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cocone F ⊢ Continuous (Quot.lift (fun p => (forget.mapCocone s).ι.app p.fst p.snd) (_ : ∀ (a b : (j : J) × (F ⋙ forget).obj j), Types.Quot.Rel (F ⋙ forget) a b → (fun p => (forget.mapCocone s).ι.app p.fst p.snd) a = (fun p => (forget.mapCocone s).ι.app p.fst p.snd) b))
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp rw [Category.comp_id] ·
exact continuous_iff_le_induced.mpr (iSup_le fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.ι.app j).continuous : _))
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp rw [Category.comp_id] ·
Mathlib.Topology.Category.TopCat.Limits.Basic.166_0.lEtiPsL1dQihFhl
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F)
Mathlib_Topology_Category_TopCat_Limits_Basic
case refine_3 J : Type v inst✝ : SmallCategory J F : J ⥤ TopCatMax s : Cocone F ⊢ forget.map ((fun s => ContinuousMap.mk (Quot.lift (fun p => (forget.mapCocone s).ι.app p.fst p.snd) (_ : ∀ (a b : (j : J) × (F ⋙ forget).obj j), Types.Quot.Rel (F ⋙ forget) a b → (fun p => (forget.mapCocone s).ι.app p.fst p.snd) a = (fun p => (forget.mapCocone s).ι.app p.fst p.snd) b))) s) = IsColimit.desc (Types.colimitCoconeIsColimit (F ⋙ forget)) (forget.mapCocone s)
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp rw [Category.comp_id] · exact continuous_iff_le_induced.mpr (iSup_le fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.ι.app j).continuous : _)) ·
rfl
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp rw [Category.comp_id] · exact continuous_iff_le_induced.mpr (iSup_le fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.ι.app j).continuous : _)) ·
Mathlib.Topology.Category.TopCat.Limits.Basic.166_0.lEtiPsL1dQihFhl
/-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F)
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J X : TopCat ⊢ Continuous fun x => PUnit.unit
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp rw [Category.comp_id] · exact continuous_iff_le_induced.mpr (iSup_le fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.ι.app j).continuous : _)) · rfl #align Top.colimit_cocone_is_colimit TopCat.colimitCoconeIsColimit instance topCat_hasColimitsOfSize : HasColimitsOfSize.{v,v} TopCatMax.{v, u} where has_colimits_of_shape _ := { has_colimit := fun F => HasColimit.mk { cocone := colimitCocone F isColimit := colimitCoconeIsColimit F } } #align Top.Top_has_colimits_of_size TopCat.topCat_hasColimitsOfSize instance topCat_hasColimits : HasColimits TopCat.{u} := TopCat.topCat_hasColimitsOfSize.{u, u} #align Top.Top_has_colimits TopCat.topCat_hasColimits instance forgetPreservesColimitsOfSize : PreservesColimitsOfSize.{v, v} forget where preservesColimitsOfShape := { preservesColimit := fun {F} => preservesColimitOfPreservesColimitCocone (colimitCoconeIsColimit F) (Types.colimitCoconeIsColimit (F ⋙ forget)) } #align Top.forget_preserves_colimits_of_size TopCat.forgetPreservesColimitsOfSize instance forgetPreservesColimits : PreservesColimits (forget : TopCat.{u} ⥤ Type u) := TopCat.forgetPreservesColimitsOfSize.{u, u} #align Top.forget_preserves_colimits TopCat.forgetPreservesColimits /-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1}) := haveI : ∀ X, Unique (X ⟶ TopCat.of PUnit.{u + 1}) := fun X => ⟨⟨⟨fun _ => PUnit.unit, by
continuity
/-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1}) := haveI : ∀ X, Unique (X ⟶ TopCat.of PUnit.{u + 1}) := fun X => ⟨⟨⟨fun _ => PUnit.unit, by
Mathlib.Topology.Category.TopCat.Limits.Basic.213_0.lEtiPsL1dQihFhl
/-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1})
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J X : TopCat f : X ⟶ of PUnit.{u + 1} ⊢ f = default
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp rw [Category.comp_id] · exact continuous_iff_le_induced.mpr (iSup_le fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.ι.app j).continuous : _)) · rfl #align Top.colimit_cocone_is_colimit TopCat.colimitCoconeIsColimit instance topCat_hasColimitsOfSize : HasColimitsOfSize.{v,v} TopCatMax.{v, u} where has_colimits_of_shape _ := { has_colimit := fun F => HasColimit.mk { cocone := colimitCocone F isColimit := colimitCoconeIsColimit F } } #align Top.Top_has_colimits_of_size TopCat.topCat_hasColimitsOfSize instance topCat_hasColimits : HasColimits TopCat.{u} := TopCat.topCat_hasColimitsOfSize.{u, u} #align Top.Top_has_colimits TopCat.topCat_hasColimits instance forgetPreservesColimitsOfSize : PreservesColimitsOfSize.{v, v} forget where preservesColimitsOfShape := { preservesColimit := fun {F} => preservesColimitOfPreservesColimitCocone (colimitCoconeIsColimit F) (Types.colimitCoconeIsColimit (F ⋙ forget)) } #align Top.forget_preserves_colimits_of_size TopCat.forgetPreservesColimitsOfSize instance forgetPreservesColimits : PreservesColimits (forget : TopCat.{u} ⥤ Type u) := TopCat.forgetPreservesColimitsOfSize.{u, u} #align Top.forget_preserves_colimits TopCat.forgetPreservesColimits /-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1}) := haveI : ∀ X, Unique (X ⟶ TopCat.of PUnit.{u + 1}) := fun X => ⟨⟨⟨fun _ => PUnit.unit, by continuity⟩⟩, fun f => by
ext
/-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1}) := haveI : ∀ X, Unique (X ⟶ TopCat.of PUnit.{u + 1}) := fun X => ⟨⟨⟨fun _ => PUnit.unit, by continuity⟩⟩, fun f => by
Mathlib.Topology.Category.TopCat.Limits.Basic.213_0.lEtiPsL1dQihFhl
/-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1})
Mathlib_Topology_Category_TopCat_Limits_Basic
case w J : Type v inst✝ : SmallCategory J X : TopCat f : X ⟶ of PUnit.{u + 1} x✝ : forget.obj X ⊢ f x✝ = default x✝
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp rw [Category.comp_id] · exact continuous_iff_le_induced.mpr (iSup_le fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.ι.app j).continuous : _)) · rfl #align Top.colimit_cocone_is_colimit TopCat.colimitCoconeIsColimit instance topCat_hasColimitsOfSize : HasColimitsOfSize.{v,v} TopCatMax.{v, u} where has_colimits_of_shape _ := { has_colimit := fun F => HasColimit.mk { cocone := colimitCocone F isColimit := colimitCoconeIsColimit F } } #align Top.Top_has_colimits_of_size TopCat.topCat_hasColimitsOfSize instance topCat_hasColimits : HasColimits TopCat.{u} := TopCat.topCat_hasColimitsOfSize.{u, u} #align Top.Top_has_colimits TopCat.topCat_hasColimits instance forgetPreservesColimitsOfSize : PreservesColimitsOfSize.{v, v} forget where preservesColimitsOfShape := { preservesColimit := fun {F} => preservesColimitOfPreservesColimitCocone (colimitCoconeIsColimit F) (Types.colimitCoconeIsColimit (F ⋙ forget)) } #align Top.forget_preserves_colimits_of_size TopCat.forgetPreservesColimitsOfSize instance forgetPreservesColimits : PreservesColimits (forget : TopCat.{u} ⥤ Type u) := TopCat.forgetPreservesColimitsOfSize.{u, u} #align Top.forget_preserves_colimits TopCat.forgetPreservesColimits /-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1}) := haveI : ∀ X, Unique (X ⟶ TopCat.of PUnit.{u + 1}) := fun X => ⟨⟨⟨fun _ => PUnit.unit, by continuity⟩⟩, fun f => by ext;
aesop
/-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1}) := haveI : ∀ X, Unique (X ⟶ TopCat.of PUnit.{u + 1}) := fun X => ⟨⟨⟨fun _ => PUnit.unit, by continuity⟩⟩, fun f => by ext;
Mathlib.Topology.Category.TopCat.Limits.Basic.213_0.lEtiPsL1dQihFhl
/-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1})
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J X : TopCat ⊢ Continuous fun x => PEmpty.elim x
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp rw [Category.comp_id] · exact continuous_iff_le_induced.mpr (iSup_le fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.ι.app j).continuous : _)) · rfl #align Top.colimit_cocone_is_colimit TopCat.colimitCoconeIsColimit instance topCat_hasColimitsOfSize : HasColimitsOfSize.{v,v} TopCatMax.{v, u} where has_colimits_of_shape _ := { has_colimit := fun F => HasColimit.mk { cocone := colimitCocone F isColimit := colimitCoconeIsColimit F } } #align Top.Top_has_colimits_of_size TopCat.topCat_hasColimitsOfSize instance topCat_hasColimits : HasColimits TopCat.{u} := TopCat.topCat_hasColimitsOfSize.{u, u} #align Top.Top_has_colimits TopCat.topCat_hasColimits instance forgetPreservesColimitsOfSize : PreservesColimitsOfSize.{v, v} forget where preservesColimitsOfShape := { preservesColimit := fun {F} => preservesColimitOfPreservesColimitCocone (colimitCoconeIsColimit F) (Types.colimitCoconeIsColimit (F ⋙ forget)) } #align Top.forget_preserves_colimits_of_size TopCat.forgetPreservesColimitsOfSize instance forgetPreservesColimits : PreservesColimits (forget : TopCat.{u} ⥤ Type u) := TopCat.forgetPreservesColimitsOfSize.{u, u} #align Top.forget_preserves_colimits TopCat.forgetPreservesColimits /-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1}) := haveI : ∀ X, Unique (X ⟶ TopCat.of PUnit.{u + 1}) := fun X => ⟨⟨⟨fun _ => PUnit.unit, by continuity⟩⟩, fun f => by ext; aesop⟩ Limits.IsTerminal.ofUnique _ #align Top.is_terminal_punit TopCat.isTerminalPUnit /-- The terminal object of `Top` is `PUnit`. -/ def terminalIsoPUnit : ⊤_ TopCat.{u} ≅ TopCat.of PUnit := terminalIsTerminal.uniqueUpToIso isTerminalPUnit #align Top.terminal_iso_punit TopCat.terminalIsoPUnit /-- The initial object of `Top` is `PEmpty`. -/ def isInitialPEmpty : IsInitial (TopCat.of PEmpty.{u + 1}) := haveI : ∀ X, Unique (TopCat.of PEmpty.{u + 1} ⟶ X) := fun X => ⟨⟨⟨fun x => x.elim, by
continuity
/-- The initial object of `Top` is `PEmpty`. -/ def isInitialPEmpty : IsInitial (TopCat.of PEmpty.{u + 1}) := haveI : ∀ X, Unique (TopCat.of PEmpty.{u + 1} ⟶ X) := fun X => ⟨⟨⟨fun x => x.elim, by
Mathlib.Topology.Category.TopCat.Limits.Basic.225_0.lEtiPsL1dQihFhl
/-- The initial object of `Top` is `PEmpty`. -/ def isInitialPEmpty : IsInitial (TopCat.of PEmpty.{u + 1})
Mathlib_Topology_Category_TopCat_Limits_Basic
J : Type v inst✝ : SmallCategory J X : TopCat f : of PEmpty.{u + 1} ⟶ X ⊢ f = default
/- Copyright (c) 2017 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang -/ import Mathlib.Topology.Category.TopCat.Basic import Mathlib.CategoryTheory.Limits.ConcreteCategory #align_import topology.category.Top.limits.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" /-! # The category of topological spaces has all limits and colimits Further, these limits and colimits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite /-- Universe inequalities in Mathlib 3 are expressed through use of `max u v`. Unfortunately, this leads to unbound universes which cannot be solved for during unification, eg `max u v =?= max v ?`. The current solution is to wrap `Type max u v` in `TypeMax.{u,v}` to expose both universe parameters directly. Similarly, for other concrete categories for which we need to refer to the maximum of two universes (e.g. any category for which we are constructing limits), we need an analogous abbreviation. -/ @[nolint checkUnivs] abbrev TopCatMax.{u, v} := TopCat.{max u v} universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] local notation "forget" => forget TopCat /-- A choice of limit cone for a functor `F : J ⥤ TopCat`. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitCone (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } π := { app := fun j => { toFun := fun u => u.val j -- Porting note: `continuity` from the original mathlib3 proof failed here. continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) } naturality := fun X Y f => by -- Automation fails in various ways in this proof. Why?! dsimp rw [Category.id_comp] apply ContinuousMap.ext intro a exact (a.2 f).symm } #align Top.limit_cone TopCat.limitCone /-- A choice of limit cone for a functor `F : J ⥤ TopCat` whose topology is defined as an infimum of topologies infimum. Generally you should just use `limit.cone F`, unless you need the actual definition (which is in terms of `Types.limitCone`). -/ def limitConeInfi (F : J ⥤ TopCatMax.{v, u}) : Cone F where pt := ⟨(Types.limitCone.{v,u} (F ⋙ forget)).pt, ⨅ j, (F.obj j).str.induced ((Types.limitCone.{v,u} (F ⋙ forget)).π.app j)⟩ π := { app := fun j => ⟨(Types.limitCone.{v,u} (F ⋙ forget)).π.app j, continuous_iff_le_induced.mpr (iInf_le _ _)⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.limitCone.{v,u} (F ⋙ forget)).π.naturality f) } #align Top.limit_cone_infi TopCat.limitConeInfi /-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitCone.{v,u} F) where lift S := { toFun := fun x => ⟨fun j => S.π.app _ x, fun f => by dsimp erw [← S.w f] rfl⟩ continuous_toFun := Continuous.subtype_mk (continuous_pi <| fun j => (S.π.app j).2) fun x i j f => by dsimp rw [← S.w f] rfl } uniq S m h := by apply ContinuousMap.ext; intros a; apply Subtype.ext; funext j dsimp rw [← h] rfl #align Top.limit_cone_is_limit TopCat.limitConeIsLimit /-- The chosen cone `TopCat.limitConeInfi F` for a functor `F : J ⥤ TopCat` is a limit cone. Generally you should just use `limit.isLimit F`, unless you need the actual definition (which is in terms of `Types.limitConeIsLimit`). -/ def limitConeInfiIsLimit (F : J ⥤ TopCatMax.{v, u}) : IsLimit (limitConeInfi.{v,u} F) := by refine IsLimit.ofFaithful forget (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) -- Porting note: previously could infer all ?_ except continuity (fun s => ⟨fun v => ⟨ fun j => (Functor.mapCone forget s).π.app j v, ?_⟩, ?_⟩) fun s => ?_ · dsimp [Functor.sections] intro _ _ _ rw [← comp_apply', forget_map_eq_coe, ← s.π.naturality, forget_map_eq_coe] dsimp rw [Category.id_comp] · exact continuous_iff_coinduced_le.mpr (le_iInf fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.π.app j).continuous : _)) · rfl #align Top.limit_cone_infi_is_limit TopCat.limitConeInfiIsLimit instance topCat_hasLimitsOfSize : HasLimitsOfSize.{v} TopCatMax.{v, u} where has_limits_of_shape _ := { has_limit := fun F => HasLimit.mk { cone := limitCone.{v,u} F isLimit := limitConeIsLimit F } } #align Top.Top_has_limits_of_size TopCat.topCat_hasLimitsOfSize instance topCat_hasLimits : HasLimits TopCat.{u} := TopCat.topCat_hasLimitsOfSize.{u, u} #align Top.Top_has_limits TopCat.topCat_hasLimits instance forgetPreservesLimitsOfSize : PreservesLimitsOfSize forget where preservesLimitsOfShape {_} := { preservesLimit := fun {F} => preservesLimitOfPreservesLimitCone (limitConeIsLimit.{v,u} F) (Types.limitConeIsLimit.{v,u} (F ⋙ forget)) } #align Top.forget_preserves_limits_of_size TopCat.forgetPreservesLimitsOfSize instance forgetPreservesLimits : PreservesLimits forget := TopCat.forgetPreservesLimitsOfSize.{u,u} #align Top.forget_preserves_limits TopCat.forgetPreservesLimits /-- A choice of colimit cocone for a functor `F : J ⥤ TopCat`. Generally you should just use `colimit.cocone F`, unless you need the actual definition (which is in terms of `Types.colimitCocone`). -/ def colimitCocone (F : J ⥤ TopCatMax.{v, u}) : Cocone F where pt := ⟨(Types.colimitCocone.{v,u} (F ⋙ forget)).pt, ⨆ j, (F.obj j).str.coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j)⟩ ι := { app := fun j => ⟨(Types.colimitCocone (F ⋙ forget)).ι.app j, continuous_iff_coinduced_le.mpr <| -- Porting note: didn't need function before le_iSup (fun j => coinduced ((Types.colimitCocone (F ⋙ forget)).ι.app j) (F.obj j).str) j⟩ naturality := fun _ _ f => ContinuousMap.coe_injective ((Types.colimitCocone (F ⋙ forget)).ι.naturality f) } #align Top.colimit_cocone TopCat.colimitCocone /-- The chosen cocone `TopCat.colimitCocone F` for a functor `F : J ⥤ TopCat` is a colimit cocone. Generally you should just use `colimit.isColimit F`, unless you need the actual definition (which is in terms of `Types.colimitCoconeIsColimit`). -/ def colimitCoconeIsColimit (F : J ⥤ TopCatMax.{v, u}) : IsColimit (colimitCocone F) := by refine IsColimit.ofFaithful forget (Types.colimitCoconeIsColimit _) (fun s => -- Porting note: it appears notation for forget breaks dot notation (also above) -- Porting note: previously function was inferred ⟨Quot.lift (fun p => (Functor.mapCocone forget s).ι.app p.fst p.snd) ?_, ?_⟩) fun s => ?_ · intro _ _ ⟨_, h⟩ dsimp rw [h, Functor.comp_map, ← comp_apply', s.ι.naturality] dsimp rw [Category.comp_id] · exact continuous_iff_le_induced.mpr (iSup_le fun j => coinduced_le_iff_le_induced.mp <| (continuous_iff_coinduced_le.mp (s.ι.app j).continuous : _)) · rfl #align Top.colimit_cocone_is_colimit TopCat.colimitCoconeIsColimit instance topCat_hasColimitsOfSize : HasColimitsOfSize.{v,v} TopCatMax.{v, u} where has_colimits_of_shape _ := { has_colimit := fun F => HasColimit.mk { cocone := colimitCocone F isColimit := colimitCoconeIsColimit F } } #align Top.Top_has_colimits_of_size TopCat.topCat_hasColimitsOfSize instance topCat_hasColimits : HasColimits TopCat.{u} := TopCat.topCat_hasColimitsOfSize.{u, u} #align Top.Top_has_colimits TopCat.topCat_hasColimits instance forgetPreservesColimitsOfSize : PreservesColimitsOfSize.{v, v} forget where preservesColimitsOfShape := { preservesColimit := fun {F} => preservesColimitOfPreservesColimitCocone (colimitCoconeIsColimit F) (Types.colimitCoconeIsColimit (F ⋙ forget)) } #align Top.forget_preserves_colimits_of_size TopCat.forgetPreservesColimitsOfSize instance forgetPreservesColimits : PreservesColimits (forget : TopCat.{u} ⥤ Type u) := TopCat.forgetPreservesColimitsOfSize.{u, u} #align Top.forget_preserves_colimits TopCat.forgetPreservesColimits /-- The terminal object of `Top` is `PUnit`. -/ def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1}) := haveI : ∀ X, Unique (X ⟶ TopCat.of PUnit.{u + 1}) := fun X => ⟨⟨⟨fun _ => PUnit.unit, by continuity⟩⟩, fun f => by ext; aesop⟩ Limits.IsTerminal.ofUnique _ #align Top.is_terminal_punit TopCat.isTerminalPUnit /-- The terminal object of `Top` is `PUnit`. -/ def terminalIsoPUnit : ⊤_ TopCat.{u} ≅ TopCat.of PUnit := terminalIsTerminal.uniqueUpToIso isTerminalPUnit #align Top.terminal_iso_punit TopCat.terminalIsoPUnit /-- The initial object of `Top` is `PEmpty`. -/ def isInitialPEmpty : IsInitial (TopCat.of PEmpty.{u + 1}) := haveI : ∀ X, Unique (TopCat.of PEmpty.{u + 1} ⟶ X) := fun X => ⟨⟨⟨fun x => x.elim, by continuity⟩⟩, fun f => by
ext ⟨⟩
/-- The initial object of `Top` is `PEmpty`. -/ def isInitialPEmpty : IsInitial (TopCat.of PEmpty.{u + 1}) := haveI : ∀ X, Unique (TopCat.of PEmpty.{u + 1} ⟶ X) := fun X => ⟨⟨⟨fun x => x.elim, by continuity⟩⟩, fun f => by
Mathlib.Topology.Category.TopCat.Limits.Basic.225_0.lEtiPsL1dQihFhl
/-- The initial object of `Top` is `PEmpty`. -/ def isInitialPEmpty : IsInitial (TopCat.of PEmpty.{u + 1})
Mathlib_Topology_Category_TopCat_Limits_Basic
B : Type u inst✝ : Quiver B a b : B f g : Discrete (Path a b) η : f ⟶ g ⊢ PrelaxFunctor.map₂ (preinclusion B) η = eqToHom (_ : (↑(preinclusion B)).map f = (↑(preinclusion B)).map g)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by
rcases η with ⟨⟨⟩⟩
@[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by
Mathlib.CategoryTheory.Bicategory.Coherence.93_0.scNCB7gGNV3iY0Z
@[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η)))
Mathlib_CategoryTheory_Bicategory_Coherence
case up.up B : Type u inst✝ : Quiver B a b : B f g : Discrete (Path a b) down✝ : f.as = g.as ⊢ PrelaxFunctor.map₂ (preinclusion B) { down := { down := down✝ } } = eqToHom (_ : (↑(preinclusion B)).map f = (↑(preinclusion B)).map g)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩
cases Discrete.ext _ _ (by assumption)
@[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩
Mathlib.CategoryTheory.Bicategory.Coherence.93_0.scNCB7gGNV3iY0Z
@[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η)))
Mathlib_CategoryTheory_Bicategory_Coherence
B : Type u inst✝ : Quiver B a b : B f g : Discrete (Path a b) down✝ : f.as = g.as ⊢ ?m.4739.as = ?m.4740.as
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by
assumption
@[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by
Mathlib.CategoryTheory.Bicategory.Coherence.93_0.scNCB7gGNV3iY0Z
@[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η)))
Mathlib_CategoryTheory_Bicategory_Coherence
case up.up.refl B : Type u inst✝ : Quiver B a b : B f : Discrete (Path a b) down✝ : f.as = f.as ⊢ PrelaxFunctor.map₂ (preinclusion B) { down := { down := down✝ } } = eqToHom (_ : (↑(preinclusion B)).map f = (↑(preinclusion B)).map f)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption)
convert (inclusionPath a b).map_id _
@[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption)
Mathlib.CategoryTheory.Bicategory.Coherence.93_0.scNCB7gGNV3iY0Z
@[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η)))
Mathlib_CategoryTheory_Bicategory_Coherence
B : Type u inst✝ : Quiver B a b c : B p : Path a b f g : Hom b c η : f ⟶ g ⊢ normalizeAux p f = normalizeAux p g
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by
rcases η with ⟨η'⟩
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk B : Type u inst✝ : Quiver B a b c : B p : Path a b f g : Hom b c η : f ⟶ g η' : Hom₂ f g ⊢ normalizeAux p f = normalizeAux p g
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩
apply @congr_fun _ _ fun p => normalizeAux p f
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h B : Type u inst✝ : Quiver B a b c : B p : Path a b f g : Hom b c η : f ⟶ g η' : Hom₂ f g ⊢ (fun p => normalizeAux p f) = fun p => normalizeAux p g
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f
clear p η
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h B : Type u inst✝ : Quiver B a b c : B f g : Hom b c η' : Hom₂ f g ⊢ (fun p => normalizeAux p f) = fun p => normalizeAux p g
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η
induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ => funext; rfl
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h B : Type u inst✝ : Quiver B a b c : B f g : Hom b c η' : Hom₂ f g ⊢ (fun p => normalizeAux p f) = fun p => normalizeAux p g
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η
induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ => funext; rfl
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.vcomp B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ : FreeBicategory B f✝ g✝ h✝ : a✝ ⟶ b✝ η✝ : Hom₂ f✝ g✝ θ✝ : Hom₂ g✝ h✝ η_ih✝ : (fun p => normalizeAux p f✝) = fun p => normalizeAux p g✝ θ_ih✝ : (fun p => normalizeAux p g✝) = fun p => normalizeAux p h✝ ⊢ (fun p => normalizeAux p f✝) = fun p => normalizeAux p h✝
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with
| vcomp _ _ _ _ => apply Eq.trans <;> assumption
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.vcomp B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ : FreeBicategory B f✝ g✝ h✝ : a✝ ⟶ b✝ η✝ : Hom₂ f✝ g✝ θ✝ : Hom₂ g✝ h✝ η_ih✝ : (fun p => normalizeAux p f✝) = fun p => normalizeAux p g✝ θ_ih✝ : (fun p => normalizeAux p g✝) = fun p => normalizeAux p h✝ ⊢ (fun p => normalizeAux p f✝) = fun p => normalizeAux p h✝
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ =>
apply Eq.trans
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ =>
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.vcomp.h₁ B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ : FreeBicategory B f✝ g✝ h✝ : a✝ ⟶ b✝ η✝ : Hom₂ f✝ g✝ θ✝ : Hom₂ g✝ h✝ η_ih✝ : (fun p => normalizeAux p f✝) = fun p => normalizeAux p g✝ θ_ih✝ : (fun p => normalizeAux p g✝) = fun p => normalizeAux p h✝ ⊢ (fun p => normalizeAux p f✝) = ?mk.h.vcomp.b
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;>
assumption
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;>
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.vcomp.h₂ B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ : FreeBicategory B f✝ g✝ h✝ : a✝ ⟶ b✝ η✝ : Hom₂ f✝ g✝ θ✝ : Hom₂ g✝ h✝ η_ih✝ : (fun p => normalizeAux p f✝) = fun p => normalizeAux p g✝ θ_ih✝ : (fun p => normalizeAux p g✝) = fun p => normalizeAux p h✝ ⊢ (fun p => normalizeAux p g✝) = fun p => normalizeAux p h✝
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;>
assumption
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;>
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.whisker_left B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ c✝ : FreeBicategory B f✝ : a✝ ⟶ b✝ g✝ h✝ : b✝ ⟶ c✝ η✝ : Hom₂ g✝ h✝ ih : (fun p => normalizeAux p g✝) = fun p => normalizeAux p h✝ ⊢ (fun p => normalizeAux p (f✝ ≫ g✝)) = fun p => normalizeAux p (f✝ ≫ h✝)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption
| whisker_left _ _ ih => funext; apply congr_fun ih
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.whisker_left B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ c✝ : FreeBicategory B f✝ : a✝ ⟶ b✝ g✝ h✝ : b✝ ⟶ c✝ η✝ : Hom₂ g✝ h✝ ih : (fun p => normalizeAux p g✝) = fun p => normalizeAux p h✝ ⊢ (fun p => normalizeAux p (f✝ ≫ g✝)) = fun p => normalizeAux p (f✝ ≫ h✝)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih =>
funext
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih =>
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.whisker_left.h B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ c✝ : FreeBicategory B f✝ : a✝ ⟶ b✝ g✝ h✝ : b✝ ⟶ c✝ η✝ : Hom₂ g✝ h✝ ih : (fun p => normalizeAux p g✝) = fun p => normalizeAux p h✝ x✝ : Path a a✝ ⊢ normalizeAux x✝ (f✝ ≫ g✝) = normalizeAux x✝ (f✝ ≫ h✝)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext;
apply congr_fun ih
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext;
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.whisker_right B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ c✝ : FreeBicategory B f✝ g✝ : a✝ ⟶ b✝ h✝ : b✝ ⟶ c✝ η✝ : Hom₂ f✝ g✝ ih : (fun p => normalizeAux p f✝) = fun p => normalizeAux p g✝ ⊢ (fun p => normalizeAux p (Hom.comp f✝ h✝)) = fun p => normalizeAux p (Hom.comp g✝ h✝)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih
| whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.whisker_right B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ c✝ : FreeBicategory B f✝ g✝ : a✝ ⟶ b✝ h✝ : b✝ ⟶ c✝ η✝ : Hom₂ f✝ g✝ ih : (fun p => normalizeAux p f✝) = fun p => normalizeAux p g✝ ⊢ (fun p => normalizeAux p (Hom.comp f✝ h✝)) = fun p => normalizeAux p (Hom.comp g✝ h✝)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih =>
funext
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih =>
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.whisker_right.h B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ c✝ : FreeBicategory B f✝ g✝ : a✝ ⟶ b✝ h✝ : b✝ ⟶ c✝ η✝ : Hom₂ f✝ g✝ ih : (fun p => normalizeAux p f✝) = fun p => normalizeAux p g✝ x✝ : Path a a✝ ⊢ normalizeAux x✝ (Hom.comp f✝ h✝) = normalizeAux x✝ (Hom.comp g✝ h✝)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext;
apply congr_arg₂ _ (congr_fun ih _) rfl
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext;
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.id B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ : FreeBicategory B f✝ : a✝ ⟶ b✝ ⊢ (fun p => normalizeAux p f✝) = fun p => normalizeAux p f✝
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl
| _ => funext; rfl
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.id B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ : FreeBicategory B f✝ : a✝ ⟶ b✝ ⊢ (fun p => normalizeAux p f✝) = fun p => normalizeAux p f✝
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ =>
funext
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ =>
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.id.h B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ : FreeBicategory B f✝ : a✝ ⟶ b✝ x✝ : Path a a✝ ⊢ normalizeAux x✝ f✝ = normalizeAux x✝ f✝
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ => funext;
rfl
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ => funext;
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.associator B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ c✝ d✝ : FreeBicategory B f✝ : a✝ ⟶ b✝ g✝ : b✝ ⟶ c✝ h✝ : c✝ ⟶ d✝ ⊢ (fun p => normalizeAux p ((f✝ ≫ g✝) ≫ h✝)) = fun p => normalizeAux p (f✝ ≫ g✝ ≫ h✝)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl
| _ => funext; rfl
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.associator B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ c✝ d✝ : FreeBicategory B f✝ : a✝ ⟶ b✝ g✝ : b✝ ⟶ c✝ h✝ : c✝ ⟶ d✝ ⊢ (fun p => normalizeAux p ((f✝ ≫ g✝) ≫ h✝)) = fun p => normalizeAux p (f✝ ≫ g✝ ≫ h✝)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ =>
funext
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ =>
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence
case mk.h.associator.h B : Type u inst✝ : Quiver B a b c : B f g : Hom b c a✝ b✝ c✝ d✝ : FreeBicategory B f✝ : a✝ ⟶ b✝ g✝ : b✝ ⟶ c✝ h✝ : c✝ ⟶ d✝ x✝ : Path a a✝ ⊢ normalizeAux x✝ ((f✝ ≫ g✝) ≫ h✝) = normalizeAux x✝ (f✝ ≫ g✝ ≫ h✝)
/- Copyright (c) 2022 Yuma Mizuno. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yuma Mizuno, Junyan Xu -/ import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" /-! # The coherence theorem for bicategories In this file, we prove the coherence theorem for bicategories, stated in the following form: the free bicategory over any quiver is locally thin. The proof is almost the same as the proof of the coherence theorem for monoidal categories that has been previously formalized in mathlib, which is based on the proof described by Ilya Beylin and Peter Dybjer. The idea is to view a path on a quiver as a normal form of a 1-morphism in the free bicategory on the same quiver. A normalization procedure is then described by `normalize : Pseudofunctor (FreeBicategory B) (LocallyDiscrete (Paths B))`, which is a pseudofunctor from the free bicategory to the locally discrete bicategory on the path category. It turns out that this pseudofunctor is locally an equivalence of categories, and the coherence theorem follows immediately from this fact. ## Main statements * `locally_thin` : the free bicategory is locally thin, that is, there is at most one 2-morphism between two fixed 1-morphisms. ## References * [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a proof of normalization for monoids][beylin1996] -/ open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] /-- Auxiliary definition for `inclusionPath`. -/ @[simp] def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux /- Porting note: Since the following instance was removed when porting `CategoryTheory.Bicategory.Free`, we add it locally here. -/ /-- Category structure on `Hom a b`. In this file, we will use `Hom a b` for `a b : B` (precisely, `FreeBicategory.Hom a b`) instead of the definitionally equal expression `a ⟶ b` for `a b : FreeBicategory B`. The main reason is that we have to annoyingly write `@Quiver.Hom (FreeBicategory B) _ a b` to get the latter expression when given `a b : B`. -/ local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b /-- The discrete category on the paths includes into the category of 1-morphisms in the free bicategory. -/ def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath /-- The inclusion from the locally discrete bicategory on the path category into the free bicategory as a prelax functor. This will be promoted to a pseudofunctor after proving the coherence theorem. See `inclusion`. -/ def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj := id map := @fun a b => (@inclusionPath B _ a b).obj map₂ η := (inclusionPath _ _).map η #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj a = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp] theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) : (preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _ #align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂ /-- The normalization of the composition of `p : Path a b` and `f : Hom b c`. `p` will eventually be taken to be `nil` and we then get the normalization of `f` alone, but the auxiliary `p` is necessary for Lean to accept the definition of `normalizeIso` and the `whisker_left` case of `normalizeAux_congr` and `normalize_naturality`. -/ @[simp] def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c | _, _, p, Hom.of f => p.cons f | _, _, p, Hom.id _ => p | _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g #align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux /- We may define ``` def normalizeAux' : ∀ {a b : B}, Hom a b → Path a b | _, _, (Hom.of f) => f.toPath | _, _, (Hom.id b) => nil | _, _, (Hom.comp f g) => (normalizeAux' f).comp (normalizeAux' g) ``` and define `normalizeAux p f` to be `p.comp (normalizeAux' f)` and this will be equal to the above definition, but the equality proof requires `comp_assoc`, and it thus lacks the correct definitional property to make the definition of `normalizeIso` typecheck. ``` example {a b c : B} (p : Path a b) (f : Hom b c) : normalizeAux p f = p.comp (normalizeAux' f) := by induction f; rfl; rfl; case comp _ _ _ _ _ ihf ihg => rw [normalizeAux, ihf, ihg]; apply comp_assoc ``` -/ /-- A 2-isomorphism between a partially-normalized 1-morphism in the free bicategory to the fully-normalized 1-morphism. -/ @[simp] def normalizeIso {a : B} : ∀ {b c : B} (p : Path a b) (f : Hom b c), (preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩ | _, _, _, Hom.of _ => Iso.refl _ | _, _, _, Hom.id b => ρ_ _ | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g #align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ => funext;
rfl
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g := by rcases η with ⟨η'⟩ apply @congr_fun _ _ fun p => normalizeAux p f clear p η induction η' with | vcomp _ _ _ _ => apply Eq.trans <;> assumption | whisker_left _ _ ih => funext; apply congr_fun ih | whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl | _ => funext;
Mathlib.CategoryTheory.Bicategory.Coherence.145_0.scNCB7gGNV3iY0Z
/-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) : normalizeAux p f = normalizeAux p g
Mathlib_CategoryTheory_Bicategory_Coherence