Skip to content

Instantly share code, notes, and snippets.

@csgordon
csgordon / gist:5846399
Last active December 18, 2015 21:19
Setting up Microsoft Research's F* compiler

Setting up MSR's F* Compiler on Windows, for use under Cygwin.

@csgordon
csgordon / fsharp-debian.md
Last active February 28, 2017 09:18
Setting up F# on Debian

Installing F# on Debian

In theory you should be able to install the mono-devel package from Debian, then grab the latest checkout of F#'s Github repository and build. Unfortunately, the most recent versions of Debian's (and Ubuntu's) mono-devel package (3.0.6) include a lovely bug that breaks the F# build (https://bugzilla.xamarin.com/show_bug.cgi?id=10884). Another alternative is installing Debian Sid (unstable branch), where there are currently working F# packages, but installing a whole system from unstable has the sorts of stability issues you might expect, and cherry-picking the right .deb packages from the Debian repositories is unpleasant. There's also the option of using an F# developer's personal repository (https://gist.github.com/tkellogg/5619461), but I don't like adding untrusted sources to my sources.list.

After discovering that Vagrant includes support for a version of Debian Wheezy with F#, I figured out a working, relatively uninvasive approach based on the package

open import Data.Nat
open import Data.Fin
module StrictlyPositive where
-- The following datatype is accepted by Agda, but rejected
-- by Coq
data Ty : Set0 -> Set0 where
c1 : Ty ℕ
c2 : Ty (Ty ℕ)
@csgordon
csgordon / LF.agda
Last active December 21, 2015 13:08
Nearly-complete inductive-recursive encoding of LF in Agda
open import Data.Nat
open import Data.Fin
open import Level
open import Relation.Binary.PropositionalEquality
module LF where
{- Semantic model primitives -}
Rℕ : {C : ℕ -> Set} -> (x : ℕ) -> C ℕ.zero -> ((n : ℕ) -> C n -> C (ℕ.suc n)) -> C x
Rℕ ℕ.zero z s = z
@csgordon
csgordon / StrictlyPositive.idr
Created September 9, 2013 18:47
Definition that isn't strictly positive according to Agda or Coq, but is accepted by Idris (:total ElimT says ElimT is total, which requires not using non-SP types)
data T : Type -> Type where
c1 : T Nat
c2 : T (T Nat)
ElimT : (A : Type) -> T A -> A
ElimT _ c1 = 3
ElimT _ c2 = c1

Keybase proof

I hereby claim:

  • I am csgordon on github.
  • I am csgordon (https://keybase.io/csgordon) on keybase.
  • I have a public key whose fingerprint is 31DF C618 06FE DE8D D007 7571 5A37 6FB7 4F95 CA41

To claim this, I am signing this object:

TeX log appears below
[verbose]: Creating arXiv submission AutoTeX object
[verbose]: *** Using TeX Live 2016 ***
[verbose]: Calling arXiv submission AutoTeX process
[verbose]: TeX/AutoTeX.pm: admin_timeout = minion
[verbose]: <acmart.cls> is of type 'TeX auxiliary'.
[verbose]: <journalarxiv.bbl> is of type 'TeX auxiliary'.
[verbose]: <journalarxiv.tex> is of type 'LATEX2e'.
[verbose]: ~~~~~~~~~~~ Processing file 'journalarxiv.tex'
@csgordon
csgordon / lang.v
Created June 12, 2019 02:40
OOPSLA'19 Paper 161 Coq 8.9.0 formalization of Figure 2, functions of Figure 3, and iteration
Require Import Utf8.
Require Import Program.
Require Import Arith.
Require Import Ensembles.
Require Import Setoid.
Require Import Relations.
Require Import Morphisms.
Require Import Coq.Classes.Equivalence.
Polymorphic Definition binop (E:Type) := E -> E -> E.
@csgordon
csgordon / Actors.dfy
Created August 2, 2019 00:13
Partial axiomatization of hybrid logic assertions for actors in Dafny
module ActorCore {
class {:extern} ActorRef<Ms> {}
predicate {:extern} at<T,Ms>(i: ActorRef<Ms>, p:(T ~> bool))
/* at[i](_) is a modality */
lemma atImpl<T,M>(c:ActorRef<M>, P:T~>bool, Q:T~>bool)
requires forall x:T :: P.requires(x) ==> Q.requires(x)
requires forall x:T :: P.requires(x) ==> P(x) ==> Q(x)
ensures at(c, P) ==> at(c, Q)
/* When using the above, Dafny sometimes doesn't notice the precondition holds;
this variant forces it to look for it. */
@csgordon
csgordon / HybridAssertionsForActors.dfy
Created September 11, 2019 16:37
Prototyping Actor verification in Dafny
/*
* Sample code for the AGERE 2019 paper "Modal Assertions for Actor Correctness" by Colin S. Gordon, DOI 10.1145/3358499.3361221.
* Note that at the time of this writing, there is an issue (https://github.com/dafny-lang/dafny/issues/359) where this file only verifies from the command line (modulo complains about missing implementations of abstract methods). Currently, verifying this via the Dafny Visual Studio Code plugin runs into trouble with the higher-order predicates.
* Last checked with a local build of Dafny commit 8f141e9d05b2dba9de4ba997040df6166c2d168c and Boogie commit bc49937e7ee88e931bbe2dbf779a42612731a8fd
*/
module ActorCore {
class {:extern} ActorRef<Ms> {}
predicate {:extern} at<T,Ms>(i: ActorRef<Ms>, p:(T ~> bool))