Skip to content

Instantly share code, notes, and snippets.

Require Import Morphisms Setoid.
Require Import Utf8.
Require Program.Basics.
Module Func := Basics.
Require SetoidClass.
Module SC := SetoidClass.
Set Implicit Arguments.
Notation "`Begin p" := p (at level 20, right associativity).
Notation "a =] p ] pr" := (@eq_trans _ a _ _ p pr) (at level 30, right associativity).
Notation "a =[ p [ pr" := (@eq_trans _ a _ _ (eq_sym p) pr) (at level 30, right associativity).
Notation "a `End" := (@eq_refl _ a) (at level 10).
Proposition congr {A B : Type} {a b : A} (P : A -> B) (p : a = b) : P a = P b.
rewrite p. reflexivity.
Qed.
Inductive list (T: Type) : Type :=
@myuon
myuon / dsim_parser.py
Created March 24, 2017 03:27
DSim Ascii parser
#! /usr/bin/env python
#-*- coding:utf-8 -*-
import io
import sys
def transpose(xs):
return list(map(list, zip(*xs)))
def deascii(d):
if d == '-': return 0
@myuon
myuon / STLC_SN_pending.agda
Created February 4, 2017 02:52
SN of STLC
{-# OPTIONS --no-positivity-check #-}
open import Data.Nat
open import Data.Vec as Vec
open import Data.Star
open import Data.Empty
open import Data.Product
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
module SN {ConTm ConTy : Set} {B-length} (Base : Vec (ConTm × ConTy) B-length) where
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleContexts #-}
module Mu where
import Data.Maybe (fromJust)
import qualified Data.Map as M
import qualified Data.Set as S
import Data.List
import Control.Monad.State
@myuon
myuon / rev.hs
Created December 1, 2016 12:53
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE DataKinds, GADTs, TypeFamilies, PolyKinds, TypeOperators #-}
{-# LANGUAGE RankNTypes, TypeApplications #-}
import Prelude(($), putStrLn)
-- equality
infix 2 ==
data (==) :: k -> k -> * where
Refl :: a == a
@myuon
myuon / CAM.ml
Created October 19, 2016 16:47
Cousineau G., Curien P.-L., Mauny M. The categorical abstract machine. — LNCS, 201, Functional programming languages computer architecture.-- 1985, pp.~50-64.
type expr =
| MLplus | MLequal | MLfst | MLsnd
| MLint of int
| MLbool of bool
| MLvar of string
| MLcond of expr * expr * expr
| MLpair of expr * expr
| MLin of dec * expr
| MLabstr of pat * expr
| MLapp of expr * expr
@myuon
myuon / .zshrc
Last active July 18, 2016 02:47
.zshrc
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
@myuon
myuon / .tmux.conf
Last active July 18, 2016 02:17
.tmux.conf
# prefixキーをC-aに変更する
set -g prefix C-z
# C-bのキーバインドを解除する
unbind C-b
# キーストロークのディレイを減らす
set -sg escape-time 1
# ウィンドウのインデックスを1から始める
@myuon
myuon / extend.js
Created July 3, 2016 05:19
typescript: extending interface
import * as $ from "jquery";
function extend<T extends U, U>(itrf: T, part: U): T {
return $.extend(itrf, part);
}
// --------
interface Test {
poyo: string,