Skip to content

Instantly share code, notes, and snippets.

View useronym's full-sized avatar

Adam Krupicka useronym

  • Breach VR
  • Trondheim, NO
View GitHub Profile
open import Data.Nat using (ℕ; zero; suc)
open import Data.Bool using (Bool; true; false)
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
_=ℕ_ : ℕ → ℕ → Bool
0 =ℕ 0 = true
suc x =ℕ suc y = x =ℕ y
_ =ℕ _ = false
=ℕ-to-≡ : ∀ {x y : ℕ} → x =ℕ y ≡ true → x ≡ y
data _⊢_ : Cx → Form → Set where
ID : ∀ {Γ A} → A ∈ Γ
→ Γ ⊢ A
MP : ∀ {Γ A B} → Γ ⊢ A ⇒ B → Γ ⊢ A
→ Γ ⊢ B
AB : ∀ {Γ A B C} → Γ ⊢ (B ⇒ C) ⇒ (A ⇒ B) ⇒ (A ⇒ C)
AC : ∀ {Γ A B C} → Γ ⊢ (A ⇒ (B ⇒ C)) ⇒ B ⇒ (A ⇒ C)
AI : ∀ {Γ A} → Γ ⊢ A ⇒ A
record Valuation : Set₁ where
field
_⊩ᵃ_ : Cx → Atom → Set
mono⊩ᵃ : ∀ {Γ Γ' a} → Γ ⊆ Γ' → Γ ⊩ᵃ a → Γ' ⊩ᵃ a
open Valuation {{…}} public
module _ {{V : Valuation}} where
_⊩_ : Cx → Form → Set
Γ ⊩ var x = Γ ⊩ᵃ x
Γ ⊩ (f₁ ⇒ f₂) = ∀ {Γ'} → Γ ⊆ Γ' → (Γ' ⊩ f₁) → (Γ' ⊩ f₂)
data _⊢_ : Cx → Form → Set where
ID : ∀ {Γ A} → A ∈ Γ
→ Γ ⊢ A
MP : ∀ {Γ A B} → Γ ⊢ A ⇒ B → Γ ⊢ A
→ Γ ⊢ B
DT : ∀ {Γ A B} → Γ , A ⊢ B
→ Γ ⊢ A ⇒ B
AB : ∀ {Γ A B C} → Γ ⊢ (B ⇒ C) ⇒ (A ⇒ B) ⇒ (A ⇒ C)
AC : ∀ {Γ A B C} → Γ ⊢ (A ⇒ (B ⇒ C)) ⇒ B ⇒ (A ⇒ C)
AI : ∀ {Γ A} → Γ ⊢ A ⇒ A
data ★ : Set where
ι : ★
_⊳_ : ★ → ★ → ★
infixr 15 _⊳_
data Term : Set where
var : Atom → Term
ƛ_↦_ : Atom → Term → Term
_⋅_ : Term → Term → Term
infix 7 ƛ_↦_
@useronym
useronym / STLC.agda
Last active September 11, 2016 08:58
module STLC where
open import Data.Empty using (⊥) public
open import Data.Unit using (⊤) renaming (tt to •) public
open import Function using () renaming (_∘′_ to _∘_) public
open import Data.Product using (_×_) renaming (_,_ to ⟨_,_⟩; proj₁ to π₁; proj₂ to π₂) public
open import Data.Nat using (ℕ) renaming (_≟_ to _≟ₙ_)
open import Data.Bool using (Bool; true; false; if_then_else_; not) renaming (_∧_ to _and_; _∨_ to _or_) public
open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; cong₂) public
open import Relation.Nullary using (Dec; yes; no; ¬_) public
-- BCI "linear" typed combinator calculus.
data ★ : Set where
ι : ★
_⊳_ : ★ → ★ → ★
infixr 10 _⊳_
data List (A : Set) : Set where
∅ : List A
_,_ : List A → A → List A
module IPC.ToSTLC where
open import Common
open import IPC
open import STLC
-- Translation from structural IPC to STLC for open terms.
transl : ∀ {Γ α} → Γ ⊢ⁱ α → Γ ⊢ˢ α
transl assumpⁱ = var zero
module test1 where
open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; trans; cong₂) public
data List (A : Set) : Set where
∅ : List A
_,_ : List A → A → List A
infixl 10 _,_
data _⊆_ {A} : List A → List A → Set where
module BCI.Hilbert.Definition where
open import Common
-- A tree variant of a Hilbert-style proof system with "BCI" as axioms.
data Form : Set where
var : Atom → Form
_⇒_ : Form → Form → Form
infixr 10 _⇒_