@@ -27,6 +27,9 @@ def newVar (Γ : Sequent L) : ℕ := (Γ.map Semiformula.fvSup).foldr max 0
2727lemma not_fvar?_newVar {φ : Proposition L} {Γ : Sequent L} (h : φ ∈ Γ) : ¬FVar? φ Γ.newVar :=
2828 not_fvar?_of_lt_fvSup φ (by simpa [newVar] using List.le_max_of_le (List.mem_map_of_mem h) (by simp))
2929
30+ @[simp] lemma rew_neg_comm {Γ : Sequent L} (ω : Rew L ℕ 0 ℕ 0 ) :
31+ (∼Γ).map (ω ▹ ·) = ∼Γ.map (ω ▹ ·) := by simp [List.tilde_def]
32+
3033end Sequent
3134
3235/-! ## Derivation for one-sided $\mathbf{LK}$ -/
@@ -48,8 +51,6 @@ namespace Derivation
4851
4952open Rewriting LawfulSyntacticRewriting
5053
51-
52-
5354def height {Δ : Sequent L} : ⊢ᴷ Δ → ℕ
5455 | .id _ _ => 0
5556 | cut dp dn => (max (height dp) (height dn)).succ
@@ -262,10 +263,6 @@ def equiv (𝓢 : Schema L) (φ) :
262263 toFun b := ⟨⟨b.axioms, b.axioms_mem⟩, b.derivation⟩
263264 invFun := fun ⟨⟨Γ, hΓ⟩, d⟩ ↦ ⟨Γ, hΓ, d⟩
264265
265- lemma provable_iff :
266- 𝓢 ⊢ φ ↔ ∃ Γ : Sequent L, (∀ ψ ∈ Γ, ψ ∈ 𝓢) ∧ Nonempty (⊢ᴷ φ :: ∼Γ) := by
267- simpa using (equiv 𝓢 φ).nonempty_congr
268-
269266instance : Entailment.Compact (Schema L) where
270267 core b := ⟨fun φ ↦ φ ∈ b.axioms⟩
271268 corePrf b := ⟨b.axioms, by simp, b.derivation⟩
@@ -284,29 +281,96 @@ instance (𝓢 𝓤 : Schema L) : 𝓢 ⪯ 𝓢 ⊔ 𝓤 := weakerThan_of_le (by
284281instance (𝓢 𝓤 : Schema L) : 𝓤 ⪯ 𝓢 ⊔ 𝓤 := weakerThan_of_le (by simp)
285282
286283lemma inconsistent_iff :
287- Entailment.Inconsistent 𝓢 ↔ ∃ Γ : Sequent L, (∀ ψ ∈ Γ, ψ ∈ 𝓢) ∧ Nonempty (⊢ᴷ ∼Γ) := calc
288- _ ↔ 𝓢 ⊢ ⊥ := Entailment.inconsistent_iff_provable_bot
289- _ ↔ ∃ Γ : Sequent L, (∀ ψ ∈ Γ, ψ ∈ 𝓢) ∧ Nonempty (⊢ᴷ ⊥ :: ∼Γ) := by simp [provable_iff]
290- _ ↔ ∃ Γ : Sequent L, (∀ ψ ∈ Γ, ψ ∈ 𝓢) ∧ Nonempty (⊢ᴷ ∼Γ) := by
291- constructor
292- · rintro ⟨Γ, hΓ, ⟨d⟩⟩
293- have : ⊢ᴷ [(∼⊥ : Proposition L)] := Derivation.verum.cast
294- exact ⟨Γ, hΓ, ⟨(Derivation.cut d this).cast⟩⟩
295- · rintro ⟨Γ, hΓ, ⟨d⟩⟩
296- exact ⟨Γ, hΓ, ⟨d.weakening⟩⟩
284+ Entailment.Inconsistent 𝓢 ↔ ∃ Γ : Sequent L, (∀ ψ ∈ Γ, ψ ∈ 𝓢) ∧ Nonempty (⊢ᴷ ∼Γ) :=
285+ OneSidedLK.inconsistent_iff
286+
287+ def rewrite [𝓢.IsClosed] (b : 𝓢 ⊢! φ) (f : ℕ → SyntacticTerm L) :
288+ 𝓢 ⊢! Rew.rewrite f ▹ φ where
289+ axioms := b.axioms.map (Rew.rewrite f ▹ ·)
290+ axioms_mem := by
291+ suffices ∀ ψ ∈ b.axioms, Rew.rewrite f ▹ ψ ∈ 𝓢 by simpa
292+ intro ψ hψ
293+ exact Schema.IsClosed.closed (Rew.rewrite f) _ (b.axioms_mem ψ hψ)
294+ derivation := b.derivation.rewrite f |>.cast
297295
298296end Schema.Proof
299297
298+ namespace Derivation
299+
300+ open Entailment
301+
302+ variable {Γ Δ : Sequent L}
303+
304+ def eCut (d₁ : ⊢ᴷ φ :: Γ) (d₂ : ⊢ᴷ ψ :: Δ) (e : ∼φ = ψ := by simp) : ⊢ᴷ Γ ++ Δ := cut d₁ (d₂.cast (by simp [e]))
305+
306+ def disj₂ {Γ Δ : Sequent L} : ⊢ᴷ (Γ ++ Δ) → ⊢ᴷ ⋁Γ :: Δ := fun d ↦
307+ match Γ with
308+ | [] => d.weakening
309+ | [φ] => d
310+ | [φ, ψ] => d.or
311+ | φ :: ψ :: χ :: Γ =>
312+ let Φ := ⋁(χ :: Γ)
313+ have : ⊢ᴷ (φ ⋎ ψ :: χ :: Γ) ++ Δ := d.or
314+ have d₁ : ⊢ᴷ (φ ⋎ ψ) ⋎ Φ :: Δ := this.disj₂
315+ have d₂ : ⊢ᴷ [(∼φ ⋏ ∼ψ) ⋏ ∼Φ, φ ⋎ ψ ⋎ Φ] :=
316+ have : ⊢ᴷ [φ, ψ ⋎ Φ, (∼φ ⋏ ∼ψ) ⋏ ∼Φ] :=
317+ ((identity φ).rotate.tensor (identity ψ).rotate).tensor
318+ (identity Φ).rotate |>.rotate.rotate.or.weakening
319+ this.or.rotate
320+ d₂.eCut d₁
321+ termination_by _ => Γ.length
322+
323+ def conj₂ {Γ Δ : Sequent L} (d : (φ : Proposition L) → φ ∈ Γ → ⊢ᴷ φ :: Δ) : ⊢ᴷ ⋀Γ :: Δ :=
324+ match Γ with
325+ | [] => verum.weakening
326+ | [φ] => d φ (by simp)
327+ | φ :: ψ :: Γ =>
328+ have : ⊢ᴷ ⋀(ψ :: Γ) :: Δ := conj₂ (Γ := ψ :: Γ) (fun χ h ↦ d χ (by simp_all))
329+ (d φ (by simp)).and this
330+
331+ def disjClosure : ⊢ᴷ Γ → 𝐋𝐊¹ ⊢! ⋁Γ := fun d ↦
332+ have : ⊢ᴷ Γ ++ [] := d.cast
333+ this.disj₂
334+
335+ def disjClosureInv : 𝐋𝐊¹ ⊢! ⋁Γ → ⊢ᴷ Γ := fun d ↦
336+ have d₁ : ⊢ᴷ [⋁Γ] := d
337+ have d₂ : ⊢ᴷ ⋀(∼Γ) :: Γ := conj₂ fun φ h ↦ close φ (by simp) (by simp_all)
338+ d₁.eCut d₂
339+
340+ lemma nonempty_iff_provable_disj : Nonempty (⊢ᴷ Γ) ↔ 𝐋𝐊¹ ⊢ ⋁Γ :=
341+ ⟨by rintro ⟨d⟩; exact ⟨d.disjClosure⟩, by rintro ⟨d⟩; exact ⟨d.disjClosureInv⟩⟩
342+
343+ end Derivation
344+
345+ namespace Schema.Proof
346+
347+ variable {𝓢 : Schema L}
348+
349+ open Derivation
350+
351+ lemma iff_context : 𝓢 ⊢ φ ↔ 𝓢 *⊢[𝐋𝐊¹] φ := by
352+ constructor
353+ · rintro ⟨d⟩
354+ have : 𝐋𝐊¹ ⊢! ⋀d.axioms ➝ φ :=
355+ have : ⊢ᴷ ∼d.axioms ++ [φ] := d.derivation.weakening
356+ this.disj₂.or.cast <| by simp [Semiformula.imp_eq]
357+ refine ⟨⟨d.axioms, by simpa using d.axioms_mem, this⟩⟩
358+ · rintro ⟨Γ, h, d⟩
359+ have d : ⊢ᴷ [⋁(∼Γ) ⋎ φ] := d.cast (by simp [Semiformula.imp_eq])
360+ have : ⊢ᴷ ⋀Γ ⋏ ∼φ :: φ :: ∼Γ :=
361+ have : ⊢ᴷ ⋀Γ :: ∼Γ := Derivation.conj₂ fun φ h ↦ close φ (by simp) (by simp [h])
362+ this.tensor (identity φ).rotate |>.weakening
363+ refine ⟨⟨Γ, h, (d.eCut this).cast⟩⟩
364+
365+ end Schema.Proof
300366
301367/-!
302368 ### Theory of schemata
303369-/
304370
305- abbrev Theory (L : Language) := Set (Sentence L)
306-
307371def Schema.theory (𝓢 : Schema L) : Theory L := {σ | 𝓢 ⊢ ↑σ}
308372
309- @[simp] lemma Schema.mem_theory {𝓢 : Schema L} {σ : Sentence L} :
373+ @[simp] lemma Schema.mem_theory {𝓢 : Schema L} :
310374 σ ∈ 𝓢.theory ↔ 𝓢 ⊢ ↑σ := by simp [Schema.theory]
311375
312376namespace Theory
0 commit comments