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

Commit 98bd247

Browse files
committed
feat(model_theory/types): Realized types (#17848)
Defines `first_order.language.Theory.type_of`, the type of a given tuple. Defines what it means for a type to be realized. Co-authored-by: Aaron Anderson <65780815+awainverse@users.noreply.github.com>
1 parent aa68866 commit 98bd247

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

src/model_theory/types.lean

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ This file defines the space of complete types over a first-order theory.
1313
## Main Definitions
1414
* `first_order.language.Theory.complete_type`:
1515
`T.complete_type α` consists of complete types over the theory `T` with variables `α`.
16+
* `first_order.language.Theory.type_of` is the type of a given tuple.
17+
* `first_order.language.Theory.realized_types`: `T.realized_types M α` is the set of
18+
types in `T.complete_type α` that are realized in `M` - that is, the type of some tuple in `M`.
1619
1720
## Main Results
1821
* `first_order.language.Theory.complete_type.nonempty_iff`:
1922
The space `T.complete_type α` is nonempty exactly when `T` is satisfiable.
23+
* `first_order.language.Theory.complete_type.exists_Model_is_realized_in`: Every type is realized in
24+
some model.
2025
2126
## Implementation Notes
2227
* Complete types are implemented as maximal consistent theories in an expanded language.
@@ -151,6 +156,54 @@ end
151156

152157
end complete_type
153158

159+
variables {M : Type w'} [L.Structure M] [nonempty M] [M ⊨ T] (T)
160+
161+
/-- The set of all formulas true at a tuple in a structure forms a complete type. -/
162+
def type_of (v : α → M) : T.complete_type α :=
163+
begin
164+
haveI : (constants_on α).Structure M := constants_on.Structure v,
165+
exact { to_Theory := L[[α]].complete_theory M,
166+
subset' := model_iff_subset_complete_theory.1 ((Lhom.on_Theory_model _ T).2 infer_instance),
167+
is_maximal' := complete_theory.is_maximal _ _ },
168+
end
169+
170+
namespace complete_type
171+
172+
variables {T} {v : α → M}
173+
174+
@[simp] lemma mem_type_of {φ : L[[α]].sentence} :
175+
φ ∈ T.type_of v ↔ (formula.equiv_sentence.symm φ).realize v :=
176+
begin
177+
letI : (constants_on α).Structure M := constants_on.Structure v,
178+
exact mem_complete_theory.trans (formula.realize_equiv_sentence_symm _ _ _).symm,
179+
end
180+
181+
lemma formula_mem_type_of {φ : L.formula α} :
182+
formula.equiv_sentence φ ∈ T.type_of v ↔ φ.realize v :=
183+
by simp
184+
185+
end complete_type
186+
187+
variable (M)
188+
189+
/-- A complete type `p` is realized in a particular structure when there is some
190+
tuple `v` whose type is `p`. -/
191+
@[simp] def realized_types (α : Type w) : set (T.complete_type α) :=
192+
set.range (T.type_of : (α → M) → T.complete_type α)
193+
194+
theorem exists_Model_is_realized_in (p : T.complete_type α) :
195+
∃ (M : Theory.Model.{u v (max u v w)} T),
196+
p ∈ T.realized_types M α :=
197+
begin
198+
obtain ⟨M⟩ := p.is_maximal.1,
199+
refine ⟨(M.subtheory_Model p.subset).reduct (L.Lhom_with_constants α), (λ a, (L.con a : M)), _⟩,
200+
refine set_like.ext (λ φ, _),
201+
simp only [complete_type.mem_type_of],
202+
refine (formula.realize_equiv_sentence_symm_con _ _).trans (trans (trans _
203+
(p.is_maximal.is_complete.realize_sentence_iff φ M)) (p.is_maximal.mem_iff_models φ).symm),
204+
refl,
205+
end
206+
154207
end Theory
155208
end language
156209
end first_order

0 commit comments

Comments
 (0)