Skip to content

Instantly share code, notes, and snippets.

View copumpkin's full-sized avatar
💭
Mostly unresponsive these days

Daniel Peebles copumpkin

💭
Mostly unresponsive these days
View GitHub Profile
@copumpkin
copumpkin / Routing.agda
Last active October 2, 2015 07:38
Routing
module Routing where
open import Function hiding (type-signature)
open import Data.Bool hiding (_≟_)
open import Data.Maybe
open import Data.Char hiding (_≟_)
open import Data.String as String
open import Data.List as List hiding ([_])
open import Data.Product hiding (curry; uncurry)
@copumpkin
copumpkin / Nicomachus.agda
Last active August 6, 2024 08:32
Nicomachus's theorem
module Nicomachus where
open import Function
open import Relation.Binary.PropositionalEquality
import Relation.Binary.EqReasoning as EqReasoning
open import Data.Nat
open import Data.Nat.Properties
-- http://en.wikipedia.org/wiki/Nicomachus%27s_theorem
module STLC where
-- Simple substitution à la Conor, as described in http://strictlypositive.org/ren-sub.pdf
id : {A : Set} → A → A
id x = x
data Type : Set where
* : Type
_⇒_ : (S T : Type) → Type
@copumpkin
copumpkin / Russell.agda
Last active October 4, 2015 11:48
Russell's paradox
{-# OPTIONS --type-in-type --without-K #-}
module Russell where
open import Data.Empty
open import Data.Product
open import Relation.Nullary hiding (yes; no)
open import Relation.Binary.PropositionalEquality
-- Based on Robert Dockins's Coq reorganization of Chad E Brown's proof of Russell's paradox
@copumpkin
copumpkin / Types.agda
Last active October 17, 2021 11:24
Types form a commutative semiring!
module Types where
open import Level
open import Function
open import Algebra
open import Data.Empty
open import Data.Unit
open import Data.Sum as Sum
open import Data.Product as Prod
open import Relation.Binary
@copumpkin
copumpkin / State.agda
Last active October 4, 2015 15:18
The State monad
module Categories.Agda.State where
open import Categories.Category
open import Categories.Agda
open import Categories.Agda.Product
open import Categories.Functor hiding (_≡_)
open import Categories.Functor.Product
open import Categories.Functor.Hom
open import Categories.Monad
open import Categories.Adjunction
@copumpkin
copumpkin / List.agda
Last active October 4, 2015 15:58
The List monad
module Categories.Agda.List where
open import Level
open import Categories.Category
open import Categories.Functor using (Functor; module Functor)
open import Categories.NaturalTransformation using (NaturalTransformation; module NaturalTransformation)
open import Categories.Adjunction
open import Categories.Monad
open import Categories.Agda
open import Categories.Support.PropositionalEquality
{-# OPTIONS --without-K #-}
module Unique where
open import Level
open import Data.Empty
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
module Unique {a} {A : Set a} (_≟_ : (x y : A) → Dec (x ≡ y)) where
squish : {x y : A} → x ≡ y → x ≡ y
@copumpkin
copumpkin / Scratch.agda
Last active October 6, 2015 00:57
Fix
module Scratch where
open import Level
open import Function
open import Relation.Binary.PropositionalEquality
import Relation.Binary.EqReasoning as EqReasoning
-- Legend has it that parametricity is just dinaturality
module Parametricity {a} {F G : Set a → Set a → Set a}
(mapF : ∀ {A B C D} → (A → B) → (C → D) → F B C → F A D)
@copumpkin
copumpkin / gist:3115103
Created July 15, 2012 05:08
Unit is not ()
{-# LANGUAGE TypeFamilies, GADTs, EmptyDataDecls #-}
data Empty
data Unit = Unit
data Equal a b where
Refl :: Equal a a
type family F a :: *