Skip to content

Instantly share code, notes, and snippets.

View maxsnew's full-sized avatar

Max S. New maxsnew

View GitHub Profile
@maxsnew
maxsnew / Cubical.Foundations.Isomorphism.More.agda
Created November 27, 2024 17:55
two versions of dependent isomorphisms
{-# OPTIONS --safe #-}
module Cubical.Foundations.Isomorphism.More where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Data.Sigma
private
variable
@maxsnew
maxsnew / GuardedKanren.agda
Last active September 4, 2024 14:51 — forked from rntz/GuardedKanren.agda
implementation of muKanren's search strategy in Agda with --guarded
{-# OPTIONS --guarded #-}
module GuardedKanren where
open import Agda.Primitive using (Level; _⊔_)
private variable
l l' : Level
A B : Set l
data Bool : Set where true false : Bool
if_then_else_ : ∀{A : Set} → Bool → A → A → A
@maxsnew
maxsnew / ChurchList.agda
Created April 12, 2024 17:13
Church Lists in Cubical Agda
module ChurchList where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
import Cubical.Data.List as List
open import Cubical.Data.List using (List)
private
variable ℓ : Level
@maxsnew
maxsnew / sexp.v
Created December 6, 2018 19:26
Decidable Equality for Sexpressions
Require Import Coq.Bool.Bool.
Inductive Sexp :=
| Atom : bool -> Sexp
| List : Forest -> Sexp
with
Forest :=
| Nil : Forest
| Cons : Sexp -> Forest -> Forest.
@maxsnew
maxsnew / equi-recursive-success.rkt
Last active July 25, 2018 20:01
Trying to encode a bidirectional lambda-calculus in Typed Racket with structural types
#lang typed/racket
(define-type Var String)
(define-type Type (U 'Base (List '-> Type Type)))
(define-type Ctx (Listof (Pair Var Type)))
(define-type Expr (U Var (List 'App Expr Term) (List 'Asc Type Term)))
(define-type Lam (List 'Lam Var Term))
(define-type Term (U Expr Lam))
(define-predicate lam? Lam)
@maxsnew
maxsnew / earlier.py
Created February 20, 2018 19:10
When should the type error happen?
def print_upper(s : str):
up_s = s.upper()
def printer(n : int):
acc = ""
for i in range(0,n):
acc += up_s
return acc
return printer
@maxsnew
maxsnew / gist:77bc24ad961e38553186
Created October 11, 2014 14:11
Scribble Interaction
[mnew:~CODE/racket/Redex-Enum-Paper]$ scribble --latex --dest x paper.scrbl (master)
[Output to x/paper.tex]
Warning: some cross references may be broken due to undefined tags:
(counter ("figure" "fig:benchmark-lines"))
(counter ("figure" "fig:benchmark-lines" "value"))
(counter ("figure" "fig:benchmark-overview"))
(counter ("figure" "fig:benchmark"))
(counter ("figure" "fig:correlation" "value"))
(counter ("figure" "fig:benchmark-overview" "value"))
(counter ("figure" "fig:benchmark" "value"))
@maxsnew
maxsnew / lifetime-error-fixed.rs
Last active August 29, 2015 14:07
Non-deterministic Lifetime Error
extern crate graphviz;
use graphviz as dot;
use std::str;
type Nd = uint;
type Ed = (uint, uint);
struct Graph<'a> {
nodes: Vec<&'a str>,
edges: Vec<Ed>,
@maxsnew
maxsnew / Request.elm
Created February 7, 2014 00:14
IO Request Serialization example
data Request = PutS String
| Exit Int
| GetS
port out : Signal (Maybe Request)
@maxsnew
maxsnew / Bug.html
Created February 6, 2014 23:51
Record Serialization Bug
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="resources/elm-runtime.js"></script>
<script src="build/Ports.js"></script>
</head>
<body>
<h1>Test</h1>
<div id="bug"></div>