Skip to main content


SCARLET

We solve the problem of learning LTL formulas from a sample consisting of traces partitioned into positive and negative. A paper presenting the algorithms behind Scarlet was published in TACAS'2022.

Installation

Installing the tool

Now, you can install the tool, as python package using pip command as follows:

python3 -m pip install Scarlet-ltl

Input File format:

The input files consist of traces separated as positives and negatives, separated by ---. Each trace is a sequence of letter separated by ;. Each letter represents the truth value of atomic propositions. An example of a trace is 1,0,1;0,0,0 which consists of two letters each of which define the values of three propositions (which by default consider to be p,q,r). An example sample looks like the following:

0,0,0;0,1,1;1,0,0;0,0,1;0,1,0
1,1,0;1,0,1;1,0,0;1,1,1;1,0,1
1,1,0;0,1,1;1,1,1;1,0,0;1,0,1
---
1,0,0;1,0,0;0,1,0;1,1,0;1,1,1
1,0,0;1,0,0;0,1,0;1,1,0;1,0,0
0,0,1;1,0,0;1,1,0;1,1,1;1,0,0

How to run Scarlet:

Create input file

To run Scarlet, you have to create an input file with .trace extension in the same directory where venv folder is located. The input file format is described in the above section.

Run Scarlet on a particular input file

from Scarlet.ltllearner import LTLlearner
learner = LTLlearner(input_file = "input_file_name.trace")
learner.learn()

This will run Scarlet on the input trace file.

Parameters

You can call the LTLlearner class with additional parameters as follows:

  • input_file = the path of the file containing LTL formuas, i.e., = 'input_file_name.trace'
  • timeout = For specifying the timeout, default = 900
  • csvname = the name of the output csv file, i.e., = 'output_file_name.csv'
  • thres = the bound on loss function for noisy data, default = 0 for perfect classification, has to be a number between zero and one

How to generate trace files from LTL formulas

You can also generate trace files from given LTL formulas following the instructions below:

Install dependencies

For generating benchmarks from a given set of LTL formula, we rely on a python package LTLf2DFA that uses MONA in its backend. As a result, one needs to install MONA first in order to be able to use this procedure (instructions can be found in the MONA website).

Create input formula file

For generating benchmarks, you have to create an input file named formulas.txt in the same directory where venv folder is located. The formula file should contain a list of formulas (in prefix notation) along with the alphabet. An example of this file is as follows:

G(!(p));p
->(F(q), U(!(p),q));p,q
G(->(q, G(!(p))));p,q

Generate trace files from formulas.txt

from Scarlet.genBenchmarks import SampleGenerator
generator = SampleGenerator(formula_file= "formulas.txt")
generator.generate()

Parameters

You can call the SampleGenerator class with additional parameters as follows:

  • formula_file = the path of the file containing LTL formuas, example = 'formulas.txt'
  • sample_sizes = list of sample_size, i.e., number of positive traces and number of negative traces (separated by comma) in each sample, default = [(10,10),(50,50)]
  • trace_lengths = For specifying the length range for each trace in the samples, default = [(6,6)]
  • output_folder = For specifying the name of the folder in which samples are generated

Metadata

Release files for Scarlet-ltl 0.0.4

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

Source distribution (sdist)

Source distribution for Scarlet-ltl 0.0.4
File Size Uploaded
Scarlet-ltl-0.0.4.tar.gz 27.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Scarlet-ltl 0.0.4
File Interpreter ABI Platform
Scarlet_ltl-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 54.6 kB

Release files / Scarlet-ltl-0.0.4.tar.gz

Download URL Scarlet-ltl-0.0.4.tar.gz
Size 27.3 kB
Tags Source
SHA-256 checksum
How to use checksums
36bab29d85abc0c838e4117e0c71c78d7380b442f77b06cf6541e0e4a790271a
BLAKE2b-256 checksum
How to use checksums
22a61aff5d22e30e2b25f27805ef6e940fd8da969288bbbfe4393087cae49693
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release files / Scarlet_ltl-0.0.4-py3-none-any.whl

Download URL Scarlet_ltl-0.0.4-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf1d522c02a4bb3a66e1df0a3aba285a79f843c400e6de2bef223feb3e5230c3
BLAKE2b-256 checksum
How to use checksums
3a68d57e229c2ad9296e36383ad5755b2628147d24c7b7fb5e865b02a45cf29c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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