Stateright
Stateright is a library for specifying state machines and model checking invariants. Embedding a model checker into a general purpose programming language allows consumers to formally verify product implementations in addition to abstract models.
Example
As a simple example of an abstract model, we can simulate a minimal "clock"
that alternates between two hours: zero and one. Then we can enumerate all
possible states verifying that the time is always within bounds and that a path
to the other hour begins at the start
hour (a model input) followed by a step
for flipping the hour bit.
use *;
let mut checker = BinaryClock .checker;
assert_eq!;
assert_eq!;
More Examples
See the examples directory for additional state machines, such as an actor based Single Decree Paxos cluster and an abstract two phase commit state machine.
To model check, run:
Stateright also includes a simple runtime for executing an actor state machine mapping messages to JSON over UDP:
Performance
To benchmark model checking speed, run with larger state spaces:
Contributing
- Clone the repository:
- Install the latest version of rust:
|| ( | )
- Run the tests:
&&
- Review the docs:
- Explore the code:
- If you would like to share improvements, please fork the library, push changes to your fork, and send a pull request.
License
Copyright 2018 Jonathan Nadal and made available under the MIT License.