m1-internship/PropositionalKripke.agda

121 lines
4.0 KiB
Agda
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{-# OPTIONS --prop #-}
module PropositionalKripke (PV : Set) where
open import PropUtil
open import PropositionalLogic PV
private
variable
x : PV
y : PV
F : Form
G : Form
Γ : Con
Γ' : Con
Η : Con
Η' : Con
record Kripke : Set where
field
Worlds : Set
_≤_ : Worlds Worlds Prop
refl≤ : {w : Worlds} w w
tran≤ : {a b c : Worlds} a b b c a c
_⊩_ : Worlds PV Prop
mon⊩ : {a b : Worlds} a b {p : PV} a p b p
private
variable
w : Worlds
w' : Worlds
w₁ : Worlds
w₂ : Worlds
w₃ : Worlds
{- Extending ⊩ to Formulas and Contexts -}
_⊩ᶠ_ : Worlds Form Prop
w ⊩ᶠ Var x = w x
w ⊩ᶠ (fp fq) = {w' : Worlds} w w' w' ⊩ᶠ fp w' ⊩ᶠ fq
_⊩ᶜ_ : Worlds Con Prop
w ⊩ᶜ [] =
w ⊩ᶜ (p c) = (w ⊩ᶠ p) (w ⊩ᶜ c)
-- The extensions are monotonous
mon⊩ᶠ : w w' w ⊩ᶠ F w' ⊩ᶠ F
mon⊩ᶠ {F = Var x} ww' wF = mon⊩ ww' wF
mon⊩ᶠ {F = F G} ww' wF w'w'' w''F = wF (tran≤ ww' w'w'') w''F
mon⊩ᶜ : w w' w ⊩ᶜ Γ w' ⊩ᶜ Γ
mon⊩ᶜ {Γ = []} ww' =
mon⊩ᶜ {Γ = F Γ} ww' = mon⊩ᶠ {F = F} ww' (proj₁ ) , mon⊩ᶜ ww' (proj₂ )
{- General operator matching the shape of ⊢ -}
_⊫_ : Con Form Prop
Γ F = {w : Worlds} w ⊩ᶜ Γ w ⊩ᶠ F
{- Soundness -}
⟦_⟧ : Γ F Γ F
zero = proj₁
next p = λ x p (proj₂ x)
lam p = λ w≤ w'A p w'A , mon⊩ᶜ w≤
app p p₁ = p refl≤ ( p₁ )
{- Universal Kripke -}
module UniversalKripke where
Worlds = Con
_≤_ : Con Con Prop
Γ Η = Η ⊢⁺ Γ
_⊩_ : Con PV Prop
Γ x = Γ Var x
refl≤ = refl⊢⁺
-- Proving transitivity
halftran≤ : {Γ Γ' : Con} {F : Form} Γ ⊢⁺ Γ' Γ' F Γ F
halftran≤ h⁺ zero = proj₁ h⁺
halftran≤ h⁺ (next h) = halftran≤ (proj₂ h⁺) h
halftran≤ h⁺ (lam h) = lam (halftran≤ zero , addhyp⊢⁺ h⁺ h)
halftran≤ h⁺ (app h h') = app (halftran≤ h⁺ h) (halftran≤ h⁺ h')
tran≤ : {Γ Γ' Γ'' : Con} Γ Γ' Γ' Γ'' Γ Γ''
tran≤ {[]} h h' = tt
tran≤ {x Γ} h h' = halftran≤ h' (proj₁ h) , tran≤ (proj₂ h) h'
mon⊩ : {w w' : Con} w w' {x : PV} w x w' x
mon⊩ h h' = halftran≤ h h'
UK : Kripke
UK = record {UniversalKripke}
module CompletenessProof where
open Kripke UK
open UniversalKripke using (halftran≤)
⊩ᶠ→⊢ : {F : Form} {Γ : Con} Γ ⊩ᶠ F Γ F
⊢→⊩ᶠ : {F : Form} {Γ : Con} Γ F Γ ⊩ᶠ F
⊢→⊩ᶠ {Var x} h = h
⊢→⊩ᶠ {F F₁} h {Γ'} iq hF = ⊢→⊩ᶠ {F₁} (app {Γ'} {F} {F₁} (lam (app (halftran≤ (addhyp⊢⁺ iq) h) zero)) (⊩ᶠ→⊢ hF))
⊩ᶠ→⊢ {Var x} h = h
⊩ᶠ→⊢ {F F₁} {Γ} h = lam (⊩ᶠ→⊢ (h (addhyp⊢⁺ refl⊢⁺) (⊢→⊩ᶠ {F} {F Γ} zero)))
completeness : {F : Form} [] F [] F
completeness {F} ⊫F = ⊩ᶠ→⊢ (⊫F tt)
{- Normalization -}
norm : [] F [] F
norm x = completeness ( x )
-- norm is identity ?!
idnorm : norm x x
idnorm = ?
-- autonorm : (P₁ P₂ : Prop) → (x₁ : P₁) → (norm x₁ : P₂) → P₁ ≡⊢ P₂
-- βηnorm : (P₁ P₂ : Prop) → (x₁ : P₁) → (norm x₁ : P₂) → (x₂ : P₂) → norm x₁ ≡ x₂ → P₁ ≡⊢ P₂
-- autonorm P = {!!}
--βηnorm P₁ P₂ = ?