Skip to main content

A refinement calculus implementation of Event-B in Python.

Project description

pyeb is a Python implementation of Event-B's refinement calculus. It takes an Event-B model as an input and generates proof-obligations that are eventually discharged with the Z3 SMT solver. Event-B models are written in Python following a special Object-Oriented syntax and notation. The pyeb tool generates proof obligations such as invariant preservation, feasibility of non-deterministic event actions, guard strengthening, simulation, preservation of machine variants, among others. pyeb uses `Z3 Python API to discharge the proof obligations automatically. It supports large parts of Event-B' syntax such as non-deterministic assignments, events, machines, contexts, and machine refinements.

pyeb can be downloaded from GitHub.

Getting Started (Mac OS X)

It is recommended to run pyeb in a virtual environment thus it will not have collateral effects on your local installation. pyeb dependencies are the Z3 solver, antlr Python runtime, and the antlr tools.

  1. Creating and activating the virtual environment::

    python -m venv .venv

    source .venv/bin/activate

  2. Optionally, you can deactivate the virtual environment after using pyeb::

    deactivate

  3. Installing dependencies::

    pip install z3-solver==4.13.0.0

    pip install antlr4-tools==0.2.1

    pip install antlr4-python3-runtime==4.13.1

  4. Installing pyeb::

    pip install pyeb

Command Line Usage (Mac OS)

  1. Running pyeb::

    pyeb python-file

  2. We have included a sample folder with several object-oriented examples of sequential algorithms (binary search, squared root, inverse function, etc.)::

    pyeb sample/binsearch_oo.py

Unit testing with pytest

  1. Installing pytest::

    pip install pytest

  2. Running pytest on a file in the sample directory::

    pytest tests/test_binsearch.py

GitHub Installation

You might want to install and run the latest version of pyeb available from GitHub.

  1. Installing pyeb::

    mkdir dist

    cd dist

    git init

    git remote add origin https://github.com/ncatanoc/pyeb.git

    git pull origin main

    git branch -M main

  2. Running pyeb as a console script::

    python main.py sample/binsearch_oo.py

  3. Optionally, Running pyeb as a module::

    python -m pyeb sample/binsearch_oo.py

Troubleshooting

For any questions or issues regarding pyeb, contact Néstor Cataño nestor.catano@gmail.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyeb-1.0.68.tar.gz (83.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyeb-1.0.68-py3-none-any.whl (81.2 kB view details)

Uploaded Python 3

File details

Details for the file pyeb-1.0.68.tar.gz.

File metadata

  • Download URL: pyeb-1.0.68.tar.gz
  • Upload date:
  • Size: 83.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pyeb-1.0.68.tar.gz
Algorithm Hash digest
SHA256 4f7009332e1f52186c0e24df04c1539ad167a0f3e0611a8a4ef1595cff61fc5b
MD5 77dd14c0ca845fc37036dbb9574c76f1
BLAKE2b-256 6253fc606ad4ea4c37727d8e788af8ebefe4c64c1179623d5cd581595ab34a96

See more details on using hashes here.

File details

Details for the file pyeb-1.0.68-py3-none-any.whl.

File metadata

  • Download URL: pyeb-1.0.68-py3-none-any.whl
  • Upload date:
  • Size: 81.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pyeb-1.0.68-py3-none-any.whl
Algorithm Hash digest
SHA256 96ab0a47f7880416044e431e72762a9110be583bebd9a69f7b2454053822ab49
MD5 525c097b57b39cdd0849dbadf9b3f9c9
BLAKE2b-256 8de9aa40a464d3ba8d490ef7513c6459553278cba65e69195949074fba653124

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page