Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit d0efbcb

Browse files
committed
feat(model_theory/elementary_maps): Elementary maps respect all (bounded) formulas (#14252)
Generalizes `elementary_embedding.map_formula` to more classes of formula.
1 parent 599240f commit d0efbcb

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

src/data/set/basic.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,6 +2243,8 @@ def inclusion (h : s ⊆ t) : s → t :=
22432243

22442244
@[simp] lemma inclusion_self (x : s) : inclusion subset.rfl x = x := by { cases x, refl }
22452245

2246+
lemma inclusion_eq_id (h : s ⊆ s) : inclusion h = id := funext inclusion_self
2247+
22462248
@[simp] lemma inclusion_mk {h : s ⊆ t} (a : α) (ha : a ∈ s) : inclusion h ⟨a, ha⟩ = ⟨a, h ha⟩ := rfl
22472249

22482250
lemma inclusion_right (h : s ⊆ t) (x : t) (m : (x : α) ∈ s) : inclusion h ⟨x, m⟩ = x :=

src/model_theory/elementary_maps.lean

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,41 @@ instance fun_like : fun_like (M ↪ₑ[L] N) M (λ _, N) :=
5757
ext x,
5858
exact function.funext_iff.1 h x end }
5959

60-
@[simp] lemma map_formula (f : M ↪ₑ[L] N) {α : Type} [fintype α] (φ : L.formula α) (x : α → M) :
61-
φ.realize (f ∘ x) ↔ φ.realize x :=
60+
instance : has_coe_to_fun (M ↪ₑ[L] N) (λ _, M → N) := fun_like.has_coe_to_fun
61+
62+
@[simp] lemma map_bounded_formula (f : M ↪ₑ[L] N) {α : Type} {n : ℕ}
63+
(φ : L.bounded_formula α n) (v : α → M) (xs : fin n → M) :
64+
φ.realize (f ∘ v) (f ∘ xs) ↔ φ.realize v xs :=
6265
begin
63-
have g := fintype.equiv_fin α,
64-
have h := f.map_formula' (φ.relabel g) (x ∘ g.symm),
65-
rw [formula.realize_relabel, formula.realize_relabel, function.comp.assoc x g.symm g,
66-
g.symm_comp_self, function.comp.right_id] at h,
67-
rw [← h, iff_eq_eq],
68-
congr,
69-
ext y,
70-
simp,
66+
classical,
67+
rw [← bounded_formula.realize_restrict_free_var set.subset.rfl, set.inclusion_eq_id, iff_eq_eq],
68+
swap, { apply_instance },
69+
have h := f.map_formula' ((φ.restrict_free_var id).to_formula.relabel (fintype.equiv_fin _))
70+
((sum.elim (v ∘ coe) xs) ∘ (fintype.equiv_fin _).symm),
71+
simp only [formula.realize_relabel, bounded_formula.realize_to_formula, iff_eq_eq] at h,
72+
rw [← function.comp.assoc _ _ ((fintype.equiv_fin _).symm),
73+
function.comp.assoc _ ((fintype.equiv_fin _).symm) (fintype.equiv_fin _),
74+
equiv.symm_comp_self, function.comp.right_id, function.comp.assoc, sum.elim_comp_inl,
75+
function.comp.assoc _ _ sum.inr, sum.elim_comp_inr,
76+
← function.comp.assoc] at h,
77+
refine h.trans _,
78+
rw [function.comp.assoc _ _ (fintype.equiv_fin _), equiv.symm_comp_self,
79+
function.comp.right_id, sum.elim_comp_inl, sum.elim_comp_inr, ← set.inclusion_eq_id,
80+
bounded_formula.realize_restrict_free_var set.subset.rfl],
7181
end
7282

83+
@[simp] lemma map_formula (f : M ↪ₑ[L] N) {α : Type} (φ : L.formula α) (x : α → M) :
84+
φ.realize (f ∘ x) ↔ φ.realize x :=
85+
by rw [formula.realize, formula.realize, ← f.map_bounded_formula, unique.eq_default (f ∘ default)]
86+
87+
lemma map_sentence (f : M ↪ₑ[L] N) (φ : L.sentence) :
88+
M ⊨ φ ↔ N ⊨ φ :=
89+
by rw [sentence.realize, sentence.realize, ← f.map_formula, unique.eq_default (f ∘ default)]
90+
91+
lemma Theory_model_iff (f : M ↪ₑ[L] N) (T : L.Theory) :
92+
M ⊨ T ↔ N ⊨ T :=
93+
by simp only [Theory.model_iff, f.map_sentence]
94+
7395
@[simp] lemma injective (φ : M ↪ₑ[L] N) :
7496
function.injective φ :=
7597
begin
@@ -84,9 +106,6 @@ end
84106
instance embedding_like : embedding_like (M ↪ₑ[L] N) M N :=
85107
{ injective' := injective }
86108

87-
instance has_coe_to_fun : has_coe_to_fun (M ↪ₑ[L] N) (λ _, M → N) :=
88-
⟨λ f, f.to_fun⟩
89-
90109
@[simp] lemma map_fun (φ : M ↪ₑ[L] N) {n : ℕ} (f : L.functions n) (x : fin n → M) :
91110
φ (fun_map f x) = fun_map f (φ ∘ x) :=
92111
begin
@@ -314,12 +333,7 @@ instance : inhabited (L.elementary_substructure M) := ⟨⊤⟩
314333

315334
@[simp] lemma realize_sentence (S : L.elementary_substructure M) (φ : L.sentence) :
316335
S ⊨ φ ↔ M ⊨ φ :=
317-
begin
318-
have h := S.is_elementary (φ.relabel (empty.elim : empty → fin 0)) default,
319-
rw [formula.realize_relabel, formula.realize_relabel] at h,
320-
exact (congr (congr rfl (congr rfl (unique.eq_default _))) (congr rfl (unique.eq_default _))).mp
321-
h.symm,
322-
end
336+
S.subtype.map_sentence φ
323337

324338
@[simp] lemma Theory_model_iff (S : L.elementary_substructure M) (T : L.Theory) :
325339
S ⊨ T ↔ M ⊨ T :=

0 commit comments

Comments
 (0)