File: Mathlib/ModelTheory/Fraisse.lean

full_name: FirstOrder.Language.age
code: /-- The age of a structure `M` is the class of finitely-generated structures that embed into it. -/
def age (M : Type w) [L.Structure M] : Set (Bundled.{w} L.Structure) 
goal: Set (CategoryTheory.Bundled L.Structure)

full_name: FirstOrder.Language.Hereditary
code: /-- A class `K` has the hereditary property when all finitely-generated structures that embed into
  structures in `K` are also in `K`.  -/
def Hereditary : Prop 
goal: Prop

full_name: FirstOrder.Language.JointEmbedding
code: /-- 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. -/
def JointEmbedding : Prop 
goal: Prop

full_name: FirstOrder.Language.Amalgamation
code: /-- 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. -/
def Amalgamation : Prop 
goal: Prop

full_name: FirstOrder.Language.IsFraisse.is_equiv_invariant
code: /-- A Fraïssé class is a nonempty, isomorphism-invariant, essentially countable class of structures
satisfying the hereditary, joint embedding, and amalgamation properties. -/
class IsFraisse : Prop where
  is_nonempty : K.Nonempty
  FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M
  is_equiv_invariant : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K)
  is_essentially_countable : (Quotient.mk' '' K).Countable
  hereditary : Hereditary K
  jointEmbedding : JointEmbedding K
  amalgamation : Amalgamation K
goal: Nonempty (↑M ≃[L] ↑N) → (M ∈ K ↔ N ∈ K)

full_name: FirstOrder.Language.IsFraisse.amalgamation
code: /-- A Fraïssé class is a nonempty, isomorphism-invariant, essentially countable class of structures
satisfying the hereditary, joint embedding, and amalgamation properties. -/
class IsFraisse : Prop where
  is_nonempty : K.Nonempty
  FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M
  is_equiv_invariant : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K)
  is_essentially_countable : (Quotient.mk' '' K).Countable
  hereditary : Hereditary K
  jointEmbedding : JointEmbedding K
  amalgamation : Amalgamation K
goal: FirstOrder.Language.Amalgamation K

full_name: FirstOrder.Language.IsFraisse.FG
code: /-- A Fraïssé class is a nonempty, isomorphism-invariant, essentially countable class of structures
satisfying the hereditary, joint embedding, and amalgamation properties. -/
class IsFraisse : Prop where
  is_nonempty : K.Nonempty
  FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M
  is_equiv_invariant : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K)
  is_essentially_countable : (Quotient.mk' '' K).Countable
  hereditary : Hereditary K
  jointEmbedding : JointEmbedding K
  amalgamation : Amalgamation K
goal: M ∈ K → FirstOrder.Language.Structure.FG L ↑M

full_name: FirstOrder.Language.IsFraisse.is_essentially_countable
code: /-- A Fraïssé class is a nonempty, isomorphism-invariant, essentially countable class of structures
satisfying the hereditary, joint embedding, and amalgamation properties. -/
class IsFraisse : Prop where
  is_nonempty : K.Nonempty
  FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M
  is_equiv_invariant : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K)
  is_essentially_countable : (Quotient.mk' '' K).Countable
  hereditary : Hereditary K
  jointEmbedding : JointEmbedding K
  amalgamation : Amalgamation K
goal: (Quotient.mk' '' K).Countable

full_name: FirstOrder.Language.IsFraisse
code: /-- A Fraïssé class is a nonempty, isomorphism-invariant, essentially countable class of structures
satisfying the hereditary, joint embedding, and amalgamation properties. -/
class IsFraisse : Prop where
  is_nonempty : K.Nonempty
  FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M
  is_equiv_invariant : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K)
  is_essentially_countable : (Quotient.mk' '' K).Countable
  hereditary : Hereditary K
  jointEmbedding : JointEmbedding K
  amalgamation : Amalgamation K
goal: Prop

full_name: FirstOrder.Language.IsFraisse.jointEmbedding
code: /-- A Fraïssé class is a nonempty, isomorphism-invariant, essentially countable class of structures
satisfying the hereditary, joint embedding, and amalgamation properties. -/
class IsFraisse : Prop where
  is_nonempty : K.Nonempty
  FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M
  is_equiv_invariant : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K)
  is_essentially_countable : (Quotient.mk' '' K).Countable
  hereditary : Hereditary K
  jointEmbedding : JointEmbedding K
  amalgamation : Amalgamation K
goal: FirstOrder.Language.JointEmbedding K

full_name: FirstOrder.Language.IsFraisse.is_nonempty
code: /-- A Fraïssé class is a nonempty, isomorphism-invariant, essentially countable class of structures
satisfying the hereditary, joint embedding, and amalgamation properties. -/
class IsFraisse : Prop where
  is_nonempty : K.Nonempty
  FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M
  is_equiv_invariant : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K)
  is_essentially_countable : (Quotient.mk' '' K).Countable
  hereditary : Hereditary K
  jointEmbedding : JointEmbedding K
  amalgamation : Amalgamation K
goal: K.Nonempty

full_name: FirstOrder.Language.IsFraisse.hereditary
code: /-- A Fraïssé class is a nonempty, isomorphism-invariant, essentially countable class of structures
satisfying the hereditary, joint embedding, and amalgamation properties. -/
class IsFraisse : Prop where
  is_nonempty : K.Nonempty
  FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M
  is_equiv_invariant : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K)
  is_essentially_countable : (Quotient.mk' '' K).Countable
  hereditary : Hereditary K
  jointEmbedding : JointEmbedding K
  amalgamation : Amalgamation K
goal: FirstOrder.Language.Hereditary K

full_name: FirstOrder.Language.age.is_equiv_invariant
code: theorem age.is_equiv_invariant (N P : Bundled.{w} L.Structure) (h : Nonempty (N ≃[L] P)) :
    N ∈ L.age M ↔ P ∈ L.age M 
goal: N ∈ L.age M ↔ P ∈ L.age M

full_name: FirstOrder.Language.Embedding.age_subset_age
code: theorem Embedding.age_subset_age (MN : M ↪[L] N) : L.age M ⊆ L.age N 
goal: L.age M ⊆ L.age N

full_name: FirstOrder.Language.Equiv.age_eq_age
code: theorem Equiv.age_eq_age (MN : M ≃[L] N) : L.age M = L.age N 
goal: L.age M = L.age N

full_name: FirstOrder.Language.Structure.FG.mem_age_of_equiv
code: theorem 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 
goal: N ∈ L.age ↑M

full_name: FirstOrder.Language.Hereditary.is_equiv_invariant_of_fg
code: theorem 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 
goal: M ∈ K ↔ N ∈ K

full_name: FirstOrder.Language.age.nonempty
code: theorem age.nonempty : (L.age M).Nonempty 
goal: (L.age M).Nonempty

full_name: FirstOrder.Language.age.hereditary
code: theorem age.hereditary : Hereditary (L.age M) 
goal: FirstOrder.Language.Hereditary (L.age M)

full_name: FirstOrder.Language.age.jointEmbedding
code: theorem age.jointEmbedding : JointEmbedding (L.age M) 
goal: FirstOrder.Language.JointEmbedding (L.age M)

full_name: FirstOrder.Language.age.countable_quotient
code: /-- The age of a countable structure is essentially countable (has countably many isomorphism
classes). -/
theorem age.countable_quotient [h : Countable M] : (Quotient.mk' '' L.age M).Countable 
goal: (Quotient.mk' '' L.age M).Countable

full_name: FirstOrder.Language.age_directLimit
code: /-- The age of a direct limit of structures is the union of the ages of the structures. -/
-- @[simp] -- Porting note: cannot simplify itself
theorem 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) 
goal: L.age (FirstOrder.Language.DirectLimit G f) = ⋃ i, L.age (G i)

full_name: FirstOrder.Language.exists_cg_is_age_of
code: /-- Sufficient conditions for a class to be the age of a countably-generated structure. -/
theorem exists_cg_is_age_of (hn : K.Nonempty)
    (h : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K))
    (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 
goal: ∃ M, FirstOrder.Language.Structure.CG L ↑M ∧ L.age ↑M = K

full_name: FirstOrder.Language.exists_countable_is_age_of_iff
code: theorem 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 
goal: (∃ M, Countable ↑M ∧ L.age ↑M = K) ↔
  K.Nonempty ∧
    (∀ (M N : CategoryTheory.Bundled L.Structure), Nonempty (↑M ≃[L] ↑N) → (M ∈ K ↔ N ∈ K)) ∧
      (Quotient.mk' '' K).Countable ∧
        (∀ M ∈ K, FirstOrder.Language.Structure.FG L ↑M) ∧
          FirstOrder.Language.Hereditary K ∧ FirstOrder.Language.JointEmbedding K

full_name: FirstOrder.Language.IsUltrahomogeneous
code: /-- A structure `M` is ultrahomogeneous if every embedding of a finitely generated substructure
into `M` extends to an automorphism of `M`. -/
def IsUltrahomogeneous : Prop 
goal: Prop

full_name: FirstOrder.Language.IsFraisseLimit
code: /-- A structure `M` is a Fraïssé limit for a class `K` if it is countably generated,
ultrahomogeneous, and has age `K`. -/
structure IsFraisseLimit [Countable (Σ l, L.Functions l)] [Countable M] : Prop where
  protected ultrahomogeneous : IsUltrahomogeneous L M
  protected age : L.age M = K
goal: Prop

full_name: FirstOrder.Language.IsFraisseLimit.ultrahomogeneous
code: /-- A structure `M` is a Fraïssé limit for a class `K` if it is countably generated,
ultrahomogeneous, and has age `K`. -/
structure IsFraisseLimit [Countable (Σ l, L.Functions l)] [Countable M] : Prop where
  protected ultrahomogeneous : IsUltrahomogeneous L M
  protected age : L.age M = K
goal: L.IsUltrahomogeneous M

full_name: FirstOrder.Language.IsFraisseLimit.age
code: /-- A structure `M` is a Fraïssé limit for a class `K` if it is countably generated,
ultrahomogeneous, and has age `K`. -/
structure IsFraisseLimit [Countable (Σ l, L.Functions l)] [Countable M] : Prop where
  protected ultrahomogeneous : IsUltrahomogeneous L M
  protected age : L.age M = K
goal: L.age M = K

full_name: FirstOrder.Language.IsUltrahomogeneous.amalgamation_age
code: theorem IsUltrahomogeneous.amalgamation_age (h : L.IsUltrahomogeneous M) :
    Amalgamation (L.age M) 
goal: FirstOrder.Language.Amalgamation (L.age M)

full_name: FirstOrder.Language.IsUltrahomogeneous.age_isFraisse
code: theorem IsUltrahomogeneous.age_isFraisse [Countable M] (h : L.IsUltrahomogeneous M) :
    IsFraisse (L.age M) 
goal: FirstOrder.Language.IsFraisse (L.age M)

full_name: FirstOrder.Language.IsFraisseLimit.isFraisse
code: /-- If a class has a Fraïssé limit, it must be Fraïssé. -/
theorem isFraisse [Countable (Σ l, L.Functions l)] [Countable M] (h : IsFraisseLimit K M) :
    IsFraisse K 
goal: FirstOrder.Language.IsFraisse K