Skip to content

Commit 9947007

Browse files
committed
feat(ModelTheory/PartialTypes): add lemma model_withFormulaSet_of_realize and simplify proofs
Add the lemma `model_withFormulaSet_of_realize` which states that if a model `M` of `T` realizes a set of formulas `S` via a tuple `v`, then `M` (with the constants-on structure induced by `v`) models `T` adjoined with `S`. Use this lemma to simplify: - `partialType_iff_finitelyRealizable` (second direction) - `partialType_completeTheory_iff_finitelyRealizable` (second direction)
1 parent 90f0851 commit 9947007

1 file changed

Lines changed: 29 additions & 32 deletions

File tree

Mathlib/ModelTheory/PartialTypes.lean

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,20 @@ theorem exists_modelType_isRealizedIn (p : T.PartialType α) :
162162
obtain ⟨M⟩ := p.isSatisfiable
163163
exact ⟨p.reductModelType M, p.isRealizedIn_reductModelType M⟩
164164

165+
/-- If `M` models `T` and a tuple `v` realizes every formula in `S`, then `M` (with the
166+
`constantsOn` structure induced by `v`) models the theory `T` adjoined with the formulas `S`. -/
167+
lemma model_withFormulaSet_of_realize {M : Type w'} [L.Structure M] [M ⊨ T]
168+
(v : α → M) {S : Set (L.Formula α)} (hS : ∀ φ ∈ S, φ.Realize v) :
169+
letI : (constantsOn α).Structure M := constantsOn.structure v;
170+
M ⊨ T.withFormulaSet S := by
171+
letI : (constantsOn α).Structure M := constantsOn.structure v
172+
have hM_on : M ⊨ (L.lhomWithConstants α).onTheory T :=
173+
(LHom.onTheory_model _ _).2 inferInstance
174+
refine (Theory.model_iff (T.withFormulaSet S)).2 fun φ hφ => ?_
175+
rcases hφ with (hφ | ⟨ψ, hψ, rfl⟩)
176+
· exact hM_on.realize_of_mem _ hφ
177+
· exact (Formula.realize_equivSentence M ψ).2 (hS ψ hψ)
178+
165179
/-- Compactness for partial types: a set of formulas extends to a partial type over `T` if and
166180
only if every finite subset is realized in some model of `T`. -/
167181
theorem partialType_iff_finitelyRealizable
@@ -182,27 +196,23 @@ theorem partialType_iff_finitelyRealizable
182196
classical
183197
let s : Finset (L.Formula α) :=
184198
(T0.map (Formula.equivSentence).symm.toEmbedding).filter fun φ => φ ∈ S
185-
have hs : (↑s : Set (L.Formula α)) ⊆ S := by
186-
intro φ hφ
199+
have hs : (s : Set (L.Formula α)) ⊆ S := fun φ hφ => by
187200
simp only [Finset.coe_filter, Finset.mem_map_equiv, _root_.Equiv.symm_symm, mem_setOf_eq,
188201
s] at hφ
189202
exact hφ.2
190203
obtain ⟨M, v, hv⟩ := h s hs
191204
letI : (constantsOn α).Structure M := constantsOn.structure v
192-
have hM : M ⊨ (L.lhomWithConstants α).onTheory T := by
193-
simp only [LHom.onTheory_model]
194-
infer_instance
195-
haveI : M ⊨ (T0 : L[[α]].Theory) := by
196-
simp only [model_iff, SetLike.mem_coe]
205+
haveI hM_with : M ⊨ T.withFormulaSet (s : Set (L.Formula α)) :=
206+
model_withFormulaSet_of_realize v hv
207+
have hT0_ss : (T0 : L[[α]].Theory) ⊆ T.withFormulaSet (s : Set (L.Formula α)) := by
197208
intro φ hφ
198-
rcases hT0 hφ with hφT | hφS
199-
· exact hM.realize_of_mem _ hφT
200-
· obtain ⟨ψ, hψS, rfl⟩ := hφS
201-
have hψ : ψ ∈ s := by
202-
simpa [s, hψS] using
203-
exact
204-
(Formula.realize_equivSentence_symm M (Formula.equivSentence ψ) v).1
205-
(by simpa using hv ψ hψ)
209+
rcases hT0 hφ with (hφT | ⟨ψ, hψS, rfl⟩)
210+
· exact Or.inl hφT
211+
· refine Or.inr ⟨ψ, ?_, rfl⟩
212+
simp only [Finset.coe_filter, Finset.mem_map_equiv, _root_.Equiv.symm_symm, mem_setOf_eq, s]
213+
refine ⟨by simpa, hψS⟩
214+
haveI : M ⊨ (T0 : L[[α]].Theory) :=
215+
hM_with.mono hT0_ss
206216
exact ⟨ModelType.of (T0 : L[[α]].Theory) M⟩
207217

208218
variable {M : Type u'} [L.Structure M] [Nonempty M]
@@ -238,25 +248,12 @@ theorem partialType_completeTheory_iff_finitelyRealizable
238248
intro s hs
239249
obtain ⟨v, hv⟩ := h s hs
240250
letI : (constantsOn α).Structure M := constantsOn.structure v
241-
have hModel :
242-
M ⊨ (L.lhomWithConstants α).onTheory (L.completeTheory M) ∪
243-
Formula.equivSentence '' (↑s : Set (L.Formula α)) := by
244-
simp only [Theory.model_iff]
245-
intro φ hφ
246-
rcases hφ with hφT | hφS
247-
· exact (((LHom.onTheory_model _ _).2 inferInstance).realize_of_mem _ hφT)
248-
· rcases hφS with ⟨ψ, hψ, rfl⟩
249-
exact (Formula.realize_equivSentence M ψ).2 (hv ψ hψ)
250-
haveI :
251-
M ⊨ (L.lhomWithConstants α).onTheory (L.completeTheory M) ∪
252-
Formula.equivSentence '' (↑s : Set (L.Formula α)) :=
253-
hModel
254-
have hSat :
255-
(((L.lhomWithConstants α).onTheory (L.completeTheory M) ∪
256-
Formula.equivSentence '' (↑s : Set (L.Formula α))).IsSatisfiable) :=
251+
haveI hModel : M ⊨ (L.completeTheory M).withFormulaSet (s : Set (L.Formula α)) :=
252+
model_withFormulaSet_of_realize v (fun φ hφ => hv φ (by simpa using hφ))
253+
have hSat : ((L.completeTheory M).withFormulaSet (s : Set (L.Formula α))).IsSatisfiable :=
257254
Theory.Model.isSatisfiable M
258255
exact
259-
(partialType_iff_finitelyRealizable (s : Set (L.Formula α))).1 hSat s fun _ hφ => hφ
256+
(partialType_iff_finitelyRealizable (s : Set (L.Formula α))).1 hSat s fun _ hφ => hφ
260257

261258
variable {β γ : Type*}
262259

0 commit comments

Comments
 (0)