Skip to content

Instantly share code, notes, and snippets.

View robstewart57's full-sized avatar

Rob Stewart robstewart57

View GitHub Profile
@robstewart57
robstewart57 / ping_pong_ltl_claim
Last active December 10, 2015 16:39
A ping-pong linear temporal logic never claim in promela that fails to verify
mtype = { PING , PONG , INFO } ;
typedef Node {
chan inChan = [50] of {mtype } ;
bool receivedInfo;
};
Node nodes[2];
active proctype Master() {
@robstewart57
robstewart57 / spin_failure_model.pml
Last active December 10, 2015 15:29
spin failure model
mtype = { FISH , RESCHEDULE , SCHEDULE , SCHEDULEREQ , SCHEDULEAUTH , ACK , NOWORK , SENDFAILED , PING } ; // message payload types
mtype = { ONNODE , INTRANSITION }; // spark.status types
typedef Node {
chan inChan = [50] of {mtype, chan } ;
bool hasSpark;
bool waitingFish;
bool waitingSchedAuth;
bool dead;
};
@robstewart57
robstewart57 / AsyncTimeouts.hs
Created December 3, 2012 13:28
Timeouts in async haskell package
{-# LANGUAGE DeriveDataTypeable #-}
import Control.Concurrent (threadDelay)
import Control.Exception (Exception,throw)
import Control.Monad (void)
import Control.Concurrent.Async (Async,race,wait,withAsync)
import Data.Typeable (Typeable)
data ThreadTimeoutException = ThreadTimeoutException
deriving (Show, Typeable)
@robstewart57
robstewart57 / newtype laziness
Created November 9, 2012 14:00
newtype vs data in haskll
Prelude> data D = D Int
Prelude> let f (D i) = "ok"
Prelude> f undefined
"*** Exception: Prelude.undefined
Prelude> newtype D = D Int
Prelude> let f (D i) = "ok"
Prelude> f undefined
"ok"