Skip to content

Instantly share code, notes, and snippets.

View wenkokke's full-sized avatar

Wen Kokke wenkokke

View GitHub Profile
@wenkokke
wenkokke / README.md
Last active March 2, 2024 10:32
A list of tactics for Agda…

Tactics in Agda

This gist is my attempt to list all projects providing proof automation for Agda.

Glossary

When I say tactic, I mean something that uses Agda's reflection to provide a smooth user experience, such as the solveZ3 tactic from Schmitty:

_ :  (x y : ℤ)  x ≤ y  y ≤ x  x ≡ y
_ = solveZ3
@wenkokke
wenkokke / AB_grammar.hs
Last active January 24, 2024 14:51
AB grammars and extensible effects can do some fun things—depends on Eff1.hs found on <http://okmij.org/ftp/Haskell/extensible/>
{-# LANGUAGE TemplateHaskell, QuasiQuotes, FlexibleInstances, FlexibleContexts,
TypeFamilies, GADTs, TypeOperators, DataKinds, PolyKinds, RankNTypes,
KindSignatures, UndecidableInstances, StandaloneDeriving,
RecordWildCards, DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
module AB where
import Prelude hiding (lookup, lex)
import Control.Applicative ((<|>),empty)
import Data.Maybe (maybeToList)
@wenkokke
wenkokke / main.agda
Last active October 31, 2023 20:37
Code extracted from "Formalising type-logical grammars in Agda".
-- This file contains the code from the paper "Formalising
-- type-logical grammars in Agda", and was directly extracted from the
-- paper's source.
--
-- Note: because the symbol customarily used for the "left difference"
-- is unavailable in the Unicode character set, and the backslash used
-- for implication is often a reserved symbol, the source file uses a
-- different notation for the connectives: the left and right
-- implications are represented by the double arrows "⇐" and "⇒", and
@wenkokke
wenkokke / build-agda-js.sh
Created June 8, 2023 19:33
Build Agda to JavaScript using the GHC 9.6 JavaScript backend
#!/bin/bash
set -eo pipefail
# 1. Build GHC with JavaScript backend
# https://gitlab.haskell.org/ghc/ghc/-/wikis/javascript-backend/building
# 2. Get Agda source
git clone --depth=1 git@github.com:agda/agda.git agda
cd agda
@wenkokke
wenkokke / dependency_graph.py
Last active July 12, 2022 22:30
Describes the dependency graph of a Talon user directory.
from contextlib import contextmanager
from curses.ascii import isalpha
from dataclasses import dataclass
from pathlib import Path
import ast
import re
from typing import Any, Optional, Sequence, Set
@dataclass
@wenkokke
wenkokke / MergeSort.agda
Last active June 2, 2022 22:14
An implementation of mergesort in Agda.
open import Level using (_⊔_)
open import Function using (_∘_)
open import Data.Vec using (Vec; []; _∷_; foldr)
open import Data.Nat using (ℕ; zero; suc; _+_)
open import Data.Nat.Properties.Simple using (+-right-identity; +-suc)
open import Data.Sum using (_⊎_; inj₁; inj₂)
open import Data.Product using (∃; _×_; _,_; proj₁; proj₂)
open import Data.Empty using (⊥-elim)
open import Relation.Nullary using (Dec; yes; no; ¬_)
open import Relation.Binary using (module DecTotalOrder; DecTotalOrder; Rel)
@wenkokke
wenkokke / .gitignore
Last active December 4, 2021 19:12 — forked from tararoys/May12knausj-master-cheatsheet.pdf
Code to print out all voice commands in the knausj talon repository,
cheatsheet.tex
*.aux
*.fls
*.log
*.synctex.gz
*.fdb_latexmk
*.lot
@wenkokke
wenkokke / Wonky.hs
Last active March 11, 2021 00:14
There's something really wonky going on with closed type families.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
module Lib where
data Nat = Z
| S Nat
-- There's something really wonky going on with closed type families: if both
@wenkokke
wenkokke / linear.fmt
Last active February 23, 2021 17:49
Directives for formatting linear types using lhs2TeX.
%if False
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% linear.fmt
%
% Format -> as a period when part of a lambda abstraction,
% as a lolli when used as part of a linear function arrow,
% and as an arrow otherwise.
%
% Wen Kokke, February 2021, version 1.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@wenkokke
wenkokke / lecture1.agda
Last active May 25, 2019 17:35
Slides and tutorial for my guest lectures on Agda at the University of Edinburgh in 2017.
{-(- by Wen Kokke, borrowing heavily from CS410-17 lecture 1 by Conor McBride -)-}
module lecture1 where
module sum-and-product-types where
{--------------------------------------------------------------------------------}
-- so Coq and Agda are kinda the same, yet very different
-- * it's said Coq looks like ML and Agda looks like Haskell