Changes files names, updated Readme
This commit is contained in:
parent
a2e7689f58
commit
1dc1826f49
@ -1,8 +1,8 @@
|
|||||||
{-# OPTIONS --prop --rewriting #-}
|
{-# OPTIONS --prop --rewriting #-}
|
||||||
|
|
||||||
open import PropUtil
|
open import PropUtil
|
||||||
|
|
||||||
module FinitaryFirstOrderLogic where
|
module FFOL where
|
||||||
|
|
||||||
open import Agda.Primitive
|
open import Agda.Primitive
|
||||||
open import ListUtil
|
open import ListUtil
|
||||||
@ -5,7 +5,7 @@ open import PropUtil
|
|||||||
module FFOLCompleteness where
|
module FFOLCompleteness where
|
||||||
|
|
||||||
open import Agda.Primitive
|
open import Agda.Primitive
|
||||||
open import FinitaryFirstOrderLogic
|
open import FFOL
|
||||||
open import ListUtil
|
open import ListUtil
|
||||||
|
|
||||||
record Family : Set (lsuc (ℓ¹)) where
|
record Family : Set (lsuc (ℓ¹)) where
|
||||||
@ -239,7 +239,7 @@ module FFOLCompleteness where
|
|||||||
app : {Γ : Con} → {F G : For Γ} → Γ ⊢ (F ⇒ G) → Γ ⊢ F → Γ ⊢ G
|
app : {Γ : Con} → {F G : For Γ} → Γ ⊢ (F ⇒ G) → Γ ⊢ F → Γ ⊢ G
|
||||||
app prf prf' = λ w γ → prf w γ w id-a (prf' w γ)
|
app prf prf' = λ w γ → prf w γ w id-a (prf' w γ)
|
||||||
-- Again, we don't write the _[_]p equalities as everything is in Prop
|
-- Again, we don't write the _[_]p equalities as everything is in Prop
|
||||||
vv
|
|
||||||
-- ∀i and ∀e
|
-- ∀i and ∀e
|
||||||
∀i : {Γ : Con} → {F : For (Γ ▹ₜ)} → (Γ ▹ₜ) ⊢ F → Γ ⊢ (∀∀ F)
|
∀i : {Γ : Con} → {F : For (Γ ▹ₜ)} → (Γ ▹ₜ) ⊢ F → Γ ⊢ (∀∀ F)
|
||||||
∀i p w γ = λ t → p w (γ ,× t)
|
∀i p w γ = λ t → p w (γ ,× t)
|
||||||
|
|||||||
@ -4,7 +4,7 @@ open import PropUtil
|
|||||||
|
|
||||||
module FFOLInitial where
|
module FFOLInitial where
|
||||||
|
|
||||||
open import FinitaryFirstOrderLogic
|
open import FFOL
|
||||||
open import Agda.Primitive
|
open import Agda.Primitive
|
||||||
open import ListUtil
|
open import ListUtil
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
{-# OPTIONS --prop #-}
|
{-# OPTIONS --prop --rewriting #-}
|
||||||
|
|
||||||
open import Agda.Builtin.Nat
|
open import PropUtil
|
||||||
|
|
||||||
module InfinitaryFirstOrderLogic (Term : Set) (R : Nat → Set) where
|
module IFOL (Term : Set) (R : Nat → Set) where
|
||||||
|
|
||||||
open import PropUtil
|
|
||||||
open import ListUtil
|
open import ListUtil
|
||||||
|
|
||||||
data Args : Nat → Set where
|
data Args : Nat → Set where
|
||||||
zero : Args 0
|
zero : Args 0
|
||||||
next : {n : Nat} → Args n → Term → Args (suc n)
|
next : {n : Nat} → Args n → Term → Args (succ n)
|
||||||
|
|
||||||
data Form : Set where
|
data Form : Set where
|
||||||
Rel : {n : Nat} → R n → (Args n) → Form
|
Rel : {n : Nat} → R n → (Args n) → Form
|
||||||
@ -1,12 +1,11 @@
|
|||||||
{-# OPTIONS --prop #-}
|
{-# OPTIONS --prop --rewriting #-}
|
||||||
|
|
||||||
open import Agda.Builtin.Nat
|
open import PropUtil
|
||||||
|
|
||||||
module InfinitaryFirstOrderKripke (Term : Set) (R : Nat → Set) where
|
module IFOLKripke (Term : Set) (R : Nat → Set) where
|
||||||
|
|
||||||
open import ListUtil
|
open import ListUtil
|
||||||
open import PropUtil
|
open import IFOL Term R
|
||||||
open import InfinitaryFirstOrderLogic Term R
|
|
||||||
|
|
||||||
private
|
private
|
||||||
variable
|
variable
|
||||||
@ -1,14 +1,13 @@
|
|||||||
{-# OPTIONS --prop #-}
|
{-# OPTIONS --prop --rewriting #-}
|
||||||
|
|
||||||
open import Agda.Builtin.Nat hiding (zero)
|
open import PropUtil hiding (zero)
|
||||||
|
|
||||||
module InfinitaryFirstOrderKripkeGeneral (Term : Set) (R : Nat → Set) where
|
module IFOLNormalization (Term : Set) (R : Nat → Set) where
|
||||||
|
|
||||||
open import ListUtil
|
open import ListUtil hiding (zero)
|
||||||
open import PropUtil
|
open import IFOL Term R using (Form; Args; Rel; _⇒_; _∧∧_; ⊤⊤; ∀∀; Con)
|
||||||
open import InfinitaryFirstOrderLogic Term R using (Form; Args; Rel; _⇒_; _∧∧_; ⊤⊤; ∀∀; Con)
|
|
||||||
|
|
||||||
open import InfinitaryFirstOrderKripke Term R using (Kripke)
|
open import IFOLKripke Term R using (Kripke)
|
||||||
|
|
||||||
record Preorder (T : Set₀) : Set₁ where
|
record Preorder (T : Set₀) : Set₁ where
|
||||||
constructor order
|
constructor order
|
||||||
@ -78,7 +77,7 @@ module InfinitaryFirstOrderKripkeGeneral (Term : Set) (R : Nat → Set) where
|
|||||||
module NormalizationTests where
|
module NormalizationTests where
|
||||||
|
|
||||||
{- Now using our records -}
|
{- Now using our records -}
|
||||||
open import InfinitaryFirstOrderLogic Term R hiding (Form; _⇒_; Con)
|
open import IFOL Term R hiding (Form; _⇒_; Con)
|
||||||
|
|
||||||
|
|
||||||
ClassicNN : NormalAndNeutral
|
ClassicNN : NormalAndNeutral
|
||||||
50
Readme.agda
50
Readme.agda
@ -1,31 +1,31 @@
|
|||||||
{-# OPTIONS --prop #-}
|
{-# OPTIONS --prop --rewriting #-}
|
||||||
|
|
||||||
module Readme where
|
module Readme where
|
||||||
|
|
||||||
-- We will use String as propositional variables
|
-- We will use String as propositional variables
|
||||||
open import Agda.Builtin.String using (String)
|
postulate String : Set
|
||||||
open import ListUtil
|
{-# BUILTIN STRING String #-}
|
||||||
|
|
||||||
open import PropUtil
|
open import PropUtil
|
||||||
|
open import ListUtil
|
||||||
|
|
||||||
-- We can use the basic propositional logic
|
-- We can use the basic propositional logic
|
||||||
open import PropositionalLogic String
|
open import ZOL String
|
||||||
|
|
||||||
-- Here is an example of a propositional formula and its proof
|
-- Here is an example of a propositional formula and its proof
|
||||||
-- The formula is (Q → R) → (P → Q) → P → R
|
-- The formula is (Q → R) → (P → Q) → P → R
|
||||||
d-C : [] ⊢ ((Var "Q") ⇒ (Var "R")) ⇒ ((Var "P") ⇒ (Var "Q")) ⇒ (Var "P") ⇒ (Var "R")
|
zol-ex : [] ⊢ ((Var "Q") ⇒ (Var "R")) ⇒ ((Var "P") ⇒ (Var "Q")) ⇒ (Var "P") ⇒ (Var "R")
|
||||||
d-C = lam (lam (lam (app (zero $ next∈ $ next∈ zero∈) (app (zero $ next∈ zero∈) (zero zero∈)))))
|
zol-ex = lam (lam (lam (app (zero $ next∈ $ next∈ zero∈) (app (zero $ next∈ zero∈) (zero zero∈)))))
|
||||||
|
|
||||||
-- We can with the basic interpretation ⟦_⟧ prove that some formulæ are not provable
|
-- We can with the basic interpretation ⟦_⟧ prove that some formulæ are not provable
|
||||||
-- For example, we can disprove (P → Q) → P 's provability as we can construct an
|
-- For example, we can disprove (P → Q) → P 's provability as we can construct an
|
||||||
-- environnement where the statement doesn't hold
|
-- environnement where the statement doesn't hold
|
||||||
|
|
||||||
ρ₀ : Env
|
ρ₀ : Env
|
||||||
ρ₀ "P" = ⊥
|
ρ₀ "P" = ⊥
|
||||||
ρ₀ "Q" = ⊤
|
ρ₀ "Q" = ⊤
|
||||||
ρ₀ _ = ⊥
|
ρ₀ _ = ⊥
|
||||||
|
zol-cex : ([] ⊢ (((Var "P") ⇒ (Var "Q")) ⇒ (Var "P"))) → ⊥
|
||||||
cex-d : ([] ⊢ (((Var "P") ⇒ (Var "Q")) ⇒ (Var "P"))) → ⊥
|
zol-cex h = ⟦ h ⟧ᵈ {ρ₀} tt λ x → tt
|
||||||
cex-d h = ⟦ h ⟧ᵈ {ρ₀} tt λ x → tt
|
|
||||||
|
|
||||||
-- But this is not enough to show the non-provability of every non-provable statement.
|
-- But this is not enough to show the non-provability of every non-provable statement.
|
||||||
-- Let's take as an example Pierce formula : ((P → Q) → P) → P
|
-- Let's take as an example Pierce formula : ((P → Q) → P) → P
|
||||||
@ -52,7 +52,7 @@ TND→P tnd {P} {Q} pqp = dis (tnd {P}) (λ p → p) (λ np → pqp (λ p → ca
|
|||||||
-- that the Pierce formula cannot be proven
|
-- that the Pierce formula cannot be proven
|
||||||
|
|
||||||
-- We import the general definition of Kripke models
|
-- We import the general definition of Kripke models
|
||||||
open import PropositionalKripke String
|
open import ZOLKripke String
|
||||||
|
|
||||||
-- We will now create a specific Kripke model in which Pierce formula doesn't hold
|
-- We will now create a specific Kripke model in which Pierce formula doesn't hold
|
||||||
|
|
||||||
@ -116,9 +116,9 @@ module PierceDisproof where
|
|||||||
PierceNotProvable h = Pierce⊥w₁ (⟦ h ⟧ {w₁} tt)
|
PierceNotProvable h = Pierce⊥w₁ (⟦ h ⟧ {w₁} tt)
|
||||||
|
|
||||||
|
|
||||||
module GeneralizationInPropositionalLogic where
|
module GeneralizationInZOL where
|
||||||
|
|
||||||
-- With Kripke models, we can even prove completeness
|
-- With Kripke models, we can even prove completeness of ZOL
|
||||||
-- Using the Universal Kripke Model
|
-- Using the Universal Kripke Model
|
||||||
|
|
||||||
-- With a slightly different universal model (using normal and neutral forms),
|
-- With a slightly different universal model (using normal and neutral forms),
|
||||||
@ -130,7 +130,7 @@ module GeneralizationInPropositionalLogic where
|
|||||||
|
|
||||||
-- As all those proofs are really similar, we created a NormalizationFrame structure
|
-- As all those proofs are really similar, we created a NormalizationFrame structure
|
||||||
-- that computes most of the proofs with only a few lemmas
|
-- that computes most of the proofs with only a few lemmas
|
||||||
open import PropositionalKripkeGeneral String
|
open import ZOLNormalization String
|
||||||
|
|
||||||
-- We now have access to quote and unquote functions with this
|
-- We now have access to quote and unquote functions with this
|
||||||
u1 = NormalizationFrame.u NormalizationTests.Frame⊢
|
u1 = NormalizationFrame.u NormalizationTests.Frame⊢
|
||||||
@ -146,13 +146,13 @@ module GeneralizationInPropositionalLogic where
|
|||||||
u6 = NormalizationFrame.u NormalizationTests.Frame⊆
|
u6 = NormalizationFrame.u NormalizationTests.Frame⊆
|
||||||
q6 = NormalizationFrame.q NormalizationTests.Frame⊆
|
q6 = NormalizationFrame.q NormalizationTests.Frame⊆
|
||||||
|
|
||||||
module GeneralizationInInfinitaryFirstOrderLogic where
|
module GeneralizationInIFOL where
|
||||||
|
|
||||||
-- We also did implement infinitary first order logic
|
-- We also did implement infinitary first order logic
|
||||||
-- (i.e. ∀ is like an infinitary ∧)
|
-- (i.e. ∀ is like an infinitary ∧)
|
||||||
-- The proofs works the same with only little modifications
|
-- The proofs works the same with only little modifications
|
||||||
|
|
||||||
open import InfinitaryFirstOrderKripkeGeneral String (λ n → String)
|
open import IFOLNormalization String (λ n → String)
|
||||||
|
|
||||||
u1 = NormalizationFrame.u NormalizationTests.Frame⊢
|
u1 = NormalizationFrame.u NormalizationTests.Frame⊢
|
||||||
q1 = NormalizationFrame.q NormalizationTests.Frame⊢
|
q1 = NormalizationFrame.q NormalizationTests.Frame⊢
|
||||||
@ -168,4 +168,22 @@ module GeneralizationInInfinitaryFirstOrderLogic where
|
|||||||
q6 = NormalizationFrame.q NormalizationTests.Frame⊆
|
q6 = NormalizationFrame.q NormalizationTests.Frame⊆
|
||||||
|
|
||||||
|
|
||||||
|
module NormalizationInFFOL where
|
||||||
|
|
||||||
|
-- We also did an implementation of the negative fragment
|
||||||
|
-- of finitary first order logic (∀ is defined with context extension)
|
||||||
|
|
||||||
|
-- The algebra has been written in this file
|
||||||
|
-- There is also the class of Tarski models, written as an example
|
||||||
|
open import FFOL
|
||||||
|
|
||||||
|
-- We have also written the syntax (initial model)
|
||||||
|
-- (a lot of transport hell, but i did it !)
|
||||||
|
open import FFOLInitial
|
||||||
|
|
||||||
|
-- And now, we can finally write the class of Family and Presheaf models
|
||||||
|
-- and we can make the proof of completeness of the latter.
|
||||||
|
open import FFOLCompleteness
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{-# OPTIONS --prop #-}
|
{-# OPTIONS --prop --rewriting #-}
|
||||||
|
|
||||||
module PropositionalLogic (PV : Set) where
|
module ZOL (PV : Set) where
|
||||||
|
|
||||||
open import PropUtil
|
open import PropUtil
|
||||||
open import ListUtil
|
open import ListUtil
|
||||||
@ -1,10 +1,10 @@
|
|||||||
{-# OPTIONS --prop #-}
|
{-# OPTIONS --prop --rewriting #-}
|
||||||
|
|
||||||
module PropositionalKripke (PV : Set) where
|
module ZOLKripke (PV : Set) where
|
||||||
|
|
||||||
open import ListUtil
|
open import ListUtil
|
||||||
open import PropUtil
|
open import PropUtil
|
||||||
open import PropositionalLogic PV
|
open import ZOL PV
|
||||||
|
|
||||||
private
|
private
|
||||||
variable
|
variable
|
||||||
@ -1,12 +1,12 @@
|
|||||||
{-# OPTIONS --prop #-}
|
{-# OPTIONS --prop --rewriting #-}
|
||||||
|
|
||||||
module PropositionalKripkeGeneral (PV : Set) where
|
module ZOLNormalization (PV : Set) where
|
||||||
|
|
||||||
open import ListUtil
|
open import ListUtil hiding (zero)
|
||||||
open import PropUtil
|
open import PropUtil hiding (zero)
|
||||||
open import PropositionalLogic PV using (Form; Var; _⇒_; _∧∧_; ⊤⊤; Con)
|
open import ZOL PV using (Form; Var; _⇒_; _∧∧_; ⊤⊤; Con)
|
||||||
|
|
||||||
open import PropositionalKripke PV using (Kripke)
|
open import ZOLKripke PV using (Kripke)
|
||||||
|
|
||||||
record Preorder (T : Set₀) : Set₁ where
|
record Preorder (T : Set₀) : Set₁ where
|
||||||
constructor order
|
constructor order
|
||||||
@ -75,7 +75,7 @@ module PropositionalKripkeGeneral (PV : Set) where
|
|||||||
module NormalizationTests where
|
module NormalizationTests where
|
||||||
|
|
||||||
{- Now using our records -}
|
{- Now using our records -}
|
||||||
open import PropositionalLogic PV hiding (Form; Var; _⇒_; Con)
|
open import ZOL PV hiding (Form; Var; _⇒_; Con)
|
||||||
|
|
||||||
|
|
||||||
ClassicNN : NormalAndNeutral
|
ClassicNN : NormalAndNeutral
|
||||||
138
fol-subst.agda
138
fol-subst.agda
@ -1,138 +0,0 @@
|
|||||||
open import Data.Nat
|
|
||||||
open import Relation.Binary.PropositionalEquality
|
|
||||||
|
|
||||||
variable m n l : ℕ
|
|
||||||
|
|
||||||
data Term : ℕ → Set where
|
|
||||||
zero : Term (suc n)
|
|
||||||
suc : Term n → Term (suc n)
|
|
||||||
|
|
||||||
variable t u : Term n
|
|
||||||
|
|
||||||
data Subst : ℕ → ℕ → Set where
|
|
||||||
ε : Subst n 0
|
|
||||||
_,_ : Subst m n → Term m → Subst m (suc n)
|
|
||||||
|
|
||||||
suc-subst : Subst m n → Subst (suc m) n
|
|
||||||
suc-subst ε = ε
|
|
||||||
suc-subst (ts , t) = suc-subst ts , suc t
|
|
||||||
|
|
||||||
id : Subst m m
|
|
||||||
id {zero} = ε
|
|
||||||
id {suc m} = (suc-subst (id {m})) , zero
|
|
||||||
|
|
||||||
subst-t : Term m → Subst n m → Term n
|
|
||||||
subst-t zero (us , u) = u
|
|
||||||
subst-t (suc t) (us , u) = subst-t t us
|
|
||||||
|
|
||||||
wk-t1 : Term n → Term (suc n)
|
|
||||||
wk-t1 t = subst-t t (suc-subst id)
|
|
||||||
|
|
||||||
subst-t1 : Term (suc n) → Term n → Term n
|
|
||||||
subst-t1 t u = subst-t t (id , u)
|
|
||||||
|
|
||||||
comp : Subst m l → Subst n m → Subst n l
|
|
||||||
comp ε us = ε
|
|
||||||
comp (ts , u) us = (comp ts us) , (subst-t u us)
|
|
||||||
|
|
||||||
{-
|
|
||||||
t [ suc-subst vs ] ≡ suc (t [vs ])
|
|
||||||
suc-subst ts ∘ (us , t) ≡ ts ∘ us
|
|
||||||
|
|
||||||
t [ id ] ≡ t
|
|
||||||
t [ us ∘ vs ] ≡ t [ us ] [ vs ]
|
|
||||||
|
|
||||||
ts ∘ id ≡ ts
|
|
||||||
id ∘ ts ≡ ts
|
|
||||||
(ts ∘ us) ∘ vs ≡ ts ∘ (us ∘ vs)
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
|
|
||||||
{-
|
|
||||||
wk-t : (l : ℕ) → Term (l + n) → Term (suc (l + n))
|
|
||||||
wk-t zero t = suc t
|
|
||||||
wk-t (suc l) zero = zero
|
|
||||||
wk-t (suc l) (suc t) = suc (wk-t l t)
|
|
||||||
|
|
||||||
subst-t : (l : ℕ) → Term (suc (l + n)) → Term n → Term (l + n)
|
|
||||||
subst-t zero zero u = u
|
|
||||||
subst-t zero (suc t) u = t
|
|
||||||
subst-t (suc l) zero u = zero
|
|
||||||
subst-t (suc l) (suc t) u = suc (subst-t l t u)
|
|
||||||
|
|
||||||
infix 15 _⇒_
|
|
||||||
|
|
||||||
data Form : ℕ → Set where
|
|
||||||
_⇒_ : Form n → Form n → Form n
|
|
||||||
∀F : Form (suc n) → Form n
|
|
||||||
P : Term n → Form n
|
|
||||||
-- R : Term n → Term n → Form n
|
|
||||||
|
|
||||||
wk-F : (l : ℕ) → Form (l + n) → Form (suc (l + n))
|
|
||||||
wk-F l (A ⇒ B) = wk-F l A ⇒ wk-F l B
|
|
||||||
wk-F l (∀F A) = ∀F (wk-F (suc l) A)
|
|
||||||
wk-F l (P t) = P (wk-t l t)
|
|
||||||
|
|
||||||
subst-F : (l : ℕ) → Form (suc (l + n)) → Term n → Form (l + n)
|
|
||||||
subst-F l (A ⇒ B) u = subst-F l A u ⇒ subst-F l B u
|
|
||||||
subst-F l (∀F A) u = ∀F (subst-F (suc l) A u)
|
|
||||||
subst-F l (P t) u = P (subst-t l t u)
|
|
||||||
|
|
||||||
infix 10 _▷_
|
|
||||||
|
|
||||||
data Con : ℕ → Set where
|
|
||||||
• : Con n
|
|
||||||
_▷_ : Con n → Form n → Con n
|
|
||||||
|
|
||||||
wk-C : (l : ℕ) → Con (l + n) → Con (suc (l + n))
|
|
||||||
wk-C l • = •
|
|
||||||
wk-C l (Γ ▷ A) = wk-C l Γ ▷ wk-F l A
|
|
||||||
|
|
||||||
variable Γ Δ : Con n
|
|
||||||
variable A B C : Form n
|
|
||||||
|
|
||||||
infix 5 _⊢_
|
|
||||||
|
|
||||||
data _⊢_ : Con n → Form n → Set where
|
|
||||||
zero : Γ ▷ A ⊢ A
|
|
||||||
suc : Γ ⊢ A → Γ ▷ B ⊢ A
|
|
||||||
lam : Γ ▷ A ⊢ B → Γ ⊢ A ⇒ B
|
|
||||||
app : Γ ⊢ A ⇒ B → Γ ⊢ A → Γ ⊢ B
|
|
||||||
Lam : (wk-C zero Γ) ⊢ A → Γ ⊢ ∀F A
|
|
||||||
App : Γ ⊢ ∀F A → (t : Term _) → Γ ⊢ subst-F zero A t
|
|
||||||
|
|
||||||
{-
|
|
||||||
-- (A ⇒ ∀ x . P x) ⇒ ∀ x . A → P x
|
|
||||||
|
|
||||||
-- A ≡ A [ wk ][ < t > ]
|
|
||||||
|
|
||||||
wk-subst : subst l (wk l A) t ≡ t
|
|
||||||
|
|
||||||
wk-subst : (A [ wk ]F) s[ < t > ]F ≡ A
|
|
||||||
wk-subst = {!!}
|
|
||||||
|
|
||||||
example : • ⊢ (A ⇒ (∀F (P zero))) ⇒ (∀F (A [ wk ]F) ⇒ P zero)
|
|
||||||
example {A = A} = lam (lam (App (app (suc zero)
|
|
||||||
(subst (λ X → (• ▷ A ⇒ ∀F (P zero)) ▷ ∀F (A [ wk ]F) ⊢ X)
|
|
||||||
(wk-subst {A = A}) (App zero zero))) zero))
|
|
||||||
|
|
||||||
|
|
||||||
-- (∀ x ∀ y . A(x,y)) ⇒ ∀ y ∀ x . A(y,x)
|
|
||||||
-- (A ⇒ ∀ x . B(x)) ⇒ ∀ x . A ⇒ B(x)
|
|
||||||
-- ∀ x y . A(x,y) ⇒ ∀ x . A(x,x)
|
|
||||||
-- ∀ x . A (x) ⇒ ∀ x y . A(x)
|
|
||||||
-- (((∀ x . A (x)) ⇒ B)⇒ B) ⇒ ∀ x . ((A (x) ⇒ B) ⇒ B)
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
--eqq : (suc (suc (l + n))) ≡ suc l + suc n
|
|
||||||
eqq : (suc (l + n)) ≡ l + suc n
|
|
||||||
eqq = {!!}
|
|
||||||
|
|
||||||
eq : ∀ {t : Term (suc (l + n))}{u : Term n} →
|
|
||||||
-- subst-t {n = suc n} l (subst Term (eqq {l = l}{n = n})(wk-t {n = n} (suc l) t)) (wk-t zero u)
|
|
||||||
subst-t {n = suc n} l (subst Term (eqq {l = (suc l)}{n = n})(wk-t {n = n} (suc l) t)) (wk-t zero u)
|
|
||||||
≡ {! subst-t l t !} -- subst-t l (wk-t (suc l) t) u ≡ subst-t l t u
|
|
||||||
eq = {!!}
|
|
||||||
-}
|
|
||||||
124
fol.agda
124
fol.agda
@ -1,124 +0,0 @@
|
|||||||
open import Data.Nat
|
|
||||||
open import Relation.Binary.PropositionalEquality
|
|
||||||
|
|
||||||
variable m n l : ℕ
|
|
||||||
|
|
||||||
_$_ : {A B : Set} → (A → B) → A → B
|
|
||||||
f $ x = f x
|
|
||||||
infixr 1 _$_
|
|
||||||
|
|
||||||
data Term : ℕ → Set where
|
|
||||||
zero : Term (suc n)
|
|
||||||
suc : Term n → Term (suc n)
|
|
||||||
|
|
||||||
variable t u : Term n
|
|
||||||
|
|
||||||
wk-t : (l : ℕ) → Term (l + n) → Term (suc (l + n))
|
|
||||||
wk-t zero t = suc t
|
|
||||||
wk-t (suc l) zero = zero
|
|
||||||
wk-t (suc l) (suc t) = suc (wk-t l t)
|
|
||||||
|
|
||||||
subst-t : (l : ℕ) → Term (suc (l + n)) → Term n → Term (l + n)
|
|
||||||
subst-t zero zero u = u
|
|
||||||
subst-t zero (suc t) u = t
|
|
||||||
subst-t (suc l) zero u = zero
|
|
||||||
subst-t (suc l) (suc t) u = suc (subst-t l t u)
|
|
||||||
|
|
||||||
infix 15 _⇒_
|
|
||||||
|
|
||||||
data Form : ℕ → Set where
|
|
||||||
_⇒_ : Form n → Form n → Form n
|
|
||||||
∀F : Form (suc n) → Form n
|
|
||||||
P : Term n → Form n
|
|
||||||
-- R : Term n → Term n → Form n
|
|
||||||
|
|
||||||
wk-F : (l : ℕ) → Form (l + n) → Form (suc (l + n))
|
|
||||||
wk-F l (A ⇒ B) = wk-F l A ⇒ wk-F l B
|
|
||||||
wk-F l (∀F A) = ∀F (wk-F (suc l) A)
|
|
||||||
wk-F l (P t) = P (wk-t l t)
|
|
||||||
|
|
||||||
subst-F : (l : ℕ) → Form (suc (l + n)) → Term n → Form (l + n)
|
|
||||||
subst-F l (A ⇒ B) u = subst-F l A u ⇒ subst-F l B u
|
|
||||||
subst-F l (∀F A) u = ∀F (subst-F (suc l) A u)
|
|
||||||
subst-F l (P t) u = P (subst-t l t u)
|
|
||||||
|
|
||||||
infix 10 _▷_
|
|
||||||
|
|
||||||
data Con : ℕ → Set where
|
|
||||||
• : Con n
|
|
||||||
_▷_ : Con n → Form n → Con n
|
|
||||||
|
|
||||||
wk-C : (l : ℕ) → Con (l + n) → Con (suc (l + n))
|
|
||||||
wk-C l • = •
|
|
||||||
wk-C l (Γ ▷ A) = wk-C l Γ ▷ wk-F l A
|
|
||||||
|
|
||||||
variable Γ Δ : Con n
|
|
||||||
variable A B C : Form n
|
|
||||||
|
|
||||||
infix 5 _⊢_
|
|
||||||
|
|
||||||
data _⊢_ : Con n → Form n → Set where
|
|
||||||
zero : Γ ▷ A ⊢ A
|
|
||||||
suc : Γ ⊢ A → Γ ▷ B ⊢ A
|
|
||||||
lam : Γ ▷ A ⊢ B → Γ ⊢ A ⇒ B
|
|
||||||
app : Γ ⊢ A ⇒ B → Γ ⊢ A → Γ ⊢ B
|
|
||||||
Lam : (wk-C zero Γ) ⊢ A → Γ ⊢ ∀F A
|
|
||||||
App : Γ ⊢ ∀F A → (t : Term _) → Γ ⊢ subst-F zero A t
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- A ≡ A [ wk ][ < t > ]
|
|
||||||
|
|
||||||
wk-substt : {t : Term (l + n)} → subst-t l (wk-t l t) u ≡ t
|
|
||||||
wk-substt {zero} = refl
|
|
||||||
wk-substt {suc l} {t = zero} = refl
|
|
||||||
wk-substt {suc l} {n} {t = suc t} = cong (λ t → suc t) (wk-substt {l})
|
|
||||||
|
|
||||||
wk-substf : {A : Form (l + n)} → subst-F l (wk-F l A) u ≡ A
|
|
||||||
wk-substf {A = A ⇒ A₁} = cong₂ (λ B B₁ → B ⇒ B₁) wk-substf wk-substf
|
|
||||||
wk-substf {A = ∀F A} = cong (λ B → ∀F B) wk-substf
|
|
||||||
wk-substf {l = l} {A = P x} = cong (λ t → P t) (wk-substt {l})
|
|
||||||
|
|
||||||
-- (A ⇒ ∀ x . P x) ⇒ ∀ x . A → P x
|
|
||||||
example : • ⊢ (A ⇒ (∀F (P zero))) ⇒ (∀F (wk-F 0 A) ⇒ P zero)
|
|
||||||
example {A = A} = lam (lam (App (app (suc zero) (subst (λ Φ → (• ▷ A ⇒ ∀F (P zero)) ▷ ∀F (wk-F 0 A) ⊢ Φ) wk-substf (App zero zero))) zero))
|
|
||||||
|
|
||||||
-- (∀ x ∀ y . A(x,y)) ⇒ ∀ y ∀ x . A(y,x)
|
|
||||||
ex1 : {A : Form 2} → • ⊢ (∀F (∀F A)) ⇒ (∀F (∀F A))
|
|
||||||
ex1 = lam zero
|
|
||||||
-- (A ⇒ ∀ x . B(x)) ⇒ ∀ x . A ⇒ B(x)
|
|
||||||
-- y → ∀x B(x) ==> y → ∀ x B(y)
|
|
||||||
eq' : {l n : ℕ} → (l + suc n) ≡ (suc (l + n))
|
|
||||||
eq : {l n : ℕ} → (1 + (l + (suc n))) ≡ (suc (suc (l + n)))
|
|
||||||
--eq {zero} {zero} = refl
|
|
||||||
--eq {zero} {suc n} = cong suc (eq {l = 0})
|
|
||||||
--eq {suc l} = cong suc (eq {l = l})
|
|
||||||
lm-t : {l n : ℕ} → {t : Term (l + suc n)} → subst-t {n = suc n} l (subst Term (sym eq) (wk-t (suc l) (subst Term eq' t)) ) zero ≡ t
|
|
||||||
lm-F : {l n : ℕ} → {A : Form (l + suc n)} → subst-F {n = suc n} l (subst Form (sym eq) (wk-F (suc l) (subst Form eq' A)) ) zero ≡ A
|
|
||||||
lm-t {t = t} = {!!}
|
|
||||||
lm-F = {!!}
|
|
||||||
{-
|
|
||||||
lm-F : {A : Form 1} → subst-F 0 (wk-F 1 A) zero ≡ A
|
|
||||||
lm-F {A ⇒ A₁} = cong₂ (λ B B₁ → B ⇒ B₁) lm-F lm-F
|
|
||||||
lm-F {∀F A} = cong (λ B → ∀F B) {!lm-F!}
|
|
||||||
lm-F {P x} = cong (λ t → P t) lm-t
|
|
||||||
-}
|
|
||||||
ex2 : {A : Form 0} → {B : Form 1} → • ⊢ ((A ⇒ (∀F B)))⇒(∀F ((wk-F 0 A) ⇒ B))
|
|
||||||
ex2 {A = A} {B = B} = lam $ Lam $ lam $ subst (λ C → (• ▷ wk-F zero A ⇒ ∀F (wk-F 1 B)) ▷ wk-F 0 A ⊢ C) lm-F (((App (app (suc zero) zero) zero)))
|
|
||||||
-- lam (Lam (lam ( subst (λ Φ → (• ▷ wk-F zero A ⇒ ∀F (wk-F 1 B)) ▷ wk-F 0 A ⊢ Φ) (wk-substf {l = 0}) (App (app (suc (suc lm)) (app (suc zero) zero)) zero))))
|
|
||||||
-- ∀ x y . A(x,y) ⇒ ∀ x . A(x,x)
|
|
||||||
-- ∀ x . A (x) ⇒ ∀ x y . A(x)
|
|
||||||
-- (((∀ x . A (x)) ⇒ B)⇒ B) ⇒ ∀ x . ((A (x) ⇒ B) ⇒ B)
|
|
||||||
|
|
||||||
{-
|
|
||||||
--eqq : (suc (suc (l + n))) ≡ suc l + suc n
|
|
||||||
eqq : (suc (l + n)) ≡ l + suc n
|
|
||||||
eqq = {!!}
|
|
||||||
|
|
||||||
eq : ∀ {t : Term (suc (l + n))}{u : Term n} →
|
|
||||||
-- subst-t {n = suc n} l (subst Term (eqq {l = l}{n = n})(wk-t {n = n} (suc l) t)) (wk-t zero u)
|
|
||||||
subst-t {n = suc n} l (subst Term (eqq {l = (suc l)}{n = n})(wk-t {n = n} (suc l) t)) (wk-t zero u)
|
|
||||||
≡ {! subst-t l t !} -- subst-t l (wk-t (suc l) t) u ≡ subst-t l t u
|
|
||||||
eq = {!!}
|
|
||||||
|
|
||||||
-}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user