Skip to content

Commit

Permalink
Add introduction rules for natural deduction
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulc29 committed Jan 30, 2024
1 parent f6af9d5 commit 83130e9
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/Realizability/Tripos/Logic/Semantics.agda
Original file line number Diff line number Diff line change
Expand Up @@ -597,3 +597,42 @@ module Soundness
(pair ⨾ (pr₁ ⨾ c) ⨾ (pr₂ ⨾ (pr₂ ⨾ c)))
((subst (λ r r ⊩ ∣ ⟦ ϕ ⟧ᶠ ∣ γ) (sym (pr₁pxy≡x _ _)) pr₁⨾c⊩ϕγ) ,
(subst (λ r r ⊩ ∣ ⟦ θ ⟧ᶠ ∣ γ) (sym (pr₂pxy≡y _ _)) pr₂⨾pr₂⨾c⊩θ))) ∣₁ }) }))

module NaturalDeduction
{n}
{relSym : Vec Sort n}
(isNonTrivial : s ≡ k ⊥)
(⟦_⟧ʳ : RelationInterpretation relSym) where
open Relational relSym
open Interpretation relSym ⟦_⟧ʳ isNonTrivial
open Soundness isNonTrivial ⟦_⟧ʳ

-- ahh yes, the reduction of natural deduction to sequent calculus
-- cause I do not like sequent calculus
-- and it is much easier for formalisation to use natural deduction

data PropContext: Context) : Type (ℓ-suc ℓ') where
[] : PropContext Γ
_`&_ : PropContext Γ Formula Γ PropContext Γ

data _∈ᶠ_ : {Γ} Formula Γ PropContext Γ Type (ℓ-suc ℓ') where
here : {Γ} {p : Formula Γ} p ∈ᶠ ([] `& p)
there : {Γ Ξ ξ} {p : Formula Γ} p ∈ᶠ Ξ p ∈ᶠ (Ξ `& ξ)

weakenPropContext : {Γ S} PropContext Γ PropContext (Γ ′ S)
weakenPropContext {Γ} {S} [] = []
weakenPropContext {Γ} {S} (ctx `& x) = weakenPropContext ctx `& weakenFormula x

-- Judgements of natural deduction
data _∣_⊢_ :: Context) PropContext Γ Formula Γ Type (ℓ-suc ℓ') where
-- Introduction rules
intro⊤ : {Γ} {Ξ} Γ ∣ Ξ ⊢ ⊤ᵗ
intro∧ : {Γ Ξ A B} Γ ∣ Ξ ⊢ A Γ ∣ Ξ ⊢ B Γ ∣ Ξ ⊢ (A `∧ B)
intro∨L : {Γ Ξ A B} Γ ∣ Ξ ⊢ A Γ ∣ Ξ ⊢ (A `∨ B)
intro∨R : {Γ Ξ A B} Γ ∣ Ξ ⊢ B Γ ∣ Ξ ⊢ (A `∨ B)
intro∀ : {Γ} {S A} : PropContext Γ} (Γ ′ S) ∣ weakenPropContext Ξ ⊢ A Γ ∣ Ξ ⊢ `∀ A
intro∃ : {Γ S A Ξ} (t : Term Γ S) Γ ∣ Ξ ⊢ substitutionFormula (t , id) A Γ ∣ Ξ ⊢ `∃ A
intro→ : {Γ Ξ A B} Γ ∣ Ξ `& A ⊢ B Γ ∣ Ξ ⊢ (A `→ B)
intro∈ : {Γ Ξ p} p ∈ᶠ Ξ Γ ∣ Ξ ⊢ p


0 comments on commit 83130e9

Please sign in to comment.