Skip to content

Commit 90f0851

Browse files
committed
refactor(ModelTheory/PartialTypes): introduce IsConsistentWith predicate
Replace the pattern `(T.withSet S).IsSatisfiable` with the dedicated predicate `T.IsConsistentWith S`, and rename the `PartialType` field `isSatisfiable'` to `isConsistent`.
1 parent 94df61c commit 90f0851

1 file changed

Lines changed: 26 additions & 23 deletions

File tree

Mathlib/ModelTheory/PartialTypes.lean

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,20 @@ variable {L : Language.{u, v}} (T : L.Theory) (α : Type w)
6262

6363
/-- The theory obtained from `T` by adjoining a set of formulas in variables `α`, viewed as
6464
sentences in the language with constants for `α`. -/
65-
def withSet {α} (S : Set (L.Formula α)) : L[[α]].Theory :=
65+
def withFormulaSet {α} (S : Set (L.Formula α)) : L[[α]].Theory :=
6666
((L.lhomWithConstants α).onTheory T ∪ Formula.equivSentence '' S)
6767

68+
/-- `T.IsConsistentWith S` means that the set of formulas `S` is consistent with `T`,
69+
i.e. there exists a model of `T` that realizes every formula in `S`. -/
70+
def IsConsistentWith {α} (S : Set (L.Formula α)) : Prop :=
71+
(T.withFormulaSet S).IsSatisfiable
72+
6873
/-- A partial type over `T` in variables `α` is a set of formulas consistent with `T`. -/
6974
structure PartialType where
7075
/-- The underlying set of formulas. -/
7176
toSet : Set (L.Formula α)
72-
/-- Consistency with `T`, packaged as satisfiability in the language with constants for `α`. -/
73-
isSatisfiable' :
74-
(T.withSet toSet).IsSatisfiable
77+
/-- `S` is consistent with `T`. -/
78+
isConsistent : T.IsConsistentWith toSet
7579

7680
variable {T α}
7781

@@ -85,12 +89,12 @@ namespace PartialType
8589
attribute [coe] PartialType.toSet
8690

8791
/-- Construct a partial type from a set of formulas via consistency. -/
88-
def ofSet (S : Set (L.Formula α)) (hS : (T.withSet S).IsSatisfiable) :
92+
def ofSet (S : Set (L.Formula α)) (hS : T.IsConsistentWith S) :
8993
T.PartialType α :=
9094
⟨S, hS⟩
9195

9296
@[simp]
93-
theorem toSet_ofSet (S : Set (L.Formula α)) (hS : (T.withSet S).IsSatisfiable) :
97+
theorem toSet_ofSet (S : Set (L.Formula α)) (hS : T.IsConsistentWith S) :
9498
(ofSet S hS).toSet = S :=
9599
rfl
96100

@@ -102,7 +106,7 @@ instance : SetLike (T.PartialType α) (L.Formula α) :=
102106

103107
@[simp]
104108
theorem coe_ofSet (S : Set (L.Formula α))
105-
(hS : (T.withSet S).IsSatisfiable) :
109+
(hS : T.IsConsistentWith S) :
106110
((ofSet S hS : T.PartialType α) : Set (L.Formula α)) = S :=
107111
rfl
108112

@@ -111,10 +115,10 @@ instance : PartialOrder (T.PartialType α) :=
111115

112116
/-- The theory associated to a partial type. -/
113117
def toTheory (p : T.PartialType α) : L[[α]].Theory :=
114-
T.withSet p.toSet
118+
T.withFormulaSet p.toSet
115119

116120
theorem isSatisfiable (p : T.PartialType α) : p.toTheory.IsSatisfiable := by
117-
simpa [toTheory] using p.isSatisfiable'
121+
simpa [toTheory, IsConsistentWith] using p.isConsistent
118122

119123
theorem subset_toTheory (p : T.PartialType α) :
120124
(L.lhomWithConstants α).onTheory T ⊆ p.toTheory := by
@@ -139,8 +143,7 @@ def RealizedBy {M : Type w'} [L.Structure M] (p : T.PartialType α) (v : α →
139143
∀ φ ∈ p, φ.Realize v
140144

141145
/-- A partial type is realized in a structure if some tuple realizes it. -/
142-
@[nolint unusedArguments]
143-
def IsRealizedIn (p : T.PartialType α) (M : Type w') [L.Structure M] [M ⊨ T] [Nonempty M] :
146+
def IsRealizedIn (p : T.PartialType α) (M : Type w') [L.Structure M] :
144147
Prop :=
145148
∃ v : α → M, p.RealizedBy v
146149

@@ -163,7 +166,7 @@ theorem exists_modelType_isRealizedIn (p : T.PartialType α) :
163166
only if every finite subset is realized in some model of `T`. -/
164167
theorem partialType_iff_finitelyRealizable
165168
(S : Set (L.Formula α)) :
166-
((T.withSet S).IsSatisfiable) ↔
169+
(T.IsConsistentWith S) ↔
167170
∀ s : Finset (L.Formula α), (↑s : Set (L.Formula α)) ⊆ S →
168171
∃ M : Theory.ModelType.{u, v, max u v w} T,
169172
∃ v : α → M, ∀ φ ∈ s, φ.Realize v := by
@@ -174,7 +177,7 @@ theorem partialType_iff_finitelyRealizable
174177
exists (p.reductModelType M)
175178
obtain ⟨v,hv⟩ := p.isRealizedIn_reductModelType M
176179
aesop
177-
· rw [isSatisfiable_iff_isFinitelySatisfiable]
180+
· rw [IsConsistentWith, isSatisfiable_iff_isFinitelySatisfiable]
178181
intro T0 hT0
179182
classical
180183
let s : Finset (L.Formula α) :=
@@ -206,7 +209,7 @@ variable {M : Type u'} [L.Structure M] [Nonempty M]
206209

207210
theorem partialType_completeTheory_iff_finitelyRealizable
208211
(S : Set (L.Formula α)) :
209-
(((L.completeTheory M).withSet S).IsSatisfiable) ↔
212+
((L.completeTheory M).IsConsistentWith S) ↔
210213
∀ s : Finset (L.Formula α), (↑s : Set (L.Formula α)) ⊆ S →
211214
∃ v : α → M, ∀ φ ∈ s, φ.Realize v := by
212215
classical
@@ -274,8 +277,8 @@ provided the induced language map is an expansion on `M`. -/
274277
theorem partialType_completeTheory_map [L[[β]].Structure M] [L[[γ]].Structure M]
275278
(g : β → γ) [hg : (L.lhomWithConstantsMap g).IsExpansionOn M]
276279
{S : Set (L[[β]].Formula α)}
277-
(hS : (((L[[β]].completeTheory M).withSet S).IsSatisfiable)) :
278-
(((L[[γ]].completeTheory M).withSet (mapSet g S)).IsSatisfiable) := by
280+
(hS : ((L[[β]].completeTheory M).IsConsistentWith S)) :
281+
((L[[γ]].completeTheory M).IsConsistentWith (mapSet g S)) := by
279282
rw [partialType_completeTheory_iff_finitelyRealizable] at hS ⊢
280283
intro s hs
281284
classical
@@ -312,7 +315,7 @@ variable {A : Set M}
312315
defines a partial type if and only if every finite subset is realized in `M` itself. -/
313316
theorem partialTypeOver_iff_finitelyRealizable
314317
(S : Set (L[[A]].Formula α)) :
315-
(((L[[A]].completeTheory M).withSet S).IsSatisfiable) ↔
318+
((L[[A]].completeTheory M).IsConsistentWith S) ↔
316319
∀ s : Finset (L[[A]].Formula α), (↑s : Set (L[[A]].Formula α)) ⊆ S →
317320
∃ v : α → M,
318321
∀ φ ∈ s, φ.Realize v := by
@@ -336,8 +339,8 @@ theorem mem_liftSet (hAB : A ⊆ B) {S : Set (L[[A]].Formula α)}
336339

337340
/-- A partial type over `A` stays a partial type over any larger parameter set `B`. -/
338341
theorem partialTypeOver_mono (hAB : A ⊆ B) {S : Set (L[[A]].Formula α)}
339-
(hS : (((L[[A]].completeTheory M).withSet S).IsSatisfiable)) :
340-
(((L[[B]].completeTheory M).withSet (liftSet hAB S)).IsSatisfiable) := by
342+
(hS : ((L[[A]].completeTheory M).IsConsistentWith S)) :
343+
((L[[B]].completeTheory M).IsConsistentWith (liftSet hAB S)) := by
341344
simpa [liftSet] using
342345
(partialType_completeTheory_map (M := M) (g := Set.inclusion hAB) (S := S) hS)
343346

@@ -346,7 +349,7 @@ def liftParams (hAB : A ⊆ B) (p : PartialTypeOver (L := L) A α) :
346349
PartialTypeOver (L := L) B α :=
347350
ofSet
348351
(liftSet hAB (p : Set (L[[A]].Formula α)))
349-
(partialTypeOver_mono (S := (p : Set (L[[A]].Formula α))) hAB p.isSatisfiable')
352+
(partialTypeOver_mono (S := (p : Set (L[[A]].Formula α))) hAB p.isConsistent)
350353

351354
@[simp]
352355
theorem coe_liftParams (hAB : A ⊆ B) (p : PartialTypeOver (L := L) A α) :
@@ -360,7 +363,7 @@ reinterpreting those parameters as constants from `M`, it is realized in a model
360363
diagram of `M`. -/
361364
theorem partialTypeOver_iff_realizedIn_elementaryExtension
362365
(S : Set (L[[A]].Formula α)) :
363-
(((L[[A]].completeTheory M).withSet S).IsSatisfiable) ↔
366+
((L[[A]].completeTheory M).IsConsistentWith S) ↔
364367
∃ N : Theory.ModelType.{max u u', v, max (max (max u u') v) w} (L.elementaryDiagram M),
365368
∃ v : α → N,
366369
∀ φ ∈ S,
@@ -373,8 +376,8 @@ theorem partialTypeOver_iff_realizedIn_elementaryExtension
373376
constantsOnMap_isExpansionOn rfl
374377
haveI : (L.lhomWithConstantsMap ((↑) : A → M)).IsExpansionOn M :=
375378
LHom.sumMap_isExpansionOn _ _ _
376-
have hS' : (((L.elementaryDiagram M).withSet S').IsSatisfiable) := by
377-
change (((L[[M]].completeTheory M).withSet S').IsSatisfiable)
379+
have hS' : ((L.elementaryDiagram M).IsConsistentWith S') := by
380+
change ((L[[M]].completeTheory M).IsConsistentWith S')
378381
simpa [S'] using
379382
(partialType_completeTheory_map ((↑) : A → M) hS)
380383
let p : (L.elementaryDiagram M).PartialType α := ofSet S' hS'

0 commit comments

Comments
 (0)