This tool performs LTL model checking by:
- Converting LTL formulas to Buchi automata
- Loading Kripke structures and interpreting them as Buchi automata
- Computing products of Buchi automata
- Converting Buchi automata to prefix NFAs (finite-word automata)
The script (test.py) performs the following operations:
- Generate Buchi Automata: Translates LTL formulas φ and ¬φ to complete Buchi automata
- Convert to Prefix NFAs: Generates standalone prefix NFAs from the Buchi automata
- Load Kripke Structure: Reads a Kripke structure from JSON and interprets it as a Buchi automaton
- Compute Products: Creates Buchi products of (Positive × Kripke) and (Negative × Kripke)
- Generate Product Prefix NFAs: Converts the product Buchi automata to prefix NFAs
The script generates the following visualizations:
negative_buchi.{dot,png}- Buchi automaton for ¬φpositive_buchi.{dot,png}- Buchi automaton for φkripke_as_buchi.{dot,png}- Kripke structure as Buchi automaton
negative_prefix_nfa.{dot,png}- Prefix NFA from negative Buchipositive_prefix_nfa.{dot,png}- Prefix NFA from positive Buchi
product_positive_buchi.{dot,png}- Positive × Kripke Buchi productproduct_negative_buchi.{dot,png}- Negative × Kripke Buchi product
prefix_product_nfa_positive.{dot,png}- Prefix NFA from positive productprefix__product_nfa_negative.{dot,png}- Prefix NFA from negative product
The Kripke structure format uses state-based labeling:
ap: A list of strings representing the atomic propositions (e.g.,["p", "q"])initial_state: The ID (string) of the initial statestates: A list of state objects. Each state object has:id: Unique identifier for the state (string)labels: A list of atomic propositions true in this state (e.g.,["p"],["p", "q"], or[])successors: A list of successor state IDs
{
"ap": ["p", "q"],
"initial_state": "s0",
"states": [
{
"id": "s0",
"labels": ["p", "q"],
"successors": ["s0", "s1"]
},
{
"id": "s1",
"labels": ["p"],
"successors": ["s1", "s2"]
},
{
"id": "s2",
"labels": ["q"],
"successors": ["s2", "s3"]
},
{
"id": "s3",
"labels": [],
"successors": ["s3", "s0"]
}
]
}The conversion follows the standard algorithm:
- Compute SCCs: Using Tarjan's algorithm, find all strongly connected components
- Identify Accepting SCCs: An SCC is accepting if it contains at least one edge with acceptance marks
- Mark Accepting States: A state is accepting in the prefix NFA if it can reach an accepting SCC
A finite word is accepted by the prefix NFA if it can be extended to an infinite word accepted by the Buchi automaton.
- Python 3.x
- Spot library for LTL and automata operations
- Graphviz (for visualization)