fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
FG.countable_hom (N : Type*) [L.Structure N] [Countable N] (h : FG L M) : Countable (M →[L] N) := by let ⟨S, finite_S, closure_S⟩ := fg_iff.1 h let g : (M →[L] N) → (S → N) := fun f ↦ f ∘ (↑) have g_inj : Function.Injective g := by intro f f' h apply Hom.eq_of_eqOn_dense closure_S intro x x_in_S exact congr_fun h ⟨x, x_in_S⟩ have : Finite ↑S := (S.finite_coe_iff).2 finite_S exact Function.Embedding.countable ⟨g, g_inj⟩
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
FG.countable_hom
null
FG.instCountable_hom (N : Type*) [L.Structure N] [Countable N] [h : FG L M] : Countable (M →[L] N) := FG.countable_hom N h
instance
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
FG.instCountable_hom
null
FG.countable_embedding (N : Type*) [L.Structure N] [Countable N] (_ : FG L M) : Countable (M ↪[L] N) := Function.Embedding.countable ⟨Embedding.toHom, Embedding.toHom_injective⟩
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
FG.countable_embedding
null
Fg.instCountable_embedding (N : Type*) [L.Structure N] [Countable N] [h : FG L M] : Countable (M ↪[L] N) := FG.countable_embedding N h
instance
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
Fg.instCountable_embedding
null
FG.of_finite [Finite M] : FG L M := by simp only [fg_def, Substructure.FG.of_finite]
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
FG.of_finite
null
FG.finite [L.IsRelational] (h : FG L M) : Finite M := Finite.of_finite_univ (Substructure.FG.finite (fg_def.1 h))
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
FG.finite
null
fg_iff_finite [L.IsRelational] : FG L M ↔ Finite M := ⟨FG.finite, fun _ => FG.of_finite⟩
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
fg_iff_finite
null
cg_def : CG L M ↔ (⊤ : L.Substructure M).CG := ⟨fun h => h.1, fun h => ⟨h⟩⟩
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
cg_def
null
cg_iff : CG L M ↔ ∃ S : Set M, S.Countable ∧ closure L S = (⊤ : L.Substructure M) := by rw [cg_def, Substructure.cg_def]
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
cg_iff
An equivalent expression of `Structure.cg`.
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
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
CG.range
null
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
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
CG.map_of_surjective
null
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
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
cg_iff_countable
null
cg_of_countable [Countable M] : CG L M := by simp only [cg_def, Substructure.cg_of_countable]
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
cg_of_countable
null
FG.cg (h : FG L M) : CG L M := cg_def.2 (fg_def.1 h).cg
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
FG.cg
null
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⟩
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
Equiv.fg_iff
null
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
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
Substructure.fg_iff_structure_fg
null
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⟩
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
Equiv.cg_iff
null
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
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
Substructure.cg_iff_structure_cg
null
Substructure.countable_fg_substructures_of_countable [Countable M] : Countable { S : L.Substructure M // S.FG } := by let g : { S : L.Substructure M // S.FG } → Finset M := fun S ↦ Exists.choose S.prop have g_inj : Function.Injective g := by intro S S' h apply Subtype.eq rw [(Exists.choose_spec S.prop).symm, (Exists.choose_spec S'.prop).symm] exact congr_arg ((closure L) ∘ Finset.toSet) h exact Function.Embedding.countable ⟨g, g_inj⟩
theorem
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
Substructure.countable_fg_substructures_of_countable
null
Substructure.instCountable_fg_substructures_of_countable [Countable M] : Countable { S : L.Substructure M // S.FG } := countable_fg_substructures_of_countable
instance
ModelTheory
[ "Mathlib.Data.Set.Finite.Lemmas", "Mathlib.ModelTheory.Substructures" ]
Mathlib/ModelTheory/FinitelyGenerated.lean
Substructure.instCountable_fg_substructures_of_countable
null
of all finitely-generated structures that embed into it. Of particular interest are Fraïssé classes, which are exactly the ages of countable ultrahomogeneous structures. To each is associated a unique (up to nonunique isomorphism) Fraïssé limit - the countable ultrahomogeneous structure with that age.
class
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
of
null
age (M : Type w) [L.Structure M] : Set (Bundled.{w} L.Structure) := {N | Structure.FG L N ∧ Nonempty (N ↪[L] M)} variable {L} variable (K : Set (Bundled.{w} L.Structure))
def
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
age
The age of a structure `M` is the class of finitely-generated structures that embed into it.
Hereditary : Prop := ∀ M : Bundled.{w} L.Structure, M ∈ K → L.age M ⊆ K
def
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
Hereditary
A class `K` has the hereditary property when all finitely-generated structures that embed into structures in `K` are also in `K`.
JointEmbedding : Prop := DirectedOn (fun M N : Bundled.{w} L.Structure => Nonempty (M ↪[L] N)) K
def
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
JointEmbedding
A class `K` has the joint embedding property when for every `M`, `N` in `K`, there is another structure in `K` into which both `M` and `N` embed.
Amalgamation : Prop := ∀ (M N P : Bundled.{w} L.Structure) (MN : M ↪[L] N) (MP : M ↪[L] P), M ∈ K → N ∈ K → P ∈ K → ∃ (Q : Bundled.{w} L.Structure) (NQ : N ↪[L] Q) (PQ : P ↪[L] Q), Q ∈ K ∧ NQ.comp MN = PQ.comp MP
def
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
Amalgamation
A class `K` has the amalgamation property when for any pair of embeddings of a structure `M` in `K` into other structures in `K`, those two structures can be embedded into a fourth structure in `K` such that the resulting square of embeddings commutes.
IsFraisse : Prop where is_nonempty : K.Nonempty FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M is_essentially_countable : (Quotient.mk' '' K).Countable hereditary : Hereditary K jointEmbedding : JointEmbedding K amalgamation : Amalgamation K variable {K} (L) (M : Type w) [Structure L M]
class
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
IsFraisse
A Fraïssé class is a nonempty, essentially countable class of structures satisfying the hereditary, joint embedding, and amalgamation properties.
age.is_equiv_invariant (N P : Bundled.{w} L.Structure) (h : Nonempty (N ≃[L] P)) : N ∈ L.age M ↔ P ∈ L.age M := and_congr h.some.fg_iff ⟨Nonempty.map fun x => Embedding.comp x h.some.symm.toEmbedding, Nonempty.map fun x => Embedding.comp x h.some.toEmbedding⟩ variable {L} {M} {N : Type w} [Structure L N]
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
age.is_equiv_invariant
null
Embedding.age_subset_age (MN : M ↪[L] N) : L.age M ⊆ L.age N := fun _ => And.imp_right (Nonempty.map MN.comp)
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
Embedding.age_subset_age
null
Equiv.age_eq_age (MN : M ≃[L] N) : L.age M = L.age N := le_antisymm MN.toEmbedding.age_subset_age MN.symm.toEmbedding.age_subset_age
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
Equiv.age_eq_age
null
Structure.FG.mem_age_of_equiv {M N : Bundled L.Structure} (h : Structure.FG L M) (MN : Nonempty (M ≃[L] N)) : N ∈ L.age M := ⟨MN.some.fg_iff.1 h, ⟨MN.some.symm.toEmbedding⟩⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
Structure.FG.mem_age_of_equiv
null
Hereditary.is_equiv_invariant_of_fg (h : Hereditary K) (fg : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M) (M N : Bundled.{w} L.Structure) (hn : Nonempty (M ≃[L] N)) : M ∈ K ↔ N ∈ K := ⟨fun MK => h M MK ((fg M MK).mem_age_of_equiv hn), fun NK => h N NK ((fg N NK).mem_age_of_equiv ⟨hn.some.symm⟩)⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
Hereditary.is_equiv_invariant_of_fg
null
IsFraisse.is_equiv_invariant [h : IsFraisse K] {M N : Bundled.{w} L.Structure} (hn : Nonempty (M ≃[L] N)) : M ∈ K ↔ N ∈ K := h.hereditary.is_equiv_invariant_of_fg h.FG M N hn variable (M)
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
IsFraisse.is_equiv_invariant
null
age.nonempty : (L.age M).Nonempty := ⟨Bundled.of (Substructure.closure L (∅ : Set M)), (fg_iff_structure_fg _).1 (fg_closure Set.finite_empty), ⟨Substructure.subtype _⟩⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
age.nonempty
null
age.hereditary : Hereditary (L.age M) := fun _ hN _ hP => hN.2.some.age_subset_age hP
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
age.hereditary
null
age.jointEmbedding : JointEmbedding (L.age M) := fun _ hN _ hP => ⟨Bundled.of (↥(hN.2.some.toHom.range ⊔ hP.2.some.toHom.range)), ⟨(fg_iff_structure_fg _).1 ((hN.1.range hN.2.some.toHom).sup (hP.1.range hP.2.some.toHom)), ⟨Substructure.subtype _⟩⟩, ⟨Embedding.comp (inclusion le_sup_left) hN.2.some.equivRange.toEmbedding⟩, ⟨Embedding.comp (inclusion le_sup_right) hP.2.some.equivRange.toEmbedding⟩⟩ variable {M} in
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
age.jointEmbedding
null
age.fg_substructure {S : L.Substructure M} (fg : S.FG) : Bundled.mk S ∈ L.age M := by exact ⟨(Substructure.fg_iff_structure_fg _).1 fg, ⟨subtype _⟩⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
age.fg_substructure
null
age.has_representative_as_substructure : ∀ C ∈ Quotient.mk' '' L.age M, ∃ V : {V : L.Substructure M // FG V}, ⟦Bundled.mk V⟧ = C := by rintro _ ⟨N, ⟨N_fg, ⟨N_incl⟩⟩, N_eq⟩ refine N_eq.symm ▸ ⟨⟨N_incl.toHom.range, ?_⟩, Quotient.sound ⟨N_incl.equivRange.symm⟩⟩ exact FG.range N_fg (Embedding.toHom N_incl)
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
age.has_representative_as_substructure
Any class in the age of a structure has a representative which is a finitely generated substructure.
age.countable_quotient [h : Countable M] : (Quotient.mk' '' L.age M).Countable := by classical refine (congr_arg _ (Set.ext <| Quotient.forall.2 fun N => ?_)).mp (countable_range fun s : Finset M => ⟦⟨closure L (s : Set M), inferInstance⟩⟧) constructor · rintro ⟨s, hs⟩ use Bundled.of (closure L (s : Set M)) exact ⟨⟨(fg_iff_structure_fg _).1 (fg_closure s.finite_toSet), ⟨Substructure.subtype _⟩⟩, hs⟩ · simp only [mem_range, Quotient.eq] rintro ⟨P, ⟨⟨s, hs⟩, ⟨PM⟩⟩, hP2⟩ refine ⟨s.image PM, Setoid.trans (b := P) ?_ <| Quotient.exact hP2⟩ rw [← Embedding.coe_toHom, Finset.coe_image, closure_image PM.toHom, hs, ← Hom.range_eq_map] exact ⟨PM.equivRange.symm⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
age.countable_quotient
The age of a countable structure is essentially countable (has countably many isomorphism classes).
age_directLimit {ι : Type w} [Preorder ι] [IsDirected ι (· ≤ ·)] [Nonempty ι] (G : ι → Type max w w') [∀ i, L.Structure (G i)] (f : ∀ i j, i ≤ j → G i ↪[L] G j) [DirectedSystem G fun i j h => f i j h] : L.age (DirectLimit G f) = ⋃ i : ι, L.age (G i) := by classical ext M simp only [mem_iUnion] constructor · rintro ⟨Mfg, ⟨e⟩⟩ obtain ⟨s, hs⟩ := Mfg.range e.toHom let out := @Quotient.out _ (DirectLimit.setoid G f) obtain ⟨i, hi⟩ := Finset.exists_le (s.image (Sigma.fst ∘ out)) have e' := (DirectLimit.of L ι G f i).equivRange.symm.toEmbedding refine ⟨i, Mfg, ⟨e'.comp ((Substructure.inclusion ?_).comp e.equivRange.toEmbedding)⟩⟩ rw [← hs, closure_le] intro x hx refine ⟨f (out x).1 i (hi (out x).1 (Finset.mem_image_of_mem _ hx)) (out x).2, ?_⟩ rw [Embedding.coe_toHom, DirectLimit.of_apply, @Quotient.mk_eq_iff_out _ (_), DirectLimit.equiv_iff G f (le_refl _) (hi (out x).1 (Finset.mem_image_of_mem _ hx)), DirectedSystem.map_self] · rintro ⟨i, Mfg, ⟨e⟩⟩ exact ⟨Mfg, ⟨Embedding.comp (DirectLimit.of L ι G f i) e⟩⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
age_directLimit
The age of a direct limit of structures is the union of the ages of the structures.
exists_cg_is_age_of (hn : K.Nonempty) (hc : (Quotient.mk' '' K).Countable) (fg : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M) (hp : Hereditary K) (jep : JointEmbedding K) : ∃ M : Bundled.{w} L.Structure, Structure.CG L M ∧ L.age M = K := by obtain ⟨F, hF⟩ := hc.exists_eq_range (hn.image _) simp only [Set.ext_iff, Quotient.forall, mem_image, mem_range] at hF simp_rw [Quotient.eq_mk_iff_out] at hF have hF' : ∀ n : ℕ, (F n).out ∈ K := by intro n obtain ⟨P, hP1, hP2⟩ := (hF (F n).out).2 ⟨n, Setoid.refl _⟩ replace hP2 := Setoid.trans (Setoid.symm (Quotient.mk_out P)) hP2 exact (hp.is_equiv_invariant_of_fg fg _ _ hP2).1 hP1 choose P hPK hP hFP using fun (N : K) (n : ℕ) => jep N N.2 (F (n + 1)).out (hF' _) let G : ℕ → K := @Nat.rec (fun _ => K) ⟨(F 0).out, hF' 0⟩ fun n N => ⟨P N n, hPK N n⟩ let f : ∀ (i j : ℕ), i ≤ j → (G i).val ↪[L] (G j).val := by refine DirectedSystem.natLERec (G' := fun i => (G i).val) (L := L) ?_ dsimp only [G] exact fun n => (hP _ n).some have : DirectedSystem (fun n ↦ (G n).val) fun i j h ↦ ↑(f i j h) := by dsimp [f, G]; infer_instance refine ⟨Bundled.of (@DirectLimit L _ _ (fun n ↦ (G n).val) _ f _ _), ?_, ?_⟩ · exact DirectLimit.cg _ (fun n => (fg _ (G n).2).cg) · refine (age_directLimit (fun n ↦ (G n).val) f).trans (subset_antisymm (iUnion_subset fun n N hN => hp (G n).val (G n).2 hN) fun N KN => ?_) have : Quotient.out (Quotient.mk' N) ≈ N := Quotient.eq_mk_iff_out.mp rfl obtain ⟨n, ⟨e⟩⟩ := (hF N).1 ⟨N, KN, this⟩ refine mem_iUnion_of_mem n ⟨fg _ KN, ⟨Embedding.comp ?_ e.symm.toEmbedding⟩⟩ rcases n with - | n · dsimp [G]; exact Embedding.refl _ _ · dsimp [G]; exact (hFP _ n).some
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
exists_cg_is_age_of
Sufficient conditions for a class to be the age of a countably-generated structure.
exists_countable_is_age_of_iff [Countable (Σ l, L.Functions l)] : (∃ M : Bundled.{w} L.Structure, Countable M ∧ L.age M = K) ↔ K.Nonempty ∧ (∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K)) ∧ (Quotient.mk' '' K).Countable ∧ (∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M) ∧ Hereditary K ∧ JointEmbedding K := by constructor · rintro ⟨M, h1, h2, rfl⟩ refine ⟨age.nonempty M, age.is_equiv_invariant L M, age.countable_quotient M, fun N hN => hN.1, age.hereditary M, age.jointEmbedding M⟩ · rintro ⟨Kn, _, cq, hfg, hp, jep⟩ obtain ⟨M, hM, rfl⟩ := exists_cg_is_age_of Kn cq hfg hp jep exact ⟨M, Structure.cg_iff_countable.1 hM, rfl⟩ variable (L)
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
exists_countable_is_age_of_iff
null
IsUltrahomogeneous : Prop := ∀ (S : L.Substructure M) (_ : S.FG) (f : S ↪[L] M), ∃ g : M ≃[L] M, f = g.toEmbedding.comp S.subtype variable {L} (K)
def
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
IsUltrahomogeneous
A structure `M` is ultrahomogeneous if every embedding of a finitely generated substructure into `M` extends to an automorphism of `M`.
IsFraisseLimit [Countable (Σ l, L.Functions l)] [Countable M] : Prop where protected ultrahomogeneous : IsUltrahomogeneous L M protected age : L.age M = K variable {M}
structure
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
IsFraisseLimit
A structure `M` is a Fraïssé limit for a class `K` if it is countably generated, ultrahomogeneous, and has age `K`.
IsUltrahomogeneous.extend_embedding (M_homog : L.IsUltrahomogeneous M) {S : Type*} [L.Structure S] (S_FG : FG L S) {T : Type*} [L.Structure T] [h : Nonempty (T ↪[L] M)] (f : S ↪[L] M) (g : S ↪[L] T) : ∃ f' : T ↪[L] M, f = f'.comp g := by let ⟨r⟩ := h let s := r.comp g let ⟨t, eq⟩ := M_homog s.toHom.range (S_FG.range s.toHom) (f.comp s.equivRange.symm.toEmbedding) use t.toEmbedding.comp r change _ = t.toEmbedding.comp s ext x have eq' := congr_fun (congr_arg DFunLike.coe eq) ⟨s x, Hom.mem_range.2 ⟨x, rfl⟩⟩ simp only [Embedding.comp_apply, coe_subtype] at eq' simp only [Embedding.comp_apply, ← eq', Equiv.coe_toEmbedding, EmbeddingLike.apply_eq_iff_eq] apply (Embedding.equivRange (Embedding.comp r g)).injective ext simp only [Equiv.apply_symm_apply, Embedding.equivRange_apply, s]
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
IsUltrahomogeneous.extend_embedding
Any embedding from a finitely generated `S` to an ultrahomogeneous structure `M` can be extended to an embedding from any structure with an embedding to `M`.
isUltrahomogeneous_iff_IsExtensionPair (M_CG : CG L M) : L.IsUltrahomogeneous M ↔ L.IsExtensionPair M M := by constructor · intro M_homog ⟨f, f_FG⟩ m let S := f.dom ⊔ closure L {m} have dom_le_S : f.dom ≤ S := le_sup_left let ⟨f', eq_f'⟩ := M_homog.extend_embedding (f.dom.fg_iff_structure_fg.1 f_FG) ((subtype _).comp f.toEquiv.toEmbedding) (inclusion dom_le_S) (h := ⟨subtype _⟩) refine ⟨⟨⟨S, f'.toHom.range, f'.equivRange⟩, f_FG.sup (fg_closure_singleton _)⟩, subset_closure.trans (le_sup_right : _ ≤ S) (mem_singleton m), ⟨dom_le_S, ?_⟩⟩ ext simp only [Embedding.comp_apply, Equiv.coe_toEmbedding, coe_subtype, eq_f', Embedding.equivRange_apply, Substructure.coe_inclusion] · intro h S S_FG f let ⟨g, ⟨dom_le_dom, eq⟩⟩ := equiv_between_cg M_CG M_CG ⟨⟨S, f.toHom.range, f.equivRange⟩, S_FG⟩ h h use g simp only [Embedding.subtype_equivRange] at eq rw [← eq] ext rfl
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
isUltrahomogeneous_iff_IsExtensionPair
A countably generated structure is ultrahomogeneous if and only if any equivalence between finitely generated substructures can be extended to any element in the domain.
IsUltrahomogeneous.amalgamation_age (h : L.IsUltrahomogeneous M) : Amalgamation (L.age M) := by rintro N P Q NP NQ ⟨Nfg, ⟨-⟩⟩ ⟨Pfg, ⟨PM⟩⟩ ⟨Qfg, ⟨QM⟩⟩ obtain ⟨g, hg⟩ := h (PM.comp NP).toHom.range (Nfg.range _) ((QM.comp NQ).comp (PM.comp NP).equivRange.symm.toEmbedding) let s := (g.toHom.comp PM.toHom).range ⊔ QM.toHom.range refine ⟨Bundled.of s, Embedding.comp (Substructure.inclusion le_sup_left) (g.toEmbedding.comp PM).equivRange.toEmbedding, Embedding.comp (Substructure.inclusion le_sup_right) QM.equivRange.toEmbedding, ⟨(fg_iff_structure_fg _).1 (FG.sup (Pfg.range _) (Qfg.range _)), ⟨Substructure.subtype _⟩⟩, ?_⟩ ext n apply Subtype.ext have hgn := (Embedding.ext_iff.1 hg) ((PM.comp NP).equivRange n) simp only [Embedding.comp_apply, Equiv.coe_toEmbedding, Equiv.symm_apply_apply, Substructure.coe_subtype, Embedding.equivRange_apply] at hgn simp only [Embedding.comp_apply, Equiv.coe_toEmbedding] erw [Substructure.coe_inclusion, Substructure.coe_inclusion] simp only [Embedding.equivRange_apply, hgn] erw [Embedding.comp_apply, Equiv.coe_toEmbedding, Embedding.equivRange_apply] simp
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
IsUltrahomogeneous.amalgamation_age
null
IsUltrahomogeneous.age_isFraisse [Countable M] (h : L.IsUltrahomogeneous M) : IsFraisse (L.age M) := ⟨age.nonempty M, fun _ hN => hN.1, age.countable_quotient M, age.hereditary M, age.jointEmbedding M, h.amalgamation_age⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
IsUltrahomogeneous.age_isFraisse
null
isFraisse [Countable (Σ l, L.Functions l)] [Countable M] (h : IsFraisseLimit K M) : IsFraisse K := (congr rfl h.age).mp h.ultrahomogeneous.age_isFraisse variable {K} {N : Type w} [L.Structure N] variable [Countable (Σ l, L.Functions l)] [Countable M] [Countable N] variable (hM : IsFraisseLimit K M) (hN : IsFraisseLimit K N) include hM hN
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
isFraisse
If a class has a Fraïssé limit, it must be Fraïssé.
protected isExtensionPair : L.IsExtensionPair M N := by intro ⟨f, f_FG⟩ m let S := f.dom ⊔ closure L {m} have S_FG : S.FG := f_FG.sup (Substructure.fg_closure_singleton _) have S_in_age_N : ⟨S, inferInstance⟩ ∈ L.age N := by rw [hN.age, ← hM.age] exact ⟨(fg_iff_structure_fg S).1 S_FG, ⟨subtype _⟩⟩ haveI nonempty_S_N : Nonempty (S ↪[L] N) := S_in_age_N.2 let ⟨g, g_eq⟩ := hN.ultrahomogeneous.extend_embedding (f.dom.fg_iff_structure_fg.1 f_FG) ((subtype f.cod).comp f.toEquiv.toEmbedding) (inclusion (le_sup_left : _ ≤ S)) refine ⟨⟨⟨S, g.toHom.range, g.equivRange⟩, S_FG⟩, subset_closure.trans (le_sup_right : _ ≤ S) (mem_singleton m), ⟨le_sup_left, ?_⟩⟩ ext simp [S, g_eq]
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
isExtensionPair
null
nonempty_equiv : Nonempty (M ≃[L] N) := by let S : L.Substructure M := ⊥ have S_fg : FG L S := (fg_iff_structure_fg _).1 Substructure.fg_bot obtain ⟨_, ⟨emb_S : S ↪[L] N⟩⟩ : ⟨S, inferInstance⟩ ∈ L.age N := by rw [hN.age, ← hM.age] exact ⟨S_fg, ⟨subtype _⟩⟩ let v : M ≃ₚ[L] N := { dom := S cod := emb_S.toHom.range toEquiv := emb_S.equivRange } exact ⟨Exists.choose (equiv_between_cg cg_of_countable cg_of_countable ⟨v, ((Substructure.fg_iff_structure_fg _).2 S_fg)⟩ (hM.isExtensionPair hN) (hN.isExtensionPair hM))⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
nonempty_equiv
The Fraïssé limit of a class is unique, in that any two Fraïssé limits are isomorphic.
isFraisseLimit_of_countable_infinite (M : Type*) [Countable M] [Infinite M] [Language.empty.Structure M] : IsFraisseLimit { S : Bundled Language.empty.Structure | Finite S } M where age := by ext S simp only [age, Structure.fg_iff_finite, mem_setOf_eq, and_iff_left_iff_imp] intro hS simp ultrahomogeneous S hS f := by classical have : Finite S := hS.finite have : Infinite { x // x ∉ S } := ((Set.toFinite _).infinite_compl).to_subtype have : Finite f.toHom.range := (((Substructure.fg_iff_structure_fg S).1 hS).range _).finite have : Infinite { x // x ∉ f.toHom.range } := ((Set.toFinite _).infinite_compl ).to_subtype refine ⟨StrongHomClass.toEquiv (f.equivRange.subtypeCongr nonempty_equiv_of_countable.some), ?_⟩ ext x simp [Equiv.subtypeCongr]
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
isFraisseLimit_of_countable_infinite
Any countable infinite structure in the empty language is a Fraïssé limit of the class of finite structures.
isFraisse_finite : IsFraisse { S : Bundled.{w} Language.empty.Structure | Finite S } := by have : Language.empty.Structure (ULift ℕ : Type w) := emptyStructure exact (isFraisseLimit_of_countable_infinite (ULift ℕ)).isFraisse
theorem
ModelTheory
[ "Mathlib.ModelTheory.FinitelyGenerated", "Mathlib.ModelTheory.PartialEquiv", "Mathlib.ModelTheory.Bundled", "Mathlib.Algebra.Order.Archimedean.Basic" ]
Mathlib/ModelTheory/Fraisse.lean
isFraisse_finite
The class of finite structures in the empty language is Fraïssé.
graphRel : ℕ → Type | adj : graphRel 2 deriving DecidableEq
inductive
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
graphRel
The type of relations for the language of graphs, consisting of a single binary relation `adj`.
protected graph : Language := ⟨fun _ => Empty, graphRel⟩ deriving IsRelational
def
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
graph
The language consisting of a single relation representing adjacency.
adj : Language.graph.Relations 2 := .adj
abbrev
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
adj
The symbol representing the adjacency relation.
_root_.SimpleGraph.structure (G : SimpleGraph V) : Language.graph.Structure V where RelMap | .adj => (fun x => G.Adj (x 0) (x 1))
def
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
_root_.SimpleGraph.structure
Any simple graph can be thought of as a structure in the language of graphs.
instSubsingleton : Subsingleton (Language.graph.Relations n) := ⟨by rintro ⟨⟩ ⟨⟩; rfl⟩
instance
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
instSubsingleton
null
protected Theory.simpleGraph : Language.graph.Theory := {adj.irreflexive, adj.symmetric} @[simp]
def
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
Theory.simpleGraph
The theory of simple graphs.
Theory.simpleGraph_model_iff [Language.graph.Structure V] : V ⊨ Theory.simpleGraph ↔ (Irreflexive fun x y : V => RelMap adj ![x, y]) ∧ Symmetric fun x y : V => RelMap adj ![x, y] := by simp [Theory.simpleGraph]
theorem
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
Theory.simpleGraph_model_iff
null
simpleGraph_model (G : SimpleGraph V) : @Theory.Model _ V G.structure Theory.simpleGraph := by letI := G.structure rw [Theory.simpleGraph_model_iff] exact ⟨G.loopless, G.symm⟩ variable (V) in
instance
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
simpleGraph_model
null
@[simps] simpleGraphOfStructure [Language.graph.Structure V] [V ⊨ Theory.simpleGraph] : SimpleGraph V where Adj x y := RelMap adj ![x, y] symm := Relations.realize_symmetric.1 (Theory.realize_sentence_of_mem Theory.simpleGraph (Set.mem_insert_of_mem _ (Set.mem_singleton _))) loopless := Relations.realize_irreflexive.1 (Theory.realize_sentence_of_mem Theory.simpleGraph (Set.mem_insert _ _)) @[simp]
def
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
simpleGraphOfStructure
Any model of the theory of simple graphs represents a simple graph.
_root_.SimpleGraph.simpleGraphOfStructure (G : SimpleGraph V) : @simpleGraphOfStructure V G.structure _ = G := by ext rfl @[simp]
theorem
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
_root_.SimpleGraph.simpleGraphOfStructure
null
structure_simpleGraphOfStructure [S : Language.graph.Structure V] [V ⊨ Theory.simpleGraph] : (simpleGraphOfStructure V).structure = S := by ext case funMap n f xs => exact isEmptyElim f case RelMap n r xs => match n, r with | 2, .adj => rw [iff_eq_eq] change RelMap adj ![xs 0, xs 1] = _ refine congr rfl (funext ?_) simp [Fin.forall_fin_two]
theorem
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
structure_simpleGraphOfStructure
null
Theory.simpleGraph_isSatisfiable : Theory.IsSatisfiable Theory.simpleGraph := ⟨@Theory.ModelType.of _ _ Unit (SimpleGraph.structure ⊥) _ _⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.Satisfiability", "Mathlib.Combinatorics.SimpleGraph.Basic" ]
Mathlib/ModelTheory/Graph.lean
Theory.simpleGraph_isSatisfiable
null
LHom where /-- The mapping of functions -/ onFunction : ∀ ⦃n⦄, L.Functions n → L'.Functions n := by exact fun {n} => isEmptyElim /-- The mapping of relations -/ onRelation : ∀ ⦃n⦄, L.Relations n → L'.Relations n :=by exact fun {n} => isEmptyElim @[inherit_doc FirstOrder.Language.LHom] infixl:10 " →ᴸ " => LHom variable {L L'}
structure
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
LHom
A language homomorphism maps the symbols of one language to symbols of another.
reduct (M : Type*) [L'.Structure M] : L.Structure M where funMap f xs := funMap (ϕ.onFunction f) xs RelMap r xs := RelMap (ϕ.onRelation r) xs
def
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
reduct
Pulls a structure back along a language map.
@[simps] protected id (L : Language) : L →ᴸ L := ⟨fun _n => id, fun _n => id⟩
def
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
id
The identity language homomorphism.
@[simps] protected sumInl : L →ᴸ L.sum L' := ⟨fun _n => Sum.inl, fun _n => Sum.inl⟩
def
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumInl
The inclusion of the left factor into the sum of two languages.
@[simps] protected sumInr : L' →ᴸ L.sum L' := ⟨fun _n => Sum.inr, fun _n => Sum.inr⟩ variable (L L')
def
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumInr
The inclusion of the right factor into the sum of two languages.
@[simps] protected ofIsEmpty [L.IsAlgebraic] [L.IsRelational] : L →ᴸ L' where variable {L L'} {L'' : Language} @[ext]
def
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
ofIsEmpty
The inclusion of an empty language into any other language.
protected funext {F G : L →ᴸ L'} (h_fun : F.onFunction = G.onFunction) (h_rel : F.onRelation = G.onRelation) : F = G := by obtain ⟨Ff, Fr⟩ := F obtain ⟨Gf, Gr⟩ := G simp only [mk.injEq] exact And.intro h_fun h_rel
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
funext
null
@[simps] comp (g : L' →ᴸ L'') (f : L →ᴸ L') : L →ᴸ L'' := ⟨fun _n F => g.1 (f.1 F), fun _ R => g.2 (f.2 R)⟩ @[inherit_doc] local infixl:60 " ∘ᴸ " => LHom.comp @[simp]
def
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
comp
The composition of two language homomorphisms.
id_comp (F : L →ᴸ L') : LHom.id L' ∘ᴸ F = F := by cases F rfl @[simp]
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
id_comp
null
comp_id (F : L →ᴸ L') : F ∘ᴸ LHom.id L = F := by cases F rfl
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
comp_id
null
comp_assoc {L3 : Language} (F : L'' →ᴸ L3) (G : L' →ᴸ L'') (H : L →ᴸ L') : F ∘ᴸ G ∘ᴸ H = F ∘ᴸ (G ∘ᴸ H) := rfl
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
comp_assoc
null
@[simps] protected sumElim : L.sum L'' →ᴸ L' where onFunction _n := Sum.elim (fun f => ϕ.onFunction f) fun f => ψ.onFunction f onRelation _n := Sum.elim (fun f => ϕ.onRelation f) fun f => ψ.onRelation f
def
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumElim
A language map defined on two factors of a sum.
sumElim_comp_inl (ψ : L'' →ᴸ L') : ϕ.sumElim ψ ∘ᴸ LHom.sumInl = ϕ := LHom.funext (funext fun _ => rfl) (funext fun _ => rfl)
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumElim_comp_inl
null
sumElim_comp_inr (ψ : L'' →ᴸ L') : ϕ.sumElim ψ ∘ᴸ LHom.sumInr = ψ := LHom.funext (funext fun _ => rfl) (funext fun _ => rfl)
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumElim_comp_inr
null
sumElim_inl_inr : LHom.sumInl.sumElim LHom.sumInr = LHom.id (L.sum L') := LHom.funext (funext fun _ => Sum.elim_inl_inr) (funext fun _ => Sum.elim_inl_inr)
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumElim_inl_inr
null
comp_sumElim {L3 : Language} (θ : L' →ᴸ L3) : θ ∘ᴸ ϕ.sumElim ψ = (θ ∘ᴸ ϕ).sumElim (θ ∘ᴸ ψ) := LHom.funext (funext fun _n => Sum.comp_elim _ _ _) (funext fun _n => Sum.comp_elim _ _ _)
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
comp_sumElim
null
@[simps] sumMap : L.sum L₁ →ᴸ L'.sum L₂ where onFunction _n := Sum.map (fun f => ϕ.onFunction f) fun f => ψ.onFunction f onRelation _n := Sum.map (fun f => ϕ.onRelation f) fun f => ψ.onRelation f @[simp]
def
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumMap
The map between two sum-languages induced by maps on the two factors.
sumMap_comp_inl : ϕ.sumMap ψ ∘ᴸ LHom.sumInl = LHom.sumInl ∘ᴸ ϕ := LHom.funext (funext fun _ => rfl) (funext fun _ => rfl) @[simp]
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumMap_comp_inl
null
sumMap_comp_inr : ϕ.sumMap ψ ∘ᴸ LHom.sumInr = LHom.sumInr ∘ᴸ ψ := LHom.funext (funext fun _ => rfl) (funext fun _ => rfl)
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumMap_comp_inr
null
protected Injective : Prop where onFunction {n} : Function.Injective fun f : L.Functions n => onFunction ϕ f onRelation {n} : Function.Injective fun R : L.Relations n => onRelation ϕ R
structure
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
Injective
A language homomorphism is injective when all the maps between symbol types are.
noncomputable defaultExpansion (ϕ : L →ᴸ L') [∀ (n) (f : L'.Functions n), Decidable (f ∈ Set.range fun f : L.Functions n => onFunction ϕ f)] [∀ (n) (r : L'.Relations n), Decidable (r ∈ Set.range fun r : L.Relations n => onRelation ϕ r)] (M : Type*) [Inhabited M] [L.Structure M] : L'.Structure M where funMap {n} f xs := if h' : f ∈ Set.range fun f : L.Functions n => onFunction ϕ f then funMap h'.choose xs else default RelMap {n} r xs := if h' : r ∈ Set.range fun r : L.Relations n => onRelation ϕ r then RelMap h'.choose xs else default
def
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
defaultExpansion
Pulls an `L`-structure along a language map `ϕ : L →ᴸ L'`, and then expands it to an `L'`-structure arbitrarily.
IsExpansionOn (M : Type*) [L.Structure M] [L'.Structure M] : Prop where map_onFunction : ∀ {n} (f : L.Functions n) (x : Fin n → M), funMap (ϕ.onFunction f) x = funMap f x := by exact fun {n} => isEmptyElim map_onRelation : ∀ {n} (R : L.Relations n) (x : Fin n → M), RelMap (ϕ.onRelation R) x = RelMap R x := by exact fun {n} => isEmptyElim @[simp]
class
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
IsExpansionOn
A language homomorphism is an expansion on a structure if it commutes with the interpretation of all symbols on that structure.
map_onFunction {M : Type*} [L.Structure M] [L'.Structure M] [ϕ.IsExpansionOn M] {n} (f : L.Functions n) (x : Fin n → M) : funMap (ϕ.onFunction f) x = funMap f x := IsExpansionOn.map_onFunction f x @[simp]
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
map_onFunction
null
map_onRelation {M : Type*} [L.Structure M] [L'.Structure M] [ϕ.IsExpansionOn M] {n} (R : L.Relations n) (x : Fin n → M) : RelMap (ϕ.onRelation R) x = RelMap R x := IsExpansionOn.map_onRelation R x
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
map_onRelation
null
id_isExpansionOn (M : Type*) [L.Structure M] : IsExpansionOn (LHom.id L) M := ⟨fun _ _ => rfl, fun _ _ => rfl⟩
instance
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
id_isExpansionOn
null
ofIsEmpty_isExpansionOn (M : Type*) [L.Structure M] [L'.Structure M] [L.IsAlgebraic] [L.IsRelational] : IsExpansionOn (LHom.ofIsEmpty L L') M where
instance
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
ofIsEmpty_isExpansionOn
null
sumElim_isExpansionOn {L'' : Language} (ψ : L'' →ᴸ L') (M : Type*) [L.Structure M] [L'.Structure M] [L''.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] : (ϕ.sumElim ψ).IsExpansionOn M := ⟨fun f _ => Sum.casesOn f (by simp) (by simp), fun R _ => Sum.casesOn R (by simp) (by simp)⟩
instance
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumElim_isExpansionOn
null
sumMap_isExpansionOn {L₁ L₂ : Language} (ψ : L₁ →ᴸ L₂) (M : Type*) [L.Structure M] [L'.Structure M] [L₁.Structure M] [L₂.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] : (ϕ.sumMap ψ).IsExpansionOn M := ⟨fun f _ => Sum.casesOn f (by simp) (by simp), fun R _ => Sum.casesOn R (by simp) (by simp)⟩
instance
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumMap_isExpansionOn
null
sumInl_isExpansionOn (M : Type*) [L.Structure M] [L'.Structure M] : (LHom.sumInl : L →ᴸ L.sum L').IsExpansionOn M := ⟨fun _f _ => rfl, fun _R _ => rfl⟩
instance
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumInl_isExpansionOn
null
sumInr_isExpansionOn (M : Type*) [L.Structure M] [L'.Structure M] : (LHom.sumInr : L' →ᴸ L.sum L').IsExpansionOn M := ⟨fun _f _ => rfl, fun _R _ => rfl⟩ @[simp]
instance
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumInr_isExpansionOn
null
funMap_sumInl [(L.sum L').Structure M] [(LHom.sumInl : L →ᴸ L.sum L').IsExpansionOn M] {n} {f : L.Functions n} {x : Fin n → M} : @funMap (L.sum L') M _ n (Sum.inl f) x = funMap f x := (LHom.sumInl : L →ᴸ L.sum L').map_onFunction f x @[simp]
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
funMap_sumInl
null
funMap_sumInr [(L'.sum L).Structure M] [(LHom.sumInr : L →ᴸ L'.sum L).IsExpansionOn M] {n} {f : L.Functions n} {x : Fin n → M} : @funMap (L'.sum L) M _ n (Sum.inr f) x = funMap f x := (LHom.sumInr : L →ᴸ L'.sum L).map_onFunction f x
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
funMap_sumInr
null
sumInl_injective : (LHom.sumInl : L →ᴸ L.sum L').Injective := ⟨fun h => Sum.inl_injective h, fun h => Sum.inl_injective h⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumInl_injective
null
sumInr_injective : (LHom.sumInr : L' →ᴸ L.sum L').Injective := ⟨fun h => Sum.inr_injective h, fun h => Sum.inr_injective h⟩
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
sumInr_injective
null
Injective.isExpansionOn_default {ϕ : L →ᴸ L'} [∀ (n) (f : L'.Functions n), Decidable (f ∈ Set.range fun f : L.Functions n => ϕ.onFunction f)] [∀ (n) (r : L'.Relations n), Decidable (r ∈ Set.range fun r : L.Relations n => ϕ.onRelation r)] (h : ϕ.Injective) (M : Type*) [Inhabited M] [L.Structure M] : @IsExpansionOn L L' ϕ M _ (ϕ.defaultExpansion M) := by letI := ϕ.defaultExpansion M refine ⟨fun {n} f xs => ?_, fun {n} r xs => ?_⟩ · have hf : ϕ.onFunction f ∈ Set.range fun f : L.Functions n => ϕ.onFunction f := ⟨f, rfl⟩ refine (dif_pos hf).trans ?_ rw [h.onFunction hf.choose_spec] · have hr : ϕ.onRelation r ∈ Set.range fun r : L.Relations n => ϕ.onRelation r := ⟨r, rfl⟩ refine (dif_pos hr).trans ?_ rw [h.onRelation hr.choose_spec]
theorem
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
Injective.isExpansionOn_default
null
LEquiv (L L' : Language) where /-- The forward language homomorphism -/ toLHom : L →ᴸ L' /-- The inverse language homomorphism -/ invLHom : L' →ᴸ L left_inv : invLHom.comp toLHom = LHom.id L right_inv : toLHom.comp invLHom = LHom.id L' @[inherit_doc] infixl:10 " ≃ᴸ " => LEquiv
structure
ModelTheory
[ "Mathlib.ModelTheory.Basic" ]
Mathlib/ModelTheory/LanguageMap.lean
LEquiv
A language equivalence maps the symbols of one language to symbols of another bijectively.