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
@brendanzab
brendanzab / maps.lean
Last active February 10, 2021 12:15
Total and partial maps in Lean 4 (inspired by Software Foundations)
/-
Total and partial maps
This is inspired by [the relevant chapter in Software Foundations]. Unlike
Software Foundations, these maps are also parameterised over a `Key`
type, which must supply an implementation of `DecidableEq`.
[Software Foundations]: https://softwarefoundations.cis.upenn.edu/lf-current/Maps.html
-/
namespace Maps
@brendanzab
brendanzab / pikelet-update.md
Last active October 18, 2020 11:16
Updates on the Pikelet Programming Language
marp theme
true
uncover

Pikelet status update

Brendan Zabarauskas

31/08/2020

@brendanzab
brendanzab / weird-lang.md
Last active June 25, 2021 21:16
A weird dependent graph language thing?
Notation Meaning
l ? T abstract node in T
l : T concrete node in T
l = t node equal to t
default = t reduce to this node if all nodes are concrete
{ ... } graph term
t1.{ l = t2 } updates node l in t1 to be t2
t.l gets the value of node l in t
t.{ l1 -> l2 } renames l1 to l2 in t
@brendanzab
brendanzab / ddl-experiment.makam
Last active May 11, 2020 05:30
A dependently typed binary data description language, prototyped in Makam!
% Copyright 2020 YesLogic Pty. Ltd.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
@brendanzab
brendanzab / combining-pi-and-simga.md
Last active June 25, 2021 21:16
Probably a terrible idea

Combining Pi and Sigma types?

-- id : forall a. a -> a
-- id x = x

id : type [
    in A : Type, 
    in a : A, 
    out a' : A,
@brendanzab
brendanzab / dependent.makam
Last active December 3, 2019 08:24
Messing with dependent type systems in makam (http://astampoulis.github.io/makam/)
(* terms *)
term : type.
universe : term.
annotate : term -> term -> term.
unitType : term.
unitTerm : term.
pairType : term -> (term -> term) -> term.
pairTerm : term -> term -> term.
@brendanzab
brendanzab / pull-processing-syntax-trees.rs
Last active November 29, 2019 05:21
Pull-based tree processing for lambda calculi.
//! See [this twitter thread](https://twitter.com/brendanzab/status/1191233778854662144).
//!
//! Traditional syntax trees suffer from lots of pointer indirections and poor data locality!
//! Could we stream things instead, using [pull-based events](http://www.xmlpull.org/history/index.html)
//! as opposed to trees? This should be equivalent to our tree based approaches, but might
//! require us to think carefully about what our core calculus looks like in order to make
//! this kind of thing easier.
use std::sync::Arc;
@brendanzab
brendanzab / weird-core-language.md
Last active June 25, 2021 21:16
🚧 A graph-based core for a dependently typed language. 🚧

A graph-based core for a dependently typed language

Abstract

An overly-ambitious attempt to re-think the core calculus of dependent type theory by basing it on graphs as opposed to lambdas, Π-types, Σ-types, etc. The hope is that this might allow us to investigate dependency more closely, and allow us to refine programs to target different environments in an easier way than with traditional programming representations.

Introduction

{
"record.term": {
"fields": {
"identity": { "node": "$identity" },
"compose": { "node": "$compose" },
"Unit": { "node": "$Unit" },
"Bool": { "node": "$Bool" },
"Option": { "node": "$Option" }
},
"nodes": {
//! Dependent type system that uses a SAX-style event streams between passes.
//!
//! It would be really neat to have a simple state machine language to describe this.
/// Handler for a state machine that accepts input events.
trait InputHandler {
fn on_bytes(self, bytes: &[u8]>);
fn on_list_start(self);
fn on_list_end(self);
}