Skip to content

Instantly share code, notes, and snippets.

@bobatkey
bobatkey / tuple.agda
Created February 27, 2024 10:08
"A Quick Introduction to Denotational Semantics using Agda" notes for talk given at TUPLE 2024 (https://typesig.comp-soc.com/tuple/)
{-# OPTIONS --postfix-projections #-}
module tuple where
------------------------------------------------------------------------------
--
@bobatkey
bobatkey / localdefs.agda
Created August 25, 2020 14:39
A start on formalisation of STLC + type synonyms and newtype
module localdefs where
mutual
data ty-ctx : Set where
ε : ty-ctx
_,-_ : (Δ : ty-ctx) → defn Δ → ty-ctx
data defn : ty-ctx → Set where
synonym : ∀ {Δ} → ty Δ → defn Δ
newtype : ∀ {Δ} → ty Δ → defn Δ
@bobatkey
bobatkey / param.agda
Last active June 23, 2020 16:20
Axiomatising parametricity in Agda via rewrite rules, with a units of measure example
{-# OPTIONS --prop --rewriting --confluence-check #-}
module param-rewrites where
open import Agda.Builtin.Unit
------------------------------------------------------------------------------
-- Equality as a proposition
data _≡_ {a} {A : Set a} : A → A → Prop where
refl : ∀{a} → a ≡ a
@bobatkey
bobatkey / cont-cwf.agda
Last active June 16, 2023 21:23
Construction of the Containers / Polynomials CwF in Agda, showing that function extensionality is refuted
{-# OPTIONS --rewriting #-}
module cont-cwf where
open import Agda.Builtin.Sigma
open import Agda.Builtin.Unit
open import Agda.Builtin.Bool
open import Agda.Builtin.Nat
open import Data.Empty
import Relation.Binary.PropositionalEquality as Eq
@bobatkey
bobatkey / fulcrum.v
Last active October 25, 2018 00:52
Verification of a Fulcrum implementation against a reference implementation in Coq
Require Import List.
Require Import FunctionalExtensionality.
Require Import ZArith.
Require Import Zcompare.
(* c.f. https://twitter.com/Hillelogram/status/987432184217731073 *)
Set Implicit Arguments.
Lemma map_combine : forall A B C (f : A -> B) (g : A -> C) xs,
@bobatkey
bobatkey / STLC.markdown
Last active December 18, 2020 15:59
Three typing rules and the constructive truth

This is a type constructor

class FunctionType:
    def __init__(self, tyA, tyB):
        self.tyA = tyA
        self.tyB = tyB

    def __eq__(self, other):
 return self.tyA == other.tyA and self.tyB == other.tyB
@bobatkey
bobatkey / gadts.sml
Created January 5, 2014 18:34
Encoding of GADTs in SML/NJ
(* This is a demonstration of the use of the SML module system to
encode (Generalized Algebraic Datatypes) GADTs via Church
encodings. The basic idea is to use the Church encoding of GADTs in
System Fomega and translate the System Fomega type into the module
system. As I demonstrate below, this allows things like the
singleton type of booleans, and the equality type, to be
represented.
This was inspired by Jon Sterling's blog post about encoding proofs
in the SML module system: