Skip to content

Commit d9aebee

Browse files
committed
feat: add liftWithConstants and withConstantsStructure for embeddings
1 parent fa0ba71 commit d9aebee

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

Mathlib/ModelTheory/ElementaryMaps.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,20 @@ theorem comp_assoc (f : M ↪ₑ[L] N) (g : N ↪ₑ[L] P) (h : P ↪ₑ[L] Q) :
194194
(h.comp g).comp f = h.comp (g.comp f) :=
195195
rfl
196196

197+
def liftWithConstants (f : M ↪ₑ[L] N) (A : Set M) :
198+
@ElementaryEmbedding (L[[A]]) M N _ (f.toEmbedding.withConstantsStructure A) := by
199+
letI : L[[A]].Structure N := f.toEmbedding.withConstantsStructure A
200+
refine ⟨f,?_⟩
201+
intro n φ x
202+
simp only [Formula.Realize,
203+
← BoundedFormula.realize_constantsVarsEquiv]
204+
have h: @Sum.elim (↑A) (Fin n) N (fun a ↦ ↑(L.con a)) (⇑f ∘ x) =
205+
f ∘ @Sum.elim (↑A) (Fin n) M (fun a ↦ ↑(L.con a)) x := by
206+
rw [Sum.comp_elim]
207+
congr 1
208+
have h': (default : Fin 0 → N) = f ∘ (default : Fin 0 → M) := List.ofFn_inj.mp rfl
209+
simp only [h, coe_con, h', map_boundedFormula]
210+
197211
end ElementaryEmbedding
198212

199213
variable (L) (M)

Mathlib/ModelTheory/LanguageMap.lean

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,35 @@ instance map_constants_inclusion_isExpansionOn :
499499
(L.lhomWithConstantsMap (Set.inclusion h)).IsExpansionOn M :=
500500
LHom.sumMap_isExpansionOn _ _ _
501501

502+
variable {L} (A) {N : Type w'} [L.Structure N] (f : M ↪[L] N)
503+
504+
def Embedding.withConstantsStructure : L[[A]].Structure N :=
505+
letI : (constantsOn A).Structure N := constantsOn.structure fun a => f a
506+
L.withConstantsStructure A
507+
508+
def Embedding.liftWithConstants :
509+
@Embedding (L[[A]]) M N _ (f.withConstantsStructure A) := by
510+
letI : L[[A]].Structure N := f.withConstantsStructure A
511+
refine ⟨f.toEmbedding,?_,?_⟩
512+
· intro n g x
513+
cases g with
514+
| inl g =>
515+
simp only [withConstants_funMap_sumInl]
516+
exact f.map_fun' g x
517+
| inr c =>
518+
cases n with
519+
| succ n => exact isEmptyElim c
520+
| zero =>
521+
simp only [withConstants_funMap_sumInr, constantMap]
522+
rfl
523+
· intro n R x
524+
cases R with
525+
| inl R =>
526+
simp only [withConstants_relMap_sumInl]
527+
exact f.map_rel' R x
528+
| inr r =>
529+
exact isEmptyElim r
530+
502531
end WithConstants
503532

504533
end Language

0 commit comments

Comments
 (0)