postprocess, translate: add support for Büchi (not state-based)
spot/twaalgos/postproc.hh: Introduce options Buchi and GeneralizedBuchi. The latter is similar to TGBA but the former differs from BA in that it does not imply state-based acceptance, since that can be specified separately. Also all other acceptance types are not abbreviated, so those new names make more sense. * NEWS: Mention that. * spot/twaalgos/postproc.cc, spot/twaalgos/translate.cc: Adjust to support Buchi and GeneralizedBuchi without breaking BA and TGBA. * bin/autfilt.cc, bin/common_aoutput.cc, bin/common_post.cc, bin/ltl2tgta.cc, doc/org/tut10.org, doc/org/tut12.org, doc/org/tut30.org, python/spot/__init__.py, tests/python/automata.ipynb, tests/python/langmap.py, tests/python/misc-ec.py, tests/python/satmin.ipynb, tests/python/satmin.py, tests/python/toweak.py: Use the new names. * tests/Makefile.am: Add missing langmap.py.
This commit is contained in:
parent
72c492b0cf
commit
9cc1bdf10f
19 changed files with 274 additions and 201 deletions
|
|
@ -88,7 +88,7 @@ that takes a formula (possibly as a string) as first argument:
|
|||
|
||||
#+BEGIN_SRC python
|
||||
import spot
|
||||
print(spot.translate('GFa -> GFb', 'BA').to_str('spin'))
|
||||
print(spot.translate('GFa -> GFb', 'buchi', 'sbacc').to_str('spin'))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
|
@ -120,15 +120,16 @@ T0_S3:
|
|||
|
||||
* C++
|
||||
|
||||
All the translation pipeline (this include simplifying the formula,
|
||||
All the translation pipeline (this includes simplifying the formula,
|
||||
translating the simplified formula into an automaton, and simplifying
|
||||
the resulting automaton) is handled by the =spot::translator= class.
|
||||
An instance of this class can configured by calling =set_type()= to
|
||||
chose the type of automaton to output, =set_level()= to set the level
|
||||
of optimization (it's high by default), and =set_pref()= to set
|
||||
various preferences (like small or deterministic) or characteristic
|
||||
(complete, unambiguous) for the resulting automaton. Finally, the
|
||||
output as a never claim is done via the =print_never_claim= function.
|
||||
(complete, unambiguous, state-based acceptance) for the resulting
|
||||
automaton. Finally, the output as a never claim is done via the
|
||||
=print_never_claim= function.
|
||||
|
||||
#+BEGIN_SRC C++
|
||||
#include <iostream>
|
||||
|
|
@ -138,11 +139,13 @@ output as a never claim is done via the =print_never_claim= function.
|
|||
|
||||
int main()
|
||||
{
|
||||
spot::parsed_formula pf = spot::parse_infix_psl("[]<>p0 || <>[]p1");
|
||||
spot::parsed_formula pf = spot::parse_infix_psl("[]<>a || <>[]b");
|
||||
if (pf.format_errors(std::cerr))
|
||||
return 1;
|
||||
spot::translator trans;
|
||||
trans.set_type(spot::postprocessor::BA);
|
||||
trans.set_type(spot::postprocessor::Buchi);
|
||||
trans.set_pref(spot::postprocessor::SBAcc
|
||||
| spot::postprocessor::Small);
|
||||
spot::twa_graph_ptr aut = trans.run(pf.f);
|
||||
print_never_claim(std::cout, aut) << '\n';
|
||||
return 0;
|
||||
|
|
@ -155,24 +158,25 @@ never {
|
|||
T0_init:
|
||||
if
|
||||
:: (true) -> goto T0_init
|
||||
:: (p0) -> goto accept_S1
|
||||
:: (p1) -> goto accept_S2
|
||||
:: (a) -> goto accept_S1
|
||||
:: (b) -> goto accept_S2
|
||||
fi;
|
||||
accept_S1:
|
||||
if
|
||||
:: (p0) -> goto accept_S1
|
||||
:: (!(p0)) -> goto T0_S3
|
||||
:: (a) -> goto accept_S1
|
||||
:: (!(a)) -> goto T0_S3
|
||||
fi;
|
||||
accept_S2:
|
||||
if
|
||||
:: (p1) -> goto accept_S2
|
||||
:: (b) -> goto accept_S2
|
||||
fi;
|
||||
T0_S3:
|
||||
if
|
||||
:: (p0) -> goto accept_S1
|
||||
:: (!(p0)) -> goto T0_S3
|
||||
:: (a) -> goto accept_S1
|
||||
:: (!(a)) -> goto T0_S3
|
||||
fi;
|
||||
}
|
||||
|
||||
#+end_example
|
||||
|
||||
* Additional comments
|
||||
|
|
@ -188,17 +192,17 @@ help(spot.translate)
|
|||
#+begin_example
|
||||
Help on function translate in module spot:
|
||||
|
||||
translate(formula, *args, dict=<spot.impl.bdd_dict; proxy of <Swig Object of type 'std::shared_ptr< spot::bdd_dict > *' at 0x7f1f9541c090> >, xargs=None)
|
||||
translate(formula, *args, dict=<spot.impl.bdd_dict; proxy of <Swig Object of type 'std::shared_ptr< spot::bdd_dict > *' at 0x7f42f4cea030> >, xargs=None)
|
||||
Translate a formula into an automaton.
|
||||
|
||||
Keep in mind that 'Deterministic' expresses just a preference that
|
||||
may not be satisfied.
|
||||
|
||||
The optional arguments should be strings among the following:
|
||||
- at most one in 'TGBA', 'BA', or 'Monitor', 'generic',
|
||||
'parity', 'parity min odd', 'parity min even',
|
||||
'parity max odd', 'parity max even' (type of automaton to
|
||||
build), 'coBuchi'
|
||||
- at most one in 'GeneralizedBuchi', 'Buchi', or 'Monitor',
|
||||
'generic', 'parity', 'parity min odd', 'parity min even',
|
||||
'parity max odd', 'parity max even', 'coBuchi'
|
||||
(type of acceptance condition to build)
|
||||
- at most one in 'Small', 'Deterministic', 'Any'
|
||||
(preferred characteristics of the produced automaton)
|
||||
- at most one in 'Low', 'Medium', 'High'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue