python: better support for explicit Kripke
Part of issue #376, reported by Hashim Ali. * python/spot/impl.i: Add bindings for kripke_graph. * python/spot/__init__.py (automaton): Add a want_kripke option. * spot/kripke/kripkegraph.hh: Honnor the "state-names" property when displaying states. * spot/twaalgos/hoa.cc: Preserve names of Kripke states. * tests/python/ltsmin-dve.ipynb: Illustrate all the above. * NEWS: Mention those changes. * THANKS: Add Hashim.
This commit is contained in:
parent
a86925e20e
commit
f26dd904ff
7 changed files with 393 additions and 33 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014-2018 Laboratoire de
|
||||
# Copyright (C) 2014-2019 Laboratoire de
|
||||
# Recherche et Développement de l'Epita (LRDE).
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
|
|
@ -367,7 +367,8 @@ class atomic_prop_set:
|
|||
|
||||
|
||||
def automata(*sources, timeout=None, ignore_abort=True,
|
||||
trust_hoa=True, no_sid=False, debug=False):
|
||||
trust_hoa=True, no_sid=False, debug=False,
|
||||
want_kripke=False):
|
||||
"""Read automata from a list of sources.
|
||||
|
||||
Parameters
|
||||
|
|
@ -386,6 +387,10 @@ def automata(*sources, timeout=None, ignore_abort=True,
|
|||
trust_hoa : bool, optional
|
||||
If True (the default), supported HOA properies that
|
||||
cannot be easily verified are trusted.
|
||||
want_kripke : bool, optional
|
||||
If True, the input is expected to discribe Kripke
|
||||
structures, in the HOA format, and the returned type
|
||||
will be of type kripke_graph_ptr.
|
||||
no_sid : bool, optional
|
||||
When an automaton is obtained from a subprocess, this
|
||||
subprocess is started from a shell with its own session
|
||||
|
|
@ -445,6 +450,8 @@ def automata(*sources, timeout=None, ignore_abort=True,
|
|||
o.ignore_abort = ignore_abort
|
||||
o.trust_hoa = trust_hoa
|
||||
o.raise_errors = True
|
||||
o.want_kripke = want_kripke
|
||||
|
||||
for filename in sources:
|
||||
try:
|
||||
p = None
|
||||
|
|
@ -496,8 +503,9 @@ def automata(*sources, timeout=None, ignore_abort=True,
|
|||
mgr = proc if proc else _supress()
|
||||
with mgr:
|
||||
while a:
|
||||
# This returns None when we reach the end of the file.
|
||||
a = p.parse(_bdd_dict).aut
|
||||
# the automaton is None when we reach the end of the file.
|
||||
res = p.parse(_bdd_dict)
|
||||
a = res.ks if want_kripke else res.aut
|
||||
if a:
|
||||
yield a
|
||||
finally:
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
%shared_ptr(spot::fair_kripke)
|
||||
%shared_ptr(spot::kripke)
|
||||
%shared_ptr(spot::kripke_graph)
|
||||
%shared_ptr(spot::kripke)
|
||||
%shared_ptr(spot::ta)
|
||||
%shared_ptr(spot::ta_explicit)
|
||||
%shared_ptr(spot::ta_product)
|
||||
|
|
@ -172,8 +171,9 @@
|
|||
|
||||
#include <spot/parseaut/public.hh>
|
||||
|
||||
#include <spot/kripke/kripke.hh>
|
||||
#include <spot/kripke/fairkripke.hh>
|
||||
#include <spot/kripke/kripke.hh>
|
||||
#include <spot/kripke/kripkegraph.hh>
|
||||
|
||||
#include <spot/ta/ta.hh>
|
||||
#include <spot/ta/tgta.hh>
|
||||
|
|
@ -678,10 +678,11 @@ def state_is_accepting(self, src) -> "bool":
|
|||
|
||||
%include <spot/twaalgos/complement.hh>
|
||||
|
||||
%include <spot/parseaut/public.hh>
|
||||
|
||||
%include <spot/kripke/fairkripke.hh>
|
||||
%include <spot/kripke/kripke.hh>
|
||||
%include <spot/kripke/kripkegraph.hh>
|
||||
|
||||
%include <spot/parseaut/public.hh>
|
||||
|
||||
%include <spot/ta/ta.hh>
|
||||
%include <spot/ta/tgta.hh>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue