#verification #compiler #monitoring #command-line-interface

app r2u2_cli

R2U2 CLI: A stream-based runtime monitor command-line interface

3 releases

new 0.1.2 Jan 13, 2025
0.1.1 Jan 13, 2025
0.1.0 Jan 13, 2025

#84 in Programming languages

Download history 200/week @ 2025-01-08

200 downloads per month

MIT/Apache

510KB
10K SLoC

Python 7.5K SLoC // 0.1% comments Rust 2K SLoC // 0.0% comments Shell 8 SLoC // 0.4% comments

R2U2 Command Line Interface

The Realizable, Reconfigurable, Unobtrusive Unit (R2U2) is a stream-based runtime verification framework based on Mission-time Linear Temporal Logic (MLTL) designed to monitor safety- or mission-critical systems with constrained computational resources.

Given a specification and input stream, R2U2 will output a stream of verdicts computing whether the specification with respect to the input stream. Specifications can be written and compiled using the Configuration Compiler for Property Organization (C2PO).

This crate allows specifications to be compiled with C2PO and monitored with R2U2. For detailed usage try:

r2u2_cli --help

Requirements

To enable satisfiability checking, install Z3. On debian-based systems, this can be done via sudo apt-get install z3.

Example Usage

Given the following example.c2po file:

INPUT
    a,b: bool;

FTSPEC
    F[1,2] (a && b);

and the following example.csv file:

# a,b
0,0
1,0
0,1
1,1
0,0
1,0
0,1
1,1

the following command will create a spec.bin file in the current directory:

r2u2_cli compile example.c2po example.csv

and the following command:

r2u2_cli run spec.bin example.csv

will output the following to the console:

0:0,F
0:2,T
0:3,F
0:4,F
0:6,T

The single following command will also provide the same output:

r2u2_cli run example.c2po example.csv

For all available options, try r2u2_cli compile --help and r2u2_cli run --help.

Output

The output of R2U2 is a verdict stream with one verdict per line. A verdict includes a formula ID, timestamp, and truth value. Formula IDs are determined by the order in which they are defined in the specification file. Verdicts are aggregated so that if R2U2 can determine a range of values with the same truth at once, only the last time is output.

The following is a stream where formula 0 is true from 0-7 and false from 8-11 and formula 1 is false from times 0-4:

0:7,T
1:4,F
0:11,F

Examples Specifications and Traces

Example specifications and traces can be found on our github page.

Documentation

The documentation for R2U2 can be found here. The documentation includes user and developer guides for both R2U2 and C2PO.

License

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~7.5MB
~130K SLoC