Giter Site home page Giter Site logo

bla's Introduction

Dummy "TLA"

Declare set of programs that share a common memory but run on differnt clocks. Verify that assertions always hold true, no matter the order of execution.

# example.py

from core import  Variables
from proof import proof

# Declare domain - the set of variables used in the program
D = Variables("Vars", ["A_set", "A_get"])

# The client, that `db.write(A, true)" to DB 
# and expects "db.read(A) = true"
def client():
    A_set = True
    assert A_get == True

# Eventually consistent DB
def server():
    "begin" # while True
    A_get = A_set
    if True: "begin"

# Proof that assertion always holds
proof([client, server], D)
# Spoiler: it doesn't
$ python3 example.py
----- step #0:
 def client():            | def server():            | A_set=False
 ->  A_set = True         |     "begin" # while True | A_get=False
     assert A_get == True | ->  A_get = A_set        |
                          |     if True: "begin"     |


----- step #1:
 def client():            | def server():            | A_set=False
 ->  A_set = True         |     "begin" # while True | A_get=False
     assert A_get == True |     A_get = A_set        |
                          | ->  if True: "begin"     |


----- step #2:
 def client():            | def server():            | A_set=True
     A_set = True         |     "begin" # while True | A_get=False
     assert A_get == True |     A_get = A_set        |
 ->==HALTED==             | ->  if True: "begin"     |


Assertion failed: client:1: assert A_get == True

bla's People

Contributors

mr0re1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.