Skip to content

Commit f070958

Browse files
committed
genericFillter
1 parent 829c510 commit f070958

3 files changed

Lines changed: 94 additions & 14 deletions

File tree

Foundation/FirstOrder/Completeness/CanonicalModel.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,10 @@ lemma dn_neg_iff {φ : Proposition L} {p : ℙ⁻} : p ⊩ᶜ ∼φ ↔ p ⊩
468468
have := by simpa using (sound_minimal (Derivation.neg_doubleNegation φ) p)
469469
exact (this p (by simp)).symm
470470

471+
@[simp] lemma verum (p : ℙ⁻) : p ⊩ᶜ ⊤ := by simp [iff_isForced, IsForced.not]
472+
473+
@[simp] lemma falsum (p : ℙ⁻) : ¬p ⊩ᶜ ⊥ := by simp [iff_isForced]
474+
471475
lemma not {φ : Proposition L} {p : ℙ⁻} : p ⊩ᶜ ∼φ ↔ ∀ q ≤ p, ¬q ⊩ᶜ φ := by
472476
simp [IsForced.not, dn_neg_iff,]; rfl
473477

@@ -483,6 +487,12 @@ lemma not {φ : Proposition L} {p : ℙ⁻} : p ⊩ᶜ ∼φ ↔ ∀ q ≤ p, ¬
483487
@[simp] lemma exs {φ : Semiproposition L 1} {p : ℙ⁻} : p ⊩ᶜ ∃⁰ φ ↔ ∀ q ≤ p, ∃ r ≤ q, ∃ t, r ⊩ᶜ φ/[t] := by
484488
simp [iff_isForced, IsForced.not, Semiformula.subst_doubleNegation]; grind
485489

490+
lemma monotone {φ : Proposition L} {p q : ℙ⁻} (h : q ≤ p) : p ⊩ᶜ φ → q ⊩ᶜ φ := IsForced.monotone h
491+
492+
lemma gnericity {φ : Proposition L} {p : ℙ⁻} : p ⊩ᶜ φ ↔ ∀ q ≤ p, ∃ r ≤ q, r ⊩ᶜ φ := calc
493+
p ⊩ᶜ φ ↔ p ⊩ᶜ ∼∼φ := by simp
494+
_ ↔ ∀ q ≤ p, ∃ r ≤ q, r ⊩ᶜ φ := by rw [not]; simp [not]
495+
486496
lemma complete {φ : Proposition L} : ℙ⁻ ∀⊩ᶜ φ ↔ 𝐋𝐊¹ ⊢ φ := by
487497
constructor
488498
· intro h
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
module
2+
3+
public import Foundation.FirstOrder.Completeness.CanonicalModel
4+
public import Foundation.Vorspiel.Order.Dense
5+
public import Mathlib.Logic.Equiv.List
6+
public import Mathlib.Logic.Encodable.Basic
7+
8+
@[expose] public section
9+
10+
namespace LO.FirstOrder.Derivation.Canonical
11+
12+
open Order
13+
14+
variable {L : Language}
15+
16+
local notation "ℙ" => Sequent L
17+
local notation "ℙ⁻" => ConsistentSequent L
18+
19+
scoped notation "ℍ" => LowerSet ℙ⁻
20+
21+
instance [L.Encodable] [L.DecidableEq] : Encodable (Sequent L) := List.encodable
22+
23+
open Classical in
24+
noncomputable instance [L.Encodable] : Encodable ℙ⁻ := Subtype.encodable
25+
26+
def value (φ : Proposition L) : ℍ where
27+
carrier := { p | p ⊩ᶜ φ }
28+
lower' _ _ hqp hp := IsWeaklyForced.monotone hqp hp
29+
30+
notation "‖" φ "‖" => value φ
31+
32+
lemma provable_iff_dense {φ : Proposition L} :
33+
𝐋𝐊¹ ⊢ φ ↔ IsDense (‖φ‖ : Set ℙ⁻) := calc
34+
𝐋𝐊¹ ⊢ φ ↔ ℙ⁻ ∀⊩ᶜ φ := IsWeaklyForced.complete.symm
35+
_ ↔ IsDense (‖φ‖ : Set ℙ⁻) := by
36+
constructor
37+
· intro h p
38+
suffices ∃ q ≤ p, q ⊩ᶜ φ by simpa [value]
39+
refine ⟨p, by simp, h p⟩
40+
· intro h p
41+
apply IsWeaklyForced.gnericity.mpr
42+
intro q hqp
43+
simpa [value] using h q
44+
45+
open Classical
46+
def decidablePoints (φ : Proposition L) : DenseSet ℙ⁻ where
47+
set := {p | p ⊩ᶜ φ ∨ p ⊩ᶜ ∼φ}
48+
is_dense := by
49+
intro p
50+
have : p ⊩ᶜ φ ⋎ ∼φ := IsWeaklyForced.complete.mpr Entailment.lem! p
51+
have : ∀ q ≤ p, ∃ r ≤ q, r ⊩ᶜ φ ∨ r ⊩ᶜ ∼φ := by simpa using this
52+
simpa using this p (by rfl)
53+
54+
variable [L.Encodable]
55+
56+
theorem genericFIlter_exists (p : ℙ⁻) :
57+
∃ G : PFilter ℙ⁻, G.IsGeneric (Set.range decidablePoints) ∧ p ∈ G :=
58+
PFilter.countable_isGeneric (Set.range decidablePoints) (Set.countable_range decidablePoints) p
59+
60+
noncomputable def genericFilter (p : ℙ⁻) : PFilter ℙ⁻ := Classical.choose (genericFIlter_exists p)
61+
62+
instance genericFilter_isGeneric (p : ℙ⁻) : (genericFilter p).IsGeneric (Set.range decidablePoints) :=
63+
Classical.choose_spec (genericFIlter_exists p) |>.1
64+
65+
@[simp] lemma mem_genericFilter (p : ℙ⁻) : p ∈ genericFilter p :=
66+
Classical.choose_spec (genericFIlter_exists p) |>.2
67+
68+
end LO.FirstOrder.Derivation.Canonical

Foundation/Vorspiel/Order/Dense.lean

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,30 +99,32 @@ def ofDescendingChain (s : ℕ → α) (hs : ∀ i j, i ≤ j → s i ≥ s j) :
9999
@[simp] lemma mem_descendingChain_iff (s : ℕ → α) (hs : ∀ i j, i ≤ j → s i ≥ s j) :
100100
x ∈ ofDescendingChain s hs ↔ ∃ i, s i ≤ x := by rfl
101101

102-
class Generic (F : PFilter α) (𝓓 : Set (DenseSet α)) where
103-
generic : ∀ d ∈ 𝓓, ∃ a ∈ F, a ∈ d
102+
class IsGeneric (F : PFilter α) (𝓓 : Set (DenseSet α)) where
103+
isGeneric : ∀ d ∈ 𝓓, ∃ a ∈ F, a ∈ d
104104

105-
@[simp] instance Generic.empty (F : PFilter α) : F.Generic ∅ := ⟨by simp⟩
105+
@[simp] instance IsGeneric.empty (F : PFilter α) : F.IsGeneric ∅ := ⟨by simp⟩
106106

107-
theorem countable_generic [Inhabited α] (𝓓 : Set (DenseSet α)) (ctb : Set.Countable 𝓓) :
108-
∃ G, Generic G 𝓓 := by
107+
theorem countable_isGeneric (𝓓 : Set (DenseSet α)) (ctb : Set.Countable 𝓓) (a : α) :
108+
∃ G : PFilter α, G.IsGeneric 𝓓 ∧ a ∈ G := by
109109
by_cases emp : 𝓓.Nonempty
110-
case neg => exact ⟨default, by simp [Set.not_nonempty_iff_eq_empty.mp emp]⟩
110+
case neg => exact ⟨principal a, by simp [Set.not_nonempty_iff_eq_empty.mp emp]⟩
111111
have : ∃ D : ℕ → 𝓓, Function.Surjective D := ctb.exists_surjective emp
112112
rcases this with ⟨D, hD⟩
113-
let s (n : ℕ) : α := n.rec default fun i ↦ (D i).val.choose
113+
let s (n : ℕ) : α := n.rec a fun i ↦ (D i).val.choose
114114
have hs : ∀ i j, i ≤ j → s i ≥ s j := fun i j hij ↦
115115
Nat.monotone_of_succ_monotone (r := fun i j ↦ s i ≥ s j)
116116
(fun _ ↦ le_refl _)
117117
fun _ _ _ ↦ ge_trans⟩
118118
(by simp [s]) hij
119-
refine ⟨ofDescendingChain s hs, ⟨?_⟩⟩
120-
intro d hd
121-
rcases show ∃ i, D i = ⟨d, hd⟩ from hD ⟨d, hd⟩ with ⟨i, hi⟩
122-
refine ⟨s (i + 1), ?_, ?_⟩
123-
· simp only [mem_descendingChain_iff]
124-
exact ⟨i + 1, by rfl⟩
125-
· simp [s, hi]
119+
refine ⟨ofDescendingChain s hs, ⟨?_⟩, ?_⟩
120+
· intro d hd
121+
rcases show ∃ i, D i = ⟨d, hd⟩ from hD ⟨d, hd⟩ with ⟨i, hi⟩
122+
refine ⟨s (i + 1), ?_, ?_⟩
123+
· simp only [mem_descendingChain_iff]
124+
exact ⟨i + 1, by rfl⟩
125+
· simp [s, hi]
126+
· suffices ∃ i, s i ≤ a by simpa
127+
refine ⟨0, by simp [s]⟩
126128

127129
end Order.PFilter
128130

0 commit comments

Comments
 (0)