Skip to content

Instantly share code, notes, and snippets.

View TOTBWF's full-sized avatar

Reed Mullanix TOTBWF

View GitHub Profile
@TOTBWF
TOTBWF / Regex.agda
Created December 2, 2020 16:25
Brzozowski Derivatives in Agda
-- Regexes via Brzozowski derivatives
{-# OPTIONS --without-K --safe #-}
module Regex where
open import Function
open import Data.Char
open import Data.Char.Properties renaming (_≟_ to _≟ᶜ_)
open import Data.String using (toList)
open import Data.Bool
@TOTBWF
TOTBWF / Fixpoint.agda
Last active April 28, 2025 05:14
Agda proof of the Knaster-Tarski Fixpoint Theorem
-- A proof of the Knaster-Tarski Fixpoint Theorem
-- See https://en.wikipedia.org/wiki/Knaster%E2%80%93Tarski_theorem
module Fixpoint where
open import Level
open import Data.Product
open import Relation.Binary
open import Relation.Binary.Morphism
@TOTBWF
TOTBWF / DayOne.agda
Created December 20, 2020 01:53
A formally verified implementation of Day One of the 2020 Advent of Code
module DayOne where
-- Lets build this up from scratch, for didactic purposes.
-- If we were doing this "for real" we ought to use agda-stdlib.
--------------------------------------------------------------------------------
-- Basic Definitions
--------------------------------------------------------------------------------
-- First, natural numbers and lists. Nothing too exciting here.
@TOTBWF
TOTBWF / Categories.hs
Last active April 21, 2021 06:06
A Tenative Category Heirarchy
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
@TOTBWF
TOTBWF / IOHCC.hs
Last active July 21, 2021 00:41
My submission for the International Obfuscated Haskell Code Competetion
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module IOHCC where
import Unsafe.Coerce
u = unsafeCoerce
@TOTBWF
TOTBWF / ObfuscatedSKI.hs
Last active February 23, 2023 06:29
A Lambda Expression to SKI Combinator compiler, written entirely using SKI combinators.
This file has been truncated, but you can view the full file.
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module ObfuscatedSKI where
import Unsafe.Coerce (unsafeCoerce)
--------------------------------------------------------------------------------
-- A Lambda to SKI Combinator Compiler, written entirely using SKI Combinators
@TOTBWF
TOTBWF / Static.agda
Created December 1, 2021 07:50
Compile Time File Embedding in Agda
{-# OPTIONS --allow-exec #-}
-- Embed a file as a string inside of an agda program.
-- To use this, make sure to add '/bin/cat' to '~/.agda/executables'
module Static where
open import Function
open import Data.Unit
{-# OPTIONS --without-K --safe #-}
module InitialAlgebra where
open import Level hiding (zero) renaming (suc to ℓ-suc)
open import Relation.Binary.PropositionalEquality.Core
open import Data.Nat.Base using (ℕ; zero; suc; _+_)
open import Data.List.Base using (List; []; _∷_)
@TOTBWF
TOTBWF / Operads.agda
Created January 23, 2022 01:34
Colored Operads via Syntactic Categories
{-# OPTIONS --without-K --safe #-}
module Operads where
open import Level
open import Categories.Category.Core
open import Categories.Functor.Core
open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong; cong₂; sym)
import Relation.Binary.PropositionalEquality as Eq
@TOTBWF
TOTBWF / CartesianNbE.agda
Last active February 5, 2022 23:24
NbE for Cartesian Categories
{-# OPTIONS --without-K --safe #-}
open import Categories.Category.Core
open import Categories.Category.Cartesian
module Categories.Tactic.Cartesian.Solver {o ℓ e} {𝒞 : Category o ℓ e} (cartesian : Cartesian 𝒞) where
open import Level
open import Categories.Category.BinaryProducts