Skip to content

Commit

Permalink
add: ModalLogic
Browse files Browse the repository at this point in the history
  • Loading branch information
iehality committed Sep 4, 2024
1 parent 8fba6e1 commit 1fea020
Showing 1 changed file with 117 additions and 0 deletions.
117 changes: 117 additions & 0 deletions Incompleteness/ModalLogic/Basic.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import Incompleteness.DC.Basic
import Logic.Modal.Standard.Deduction

namespace LO.Modal.Standard.Provability

open LO.FirstOrder LO.FirstOrder.DerivabilityCondition

variable {ฮฑ : Type*} [DecidableEq ฮฑ]

/-- Mapping modal prop vars to first-order sentence -/
def realization (L) (ฮฑ : Type u) := ฮฑ โ†’ FirstOrder.Sentence L

/-- Mapping modal formulae to first-order sentence -/
def interpretation
[Semiterm.Operator.GoedelNumber L (FirstOrder.Sentence L)]
(f : realization L ฮฑ) (๐”Ÿ : ProvabilityPredicate L L) : Formula ฮฑ โ†’ FirstOrder.Sentence L
| .atom a => f a
| โ–กp => โฆ๐”ŸโฆŽ(interpretation f ๐”Ÿ p)
| โŠฅ => โŠฅ
| p โŸถ q => (interpretation f ๐”Ÿ p) โŸถ (interpretation f ๐”Ÿ q)
scoped notation f "[" ๐”Ÿ "] " p => interpretation f ๐”Ÿ p -- TODO: more good notation

namespace interpretation

variable [Semiterm.Operator.GoedelNumber L (FirstOrder.Sentence L)]
{f : realization L ฮฑ} {๐”Ÿ : ProvabilityPredicate L L} {p q : Formula ฮฑ}
[NegAbbrev (FirstOrder.Sentence L)]

lemma imp_def : (f[๐”Ÿ] (p โŸถ q)) = ((f[๐”Ÿ] p) โŸถ (f[๐”Ÿ] q)) := by rfl
lemma box_def : (f[๐”Ÿ] โ–กp) = โฆ๐”ŸโฆŽ(f[๐”Ÿ] p) := by rfl
lemma neg_def : (f[๐”Ÿ] ~p) = (f[๐”Ÿ] p) โŸถ โŠฅ := by rfl

end interpretation

/-
TODO:
`ArithmeticalSoundness`ใจ`ArithmeticalCompleteness`ใ‚’ๅ˜็ด”ใซinstanceๅŒ–ใ™ใ‚‹้š›ใซใฏๅคงๆŠต`Tโ‚€`ใซไพๅญ˜ใ—ใฆใ—ใพใ†ใŸใ‚ๅž‹ๆŽจ่ซ–ใŒๅฃŠใ‚Œใฆใ—ใพใ†๏ผŽ
ใ‚‚ใ†ๅฐ‘ใ—่‰ฏใ„ใ‚„ใ‚Šๆ–นใŒใ‚ใ‚Šใใ†ใชๆฐ—ใ‚‚ใ™ใ‚‹ใฎใงไธ€ๆ—ฆใ‚ณใƒกใƒณใƒˆใ‚ขใ‚ฆใƒˆ
section
variable {L : FirstOrder.Language} [Semiterm.Operator.GoedelNumber L (Sentence L)]
variable (ฮฑ) (๐”Ÿ : ProvabilityPredicate L L)
class ArithmeticalSoundness (๐““ : DeductionParameter ฮฑ) (T : FirstOrder.Theory L) where
sound : โˆ€ {p}, (๐““ โŠข! p) โ†’ (โˆ€ f, T โŠข! f[๐”Ÿ] p)
class ArithmeticalCompleteness (๐““ : DeductionParameter ฮฑ) (T : FirstOrder.Theory L) where
complete : โˆ€ {p}, (โˆ€ f, T โŠข! f[๐”Ÿ] p) โ†’ (๐““ โŠข! p)
class ProvabilityLogic (๐““ : DeductionParameter ฮฑ) (T : FirstOrder.Theory L)where
is : System.theory ๐““ = { p | โˆ€ f, T โŠข! f[๐”Ÿ] p }
variable {ฮฑ ๐”Ÿ} {๐““ : DeductionParameter ฮฑ} {T : FirstOrder.Theory L}
instance [ArithmeticalSoundness ฮฑ ๐”Ÿ ๐““ T] [ArithmeticalCompleteness ฮฑ ๐”Ÿ ๐““ T] : ProvabilityLogic ฮฑ ๐”Ÿ ๐““ T where
is := by
apply Set.eq_of_subset_of_subset;
. intro p hp;
simp only [Set.mem_setOf_eq];
exact ArithmeticalSoundness.sound hp;
. intro p hp;
simp at hp;
exact ArithmeticalCompleteness.complete hp;
end
-/

section ArithmeticalSoundness

open System
open ProvabilityPredicate

variable {L : FirstOrder.Language} [Semiterm.Operator.GoedelNumber L (Sentence L)]
[DecidableEq (Sentence L)]
(Tโ‚€ T : FirstOrder.Theory L) [Tโ‚€ โ‰ผ T] [Diagonalization Tโ‚€]
(๐”Ÿ : ProvabilityPredicate L L)

lemma arithmetical_soundness_K4Loeb [๐”Ÿ.HBL Tโ‚€ T] (h : ๐Š๐Ÿ’(๐‹) โŠข! p) : โˆ€ {f : realization L ฮฑ}, T โŠข!. (f[๐”Ÿ] p) := by
intro f;
induction h using Deduction.inducition! with
| hRules rl hrl hant ih =>
rcases hrl with (โŸจ_, rflโŸฉ | โŸจ_, rflโŸฉ)
. simp_all only [List.mem_singleton, forall_eq]; exact D1s (Tโ‚€ := Tโ‚€) ih;
. simp_all only [List.mem_singleton, forall_eq]; exact Loeb.LT Tโ‚€ ih;
| hMaxm hp =>
rcases hp with (โŸจ_, _, rflโŸฉ | โŸจ_, rflโŸฉ)
. exact D2s (Tโ‚€ := Tโ‚€);
. exact D3s (Tโ‚€ := Tโ‚€);
| hMdp ihpq ihp =>
simp [interpretation] at ihpq;
exact ihpq โจ€ ihp;
| _ => dsimp [interpretation]; trivial;

theorem arithmetical_soundness_GL [๐”Ÿ.HBL Tโ‚€ T] (h : ๐†๐‹ โŠข! p) : โˆ€ {f : realization L ฮฑ}, T โŠข!. (f[๐”Ÿ] p) := by
apply arithmetical_soundness_K4Loeb (Tโ‚€ := Tโ‚€);
exact (System.weakerThan_iff.mp reducible_GL_K4Loeb) h;


lemma arithmetical_soundness_N [๐”Ÿ.HBL Tโ‚€ T] (h : ๐ โŠข! p) : โˆ€ {f : realization L ฮฑ}, T โŠข!. (f[๐”Ÿ] p) := by
intro f;
induction h using Deduction.inducition! with
| hMaxm hp => simp at hp;
| hRules rl hrl hant ih =>
simp only [Set.mem_setOf_eq] at hrl;
obtain โŸจp, rflโŸฉ := hrl;
simp_all only [List.mem_singleton, forall_eq];
exact D1s (Tโ‚€ := Tโ‚€) ih;
| hMdp ihpq ihp =>
simp only [interpretation] at ihpq;
exact ihpq โจ€ ihp;
| _ => dsimp [interpretation]; trivial;

end ArithmeticalSoundness

end Modal.Standard.Provability

end LO

0 comments on commit 1fea020

Please sign in to comment.