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
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M →[L] N s : Substructure L M hs : CG s t : Set M ht : Set.Countable t ∧ LowerAdjoint.toFun (closure L) t = s ⊢ LowerAdjoint.toFun (closure L) (⇑f '' t) = Substructure.map f s
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by
rw [closure_image, ht.2]
theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by
Mathlib.ModelTheory.FinitelyGenerated.156_0.mkqJR9tOk3JtWTX
theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M hs : CG (Substructure.map (Embedding.toHom f) s) ⊢ CG s
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by
rcases hs with ⟨t, h1, h2⟩
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M t : Set N h1 : Set.Countable t h2 : LowerAdjoint.toFun (closure L) t = Substructure.map (Embedding.toHom f) s ⊢ CG s
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩
rw [cg_def]
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M t : Set N h1 : Set.Countable t h2 : LowerAdjoint.toFun (closure L) t = Substructure.map (Embedding.toHom f) s ⊢ ∃ S, Set.Countable S ∧ LowerAdjoint.toFun (closure L) S = s
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def]
refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def]
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M t : Set N h1 : Set.Countable t h2 : LowerAdjoint.toFun (closure L) t = Substructure.map (Embedding.toHom f) s ⊢ LowerAdjoint.toFun (closure L) (⇑f ⁻¹' t) = s
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩
have hf : Function.Injective f.toHom := f.injective
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M t : Set N h1 : Set.Countable t h2 : LowerAdjoint.toFun (closure L) t = Substructure.map (Embedding.toHom f) s hf : Function.Injective ⇑(Embedding.toHom f) ⊢ LowerAdjoint.toFun (closure L) (⇑f ⁻¹' t) = s
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective
refine' map_injective_of_injective hf _
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M t : Set N h1 : Set.Countable t h2 : LowerAdjoint.toFun (closure L) t = Substructure.map (Embedding.toHom f) s hf : Function.Injective ⇑(Embedding.toHom f) ⊢ Substructure.map (Embedding.toHom f) (LowerAdjoint.toFun (closure L) (⇑f ⁻¹' t)) = Substructure.map (Embedding.toHom f) s
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _
rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset]
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M t : Set N h1 : Set.Countable t h2 : LowerAdjoint.toFun (closure L) t = Substructure.map (Embedding.toHom f) s hf : Function.Injective ⇑(Embedding.toHom f) ⊢ t ⊆ range ⇑f
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset]
intro x hx
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset]
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M t : Set N h1 : Set.Countable t h2 : LowerAdjoint.toFun (closure L) t = Substructure.map (Embedding.toHom f) s hf : Function.Injective ⇑(Embedding.toHom f) x : N hx : x ∈ t ⊢ x ∈ range ⇑f
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx
have h' := subset_closure (L := L) hx
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M t : Set N h1 : Set.Countable t h2 : LowerAdjoint.toFun (closure L) t = Substructure.map (Embedding.toHom f) s hf : Function.Injective ⇑(Embedding.toHom f) x : N hx : x ∈ t h' : x ∈ ↑(LowerAdjoint.toFun (closure L) t) ⊢ x ∈ range ⇑f
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx
rw [h2] at h'
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N f : M ↪[L] N s : Substructure L M t : Set N h1 : Set.Countable t h2 : LowerAdjoint.toFun (closure L) t = Substructure.map (Embedding.toHom f) s hf : Function.Injective ⇑(Embedding.toHom f) x : N hx : x ∈ t h' : x ∈ ↑(Substructure.map (Embedding.toHom f) s) ⊢ x ∈ range ⇑f
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h'
exact Hom.map_le_range h'
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h'
Mathlib.ModelTheory.FinitelyGenerated.162_0.mkqJR9tOk3JtWTX
theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M inst✝ : Countable ((l : ℕ) × Functions L l) s : Substructure L M ⊢ CG s ↔ Countable ↥s
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by
refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩
theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by
Mathlib.ModelTheory.FinitelyGenerated.176_0.mkqJR9tOk3JtWTX
theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M inst✝ : Countable ((l : ℕ) × Functions L l) s : Substructure L M ⊢ CG s → Countable ↥s
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩
rintro ⟨s, h, rfl⟩
theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩
Mathlib.ModelTheory.FinitelyGenerated.176_0.mkqJR9tOk3JtWTX
theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s
Mathlib_ModelTheory_FinitelyGenerated
case intro.intro L : Language M : Type u_1 inst✝¹ : Structure L M inst✝ : Countable ((l : ℕ) × Functions L l) s : Set M h : Set.Countable s ⊢ Countable ↥(LowerAdjoint.toFun (closure L) s)
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩
exact h.substructure_closure L
theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩
Mathlib.ModelTheory.FinitelyGenerated.176_0.mkqJR9tOk3JtWTX
theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝ : Structure L M ⊢ FG L M ↔ ∃ S, Set.Finite S ∧ LowerAdjoint.toFun (closure L) S = ⊤
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by
rw [fg_def, Substructure.fg_def]
/-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by
Mathlib.ModelTheory.FinitelyGenerated.209_0.mkqJR9tOk3JtWTX
/-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M)
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : FG L M f : M →[L] N ⊢ Substructure.FG (Hom.range f)
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by
rw [Hom.range_eq_map]
theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by
Mathlib.ModelTheory.FinitelyGenerated.214_0.mkqJR9tOk3JtWTX
theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : FG L M f : M →[L] N ⊢ Substructure.FG (map f ⊤)
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map]
exact (fg_def.1 h).map f
theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map]
Mathlib.ModelTheory.FinitelyGenerated.214_0.mkqJR9tOk3JtWTX
theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : FG L M f : M →[L] N hs : Function.Surjective ⇑f ⊢ FG L N
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by
rw [← Hom.range_eq_top] at hs
theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by
Mathlib.ModelTheory.FinitelyGenerated.219_0.mkqJR9tOk3JtWTX
theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : FG L M f : M →[L] N hs : Hom.range f = ⊤ ⊢ FG L N
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs
rw [fg_def, ← hs]
theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs
Mathlib.ModelTheory.FinitelyGenerated.219_0.mkqJR9tOk3JtWTX
theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : FG L M f : M →[L] N hs : Hom.range f = ⊤ ⊢ Substructure.FG (Hom.range f)
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs]
exact h.range f
theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs]
Mathlib.ModelTheory.FinitelyGenerated.219_0.mkqJR9tOk3JtWTX
theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝ : Structure L M ⊢ CG L M ↔ ∃ S, Set.Countable S ∧ LowerAdjoint.toFun (closure L) S = ⊤
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by
rw [cg_def, Substructure.cg_def]
/-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by
Mathlib.ModelTheory.FinitelyGenerated.230_0.mkqJR9tOk3JtWTX
/-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M)
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : CG L M f : M →[L] N ⊢ Substructure.CG (Hom.range f)
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by
rw [Hom.range_eq_map]
theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by
Mathlib.ModelTheory.FinitelyGenerated.235_0.mkqJR9tOk3JtWTX
theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : CG L M f : M →[L] N ⊢ Substructure.CG (map f ⊤)
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map]
exact (cg_def.1 h).map f
theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map]
Mathlib.ModelTheory.FinitelyGenerated.235_0.mkqJR9tOk3JtWTX
theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : CG L M f : M →[L] N hs : Function.Surjective ⇑f ⊢ CG L N
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by
rw [← Hom.range_eq_top] at hs
theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by
Mathlib.ModelTheory.FinitelyGenerated.240_0.mkqJR9tOk3JtWTX
theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : CG L M f : M →[L] N hs : Hom.range f = ⊤ ⊢ CG L N
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs
rw [cg_def, ← hs]
theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs
Mathlib.ModelTheory.FinitelyGenerated.240_0.mkqJR9tOk3JtWTX
theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M N : Type u_2 inst✝ : Structure L N h : CG L M f : M →[L] N hs : Hom.range f = ⊤ ⊢ Substructure.CG (Hom.range f)
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs]
exact h.range f
theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs]
Mathlib.ModelTheory.FinitelyGenerated.240_0.mkqJR9tOk3JtWTX
theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝¹ : Structure L M inst✝ : Countable ((l : ℕ) × Functions L l) ⊢ CG L M ↔ Countable M
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by
rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff]
theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by
Mathlib.ModelTheory.FinitelyGenerated.247_0.mkqJR9tOk3JtWTX
theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M ⊢ FG S ↔ Structure.FG L ↥S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by
rw [Structure.fg_def]
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by
Mathlib.ModelTheory.FinitelyGenerated.267_0.mkqJR9tOk3JtWTX
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M ⊢ FG S ↔ FG ⊤
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def]
refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def]
Mathlib.ModelTheory.FinitelyGenerated.267_0.mkqJR9tOk3JtWTX
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_1 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h : FG S ⊢ FG (map (Embedding.toHom (subtype S)) ⊤)
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ ·
rw [← Hom.range_eq_map, range_subtype]
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ ·
Mathlib.ModelTheory.FinitelyGenerated.267_0.mkqJR9tOk3JtWTX
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_1 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h : FG S ⊢ FG S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype]
exact h
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype]
Mathlib.ModelTheory.FinitelyGenerated.267_0.mkqJR9tOk3JtWTX
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_2 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h : FG ⊤ ⊢ FG S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h ·
have h := h.map S.subtype.toHom
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h ·
Mathlib.ModelTheory.FinitelyGenerated.267_0.mkqJR9tOk3JtWTX
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_2 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h✝ : FG ⊤ h : FG (map (Embedding.toHom (subtype S)) ⊤) ⊢ FG S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom
rw [← Hom.range_eq_map, range_subtype] at h
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom
Mathlib.ModelTheory.FinitelyGenerated.267_0.mkqJR9tOk3JtWTX
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_2 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h✝ : FG ⊤ h : FG S ⊢ FG S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h
exact h
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h
Mathlib.ModelTheory.FinitelyGenerated.267_0.mkqJR9tOk3JtWTX
theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M ⊢ CG S ↔ Structure.CG L ↥S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h exact h set_option linter.uppercaseLean3 false in #align first_order.language.substructure.fg_iff_Structure_fg FirstOrder.Language.Substructure.fg_iff_structure_fg theorem Equiv.cg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.CG L M ↔ Structure.CG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.cg_iff FirstOrder.Language.Equiv.cg_iff theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by
rw [Structure.cg_def]
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by
Mathlib.ModelTheory.FinitelyGenerated.284_0.mkqJR9tOk3JtWTX
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S
Mathlib_ModelTheory_FinitelyGenerated
L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M ⊢ CG S ↔ CG ⊤
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h exact h set_option linter.uppercaseLean3 false in #align first_order.language.substructure.fg_iff_Structure_fg FirstOrder.Language.Substructure.fg_iff_structure_fg theorem Equiv.cg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.CG L M ↔ Structure.CG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.cg_iff FirstOrder.Language.Equiv.cg_iff theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def]
refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def]
Mathlib.ModelTheory.FinitelyGenerated.284_0.mkqJR9tOk3JtWTX
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_1 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h : CG S ⊢ CG (map (Embedding.toHom (subtype S)) ⊤)
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h exact h set_option linter.uppercaseLean3 false in #align first_order.language.substructure.fg_iff_Structure_fg FirstOrder.Language.Substructure.fg_iff_structure_fg theorem Equiv.cg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.CG L M ↔ Structure.CG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.cg_iff FirstOrder.Language.Equiv.cg_iff theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ ·
rw [← Hom.range_eq_map, range_subtype]
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ ·
Mathlib.ModelTheory.FinitelyGenerated.284_0.mkqJR9tOk3JtWTX
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_1 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h : CG S ⊢ CG S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h exact h set_option linter.uppercaseLean3 false in #align first_order.language.substructure.fg_iff_Structure_fg FirstOrder.Language.Substructure.fg_iff_structure_fg theorem Equiv.cg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.CG L M ↔ Structure.CG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.cg_iff FirstOrder.Language.Equiv.cg_iff theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype]
exact h
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype]
Mathlib.ModelTheory.FinitelyGenerated.284_0.mkqJR9tOk3JtWTX
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_2 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h : CG ⊤ ⊢ CG S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h exact h set_option linter.uppercaseLean3 false in #align first_order.language.substructure.fg_iff_Structure_fg FirstOrder.Language.Substructure.fg_iff_structure_fg theorem Equiv.cg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.CG L M ↔ Structure.CG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.cg_iff FirstOrder.Language.Equiv.cg_iff theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h ·
have h := h.map S.subtype.toHom
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h ·
Mathlib.ModelTheory.FinitelyGenerated.284_0.mkqJR9tOk3JtWTX
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_2 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h✝ : CG ⊤ h : CG (map (Embedding.toHom (subtype S)) ⊤) ⊢ CG S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h exact h set_option linter.uppercaseLean3 false in #align first_order.language.substructure.fg_iff_Structure_fg FirstOrder.Language.Substructure.fg_iff_structure_fg theorem Equiv.cg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.CG L M ↔ Structure.CG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.cg_iff FirstOrder.Language.Equiv.cg_iff theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom
rw [← Hom.range_eq_map, range_subtype] at h
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom
Mathlib.ModelTheory.FinitelyGenerated.284_0.mkqJR9tOk3JtWTX
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S
Mathlib_ModelTheory_FinitelyGenerated
case refine'_2 L : Language M : Type u_1 inst✝ : Structure L M S : Substructure L M h✝ : CG ⊤ h : CG S ⊢ CG S
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Substructures #align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" /-! # Finitely Generated First-Order Structures This file defines what it means for a first-order (sub)structure to be finitely or countably generated, similarly to other finitely-generated objects in the algebra library. ## Main Definitions * `FirstOrder.Language.Substructure.FG` indicates that a substructure is finitely generated. * `FirstOrder.Language.Structure.FG` indicates that a structure is finitely generated. * `FirstOrder.Language.Substructure.CG` indicates that a substructure is countably generated. * `FirstOrder.Language.Structure.CG` indicates that a structure is countably generated. ## TODO Develop a more unified definition of finite generation using the theory of closure operators, or use this definition of finite generation to define the others. -/ open FirstOrder Set namespace FirstOrder namespace Language open Structure variable {L : Language} {M : Type*} [L.Structure M] namespace Substructure /-- A substructure of `M` is finitely generated if it is the closure of a finite subset of `M`. -/ def FG (N : L.Substructure M) : Prop := ∃ S : Finset M, closure L S = N #align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N := ⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by rintro ⟨t', h, rfl⟩ rcases Finite.exists_finset_coe h with ⟨t, rfl⟩ exact ⟨t, rfl⟩⟩ #align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} : N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by rw [fg_def] constructor · rintro ⟨S, Sfin, hS⟩ obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding exact ⟨n, f, hS⟩ · rintro ⟨n, s, hs⟩ refine' ⟨range s, finite_range s, hs⟩ #align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family theorem fg_bot : (⊥ : L.Substructure M).FG := ⟨∅, by rw [Finset.coe_empty, closure_empty]⟩ #align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) := ⟨hs.toFinset, by rw [hs.coe_toFinset]⟩ #align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) := fg_closure (finite_singleton x) #align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG := let ⟨t₁, ht₁⟩ := fg_def.1 hN₁ let ⟨t₂, ht₂⟩ := fg_def.1 hN₂ fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) : (s.map f).FG := let ⟨t, ht⟩ := fg_def.1 hs fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).FG) : s.FG := by rcases hs with ⟨t, h⟩ rw [fg_def] refine' ⟨f ⁻¹' t, t.finite_toSet.preimage (f.injective.injOn _), _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h] at h' exact Hom.map_le_range h' #align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding /-- A substructure of `M` is countably generated if it is the closure of a countable subset of `M`. -/ def CG (N : L.Substructure M) : Prop := ∃ S : Set M, S.Countable ∧ closure L S = N #align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N := Iff.refl _ #align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by obtain ⟨s, hf, rfl⟩ := fg_def.1 h refine' ⟨s, hf.countable, rfl⟩ #align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} : N.CG ↔ N = (∅ : Set M) ∨ ∃ s : ℕ → M, closure L (range s) = N := by rw [cg_def] constructor · rintro ⟨S, Scount, hS⟩ rcases eq_empty_or_nonempty (N : Set M) with h | h · exact Or.intro_left _ h obtain ⟨f, h'⟩ := (Scount.union (Set.countable_singleton h.some)).exists_eq_range (singleton_nonempty h.some).inr refine' Or.intro_right _ ⟨f, _⟩ rw [← h', closure_union, hS, sup_eq_left, closure_le] exact singleton_subset_iff.2 h.some_mem · intro h cases' h with h h · refine' ⟨∅, countable_empty, closure_eq_of_le (empty_subset _) _⟩ rw [← SetLike.coe_subset_coe, h] exact empty_subset _ · obtain ⟨f, rfl⟩ := h exact ⟨range f, countable_range _, rfl⟩ #align first_order.language.substructure.cg_iff_empty_or_exists_nat_generating_family FirstOrder.Language.Substructure.cg_iff_empty_or_exists_nat_generating_family theorem cg_bot : (⊥ : L.Substructure M).CG := fg_bot.cg #align first_order.language.substructure.cg_bot FirstOrder.Language.Substructure.cg_bot theorem cg_closure {s : Set M} (hs : s.Countable) : CG (closure L s) := ⟨s, hs, rfl⟩ #align first_order.language.substructure.cg_closure FirstOrder.Language.Substructure.cg_closure theorem cg_closure_singleton (x : M) : CG (closure L ({x} : Set M)) := (fg_closure_singleton x).cg #align first_order.language.substructure.cg_closure_singleton FirstOrder.Language.Substructure.cg_closure_singleton theorem CG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.CG) (hN₂ : N₂.CG) : (N₁ ⊔ N₂).CG := let ⟨t₁, ht₁⟩ := cg_def.1 hN₁ let ⟨t₂, ht₂⟩ := cg_def.1 hN₂ cg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩ #align first_order.language.substructure.cg.sup FirstOrder.Language.Substructure.CG.sup theorem CG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.CG) : (s.map f).CG := let ⟨t, ht⟩ := cg_def.1 hs cg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩ #align first_order.language.substructure.cg.map FirstOrder.Language.Substructure.CG.map theorem CG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M} (hs : (s.map f.toHom).CG) : s.CG := by rcases hs with ⟨t, h1, h2⟩ rw [cg_def] refine' ⟨f ⁻¹' t, h1.preimage f.injective, _⟩ have hf : Function.Injective f.toHom := f.injective refine' map_injective_of_injective hf _ rw [← h2, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset] intro x hx have h' := subset_closure (L := L) hx rw [h2] at h' exact Hom.map_le_range h' #align first_order.language.substructure.cg.of_map_embedding FirstOrder.Language.Substructure.CG.of_map_embedding theorem cg_iff_countable [Countable (Σl, L.Functions l)] {s : L.Substructure M} : s.CG ↔ Countable s := by refine' ⟨_, fun h => ⟨s, h.to_set, s.closure_eq⟩⟩ rintro ⟨s, h, rfl⟩ exact h.substructure_closure L #align first_order.language.substructure.cg_iff_countable FirstOrder.Language.Substructure.cg_iff_countable end Substructure open Substructure namespace Structure set_option linter.uppercaseLean3 false variable (L) (M) /-- A structure is finitely generated if it is the closure of a finite subset. -/ class FG : Prop where out : (⊤ : L.Substructure M).FG #align first_order.language.Structure.fg FirstOrder.Language.Structure.FG /-- A structure is countably generated if it is the closure of a countable subset. -/ class CG : Prop where out : (⊤ : L.Substructure M).CG #align first_order.language.Structure.cg FirstOrder.Language.Structure.CG variable {L M} theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.fg_def FirstOrder.Language.Structure.fg_def /-- An equivalent expression of `Structure.FG` in terms of `Set.Finite` instead of `Finset`. -/ theorem fg_iff : FG L M ↔ ∃ S : Set M, S.Finite ∧ closure L S = (⊤ : L.Substructure M) := by rw [fg_def, Substructure.fg_def] #align first_order.language.Structure.fg_iff FirstOrder.Language.Structure.fg_iff theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG := by rw [Hom.range_eq_map] exact (fg_def.1 h).map f #align first_order.language.Structure.fg.range FirstOrder.Language.Structure.FG.range theorem FG.map_of_surjective {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) (hs : Function.Surjective f) : FG L N := by rw [← Hom.range_eq_top] at hs rw [fg_def, ← hs] exact h.range f #align first_order.language.Structure.fg.map_of_surjective FirstOrder.Language.Structure.FG.map_of_surjective theorem cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align first_order.language.Structure.cg_def FirstOrder.Language.Structure.cg_def /-- An equivalent expression of `Structure.cg`. -/ theorem cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def] #align first_order.language.Structure.cg_iff FirstOrder.Language.Structure.cg_iff theorem CG.range {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) : f.range.CG := by rw [Hom.range_eq_map] exact (cg_def.1 h).map f #align first_order.language.Structure.cg.range FirstOrder.Language.Structure.CG.range theorem CG.map_of_surjective {N : Type*} [L.Structure N] (h : CG L M) (f : M →[L] N) (hs : Function.Surjective f) : CG L N := by rw [← Hom.range_eq_top] at hs rw [cg_def, ← hs] exact h.range f #align first_order.language.Structure.cg.map_of_surjective FirstOrder.Language.Structure.CG.map_of_surjective theorem cg_iff_countable [Countable (Σl, L.Functions l)] : CG L M ↔ Countable M := by rw [cg_def, Substructure.cg_iff_countable, topEquiv.toEquiv.countable_iff] #align first_order.language.Structure.cg_iff_countable FirstOrder.Language.Structure.cg_iff_countable theorem FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg #align first_order.language.Structure.fg.cg FirstOrder.Language.Structure.FG.cg instance (priority := 100) cg_of_fg [h : FG L M] : CG L M := h.cg #align first_order.language.Structure.cg_of_fg FirstOrder.Language.Structure.cg_of_fg end Structure theorem Equiv.fg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.FG L M ↔ Structure.FG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.fg_iff FirstOrder.Language.Equiv.fg_iff theorem Substructure.fg_iff_structure_fg (S : L.Substructure M) : S.FG ↔ Structure.FG L S := by rw [Structure.fg_def] refine' ⟨fun h => FG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h exact h set_option linter.uppercaseLean3 false in #align first_order.language.substructure.fg_iff_Structure_fg FirstOrder.Language.Substructure.fg_iff_structure_fg theorem Equiv.cg_iff {N : Type*} [L.Structure N] (f : M ≃[L] N) : Structure.CG L M ↔ Structure.CG L N := ⟨fun h => h.map_of_surjective f.toHom f.toEquiv.surjective, fun h => h.map_of_surjective f.symm.toHom f.toEquiv.symm.surjective⟩ #align first_order.language.equiv.cg_iff FirstOrder.Language.Equiv.cg_iff theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h
exact h
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S := by rw [Structure.cg_def] refine' ⟨fun h => CG.of_map_embedding S.subtype _, fun h => _⟩ · rw [← Hom.range_eq_map, range_subtype] exact h · have h := h.map S.subtype.toHom rw [← Hom.range_eq_map, range_subtype] at h
Mathlib.ModelTheory.FinitelyGenerated.284_0.mkqJR9tOk3JtWTX
theorem Substructure.cg_iff_structure_cg (S : L.Substructure M) : S.CG ↔ Structure.CG L S
Mathlib_ModelTheory_FinitelyGenerated
F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite 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ˣ _ _
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α ⊢ ∃ α, 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 α
/-- **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ˣ _ _
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case h F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α ⊢ 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
/-- **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 α
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case h F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α ⊢ ⊤ ≤ 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 -
/-- **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
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case h F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α x : E ⊢ x ∈ 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
/-- **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 -
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case pos F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α x : E hx : x = 0 ⊢ x ∈ 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]
/-- **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 ·
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case pos F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α x : E hx : x = 0 ⊢ 0 ∈ 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
/-- **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]
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case neg F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α x : E hx : ¬x = 0 ⊢ x ∈ 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))
/-- **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 ·
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case neg.intro F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α x : E hx : ¬x = 0 n : ℤ hn : (fun x => α ^ x) n = Units.mk0 x hx ⊢ x ∈ 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
/-- **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))
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case neg.intro F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α x : E hx : ¬x = 0 n : ℤ hn : α ^ n = Units.mk0 x hx ⊢ x ∈ 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]]
/-- **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
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α x : E hx : ¬x = 0 n : ℤ hn : α ^ n = Units.mk0 x hx ⊢ x = ↑α ^ n
/- 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
/-- **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
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α x : E hx : ¬x = 0 n : ℤ hn : α ^ n = Units.mk0 x hx ⊢ x = ↑(α ^ n)
/- 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]
/-- **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;
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
case neg.intro F : Type u_1 inst✝³ : Field F E : Type u_2 inst✝² : Field E inst✝¹ : Algebra F E inst✝ : Finite E α : Eˣ hα : ∀ (x : Eˣ), x ∈ Subgroup.zpowers α x : E hx : ¬x = 0 n : ℤ hn : α ^ n = Units.mk0 x hx ⊢ ↑α ^ n ∈ 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
/-- **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]]
Mathlib.FieldTheory.PrimitiveElement.56_0.R5HND7n71i1v1rZ
/-- **Primitive element theorem** assuming E is finite. -/ theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝² : Field F inst✝¹ : Infinite F E : Type u_2 inst✝ : Field E ϕ : F →+* E α β : E f g : F[X] ⊢ ∃ c, ∀ α' ∈ roots (Polynomial.map ϕ f), ∀ β' ∈ roots (Polynomial.map ϕ g), -(α' - α) / (β' - β) ≠ ϕ c
/- 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
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by
Mathlib.FieldTheory.PrimitiveElement.87_0.R5HND7n71i1v1rZ
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝² : Field F inst✝¹ : Infinite F E : Type u_2 inst✝ : Field E ϕ : F →+* E α β : E f g : F[X] sf : Multiset E := roots (Polynomial.map ϕ f) ⊢ ∃ c, ∀ α' ∈ roots (Polynomial.map ϕ f), ∀ β' ∈ roots (Polynomial.map ϕ g), -(α' - α) / (β' - β) ≠ ϕ c
/- 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
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
Mathlib.FieldTheory.PrimitiveElement.87_0.R5HND7n71i1v1rZ
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝² : Field F inst✝¹ : Infinite F E : Type u_2 inst✝ : Field E ϕ : F →+* E α β : E f g : F[X] sf : Multiset E := roots (Polynomial.map ϕ f) sg : Multiset E := roots (Polynomial.map ϕ g) ⊢ ∃ c, ∀ α' ∈ roots (Polynomial.map ϕ f), ∀ β' ∈ roots (Polynomial.map ϕ g), -(α' - α) / (β' - β) ≠ ϕ c
/- 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
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
Mathlib.FieldTheory.PrimitiveElement.87_0.R5HND7n71i1v1rZ
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝² : Field F inst✝¹ : Infinite F E : Type u_2 inst✝ : Field E ϕ : F →+* E α β : E f g : F[X] sf : Multiset E := roots (Polynomial.map ϕ f) sg : Multiset E := roots (Polynomial.map ϕ g) s : Finset E := Multiset.toFinset (Multiset.bind sf fun α' => Multiset.map (fun β' => -(α' - α) / (β' - β)) sg) ⊢ ∃ c, ∀ α' ∈ roots (Polynomial.map ϕ f), ∀ β' ∈ roots (Polynomial.map ϕ g), -(α' - α) / (β' - β) ≠ ϕ c
/- 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
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
Mathlib.FieldTheory.PrimitiveElement.87_0.R5HND7n71i1v1rZ
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝² : Field F inst✝¹ : Infinite F E : Type u_2 inst✝ : Field E ϕ : F →+* E α β : E f g : F[X] sf : Multiset E := roots (Polynomial.map ϕ f) sg : Multiset E := roots (Polynomial.map ϕ g) s : Finset E := Multiset.toFinset (Multiset.bind sf fun α' => Multiset.map (fun β' => -(α' - α) / (β' - β)) sg) s' : Finset F := Finset.preimage s ⇑ϕ (_ : ∀ x ∈ ⇑ϕ ⁻¹' ↑s, ∀ y ∈ ⇑ϕ ⁻¹' ↑s, ϕ x = ϕ y → x = y) ⊢ ∃ c, ∀ α' ∈ roots (Polynomial.map ϕ f), ∀ β' ∈ roots (Polynomial.map ϕ g), -(α' - α) / (β' - β) ≠ ϕ c
/- 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'
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
Mathlib.FieldTheory.PrimitiveElement.87_0.R5HND7n71i1v1rZ
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 inst✝² : Field F inst✝¹ : Infinite F E : Type u_2 inst✝ : Field E ϕ : F →+* E α β : E f g : F[X] sf : Multiset E := roots (Polynomial.map ϕ f) sg : Multiset E := roots (Polynomial.map ϕ g) s : Finset E := Multiset.toFinset (Multiset.bind sf fun α' => Multiset.map (fun β' => -(α' - α) / (β' - β)) sg) s' : Finset F := Finset.preimage s ⇑ϕ (_ : ∀ x ∈ ⇑ϕ ⁻¹' ↑s, ∀ y ∈ ⇑ϕ ⁻¹' ↑s, ϕ x = ϕ y → x = y) c : F hc : c ∉ s' ⊢ ∃ c, ∀ α' ∈ roots (Polynomial.map ϕ f), ∀ β' ∈ roots (Polynomial.map ϕ g), -(α' - α) / (β' - β) ≠ ϕ c
/- 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
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'
Mathlib.FieldTheory.PrimitiveElement.87_0.R5HND7n71i1v1rZ
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 inst✝² : Field F inst✝¹ : Infinite F E : Type u_2 inst✝ : Field E ϕ : F →+* E α β : E f g : F[X] sf : Multiset E := roots (Polynomial.map ϕ f) sg : Multiset E := roots (Polynomial.map ϕ g) s : Finset E := Multiset.toFinset (Multiset.bind sf fun α' => Multiset.map (fun β' => -(α' - α) / (β' - β)) sg) s' : Finset F := Finset.preimage s ⇑ϕ (_ : ∀ x ∈ ⇑ϕ ⁻¹' ↑s, ∀ y ∈ ⇑ϕ ⁻¹' ↑s, ϕ x = ϕ y → x = y) c : F hc : ¬∃ a ∈ roots (Polynomial.map ϕ f), ∃ a_1 ∈ roots (Polynomial.map ϕ g), -(a - α) / (a_1 - β) = ϕ c ⊢ ∃ c, ∀ α' ∈ roots (Polynomial.map ϕ f), ∀ β' ∈ roots (Polynomial.map ϕ g), -(α' - α) / (β' - β) ≠ ϕ c
/- 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
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
Mathlib.FieldTheory.PrimitiveElement.87_0.R5HND7n71i1v1rZ
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 inst✝² : Field F inst✝¹ : Infinite F E : Type u_2 inst✝ : Field E ϕ : F →+* E α β : E f g : F[X] sf : Multiset E := roots (Polynomial.map ϕ f) sg : Multiset E := roots (Polynomial.map ϕ g) s : Finset E := Multiset.toFinset (Multiset.bind sf fun α' => Multiset.map (fun β' => -(α' - α) / (β' - β)) sg) s' : Finset F := Finset.preimage s ⇑ϕ (_ : ∀ x ∈ ⇑ϕ ⁻¹' ↑s, ∀ y ∈ ⇑ϕ ⁻¹' ↑s, ϕ x = ϕ y → x = y) c : F hc : ∀ a ∈ roots (Polynomial.map ϕ f), ∀ a_1 ∈ roots (Polynomial.map ϕ g), -(a - α) / (a_1 - β) ≠ ϕ c ⊢ ∃ c, ∀ α' ∈ roots (Polynomial.map ϕ f), ∀ β' ∈ roots (Polynomial.map ϕ g), -(α' - α) / (β' - β) ≠ ϕ c
/- 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⟩
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
Mathlib.FieldTheory.PrimitiveElement.87_0.R5HND7n71i1v1rZ
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E ⊢ ∃ γ, 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 α
/-- 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
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α ⊢ ∃ γ, 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 β
/-- 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 α
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β ⊢ ∃ γ, 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 α
/-- 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 β
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α ⊢ ∃ γ, 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 β
/-- 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 α
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ⊢ ∃ γ, 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
/-- 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 β
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ⊢ ∃ γ, 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))
/-- 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
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) ⊢ ∃ γ, 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
/-- 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))
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c ⊢ ∃ γ, 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 • β
/-- 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
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β ⊢ ∃ γ, 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⟮γ⟯
/-- 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 • β
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case intro F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ F⟮γ⟯ ⊢ ∃ γ, 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 γ
/-- 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⟮γ⟯ ·
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ F⟮γ⟯ ⊢ 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
/-- 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 γ
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h.a F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ F⟮γ⟯ ⊢ 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]
/-- 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 ·
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h.a F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ 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)
/-- 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]
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ 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 • β)]
/-- 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
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ F⟮γ⟯ ⊢ α + c • β - c • β ∈ 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)
/-- 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 • β)]
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h.a F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ F⟮γ⟯ α_in_Fγ : α ∈ 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)
/-- 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)
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h.a.inl F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hβ : IsIntegral F β g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F x : E hα : IsIntegral F x f : F[X] := minpoly F x hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' x) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := x + c • β β_in_Fγ : β ∈ F⟮γ⟯ α_in_Fγ : x ∈ F⟮γ⟯ ⊢ x ∈ ↑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
/-- 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) <;>
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h.a.inr F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α f : F[X] := minpoly F α ιFE : F →+* E := algebraMap F E c : F x : E hβ : IsIntegral F x g : F[X] := minpoly F x ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' x) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • x β_in_Fγ : x ∈ F⟮γ⟯ α_in_Fγ : α ∈ F⟮γ⟯ ⊢ x ∈ ↑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
/-- 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) <;>
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h.a F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ F⟮γ⟯ ⊢ 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]
/-- 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 ·
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h.a F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ 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 α {β})
/-- 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]
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h.a F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ F⟮γ⟯ α_in_Fαβ : α ∈ 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)
/-- 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 α {β})
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case h.a F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β β_in_Fγ : β ∈ F⟮γ⟯ α_in_Fαβ : α ∈ F⟮α, β⟯ β_in_Fαβ : β ∈ 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αβ)
/-- 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)
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case β_in_Fγ F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β ⊢ β ∈ 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⟮γ⟯))
/-- 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αβ)
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case β_in_Fγ F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) ⊢ β ∈ 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)
/-- 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⟮γ⟯))
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case β_in_Fγ F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) ⊢ β ∈ 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β)
/-- 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)
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case β_in_Fγ F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 ⊢ β ∈ 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)
/-- 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β)
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case β_in_Fγ F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 ⊢ β ∈ 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 β)
/-- 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)
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case β_in_Fγ F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 p_linear : Polynomial.map (algebraMap (↥F⟮γ⟯) E) p = C (leadingCoeff h) * (X - C β) ⊢ β ∈ 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]
/-- 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 β) ·
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 p_linear : Polynomial.map (algebraMap (↥F⟮γ⟯) E) p = C (leadingCoeff h) * (X - C β) ⊢ β = (algebraMap (↥F⟮γ⟯) E) (-coeff p 0 / coeff p 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]
/-- 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
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 p_linear : Polynomial.map (algebraMap (↥F⟮γ⟯) E) p = C (leadingCoeff h) * (X - C β) ⊢ β = -coeff (C (leadingCoeff h) * (X - C β)) 0 / coeff (C (leadingCoeff h) * (X - C β)) 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]
/-- 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.
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case β_in_Fγ F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 p_linear : Polynomial.map (algebraMap (↥F⟮γ⟯) E) p = C (leadingCoeff h) * (X - C β) finale : β = (algebraMap (↥F⟮γ⟯) E) (-coeff p 0 / coeff p 1) ⊢ β ∈ 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]
/-- 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)]
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case β_in_Fγ F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 p_linear : Polynomial.map (algebraMap (↥F⟮γ⟯) E) p = C (leadingCoeff h) * (X - C β) finale : β = (algebraMap (↥F⟮γ⟯) E) (-coeff p 0 / coeff p 1) ⊢ (algebraMap (↥F⟮γ⟯) E) (-coeff p 0 / coeff p 1) ∈ 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)
/-- 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]
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case p_linear F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 ⊢ Polynomial.map (algebraMap (↥F⟮γ⟯) E) p = C (leadingCoeff h) * (X - C β)
/- 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
/-- 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)
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case p_linear F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 h_sep : Separable h ⊢ Polynomial.map (algebraMap (↥F⟮γ⟯) E) p = C (leadingCoeff h) * (X - C β)
/- 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]
/-- 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
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 h_sep : Separable h ⊢ eval β h = 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
/-- 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
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case hf F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 h_sep : Separable h ⊢ eval β (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) = 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]
/-- 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 ·
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case hg F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 h_sep : Separable h ⊢ eval β (Polynomial.map ιFE g) = 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]
/-- 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] ·
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement
case p_linear F : Type u_1 inst✝⁴ : Field F inst✝³ : Infinite F E : Type u_2 inst✝² : Field E ϕ : F →+* E α β : E inst✝¹ : Algebra F E inst✝ : IsSeparable F E hα : IsIntegral F α hβ : IsIntegral F β f : F[X] := minpoly F α g : F[X] := minpoly F β ιFE : F →+* E := algebraMap F E ιEE' : E →+* SplittingField (Polynomial.map ιFE g) := algebraMap E (SplittingField (Polynomial.map ιFE g)) c : F hc : ∀ α' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) f), ∀ β' ∈ roots (Polynomial.map (RingHom.comp ιEE' ιFE) g), -(α' - ιEE' α) / (β' - ιEE' β) ≠ (RingHom.comp ιEE' ιFE) c γ : E := α + c • β p : (↥F⟮γ⟯)[X] := EuclideanDomain.gcd (comp (Polynomial.map (algebraMap F ↥F⟮γ⟯) f) (C (AdjoinSimple.gen F γ) - C { val := (algebraMap F E) c, property := (_ : (algebraMap F E) c ∈ F⟮γ⟯) } * X)) (Polynomial.map (algebraMap F ↥F⟮γ⟯) g) h : E[X] := EuclideanDomain.gcd (comp (Polynomial.map ιFE f) (C γ - C (ιFE c) * X)) (Polynomial.map ιFE g) map_g_ne_zero : Polynomial.map ιFE g ≠ 0 h_ne_zero : h ≠ 0 h_sep : Separable h h_root : eval β h = 0 ⊢ Polynomial.map (algebraMap (↥F⟮γ⟯) E) p = C (leadingCoeff h) * (X - C β)
/- 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 _)
/-- 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]
Mathlib.FieldTheory.PrimitiveElement.103_0.R5HND7n71i1v1rZ
/-- 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⟮γ⟯
Mathlib_FieldTheory_PrimitiveElement