Skip to content

Instantly share code, notes, and snippets.

View brendanzab's full-sized avatar
😵‍💫
writing elaborators

Brendan Zabarauskas brendanzab

😵‍💫
writing elaborators
View GitHub Profile
@rntz
rntz / mapgen.hs
Created November 13, 2024 03:04
generating maps
import System.Environment (getArgs)
import Control.Monad (guard, forM_)
import System.Random (RandomGen)
import qualified System.Random as Random
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
description
Inversion hell.
@AndrasKovacs
AndrasKovacs / TwoStageRegion.md
Last active November 17, 2024 15:34
Lightweight region memory management in a two-stage language
@atennapel
atennapel / anormalform.hs
Last active August 30, 2024 12:34
Normalization of polarized lambda calculus to A-normal form
-- Polarized lambda calculus to A-normal form
-- With eta-expansion and call-saturation
type Ix = Int
type Lvl = Int
data Ty = TInt
deriving (Show)
data TFun = TFun [Ty] Ty
deriving (Show)
@AndrasKovacs
AndrasKovacs / Elaboration.md
Last active November 13, 2024 09:33
Basic setup for formalizing elaboration

Basic setup for formalizing elaboration

First attempts

Elaboration is, broadly speaking, taking user-written syntax and converting it to "core" syntax by filling in missing information and at the same time validating that the input is well-formed.

I haven't been fully happy with formalizations that I previously used, so I make a new attempt here. I focus on a minimal dependently typed case.

@DasNaCl
DasNaCl / stlc+nat.v
Created June 25, 2024 12:40
Proof of syntactic type safety for call-by-value STLC extended with natural number constants.
Set Implicit Arguments.
Require Import List Program FunctionalExtensionality.
(** Proof of syntactic type safety for call-by-value STLC extended with ℕ. *)
(** Names/Variables will be identified with a natural number.
λx.λy.y x is represented as λλ0 1 *)
Definition var : Type := nat.
(** There is a need for partial maps, e.g., to keep track of what variable
@jake-87
jake-87 / systemf.md
Last active February 27, 2024 03:09

A somewhat brief overview of typechecking System F

This document comprises an example of typechecking a type system based on System F, in a small ML-like language.

You can skip the below section if you already understand System F itself.

A brief overview of System F

System F is the name given to an extension of the simply typed lambda calclus.

-- Moved to https://agda.monade.li/Goat.html
@AndrasKovacs
AndrasKovacs / SetoidTTinTT.agda
Last active November 3, 2024 19:20
TT in TT using only induction-induction
{-# OPTIONS --without-K #-}
-- version 1, conversion is indexed over conversion
module IndexedConv where
data Con : Set
data Ty : Con → Set
data Sub : Con → Con → Set
data Tm : ∀ Γ → Ty Γ → Set
data Con~ : Con → Con → Set
{-# OPTIONS --guarded #-}
open import Agda.Primitive
open import Relation.Binary.PropositionalEquality using (_≡_; refl; subst; sym; trans)
open import Data.Unit using (⊤; tt)
open import Data.Nat -- using (ℕ; _+_; suc; _<_)
open import Data.Nat.Properties
open import Data.Fin using (Fin; fromℕ; fromℕ<)
open import Data.Vec using (Vec; lookup; []; _∷_; [_]; _++_; map)