-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modal and Superintuitionistic based on new system #47
Conversation
namespace LO.Modal.Standard | ||
|
||
namespace Kripke | ||
|
||
variable (W α : Type*) | ||
variable (W : Type*) (α : Type u) | ||
|
||
set_option linter.unusedVariables false in | ||
abbrev Frame (α : Type*) := W → W → Prop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FrameClass
の定義に照らし合わせると,(というより,一般にはこういう定義だと思う)W
は型の中に含めてしまったほうが良いと思うが,どうだろう?
structure Frame (α : Type*) where
World : Type*
nonempty : Nonempty World
Rel : World → World → Prop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この方法を採用する場合,α
は単なるマーカーなので以下のようにしたほうがいいかもしれない
structure Frame where
World : Type*
nonempty : Nonempty World
Rel : World → World → Prop
set_option linter.unusedVariables false in
abbrev FrameOn (α : Type*) := Frame
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この定義で少し試してみたが,Formula.Kripke.Satisfies
のSemantics
へのインスタンス化で上手く型を合わせることが出来ず失敗してしまった(w
の型がM
に依存するためだろうか?).勘違いかもしれないので試してみてほしい.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
M
はw
から推論されるので,instance (M : Model α) : Semantics (Formula α) M.frame.World
を示せばよいと思う(依存積instance : Semantics (Formula α) ((M : Model α) × M.frame.World)
で定義してもよいが,型推論がうまく行かないことがある).Modal/Standard/Kripke/Semantics.leanの冒頭部分だけを書き直してみたが,問題ないと思う.
import Logic.Logic.System
import Logic.Modal.Standard.Formula
universe u
namespace LO.Modal.Standard
namespace Kripke
-- variable (W α : Type*) [Inhabited W]
structure Frame where
World : Type*
nonempty : Nonempty World
Rel : World → World → Prop
structure FiniteFrame extends Frame where
finite : Finite World
set_option linter.unusedVariables false in
abbrev Frame' (α : Type*) := Frame
set_option linter.unusedVariables false in
abbrev FiniteFrame' (α : Type*) := FiniteFrame
instance (F : Frame) : Nonempty F.World := F.nonempty
abbrev Frame.Rel' {F : Frame} (w w' : F.World) : Prop := F.Rel w w'
scoped infix:45 " ≺ " => Frame.Rel'
-- Vorspiel とかに移動したほうがいいかも
def RelItr {α : Type*} (R : α → α → Prop) : ℕ → α → α → Prop
| 0 => (· = ·)
| n + 1 => fun x y ↦ ∃ z, R x z ∧ RelItr R n z y
@[simp] lemma relItr_zero {α : Type*} (R : α → α → Prop) (x y : α) : RelItr R 0 x y ↔ x = y := iff_of_eq rfl
@[simp] lemma relItr_succ {α : Type*} (R : α → α → Prop) (x y : α) :
RelItr R (n + 1) x y ↔ ∃ z, R x z ∧ RelItr R n z y := iff_of_eq rfl
protected abbrev Frame.RelItr (n : ℕ) {F : Frame} (w w' : F.World) : Prop := RelItr (· ≺ ·) n w w'
scoped notation w:45 " ≺^[" n "] " w':46 => Frame.RelItr n w w'
def Multiframe (F : Frame) (n : ℕ) : Frame where
World := F.World
nonempty := F.nonempty
Rel := (· ≺^[n] ·)
notation:max F "^[" n "]" => Multiframe F n
abbrev Valuation (W α) := W → α → Prop
structure Model (α) where
frame : Frame
valuation : Valuation frame.World α
abbrev FrameClass := Set Frame
abbrev FiniteFrameClass := Set FiniteFrame
set_option linter.unusedVariables false in
abbrev FrameClass' (α : Type*) := FrameClass
set_option linter.unusedVariables false in
abbrev FiniteFrameClass' (α : Type*) := FiniteFrameClass
def FrameClass.toFinite (𝔽 : FrameClass) : FiniteFrameClass := {F | F.toFrame ∈ 𝔽}
postfix:max "ꟳ" => FrameClass.toFinite
instance : Coe FrameClass FiniteFrameClass := ⟨λ 𝔽 ↦ 𝔽ꟳ⟩
instance : Coe (FrameClass' α) (FiniteFrameClass' α) := ⟨λ 𝔽 ↦ 𝔽ꟳ⟩
abbrev FrameClass.Nonempty (𝔽 : FrameClass) : Prop := Set.Nonempty 𝔽
abbrev FiniteFrameClass.Nonempty (𝔽 : FiniteFrameClass) := Set.Nonempty 𝔽
abbrev FrameProperty (α : Type u) := Frame' α → Prop
abbrev FiniteFrameProperty (α : Type u) := FiniteFrame' α → Prop
abbrev Model.World (M : Model α) := M.frame.World
end Kripke
variable {W α : Type*} [Inhabited W]
open Standard.Kripke
def Formula.Kripke.Satisfies (M : Kripke.Model α) (w : M.frame.World) : Formula α → Prop
| atom a => M.valuation w a
| falsum => False
| and p q => (Satisfies M w p) ∧ (Satisfies M w q)
| or p q => (Satisfies M w p) ∨ (Satisfies M w q)
| imp p q => ¬(Satisfies M w p) ∨ (Satisfies M w q)
| box p => ∀ w', w ≺ w' → (Satisfies M w' p)
instance (M : Model α) : Semantics (Formula α) M.World := ⟨fun w ↦ Formula.Kripke.Satisfies M w⟩
open Formula.Kripke
namespace Formula.Kripke.Satisfies
lemma iff_models {M : Model α} {w : M.World} : w ⊧ f ↔ Formula.Kripke.Satisfies M w f := iff_of_eq rfl
instance (M : Model α) : Semantics.Tarski M.World where
realize_top := by simp [iff_models, Satisfies]
realize_bot := by simp [iff_models, Satisfies]
realize_not := by simp [iff_models, Satisfies]
realize_and := by simp [iff_models, Satisfies]
realize_or := by simp [iff_models, Satisfies]
realize_imp := by simp [iff_models, Satisfies, imp_iff_not_or]
variable {M : Model α} {w : M.World} {p q : Formula α}
@[simp] lemma atom_def : w ⊧ atom a ↔ M.valuation w a := by simp [iff_models, Satisfies];
@[simp] lemma box_def : w ⊧ (□p : Formula α) ↔ ∀ w', w ≺ w' → w' ⊧ p := by simp [iff_models, Satisfies];
@[simp] lemma dia_def : w ⊧ (◇p : Formula α) ↔ ∃ w', w ≺ w' ∧ w' ⊧ p := by simp [iff_models, Satisfies];
@[simp]
lemma multibox_def : (w ⊧ (□^[n]p : Formula α)) ↔ (∀ v, w ≺^[n] v → v ⊧ p) := by
induction n generalizing w with
| zero => simp;
| succ n ih =>
constructor;
. intro h w' hww';
simp at h;
obtain ⟨v, hwv, hvw'⟩ := hww';
exact (ih.mp $ h _ hwv) w' hvw';
. simp;
intro h w' hww';
apply ih.mpr;
intro v hwv;
exact h v w' hww' hwv;
ただ□p
の型推論がうまくいかないところが気になる.集合の場合は□'' s
などの表記にするのはどうだろう.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
全体的にこの方針で書き換えたのだが,Model
が非明示的なので⊧
などの表記が使えずSatisfies
で直接書かざるケースが多々あり,やや冗長な気もする.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
おそらく多くの場合はノーテーションを若干変えればSatisfies
を使用しなくて済むと思う.例えば,Modal/Standard/Kripke/Semantics.leanではCanonicalFrame L
を最初に定義してしまって,MCT L
についての定理を(CanonicalFrame L).World
に置き換えて示せばよい.このような言い換えが難しい場合は,フレームf := {World := W, Rel := R}
の自明な全単射W ≃ f.World
を用いてworldにアクセスすればよい.
_.World
といちいち書くのは面倒なのでinstance : CoeSort Frame Type* where coe := Frame.World
を定義するといいと思う.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
様相論理の書き換えが完了した.残りは直観主義論理の完全性のみ. |
全ての書き換えが終わりました. |
このPR自体がもうかなり大きいためドキュメントについては別PRで出そうと思う. |
とりあえず修正した. |
* add System * add axioms * rename * semantics * soundness / completeness * feat(Logic): Semantics.Meaningful * calculus * propositional * remove unused/updated files * add Collection * refactor * context * deduction theorem * context * fix * FirstOrder.Basic * context * add context * fix * compact * add Gentzen * FirstOrder * FirstOrder * refactor * doc * FaithfulTranslation, Bitranslation * fix * temporary comment out * complete * `oRing_consequence_of` * `SigmaSymbol`, `PiSymbol` * refactor * rename * rename * univitr, exItr * elab existsUnique * uncomment * Modal and Superintuitionistic based on new system (#47) * refactor(Modal, wip): RefactorModal Logical Connectives * fix * fix * fix * no `Fin` * refactor * wip * Testing rewrite Kripkean semantics for modal logic * multiframe * deduction wip * refactor(Modal, wip): RefactorModal Logical Connectives * fix * fix * fix * soundness * refactor soundness * update * refactor * wip 1 * wip 2 * fix 3 * Nat iterate style * wip * Completeness (wip) and disjunctive * commentout * wip * wip * FaithfulTranslation, Bitranslation * fix * feat(Modal): Strength of Logics Part.2 (#45) * refactor(Normal Modal): Refactor modal strength * fix(Modal): Require weak kripke completeness * Create LICENSE * ci: Update actions (#49) * wip * Completeness (wip) and disjunctive * commentout * wip * wip * move, rewrite, wip * geach definability and reducible * GL definability * rewrite by list wip * Rewrite axiomsetframeclass * wip * refactoring * wip * fx * fix * `conj'IffConj` * Modal Companion wip * refactoring and fix * modal companion * Remove sorry in some lemmata for glivenko * wip * wip * remove sorry for truthlemma & corollary * completeness of 𝐊 * fix misc * fix * fix * add axiomsets * deduction system 2 * modal completeness wip * commentout some sorry * modal logic completeness. * Modal logic Semantics * refactor * wip (remain few lemmata) * rm old file * finished * fx comment * refactor * fix by review --------- Co-authored-by: palalansouki <palalansouki@gmail.com> --------- Co-authored-by: SnO₂WMaN <me@sno2wman.net>
Rewrite modal logic based on #44
Depends