Skip to main content

Past MTL Monitors

A library for creating past metric temporal logic monitors.

Build Status Documentation Status codecov PyPI version License: MIT

Table of Contents

Installation

If you just need to use past-mtl-monitors, you can just run:

$ pip install past-mtl-monitors

For developers, note that this project uses the poetry python package/dependency management tool. Please familarize yourself with it and then run:

$ poetry install

Usage

The primary entry point to the past-mtl-monitors package is the atom function. This exposes a monitor factory which can be combined with other monitor factories to create complex property monitors.

Under the hood, these monitor factories are just wrappers around python coroutines that expect a (time, val) pair, where time is a float and val is a mapping from strings to robustness values (float).

Note past-mtl-monitors only implements a quantitative semantics where a value greater than 0 implies sat and a value less than 0 implies unsat.

Thus if one would like to use Boolean semantics, use 1 for True and -1 for False.

from past_mtl_monitors import atom

x, y, z = atom('x'), atom('y'), atom('z')

# Monitor that historically, x has been equal to y.
monitor = (x == y).hist().monitor()

#                    time         values
assert monitor.send((0    , {'x': 1, 'y': 1}))  ==  1   # sat
assert monitor.send((1.1  , {'x': 1, 'y': -1})) == -1   # unsat
assert monitor.send((1.5  , {'x': 1, 'y': 1}))  == -1   # unsat

monitor2 = x.once().monitor()  # Monitor's x's maximum value.
assert monitor2.send((0 , {'x': -10, 'y': 1})) == -10
assert monitor2.send((0 , {'x': 100, 'y': 2})) == 100
assert monitor2.send((0 , {'x': -100, 'y': -1})) == 100

# Monitor that x & y have been true since the last
# time that z held for 3 time units.
monitor3 = (x & y).since(z.hist(0, 3)).monitor()

Metadata

Release files for past-mtl-monitors 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for past-mtl-monitors 0.1.0
File Size Uploaded
past-mtl-monitors-0.1.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for past-mtl-monitors 0.1.0
File Interpreter ABI Platform
past_mtl_monitors-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / past-mtl-monitors-0.1.0.tar.gz

Download URL past-mtl-monitors-0.1.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dbe655037361903f2d963e81d20caab5ff1e61a345a0bf9a488004d01909abb7
BLAKE2b-256 checksum
How to use checksums
834b0cef4a6dc41559f60416bb4e3c6a7c1dee2174fc397b0d6e92545141b9df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.3 CPython/3.8.1 Linux/5.5.0-1-MANJARO

Release files / past_mtl_monitors-0.1.0-py3-none-any.whl

Download URL past_mtl_monitors-0.1.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11b5061cb21b2862a18ea82f616b52ce32bf293555dd10ab86d27a47ba3f6c25
BLAKE2b-256 checksum
How to use checksums
c46218ea3acb5eba0009e482c0eb53114a3b25a351f97d78fc21b1f68cadf6f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.3 CPython/3.8.1 Linux/5.5.0-1-MANJARO

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page