Skip to content

Commit 75d29e4

Browse files
committed
Merge remote-tracking branch 'jonas/typespace' into OmittingTypes
This PR depends on the PR in Jonas's branch.
2 parents cc2ebbe + 7332cf1 commit 75d29e4

4 files changed

Lines changed: 97 additions & 0 deletions

File tree

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5107,6 +5107,7 @@ public import Mathlib.ModelTheory.Semantics
51075107
public import Mathlib.ModelTheory.Skolem
51085108
public import Mathlib.ModelTheory.Substructures
51095109
public import Mathlib.ModelTheory.Syntax
5110+
public import Mathlib.ModelTheory.Topology.Types
51105111
public import Mathlib.ModelTheory.Types
51115112
public import Mathlib.ModelTheory.Ultraproducts
51125113
public import Mathlib.NumberTheory.ADEInequality
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/-
2+
Copyright (c) 2025 Jonas van der Schaaf. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Jonas van der Schaaf
5+
-/
6+
7+
module
8+
9+
public import Mathlib.ModelTheory.Types
10+
public import Mathlib.Topology.Bases
11+
public import Mathlib.Topology.Connected.TotallyDisconnected
12+
public import Mathlib.Topology.Compactness.Compact
13+
14+
/-!
15+
# Topology on the space of complete types
16+
17+
This file defines a topological structure on the type `CompleteType T α` (note that
18+
these are types from model theory and not types from type theory). The topology
19+
is generated by sets of the form `{p : CompleteType T α | ∃ φ, φ ∈ p}`.
20+
21+
Note that the contents of this file are separate from ModelTheory/Types.lean to avoid
22+
importing files from the Topology folder there.
23+
-/
24+
25+
open Set FirstOrder Language Theory CompleteType TopologicalSpace
26+
27+
namespace CompleteType
28+
29+
universe u
30+
31+
variable {L : Language} {T : L.Theory} {α : Type _}
32+
33+
instance : TopologicalSpace (CompleteType T α) := generateFrom (range typesWith)
34+
35+
public lemma typesWith_basis : IsTopologicalBasis (range (typesWith (α := α) (T := T))) where
36+
exists_subset_inter := by
37+
intro t₁ ⟨φ, ht₁⟩ t₂ ⟨ψ, ht₂⟩ x hx
38+
refine ⟨typesWith (φ ⊓ ψ), ⟨φ ⊓ ψ, rfl⟩, ?_⟩
39+
rw [typesWith_inf, ht₁, ht₂]
40+
exact ⟨hx, fun _ ↦ id⟩
41+
sUnion_eq := by
42+
rw [←Set.univ_subset_iff]
43+
exact Set.subset_sUnion_of_mem ⟨_, typesWith_top⟩
44+
eq_generateFrom := rfl
45+
46+
lemma typesWith_open (φ : (L[[α]]).Sentence) : IsOpen (typesWith (T := T) φ) :=
47+
isOpen_generateFrom_of_mem ⟨φ, rfl⟩
48+
49+
lemma typesWith_closed (φ : (L[[α]]).Sentence) : IsClosed (typesWith (T := T) φ) where
50+
isOpen_compl := by rw [←typesWith_compl]; exact typesWith_open _
51+
52+
lemma typesWith_clopen (φ : (L[[α]]).Sentence) : IsClopen (typesWith (T := T) φ) where
53+
left := typesWith_closed _
54+
right := typesWith_open _
55+
56+
instance : TotallySeparatedSpace (CompleteType T α) := by
57+
rw [totallySeparatedSpace_iff_exists_isClopen]
58+
intro p q hpq
59+
simp only [ne_eq, SetLike.ext_iff, not_forall, not_iff] at hpq
60+
obtain ⟨φ, hφ⟩ := hpq
61+
exact (mem_or_not_mem p φ).elim
62+
(fun h ↦ ⟨typesWith φ, typesWith_clopen _, h, by change ¬φ ∈ q; rwa [←hφ, not_not]⟩)
63+
(fun h ↦ ⟨
64+
typesWith ∼φ,
65+
typesWith_clopen _, h,
66+
by change ¬∼φ∈q; rwa [not_mem_iff,←hφ, not_not, ←not_mem_iff]
67+
⟩)
68+
69+
70+
end CompleteType

Mathlib/ModelTheory/Types.lean

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ theorem subset (p : T.CompleteType α) : (L.lhomWithConstants α).onTheory T ⊆
9090
theorem mem_or_not_mem (p : T.CompleteType α) (φ : L[[α]].Sentence) : φ ∈ p ∨ φ.not ∈ p :=
9191
p.isMaximal.mem_or_not_mem φ
9292

93+
lemma mem_not_mem (hT : T.IsSatisfiable) {φ : L.Sentence} (hφ : φ ∈ T) (hφ' : ∼φ ∈ T) : False :=
94+
have ⟨M⟩ := hT
95+
(M.is_model.realize_of_mem _ hφ') (M.is_model.realize_of_mem _ hφ)
96+
9397
theorem mem_of_models (p : T.CompleteType α) {φ : L[[α]].Sentence}
9498
(h : (L.lhomWithConstants α).onTheory T ⊨ᵇ φ) : φ ∈ p :=
9599
(p.mem_or_not_mem φ).resolve_right fun con =>
@@ -185,6 +189,27 @@ theorem mem_typeOf {φ : L[[α]].Sentence} :
185189
theorem formula_mem_typeOf {φ : L.Formula α} :
186190
Formula.equivSentence φ ∈ T.typeOf v ↔ φ.Realize v := by simp
187191

192+
/-- The clopen set of complete types which contain a formula. -/
193+
def typesWith : L[[α]].Sentence → Set (CompleteType T α) := fun φ ↦ {p | φ ∈ p}
194+
195+
lemma typesWith_inf (φ ψ : L[[α]].Sentence)
196+
: typesWith (T := T) (φ ⊓ ψ) = typesWith φ ∩ typesWith ψ := by
197+
ext p
198+
change φ ⊓ ψ ∈ (p : Set (L[[α]]).Sentence)
199+
↔ φ ∈ (p : Set (L[[α]]).Sentence) ∧ ψ ∈ (p : Set (L[[α]]).Sentence)
200+
simp only [p.isMaximal.mem_iff_models, ModelsBoundedFormula, ←forall_and]
201+
exact forall₃_congr fun _ _ _ ↦ BoundedFormula.realize_inf
202+
203+
lemma typesWith_mem {φ} (hφ : φ ∈ (L.lhomWithConstants α).onTheory T)
204+
: typesWith (T := T) φ = Set.univ
205+
:= univ_subset_iff.mp fun p _ ↦ p.subset hφ
206+
207+
lemma typesWith_top : typesWith (T := T) (α := α) ⊤ = Set.univ
208+
:= univ_subset_iff.mp fun p _ ↦ p.isMaximal.mem_of_models (φ := ⊤) (fun _ _ _ a ↦ a)
209+
210+
lemma typesWith_compl (φ : L[[α]].Sentence) : typesWith ∼φ = (typesWith (T := T) φ)ᶜ := by
211+
simp [typesWith]
212+
188213
end CompleteType
189214

190215
variable (M)

Mathlib/Tactic/Linter/DirectoryDependency.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ def overrideAllowedImportDirs : NamePrefixRel := .ofArray #[
615615
(`Mathlib.LinearAlgebra.Matrix, `Mathlib.Topology), -- For e.g. spectra.
616616
(`Mathlib.LinearAlgebra.QuadraticForm, `Mathlib.Topology), -- For real/complex quadratic forms.
617617
(`Mathlib.LinearAlgebra.SesquilinearForm, `Mathlib.Topology), -- for links with positive semidefinite matrices
618+
(`Mathlib.ModelTheory.Topology, `Mathlib.Topology), -- For e.g. topology on complete types.
618619
(`Mathlib.Topology.Algebra, `Mathlib.Algebra),
619620
(`Mathlib.Topology.Compactification, `Mathlib.Geometry.Manifold)
620621
]

0 commit comments

Comments
 (0)