File: Mathlib/ModelTheory/ElementaryMaps.lean

full_name: FirstOrder.Language.ElementaryEmbedding.toFun
code: /-- An elementary embedding of first-order structures is an embedding that commutes with the
  realizations of formulas. -/
structure ElementaryEmbedding where
  toFun : M → N
  -- Porting note:
  -- The autoparam here used to be `obviously`. We would like to replace it with `aesop`
  -- but that isn't currently sufficient.
  -- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases
  -- If that can be improved, we should change this to `by aesop` and remove the proofs below.
  map_formula' :
    ∀ ⦃n⦄ (φ : L.Formula (Fin n)) (x : Fin n → M), φ.Realize (toFun ∘ x) ↔ φ.Realize x := by
    intros; trivial
goal: M → N

full_name: FirstOrder.Language.ElementaryEmbedding
code: /-- An elementary embedding of first-order structures is an embedding that commutes with the
  realizations of formulas. -/
structure ElementaryEmbedding where
  toFun : M → N
  -- Porting note:
  -- The autoparam here used to be `obviously`. We would like to replace it with `aesop`
  -- but that isn't currently sufficient.
  -- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases
  -- If that can be improved, we should change this to `by aesop` and remove the proofs below.
  map_formula' :
    ∀ ⦃n⦄ (φ : L.Formula (Fin n)) (x : Fin n → M), φ.Realize (toFun ∘ x) ↔ φ.Realize x := by
    intros; trivial
goal: Type (max u_1 u_2)

full_name: FirstOrder.Language.ElementaryEmbedding.map_formula'
code: /-- An elementary embedding of first-order structures is an embedding that commutes with the
  realizations of formulas. -/
structure ElementaryEmbedding where
  toFun : M → N
  -- Porting note:
  -- The autoparam here used to be `obviously`. We would like to replace it with `aesop`
  -- but that isn't currently sufficient.
  -- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases
  -- If that can be improved, we should change this to `by aesop` and remove the proofs below.
  map_formula' :
    ∀ ⦃n⦄ (φ : L.Formula (Fin n)) (x : Fin n → M), φ.Realize (toFun ∘ x) ↔ φ.Realize x := by
    intros; trivial
goal: φ.Realize (↑self ∘ x) ↔ φ.Realize x

full_name: FirstOrder._aux_Mathlib_ModelTheory_ElementaryMaps___unexpand_FirstOrder_Language_ElementaryEmbedding_1
code: @[inherit_doc FirstOrder.Language.ElementaryEmbedding]
scoped[FirstOrder] notation:25 A " ↪ₑ[" L "] " B => FirstOrder.Language.ElementaryEmbedding L A B
goal: Lean.PrettyPrinter.Unexpander

full_name: FirstOrder.«_aux_Mathlib_ModelTheory_ElementaryMaps___macroRules_FirstOrder_term_↪ₑ[_]__1»
code: @[inherit_doc FirstOrder.Language.ElementaryEmbedding]
scoped[FirstOrder] notation:25 A " ↪ₑ[" L "] " B => FirstOrder.Language.ElementaryEmbedding L A B
goal: Lean.Macro

full_name: FirstOrder.Language.ElementaryEmbedding.instFunLike
code: instance instFunLike : FunLike (M ↪ₑ[L] N) M N 
goal: FunLike (M ↪ₑ[L] N) M N

full_name: FirstOrder.Language.ElementaryEmbedding.instCoeFunForall
code: instance : CoeFun (M ↪ₑ[L] N) fun _ => M → N 
goal: CoeFun (M ↪ₑ[L] N) fun x => M → N

full_name: FirstOrder.Language.ElementaryEmbedding.map_boundedFormula
code: @[simp]
theorem map_boundedFormula (f : M ↪ₑ[L] N) {α : Type*} {n : ℕ} (φ : L.BoundedFormula α n)
    (v : α → M) (xs : Fin n → M) : φ.Realize (f ∘ v) (f ∘ xs) ↔ φ.Realize v xs 
goal: φ.Realize (⇑f ∘ v) (⇑f ∘ xs) ↔ φ.Realize v xs

full_name: FirstOrder.Language.ElementaryEmbedding.map_formula
code: @[simp]
theorem map_formula (f : M ↪ₑ[L] N) {α : Type*} (φ : L.Formula α) (x : α → M) :
    φ.Realize (f ∘ x) ↔ φ.Realize x 
goal: φ.Realize (⇑f ∘ x) ↔ φ.Realize x

full_name: FirstOrder.Language.ElementaryEmbedding.map_sentence
code: theorem map_sentence (f : M ↪ₑ[L] N) (φ : L.Sentence) : M ⊨ φ ↔ N ⊨ φ 
goal: M ⊨ φ ↔ N ⊨ φ

full_name: FirstOrder.Language.ElementaryEmbedding.theory_model_iff
code: theorem theory_model_iff (f : M ↪ₑ[L] N) (T : L.Theory) : M ⊨ T ↔ N ⊨ T 
goal: M ⊨ T ↔ N ⊨ T

full_name: FirstOrder.Language.ElementaryEmbedding.elementarilyEquivalent
code: theorem elementarilyEquivalent (f : M ↪ₑ[L] N) : M ≅[L] N 
goal: M ≅[L] N

full_name: FirstOrder.Language.ElementaryEmbedding.injective
code: @[simp]
theorem injective (φ : M ↪ₑ[L] N) : Function.Injective φ 
goal: Function.Injective ⇑φ

full_name: FirstOrder.Language.ElementaryEmbedding.embeddingLike
code: instance embeddingLike : EmbeddingLike (M ↪ₑ[L] N) M N 
goal: EmbeddingLike (M ↪ₑ[L] N) M N

full_name: FirstOrder.Language.ElementaryEmbedding.map_fun
code: @[simp]
theorem map_fun (φ : M ↪ₑ[L] N) {n : ℕ} (f : L.Functions n) (x : Fin n → M) :
    φ (funMap f x) = funMap f (φ ∘ x) 
goal: φ (FirstOrder.Language.Structure.funMap f x) = FirstOrder.Language.Structure.funMap f (⇑φ ∘ x)

full_name: FirstOrder.Language.ElementaryEmbedding.map_rel
code: @[simp]
theorem map_rel (φ : M ↪ₑ[L] N) {n : ℕ} (r : L.Relations n) (x : Fin n → M) :
    RelMap r (φ ∘ x) ↔ RelMap r x 
goal: FirstOrder.Language.Structure.RelMap r (⇑φ ∘ x) ↔ FirstOrder.Language.Structure.RelMap r x

full_name: FirstOrder.Language.ElementaryEmbedding.strongHomClass
code: instance strongHomClass : StrongHomClass L (M ↪ₑ[L] N) M N 
goal: L.StrongHomClass (M ↪ₑ[L] N) M N

full_name: FirstOrder.Language.ElementaryEmbedding.map_constants
code: @[simp]
theorem map_constants (φ : M ↪ₑ[L] N) (c : L.Constants) : φ c = c 
goal: φ ↑c = ↑c

full_name: FirstOrder.Language.ElementaryEmbedding.toEmbedding
code: /-- An elementary embedding is also a first-order embedding. -/
def toEmbedding (f : M ↪ₑ[L] N) : M ↪[L] N 
goal: M ↪[L] N

full_name: FirstOrder.Language.ElementaryEmbedding.toHom
code: /-- An elementary embedding is also a first-order homomorphism. -/
def toHom (f : M ↪ₑ[L] N) : M →[L] N 
goal: M →[L] N

full_name: FirstOrder.Language.ElementaryEmbedding.toEmbedding_toHom
code: @[simp]
theorem toEmbedding_toHom (f : M ↪ₑ[L] N) : f.toEmbedding.toHom = f.toHom 
goal: f.toEmbedding.toHom = f.toHom

full_name: FirstOrder.Language.ElementaryEmbedding.coe_toHom
code: @[simp]
theorem coe_toHom {f : M ↪ₑ[L] N} : (f.toHom : M → N) = (f : M → N) 
goal: ⇑f.toHom = ⇑f

full_name: FirstOrder.Language.ElementaryEmbedding.coe_toEmbedding
code: @[simp]
theorem coe_toEmbedding (f : M ↪ₑ[L] N) : (f.toEmbedding : M → N) = (f : M → N) 
goal: ⇑f.toEmbedding = ⇑f

full_name: FirstOrder.Language.ElementaryEmbedding.coe_injective
code: theorem coe_injective : @Function.Injective (M ↪ₑ[L] N) (M → N) (↑) 
goal: Function.Injective DFunLike.coe

full_name: FirstOrder.Language.ElementaryEmbedding.ext
code: @[ext]
theorem ext ⦃f g : M ↪ₑ[L] N⦄ (h : ∀ x, f x = g x) : f = g 
goal: f = g

full_name: FirstOrder.Language.ElementaryEmbedding.ext_iff
code: theorem ext_iff {f g : M ↪ₑ[L] N} : f = g ↔ ∀ x, f x = g x 
goal: f = g ↔ ∀ (x : M), f x = g x

full_name: FirstOrder.Language.ElementaryEmbedding.refl
code: /-- The identity elementary embedding from a structure to itself -/
@[refl]
def refl : M ↪ₑ[L] M 
goal: M ↪ₑ[L] M

full_name: FirstOrder.Language.ElementaryEmbedding.instInhabited
code: instance : Inhabited (M ↪ₑ[L] M) 
goal: Inhabited (M ↪ₑ[L] M)

full_name: FirstOrder.Language.ElementaryEmbedding.refl_apply
code: @[simp]
theorem refl_apply (x : M) : refl L M x = x 
goal: (FirstOrder.Language.ElementaryEmbedding.refl L M) x = x

full_name: FirstOrder.Language.ElementaryEmbedding.comp
code: /-- Composition of elementary embeddings -/
@[trans]
def comp (hnp : N ↪ₑ[L] P) (hmn : M ↪ₑ[L] N) : M ↪ₑ[L] P 
goal: M ↪ₑ[L] P

full_name: FirstOrder.Language.ElementaryEmbedding.comp_apply
code: @[simp]
theorem comp_apply (g : N ↪ₑ[L] P) (f : M ↪ₑ[L] N) (x : M) : g.comp f x = g (f x) 
goal: (g.comp f) x = g (f x)

full_name: FirstOrder.Language.ElementaryEmbedding.comp_assoc
code: /-- Composition of elementary embeddings is associative. -/
theorem comp_assoc (f : M ↪ₑ[L] N) (g : N ↪ₑ[L] P) (h : P ↪ₑ[L] Q) :
    (h.comp g).comp f = h.comp (g.comp f) 
goal: (h.comp g).comp f = h.comp (g.comp f)

full_name: FirstOrder.Language.elementaryDiagram
code: /-- The elementary diagram of an `L`-structure is the set of all sentences with parameters it
  satisfies. -/
abbrev elementaryDiagram : L[[M]].Theory 
goal: L[[M]].Theory

full_name: FirstOrder.Language.ElementaryEmbedding.ofModelsElementaryDiagram_toFun
code: /-- The canonical elementary embedding of an `L`-structure into any model of its elementary diagram
-/
@[simps]
def ElementaryEmbedding.ofModelsElementaryDiagram (N : Type*) [L.Structure N] [L[[M]].Structure N]
    [(lhomWithConstants L M).IsExpansionOn N] [N ⊨ L.elementaryDiagram M] : M ↪ₑ[L] N 
goal: ∀ (a : M),
  (FirstOrder.Language.ElementaryEmbedding.ofModelsElementaryDiagram L M N) a =
    (FirstOrder.Language.constantMap ∘ Sum.inr) a

full_name: FirstOrder.Language.ElementaryEmbedding.ofModelsElementaryDiagram
code: /-- The canonical elementary embedding of an `L`-structure into any model of its elementary diagram
-/
@[simps]
def ElementaryEmbedding.ofModelsElementaryDiagram (N : Type*) [L.Structure N] [L[[M]].Structure N]
    [(lhomWithConstants L M).IsExpansionOn N] [N ⊨ L.elementaryDiagram M] : M ↪ₑ[L] N 
goal: M ↪ₑ[L] N

full_name: FirstOrder.Language.Embedding.isElementary_of_exists
code: /-- The **Tarski-Vaught test** for elementarity of an embedding. -/
theorem isElementary_of_exists (f : M ↪[L] N)
    (htv :
      ∀ (n : ℕ) (φ : L.BoundedFormula Empty (n + 1)) (x : Fin n → M) (a : N),
        φ.Realize default (Fin.snoc (f ∘ x) a : _ → N) →
          ∃ b : M, φ.Realize default (Fin.snoc (f ∘ x) (f b) : _ → N)) :
    ∀ {n} (φ : L.Formula (Fin n)) (x : Fin n → M), φ.Realize (f ∘ x) ↔ φ.Realize x 
goal: φ.Realize (⇑f ∘ x) ↔ φ.Realize x

full_name: FirstOrder.Language.Embedding.toElementaryEmbedding_toFun
code: /-- Bundles an embedding satisfying the Tarski-Vaught test as an elementary embedding. -/
@[simps]
def toElementaryEmbedding (f : M ↪[L] N)
    (htv :
      ∀ (n : ℕ) (φ : L.BoundedFormula Empty (n + 1)) (x : Fin n → M) (a : N),
        φ.Realize default (Fin.snoc (f ∘ x) a : _ → N) →
          ∃ b : M, φ.Realize default (Fin.snoc (f ∘ x) (f b) : _ → N)) :
    M ↪ₑ[L] N 
goal: (f.toElementaryEmbedding htv) a = f a

full_name: FirstOrder.Language.Embedding.toElementaryEmbedding
code: /-- Bundles an embedding satisfying the Tarski-Vaught test as an elementary embedding. -/
@[simps]
def toElementaryEmbedding (f : M ↪[L] N)
    (htv :
      ∀ (n : ℕ) (φ : L.BoundedFormula Empty (n + 1)) (x : Fin n → M) (a : N),
        φ.Realize default (Fin.snoc (f ∘ x) a : _ → N) →
          ∃ b : M, φ.Realize default (Fin.snoc (f ∘ x) (f b) : _ → N)) :
    M ↪ₑ[L] N 
goal: M ↪ₑ[L] N

full_name: FirstOrder.Language.Equiv.toElementaryEmbedding
code: /-- A first-order equivalence is also an elementary embedding. -/
def toElementaryEmbedding (f : M ≃[L] N) : M ↪ₑ[L] N 
goal: M ↪ₑ[L] N

full_name: FirstOrder.Language.Equiv.toElementaryEmbedding_toEmbedding
code: @[simp]
theorem toElementaryEmbedding_toEmbedding (f : M ≃[L] N) :
    f.toElementaryEmbedding.toEmbedding = f.toEmbedding 
goal: f.toElementaryEmbedding.toEmbedding = f.toEmbedding

full_name: FirstOrder.Language.Equiv.coe_toElementaryEmbedding
code: @[simp]
theorem coe_toElementaryEmbedding (f : M ≃[L] N) :
    (f.toElementaryEmbedding : M → N) = (f : M → N) 
goal: ⇑f.toElementaryEmbedding = ⇑f

full_name: FirstOrder.Language.realize_term_substructure
code: @[simp]
theorem realize_term_substructure {α : Type*} {S : L.Substructure M} (v : α → S) (t : L.Term α) :
    t.realize ((↑) ∘ v) = (↑(t.realize v) : M) 
goal: FirstOrder.Language.Term.realize (Subtype.val ∘ v) t = ↑(FirstOrder.Language.Term.realize v t)