|
1 | 1 | module |
2 | 2 |
|
3 | | -public import Foundation.FirstOrder.NegationTranslation.GoedelGentzen |
| 3 | +public import Foundation.FirstOrder.Hauptsatz |
4 | 4 | public import Foundation.Logic.ForcingRelation |
5 | 5 |
|
6 | 6 | @[expose] public section |
7 | 7 |
|
8 | 8 | /-! |
9 | | -# Canonical model of classical first-order logic |
| 9 | +# Canonical model for classical first-order logic |
10 | 10 |
|
11 | 11 | Main reference: Jeremy Avigad, Algebraic proofs of cut elimination [Avi01] |
12 | 12 | -/ |
13 | 13 |
|
14 | | -namespace LO.FirstOrder.Derivation |
| 14 | +namespace LO.FirstOrder.Derivation.Canonical |
15 | 15 |
|
16 | 16 | variable {L : Language} |
17 | 17 |
|
18 | | -inductive Positive (Ξ : Sequent L) : Sequent L → Type _ |
19 | | -| or : Positive Ξ (φ :: ψ :: Γ) → Positive Ξ (φ ⋎ ψ :: Γ) |
20 | | -| exs : Positive Ξ (φ/[t] :: Γ) → Positive Ξ ((∃⁰ φ) :: Γ) |
21 | | -| wk : Positive Ξ Δ → Δ ⊆ Γ → Positive Ξ Γ |
22 | | -| protected id : Positive Ξ Ξ |
23 | | - |
24 | | -infix:45 " ⟶⁺ " => Positive |
25 | | - |
26 | | -namespace Positive |
27 | | - |
28 | | -variable {Ξ Γ Δ : Sequent L} |
29 | | - |
30 | | -def ofSubset (ss : Ξ ⊆ Γ) : Ξ ⟶⁺ Γ := wk .id ss |
31 | | - |
32 | | -def trans {Ξ Γ Δ : Sequent L} : Ξ ⟶⁺ Γ → Γ ⟶⁺ Δ → Ξ ⟶⁺ Δ |
33 | | - | b, or d => or (b.trans d) |
34 | | - | b, exs d => exs (b.trans d) |
35 | | - | b, wk d h => wk (b.trans d) h |
36 | | - | b, .id => b |
37 | | - |
38 | | -def cons {Ξ Γ : Sequent L} (φ) : Ξ ⟶⁺ Γ → φ :: Ξ ⟶⁺ φ :: Γ |
39 | | - | or (Γ := Γ) (φ := ψ) (ψ := χ) d => |
40 | | - have : φ :: Ξ ⟶⁺ ψ :: χ :: φ :: Γ := wk (cons φ d) (by simp; tauto) |
41 | | - wk (or this) (by simp) |
42 | | - | exs (Ξ := Ξ) (Γ := Γ) (φ := ψ) (t := t) d => |
43 | | - have : φ :: Ξ ⟶⁺ ψ/[t] :: φ :: Γ := wk (cons φ d) (by simp) |
44 | | - wk this.exs (by simp) |
45 | | - | wk d h => wk (d.cons φ) (by simp [h]) |
46 | | - | .id => .id |
47 | | - |
48 | | -def append {Ξ Γ : Sequent L} : (Δ : Sequent L) → Ξ ⟶⁺ Γ → Δ ++ Ξ ⟶⁺ Δ ++ Γ |
49 | | - | [], d => d |
50 | | - | φ :: Δ, d => (d.append Δ).cons φ |
51 | | - |
52 | | -def add {Γ Δ Ξ Θ : Sequent L} : Γ ⟶⁺ Δ → Ξ ⟶⁺ Θ → Γ ++ Ξ ⟶⁺ Δ ++ Θ |
53 | | - | or d, b => or (d.add b) |
54 | | - | exs d, b => exs (d.add b) |
55 | | - | wk d h, b => wk (d.add b) (by simp [h]) |
56 | | - | .id, b => b.append Γ |
57 | | - |
58 | | -def graft {Ξ Γ : Sequent L} (b : ⊢ᴸᴷ¹ Ξ) : Ξ ⟶⁺ Γ → ⊢ᴸᴷ¹ Γ |
59 | | - | or d => .or (d.graft b) |
60 | | - | exs d => .exs (d.graft b) |
61 | | - | wk d h => .wk (d.graft b) h |
62 | | - | .id => b |
63 | | - |
64 | | -lemma graft_isCutFree_of_isCutFree {b : ⊢ᴸᴷ¹ Ξ} {d : Ξ ⟶⁺ Γ} (hb : Derivation.IsCutFree b) : Derivation.IsCutFree (d.graft b) := by |
65 | | - induction d <;> simp [graft, *] |
66 | | - |
67 | | -end Positive |
68 | | - |
69 | | -namespace Canonical |
70 | | - |
71 | | -open Semiformulaᵢ |
72 | | - |
73 | 18 | local notation "ℙ" => Sequent L |
74 | 19 |
|
75 | | -structure StrongerThan (q p : ℙ) where |
76 | | - val : ∼p ⟶⁺ ∼q |
77 | | - |
78 | | -scoped infix:60 " ≼ " => StrongerThan |
79 | | - |
80 | | -scoped instance : Min ℙ := ⟨fun p q ↦ p ++ q⟩ |
81 | | - |
82 | | -lemma inf_def (p q : ℙ) : p ⊓ q = p ++ q := rfl |
83 | | - |
84 | | -@[simp] lemma neg_inf_p_eq (p q : ℙ) : ∼(p ⊓ q) = ∼p ⊓ ∼q := List.map_append |
85 | | - |
86 | | -namespace StrongerThan |
87 | | - |
88 | | -protected def refl (p : ℙ) : p ≼ p := ⟨.id⟩ |
89 | | - |
90 | | -def trans {r q p : ℙ} (srq : r ≼ q) (sqp : q ≼ p) : r ≼ p := ⟨sqp.val.trans srq.val⟩ |
91 | | - |
92 | | -def ofSubset {q p : ℙ} (h : q ⊇ p) : q ≼ p := ⟨.ofSubset <| List.map_subset _ h⟩ |
93 | | - |
94 | | -def and {p : ℙ} (φ ψ : Proposition L) : φ ⋏ ψ :: p ≼ φ :: ψ :: p := ⟨.or .id⟩ |
95 | | - |
96 | | -def K_left {p : ℙ} (φ ψ : Proposition L) : φ ⋏ ψ :: p ≼ φ :: p := trans (and φ ψ) (ofSubset <| by simp) |
97 | | - |
98 | | -def K_right {p : ℙ} (φ ψ : Proposition L) : φ ⋏ ψ :: p ≼ ψ :: p := trans (and φ ψ) (ofSubset <| by simp) |
99 | | - |
100 | | -def all {p : ℙ} (φ : Semiproposition L 1) (t) : (∀⁰ φ) :: p ≼ φ/[t] :: p := ⟨.exs (t := t) (by simpa [← Semiformula.neg_eq] using .id)⟩ |
101 | | - |
102 | | -def minLeLeft (p q : ℙ) : p ⊓ q ≼ p := ofSubset (by simp [inf_def]) |
103 | | - |
104 | | -def minLeRight (p q : ℙ) : p ⊓ q ≼ q := ofSubset (by simp [inf_def]) |
105 | | - |
106 | | -def leMinOfle (srp : r ≼ p) (srq : r ≼ q) : r ≼ p ⊓ q := ⟨ |
107 | | - let d : ∼p ++ ∼q ⟶⁺ ∼r := .wk (srp.val.add srq.val) (by simp) |
108 | | - neg_inf_p_eq _ _ ▸ d⟩ |
109 | | - |
110 | | -def leMinRightOfLe (s : q ≼ p) : q ≼ p ⊓ q := leMinOfle s (.refl q) |
111 | | - |
112 | | -end StrongerThan |
113 | | - |
114 | | -def Forces (p : ℙ) : Propositionᵢ L → Type u |
115 | | - | ⊥ => { b : ⊢ᴸᴷ¹ ∼p // Derivation.IsCutFree b } |
116 | | - | .rel R v => { b : ⊢ᴸᴷ¹ .rel R v :: ∼p // Derivation.IsCutFree b } |
117 | | - | φ ⋏ ψ => Forces p φ × Forces p ψ |
118 | | - | φ ⋎ ψ => Forces p φ ⊕ Forces p ψ |
119 | | - | φ 🡒 ψ => (q : ℙ) → q ≼ p → Forces q φ → Forces q ψ |
120 | | - | ∀⁰ φ => (t : SyntacticTerm L) → Forces p (φ/[t]) |
121 | | - | ∃⁰ φ => (t : SyntacticTerm L) × Forces p (φ/[t]) |
122 | | - termination_by φ => φ.complexity |
123 | | - |
124 | | - |
125 | | -abbrev allForces (φ : Propositionᵢ L) := (p : ℙ) → Forces p φ |
126 | | - |
127 | | -namespace Forces |
128 | | - |
129 | | -scoped infix:45 " ⊩ " => Forces |
130 | | - |
131 | | -scoped prefix:45 "⊩ " => allForces |
132 | | - |
133 | | - |
134 | | -def falsumEquiv : p ⊩ ⊥ ≃ { b : ⊢ᴸᴷ¹ ∼p // Derivation.IsCutFree b} := by unfold Forces; exact .refl _ |
135 | | - |
136 | | -def relEquiv {k} {R : L.Rel k} {v} : p ⊩ .rel R v ≃ { b : ⊢ᴸᴷ¹ .rel R v :: ∼p // Derivation.IsCutFree b } := by |
137 | | - unfold Forces; exact .refl _ |
138 | | - |
139 | | -def andEquiv {φ ψ : Propositionᵢ L} : p ⊩ φ ⋏ ψ ≃ (p ⊩ φ) × (p ⊩ ψ) := by |
140 | | - conv => |
141 | | - lhs |
142 | | - unfold Forces |
143 | | - exact .refl _ |
144 | | - |
145 | | -def orEquiv {φ ψ : Propositionᵢ L} : p ⊩ φ ⋎ ψ ≃ (p ⊩ φ) ⊕ (p ⊩ ψ) := by |
146 | | - conv => |
147 | | - lhs |
148 | | - unfold Forces |
149 | | - exact .refl _ |
150 | | - |
151 | | -def implyEquiv {φ ψ : Propositionᵢ L} : p ⊩ φ 🡒 ψ ≃ ((q : ℙ) → q ≼ p → q ⊩ φ → q ⊩ ψ) := by |
152 | | - conv => |
153 | | - lhs |
154 | | - unfold Forces |
155 | | - exact .refl _ |
156 | | - |
157 | | -def allEquiv {φ} : p ⊩ ∀⁰ φ ≃ ((t : SyntacticTerm L) → Forces p (φ/[t])) := by |
158 | | - conv => |
159 | | - lhs |
160 | | - unfold Forces |
161 | | - exact .refl _ |
162 | | - |
163 | | -def exsEquiv {φ} : p ⊩ ∃⁰ φ ≃ ((t : SyntacticTerm L) × Forces p (φ/[t])) := by |
164 | | - conv => |
165 | | - lhs |
166 | | - unfold Forces |
167 | | - exact .refl _ |
168 | | - |
169 | | -def cast {p : ℙ} (f : p ⊩ φ) (s : φ = ψ) : p ⊩ ψ := s ▸ f |
170 | | - |
171 | | -def monotone {q p : ℙ} (s : q ≼ p) : {φ : Propositionᵢ L} → p ⊩ φ → q ⊩ φ |
172 | | - | ⊥, b => |
173 | | - let ⟨d, hd⟩ := b.falsumEquiv |
174 | | - falsumEquiv.symm ⟨s.val.graft d, Positive.graft_isCutFree_of_isCutFree hd⟩ |
175 | | - | .rel R v, b => |
176 | | - let ⟨d, hd⟩ := b.relEquiv |
177 | | - relEquiv.symm ⟨s.val.cons (.rel R v) |>.graft d, Positive.graft_isCutFree_of_isCutFree hd⟩ |
178 | | - | φ ⋏ ψ, b => andEquiv.symm ⟨monotone s b.andEquiv.1, monotone s b.andEquiv.2⟩ |
179 | | - | φ ⋎ ψ, b => orEquiv.symm <| b.orEquiv.rec (fun b ↦ .inl <| b.monotone s) (fun b ↦ .inr <| b.monotone s) |
180 | | - | φ 🡒 ψ, b => implyEquiv.symm fun r srq bφ ↦ b.implyEquiv r (srq.trans s) bφ |
181 | | - | ∀⁰ φ, b => allEquiv.symm fun t ↦ (b.allEquiv t).monotone s |
182 | | - | ∃⁰ φ, b => |
183 | | - let ⟨t, d⟩ : (t : SyntacticTerm L) × p ⊩ φ/[t] := b.exsEquiv |
184 | | - exsEquiv.symm ⟨t, d.monotone s⟩ |
185 | | - termination_by φ => φ.complexity |
186 | | - |
187 | | -def explosion {p : ℙ} (b : p ⊩ ⊥) : (φ : Propositionᵢ L) → p ⊩ φ |
188 | | - | ⊥ => b |
189 | | - | .rel R v => |
190 | | - let ⟨d, hd⟩ := b.falsumEquiv |
191 | | - relEquiv.symm ⟨.wk d (by simp), by simp [hd]⟩ |
192 | | - | φ ⋏ ψ => andEquiv.symm ⟨b.explosion φ, b.explosion ψ⟩ |
193 | | - | φ ⋎ ψ => orEquiv.symm <| .inl <| b.explosion φ |
194 | | - | φ 🡒 ψ => implyEquiv.symm fun q sqp dφ ↦ (b.monotone sqp).explosion ψ |
195 | | - | ∀⁰ φ => allEquiv.symm fun t ↦ b.explosion (φ/[t]) |
196 | | - | ∃⁰ φ => exsEquiv.symm ⟨default, b.explosion (φ/[default])⟩ |
197 | | - termination_by φ => φ.complexity |
198 | | - |
199 | | -def efq (φ : Propositionᵢ L) : ⊩ ⊥ 🡒 φ := fun _ ↦ implyEquiv.symm fun _ _ d ↦ d.explosion φ |
200 | | - |
201 | | -def implyOf {φ ψ : Propositionᵢ L} (b : (q : ℙ) → q ⊩ φ → p ⊓ q ⊩ ψ) : |
202 | | - p ⊩ φ 🡒 ψ := implyEquiv.symm fun q sqp fφ ↦ |
203 | | - let fψ : p ⊓ q ⊩ ψ := b q fφ |
204 | | - fψ.monotone (StrongerThan.leMinRightOfLe sqp) |
205 | | - |
206 | | -open LawfulSyntacticRewriting |
207 | | - |
208 | | -def modusPonens {φ ψ : Propositionᵢ L} (f : p ⊩ φ 🡒 ψ) (g : p ⊩ φ) : p ⊩ ψ := |
209 | | - f.implyEquiv p (StrongerThan.refl p) g |
210 | | - |
211 | | -def sound {φ : Propositionᵢ L} : 𝗠𝗶𝗻¹ ⊢! φ → ⊩ φ |
212 | | - | .mdp (φ := ψ) b d => fun p ↦ |
213 | | - let b : p ⊩ ψ 🡒 φ := sound b p |
214 | | - let d : p ⊩ ψ := sound d p |
215 | | - b.implyEquiv p (StrongerThan.refl p) d |
216 | | - | .gen (φ := φ) b => fun p ↦ allEquiv.symm fun t ↦ |
217 | | - let d : 𝗠𝗶𝗻¹ ⊢! φ/[t] := |
218 | | - HilbertProofᵢ.cast (HilbertProofᵢ.rewrite (t :>ₙ fun x ↦ &x) b) (by simp [rewrite_free_eq_subst]) |
219 | | - sound d p |
220 | | - | .verum => fun p ↦ implyEquiv.symm fun q sqp bφ ↦ bφ |
221 | | - | .implyK φ ψ => fun p ↦ implyEquiv.symm fun q sqp bφ ↦ implyEquiv.symm fun r srq bψ ↦ bφ.monotone srq |
222 | | - | .implyS φ ψ χ => fun p ↦ |
223 | | - implyEquiv.symm fun q sqp b₁ ↦ |
224 | | - implyEquiv.symm fun r srq b₂ ↦ |
225 | | - implyEquiv.symm fun s ssr b₃ ↦ |
226 | | - let d₁ : s ⊩ ψ 🡒 χ := b₁.implyEquiv s (ssr.trans srq) b₃ |
227 | | - let d₂ : s ⊩ ψ := b₂.implyEquiv s ssr b₃ |
228 | | - d₁.implyEquiv s (StrongerThan.refl s) d₂ |
229 | | - | .and₁ φ ψ => fun p ↦ |
230 | | - implyEquiv.symm fun q sqp b ↦ |
231 | | - let ⟨dφ, dψ⟩ : q ⊩ φ × q ⊩ ψ := b.andEquiv |
232 | | - dφ |
233 | | - | .and₂ φ ψ => fun p ↦ |
234 | | - implyEquiv.symm fun q sqp b ↦ |
235 | | - let ⟨dφ, dψ⟩ : q ⊩ φ × q ⊩ ψ := b.andEquiv |
236 | | - dψ |
237 | | - | .and₃ φ ψ => fun p ↦ |
238 | | - implyEquiv.symm fun q sqp bφ ↦ |
239 | | - implyEquiv.symm fun r srq bψ ↦ |
240 | | - andEquiv.symm ⟨bφ.monotone srq, bψ⟩ |
241 | | - | .or₁ φ ψ => fun p ↦ |
242 | | - implyEquiv.symm fun q sqp bφ ↦ orEquiv.symm <| .inl bφ |
243 | | - | .or₂ φ ψ => fun p ↦ |
244 | | - implyEquiv.symm fun q sqp bψ ↦ orEquiv.symm <| .inr bψ |
245 | | - | .or₃ φ ψ χ => fun p ↦ |
246 | | - implyEquiv.symm fun q sqp bφχ ↦ |
247 | | - implyEquiv.symm fun r srq bψχ ↦ |
248 | | - implyEquiv.symm fun s ssr b ↦ |
249 | | - let d : s ⊩ φ ⊕ s ⊩ ψ := b.orEquiv |
250 | | - d.rec |
251 | | - (fun dφ ↦ bφχ.implyEquiv s (ssr.trans srq) dφ) |
252 | | - (fun dψ ↦ bψχ.implyEquiv s ssr dψ) |
253 | | - | .all₁ φ t => fun p ↦ implyEquiv.symm fun q sqp b ↦ b.allEquiv t |
254 | | - | .all₂ φ ψ => fun p ↦ |
255 | | - implyEquiv.symm fun q sqp b ↦ |
256 | | - implyEquiv.symm fun r srq bφ ↦ |
257 | | - allEquiv.symm fun t ↦ |
258 | | - let d : q ⊩ φ 🡒 ψ/[t] := by simpa using (b.allEquiv t) |
259 | | - d.implyEquiv r srq bφ |
260 | | - | .ex₁ t φ => fun p ↦ |
261 | | - implyEquiv.symm fun q sqp bφ ↦ exsEquiv.symm ⟨t, bφ⟩ |
262 | | - | .ex₂ φ ψ => fun p ↦ |
263 | | - implyEquiv.symm fun q sqp b ↦ |
264 | | - implyEquiv.symm fun r srq bφ ↦ |
265 | | - let ⟨t, dt⟩ : (t : SyntacticTerm L) × r ⊩ φ/[t] := bφ.exsEquiv |
266 | | - let d : q ⊩ φ/[t] 🡒 ψ := by simpa using b.allEquiv t |
267 | | - d.implyEquiv r srq dt |
268 | | - termination_by b => HilbertProofᵢ.depth b |
269 | | - |
270 | | -def relRefl {k} (R : L.Rel k) (v : Fin k → SyntacticTerm L) : [.rel R v] ⊩ rel R v := |
271 | | - relEquiv.symm ⟨Derivation.identity _ _, by simp⟩ |
272 | | - |
273 | | -protected def refl.or (ihφ : [φ] ⊩ φᴺ) (ihψ : [ψ] ⊩ ψᴺ) : [φ ⋎ ψ] ⊩ (φ ⋎ ψ)ᴺ := |
274 | | - implyOf fun q dq ↦ |
275 | | - let ⟨dφ, dψ⟩ : q ⊩ ∼φᴺ × q ⊩ ∼ψᴺ := dq.andEquiv |
276 | | - let ihφ : [φ] ⊩ φᴺ := ihφ |
277 | | - let ihψ : [ψ] ⊩ ψᴺ := ihψ |
278 | | - let bφ : [φ] ⊓ q ⊩ ⊥ := dφ.implyEquiv ([φ] ⊓ q) (.minLeRight _ _) (ihφ.monotone (.minLeLeft _ _)) |
279 | | - let bψ : [ψ] ⊓ q ⊩ ⊥ := dψ.implyEquiv ([ψ] ⊓ q) (.minLeRight _ _) (ihψ.monotone (.minLeLeft _ _)) |
280 | | - let ⟨bbφ, hbbφ⟩ := bφ.falsumEquiv |
281 | | - let ⟨bbψ, hbbψ⟩ := bψ.falsumEquiv |
282 | | - let band : ⊢ᴸᴷ¹ ∼φ ⋏ ∼ψ :: ∼q := Derivation.and |
283 | | - (Derivation.cast bbφ (by simp [inf_def])) (Derivation.cast bbψ (by simp [inf_def])) |
284 | | - falsumEquiv.symm ⟨Derivation.cast band (by simp [inf_def]), by simp [band, hbbφ, hbbψ]⟩ |
285 | | - |
286 | | -set_option backward.isDefEq.respectTransparency false in |
287 | | -protected def refl.exs (d : ∀ x, [φ/[&x]] ⊩ (φ/[&x])ᴺ) : [∃⁰ φ] ⊩ (∃⁰ φ)ᴺ := |
288 | | - implyOf fun q f ↦ |
289 | | - let x := Sequent.newVar ((∀⁰ ∼φ) :: ∼q) |
290 | | - let ih : [φ/[&x]] ⊩ φᴺ/[&x] := cast (d x) (by simp [Semiformula.subst_doubleNegation]) |
291 | | - let b : [φ/[&x]] ⊓ q ⊩ ⊥ := |
292 | | - (f.allEquiv &x).implyEquiv ([φ/[&x]] ⊓ q) (StrongerThan.minLeRight _ _) (ih.monotone (StrongerThan.minLeLeft _ _)) |
293 | | - let ⟨b, hb⟩ := b.falsumEquiv |
294 | | - let ba : ⊢ᴸᴷ¹ (∀⁰ ∼φ) :: ∼q := |
295 | | - Derivation.genelalizeByNewver (m := x) |
296 | | - (by have : ¬Semiformula.FVar? (∀⁰ ∼φ) x := Sequent.not_fvar?_newVar (by simp) |
297 | | - simpa using this) |
298 | | - (fun ψ hψ ↦ Sequent.not_fvar?_newVar (List.mem_cons_of_mem (∀⁰ ∼φ) hψ)) |
299 | | - (Derivation.cast b (by simp [inf_def])) |
300 | | - falsumEquiv.symm ⟨ba, by simp [ba, hb]⟩ |
301 | | - |
302 | | -set_option backward.isDefEq.respectTransparency false in |
303 | | -protected def refl : (φ : Proposition L) → [φ] ⊩ φᴺ |
304 | | - | ⊤ => implyEquiv.symm fun q sqp dφ ↦ dφ |
305 | | - | ⊥ => falsumEquiv.symm ⟨Derivation.verum, by simp⟩ |
306 | | - | .rel R v => implyOf fun q dq ↦ |
307 | | - let b : [.rel R v] ⊓ q ⊩ rel R v := (relRefl R v).monotone (StrongerThan.minLeLeft _ _) |
308 | | - dq.implyEquiv ([.rel R v] ⊓ q) (StrongerThan.minLeRight _ _) b |
309 | | - | .nrel R v => implyOf fun q dq ↦ |
310 | | - let ⟨d, hd⟩ := dq.relEquiv |
311 | | - falsumEquiv.symm ⟨Derivation.cast d (by simp [inf_def]), by simp [hd]⟩ |
312 | | - | φ ⋏ ψ => |
313 | | - let ihφ : [φ] ⊩ φᴺ := Forces.refl φ |
314 | | - let ihψ : [ψ] ⊩ ψᴺ := Forces.refl ψ |
315 | | - andEquiv.symm ⟨ihφ.monotone (.K_left φ ψ), ihψ.monotone (.K_right φ ψ)⟩ |
316 | | - | φ ⋎ ψ => refl.or (Forces.refl φ) (Forces.refl ψ) |
317 | | - | ∀⁰ φ => allEquiv.symm fun t ↦ |
318 | | - let b : [φ/[t]] ⊩ φᴺ/[t] := by simpa [Semiformula.rew_doubleNegation] using Forces.refl (φ/[t]) |
319 | | - b.monotone (StrongerThan.all φ t) |
320 | | - | ∃⁰ φ => refl.exs fun x ↦ Forces.refl (φ/[&x]) |
321 | | - termination_by φ => φ.complexity |
322 | | - |
323 | | -def conj : {Γ : Sequentᵢ L} → (b : (φ : Propositionᵢ L) → φ ∈ Γ → p ⊩ φ) → p ⊩ ⋀Γ |
324 | | - | [], _ => implyEquiv.symm fun q sqp bφ ↦ bφ |
325 | | - | [φ], b => b φ (by simp) |
326 | | - | φ :: ψ :: Γ, b => andEquiv.symm ⟨b φ (by simp), conj (fun χ hχ ↦ b χ (List.mem_cons_of_mem φ hχ))⟩ |
327 | | - |
328 | | -def conj' : {Γ : Sequent L} → (b : (φ : Proposition L) → φ ∈ Γ → p ⊩ φᴺ) → p ⊩ ⋀Γᴺ |
329 | | - | [], _ => implyEquiv.symm fun q sqp bφ ↦ bφ |
330 | | - | [φ], b => b φ (by simp) |
331 | | - | φ :: ψ :: Γ, b => andEquiv.symm ⟨b φ (by simp), conj' (fun χ hχ ↦ b χ (List.mem_cons_of_mem φ hχ))⟩ |
332 | | - |
333 | | -end Forces |
334 | | - |
335 | | -/-- Cut elimination theorem of $\mathbf{LK}$. -/ |
336 | | -def hauptsatz [L.DecidableEq] {Γ : Sequent L} : ⊢ᴸᴷ¹ Γ → {d : ⊢ᴸᴷ¹ Γ // Derivation.IsCutFree d} := fun d ↦ |
337 | | - let d : 𝗠𝗶𝗻¹ ⊢! ⋀(∼Γ)ᴺ 🡒 ⊥ := Entailment.FiniteContext.toDef (Derivation.gödelGentzen d) |
338 | | - let ff : Forces (∼Γ) (⋀(∼Γ)ᴺ 🡒 ⊥) := Forces.sound d (∼Γ) |
339 | | - let fc : Forces (∼Γ) (⋀(∼Γ)ᴺ) := Forces.conj' fun φ hφ ↦ |
340 | | - (Forces.refl φ).monotone (StrongerThan.ofSubset <| List.cons_subset.mpr ⟨hφ, by simp⟩) |
341 | | - let b : Forces (∼Γ) ⊥ := ff.modusPonens fc |
342 | | - let ⟨b, hb⟩ := b.falsumEquiv |
343 | | - ⟨Derivation.cast b (by simp), by simp [hb]⟩ |
344 | | - |
345 | 20 | instance : LE ℙ := ⟨fun q p ↦ Nonempty (q ≼ p)⟩ |
346 | 21 |
|
347 | 22 | instance : Preorder ℙ where |
|
0 commit comments