Skip to content

Commit 6cd948c

Browse files
committed
Use a type synonym for withConstants structures
1 parent 6811884 commit 6cd948c

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

Mathlib/ModelTheory/ElementaryMaps.lean

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,17 @@ theorem comp_assoc (f : M ↪ₑ[L] N) (g : N ↪ₑ[L] P) (h : P ↪ₑ[L] Q) :
196196

197197
/-- Lifts an elementary embedding to the expanded language with constants -/
198198
def liftWithConstants (f : M ↪ₑ[L] N) (A : Set M) :
199-
@ElementaryEmbedding (L[[A]]) M N _ (f.toEmbedding.withConstantsStructure A) := by
200-
letI : L[[A]].Structure N := f.toEmbedding.withConstantsStructure A
199+
M ↪ₑ[L[[A]]] (f.toEmbedding.withConstants A) := by
201200
refine ⟨f, ?_⟩
202201
intro n φ x
203-
have h : Sum.elim (fun a ↦ ↑(L.con a)) (f ∘ x) = f ∘ Sum.elim (fun a : ↑A ↦ ↑(L.con a)) x :=
202+
have h :
203+
(Sum.elim (fun a ↦ ↑(L.con a)) (⇑f ∘ x) :
204+
↑A ⊕ Fin n → f.toEmbedding.withConstants A) =
205+
f ∘ Sum.elim (fun a ↦ ↑(L.con a)) x :=
204206
(Sum.comp_elim _ _ _).symm
205207
have h' : (default : Fin 0 → N) = f ∘ (default : Fin 0 → M) := List.ofFn_inj.mp rfl
206-
simp [Formula.Realize, h', ← BoundedFormula.realize_constantsVarsEquiv, h]
208+
simp only [Formula.Realize, h', ← BoundedFormula.realize_constantsVarsEquiv, h]
209+
exact f.map_boundedFormula _ _ _
207210

208211
end ElementaryEmbedding
209212

Mathlib/ModelTheory/LanguageMap.lean

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,15 +502,23 @@ instance map_constants_inclusion_isExpansionOn :
502502

503503
variable {L} (A) {N : Type w'} [L.Structure N] (f : M ↪[L] N)
504504

505-
/-- Lifts a structure to the expanded language with respect to an embedding. -/
506-
def Embedding.withConstantsStructure : L[[A]].Structure N :=
507-
letI : (constantsOn A).Structure N := constantsOn.structure fun a => f a
508-
L.withConstantsStructure A
505+
/-- Type synonym for `N` used to equip it with an `L[[A]]`-structure where the new constants on `A`
506+
are interpreted via the embedding `f`. -/
507+
@[nolint unusedArguments]
508+
def Embedding.withConstants (f : M ↪[L] N) (A : Set M) : Type w' := N
509+
510+
instance : L.Structure (f.withConstants A) := by
511+
dsimp [Embedding.withConstants]
512+
infer_instance
513+
514+
instance (f : M ↪[L] N) : (constantsOn A).Structure (f.withConstants A) :=
515+
constantsOn.structure fun a => f a
516+
517+
instance : L[[A]].Structure (f.withConstants A) := L.withConstantsStructure A
509518

510519
/-- Lifts an embedding to the expanded language with constants. -/
511520
def Embedding.liftWithConstants :
512-
@Embedding (L[[A]]) M N _ (f.withConstantsStructure A) := by
513-
letI : L[[A]].Structure N := f.withConstantsStructure A
521+
M ↪[L[[A]]] f.withConstants A := by
514522
refine ⟨f.toEmbedding, ?_, ?_⟩
515523
· intro n g x
516524
cases g with

0 commit comments

Comments
 (0)