This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Logger(object): | |
def __enter__(self): | |
return self | |
def __exit__(self, exc_type, value, traceback): | |
print "Logging some stuff" | |
if exc_type is not None: | |
print "Sending exception up to New Relic" | |
........ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------- MODULE Deployments ---------------------------- | |
EXTENDS TLC, Integers | |
CONSTANT UPDATING, CORRUPT, ABORTED | |
CONSTANT SKIP_UPDATE | |
(* --algorithm deploy | |
variables servers = {"s1", "s2", "s3"}, | |
load_balancer = servers, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------ MODULE tlrouter ------------------------------ | |
EXTENDS TLC, Sequences, Integers | |
(* --algorithm tlrouter | |
variables | |
input_stream = << [dest |-> "a", id |-> 1], [id |-> 1]>>, | |
routing_table = <<>>, | |
output_streams = <<>>, | |
dead_messages = {}, | |
msg; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module hallway | |
open util/ordering[Time] | |
sig Time {} | |
abstract sig Position {} | |
one sig Left, Right, Passed extends Position {} | |
abstract sig Person { | |
position: Position one -> Time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIFS = ( | |
'https://gifs.parlar.ca/original/get_out.gif', | |
'https://gifs.parlar.ca/tongue/tongue-out.gif', | |
'https://gifs.parlar.ca/bring-it/luke-cage-bring-it.gif', | |
'https://gifs.parlar.ca/original/kick.gif', | |
'https://gifs.parlar.ca/original/nope_bobby.gif', | |
'https://gifs.parlar.ca/contempt/Dwight-Schrute-look-of-disapproval.gif', | |
'https://gifs.parlar.ca/original/no_josh.gif', | |
'https://gifs.parlar.ca/contempt/simon-cowel-glazed-look.gif', | |
'https://gifs.parlar.ca/no/nope-duck.gif', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXTENDS Integers | |
CONSTANT EMPTY | |
(* | |
The basic model is to map positions in a sequence to | |
the squares on a tic-tac-toe board, as | |
1 | 2 | 3 | |
--------- | |
4 | 5 | 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sig FriendGroup { | |
members: set Developer | |
} | |
sig Developer { | |
// Each Developer is only working on zero or more Projects | |
project: set Project, | |
// The set of languages the developer enjoys using. | |
// `some` means that there is at least one language in this set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------- MODULE logger ------------------------------- | |
EXTENDS Integers | |
CONSTANTS Clients | |
(*--algorithm logger | |
variables time = 0, | |
log_start = [c \in Clients |-> 0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ericpony.github.io/z3py-tutorial/guide-examples.htm | |
http://ericpony.github.io/z3py-tutorial/advanced-examples.htm | |
https://theory.stanford.edu/~nikolaj/programmingz3.html | |
A big tutorial: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.225.8231&rep=rep1&type=pdf | |
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.367.9961&rep=rep1&type=pdf | |
Strategies/goals/tactics: http://www.cs.tau.ac.il/~msagiv/courses/asv/z3py/strategies-examples.htm | |
Modelling a logic puzzle. Interesting because it uses uninterpreted functions https://stackoverflow.com/questions/53711168/modelling-a-logic-puzzle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
one sig Person { | |
} | |
sig Resource { | |
, access: set Person | |
, parent: lone Resource | |
} | |
fact "No cycles" { |