Commit graph

201 commits

Author SHA1 Message Date
0505ee9310 tl: implement suffix operator normal form
* spot/tl/Makefile.am: New sonf files
* spot/tl/sonf.cc,spot/tl/sonf.hh: Here.
* python/spot/impl.i: include sonf.hh header
* doc/spot.bib: add entry for the SONF paper
* tests/python/formulas.ipynb: show sample usage
* tests/python/spot.py: test automata equivalence before/after SONF
* NEWS: mention the change
2022-03-03 09:13:04 +01:00
Alexandre Duret-Lutz
a8cfcd2cc2 python: fix a memory leak in all added __iter__ methods
Reported by Yechuan Xia

* python/spot/impl.i: Add %newobject to all __iter__ methods.
* NEWS: Mention the list of affected methods.
* THANKS: Update.
2022-01-31 10:20:42 +01:00
Alexandre Duret-Lutz
dac3d78244 hoa: better support for aliases on output
Part of issue #497.

* doc/org/concepts.org: Declare a new "aliases" named property.
* spot/parseaut/parseaut.yy: Fill the aliases named property.
* spot/twa/twa.cc (copy_named_properties_of): Copy it.
* spot/twaalgos/hoa.cc: Use "aliases" while encoding BDDs for
output.
* spot/twaalgos/hoa.hh: Add helper function to set/get aliases.
* python/spot/impl.i: Create a type for aliases.
* tests/core/parseaut.test: Adjust test case.
* tests/python/aliases.py: New file.
* tests/Makefile.am: Add it.
* NEWS: Mention this change.
2022-01-21 16:53:11 +01:00
Alexandre Duret-Lutz
20bcc216a0 introduce the original-classes named property
* doc/org/concepts.org, NEWS: Document it.
* spot/twaalgos/determinize.cc, spot/twaalgos/determinize.hh,
spot/twaalgos/sbacc.cc, spot/twaalgos/sbacc.hh: Use it.
* spot/twa/twagraph.cc: Update it on defrag.
* spot/twa/twa.cc (copy_named_properties_of): Copy it.
* tests/python/det.py: New file.
* tests/Makefile.am: Add it.
* python/spot/impl.i (get_original_states, get_original_classes): New
methods, to help with the tests.
2021-12-17 22:36:16 +01:00
Alexandre Duret-Lutz
afdd38277d formula: catch min/max overflows at construction
For issue #485.

* spot/tl/formula.cc, spot/tl/formula.hh: Catch min/max overflow
when the operators are constructed.  Also disable travial
simplification rules that would create such overflow.
For instance x[*200][*2] will not become x[*400] anymore.
* python/spot/impl.i: Catch std::overflow_error.
* tests/core/equals.test, tests/python/except.py: Add test cases.
2021-11-18 22:03:23 +01:00
Alexandre Duret-Lutz
ce18a7896b Work around issue with inttypes.h macros
* python/Makefile.am: Define __STDC_FORMAT_MACROS.
2021-11-16 23:28:16 +01:00
Alexandre Duret-Lutz
186d206302 ltsmin-pml: work around newer jupyter versions
Newer Jupyter version are able to capture the system's stdout and
stderr to display it in the notebook.  This is done asynchronously,
with a thread polling those file descriptor.  While this will help us
debug (finaly we can see the tracing code we put in C++) this causes
two issues for testing.  One is the asynchronous behaviour, which
makes it very hard to reproduce notebooks.  The second issue is that
older version of Jupyter used to hide some of the prints from the
notebook, so it is hard to accommodate both.

In the case of the ltsmin-pml notebook, loading the PML file from
a filename used to trigger a compilation silently (with output on the
console, but not in the notebook).  The newer version had the output
of that compilation spread into two cells.

* python/spot/ltsmin.i: Work around the issue by triggering the
compilation from Python, and capturing its output explicitly, so it
work with all Jupyter versions.  Also adjust to use the more recent
and simpler subprocess.run() interface, available since Python 3.5.
* tests/python/ltsmin-pml.ipynb: Adjust expected output.
* tests/python/ipnbdoctest.py (canonicalize): Adjust patterns.
2021-11-15 23:37:08 +01:00
Alexandre Duret-Lutz
6555af1f44 python: fix support for std::vector<const_twa_graph_ptr>
* spot/twaalgos/aiger.hh, spot/twaalgos/aiger.cc: Fix prototypes, as
well as several error messages.
* python/spot/impl.i: Implement an ad-hoc conversion for
std::vector<const_twa_graph_ptr>.
* tests/python/synthesis.ipynb: Use it to simplify the example.
Adjust some comments.
2021-11-12 22:38:37 +01:00
philipp
98ebbea17e Renaming and clean up
"Strategy" was used for mealy machines and game strategies a like.
Introduced the notion of mealy machine in three different flavors:
mealy machine: twa_graph with synthesis-outputs
separated mealy machine: mealy machine and all transitions
have conditions of the form (bdd over inputs)&(bdd over outputs)
split mealy machine: mealy machine that alternates between
env and player states. Needs state-players

* bin/ltlsynt.cc: renaming
* python/spot/impl.i: Add vector for const_twa_graph_ptr
* spot/twaalgos/aiger.cc,
spot/twaalgos/aiger.hh: Adapting functions
* spot/twaalgos/mealy_machine.cc,
spot/twaalgos/mealy_machine.hh: Add test functions and
propagate properties correctly. Adjust for names
* spot/twaalgos/synthesis.cc,
spot/twaalgos/synthesis.hh: Removing unnecessary functions
and adapt to new names
* tests/python/aiger.py,
tests/python/_mealy.ipynb,
tests/python/mealy.py,
tests/python/synthesis.ipynb: Adjust
2021-11-11 00:38:14 +01:00
Alexandre Duret-Lutz
09b361712d python: make sure swig also work with --disable-dependency-tracking
Fixes #482, reported by Antoine Martin.

* python/Makefile.am: Do not pass -MF to Swig when AMDEP is false.
2021-10-29 11:41:09 +02:00
Alexandre Duret-Lutz
88d0d2e112 org: cleanup tut40
* doc/org/tut40.org: Add more explanations and some cleanup.
* python/spot/__init__.py (set_state_players, get_state_winners,
get_state_players, set_state_player, get_state_winner,
get_state_player, get_strategy): Add these methods to the twa_graph
class for convenience.
* NEWS, doc/org/tut.org: Mention tut40.org.
2021-10-01 08:48:11 +02:00
Florian Renkin
306a45f239 Aiger: Add a way to evaluate an input sequence (Python)
Add a method to the class aig (Python) that produces a sequence of
outputs for a given sequence of inputs.

* python/spot/__init__.py: here
2021-09-16 14:53:49 +02:00
philipp
2c267dd894 Adding dot suppport for aiger class
* spot/twaalgos/aiger.cc: Useless assert
* spot/twaalgos/dot.hh,
spot/twaalgos/dot.cc: aig to dot
* python/spot/__init__.py: Adapting
* tests/python/games.ipynb: Additional tests
2021-09-16 14:53:47 +02:00
philipp
17db582341 Making aiger a class
Aiger circuits noew have their own class.
Monitors can be translated to and obtained
from aiger circuits.
Moreover a step by step evaluation method
is provided.

* spot/twaalgos/aiger.hh,
spot/twaalgos/aiger.cc: Here
* bin/ltlsynt.cc: Adopt new modes
* tests/core/ltlsynt.test: Adapt tests
* python/spot/impl.i: Add python support
* tests/Makefile.am,
tests/python/aiger.py: New test cases
2021-09-16 14:53:46 +02:00
philipp
18948a96be Adding bdd_is_cube for python
* python/buddy.i: Here
2021-09-16 14:53:45 +02:00
Alexandre Duret-Lutz
7fedb3dc61 acc: introduce fin_one_extract()
* spot/twa/acc.cc, spot/twa/acc.hh (acc_cond::fin_one_extract,
acc_code::acc_cond::fin_one_extract): New methods.
* python/spot/impl.i: Add support for the return type.
* tests/python/acc_cond.ipynb: Test them.
2021-09-11 01:00:38 +02:00
Alexandre Duret-Lutz
5c5790039b zlktree: cleanup the interface, and add interactive ACD
* tests/python/_zlktree.ipynb: Remove and replace by...
* tests/python/zlktree.ipynb: ... this more documented notebook.
* tests/Makefile.am: Adjust.
* doc/org/tut.org, NEWS: Mention zlktree.ipynb.
* spot/twaalgos/zlktree.hh, spot/twaalgos/zlktree.cc,
python/spot/__init__.py: Cleanup interface, and add support for
interactive display.
2021-09-04 12:48:57 +02:00
Alexandre Duret-Lutz
26f2179805 zlktree: implement ACD and its transform
A quick and dirty implementation of the Alternating Cycle
Decomposition of the casares.21.icalp paper.

* spot/twaalgos/genem.cc, spot/twaalgos/genem.hh
(maximal_accepting_loops_for_scc): New function.
* spot/twaalgos/sccinfo.cc,
spot/twaalgos/sccinfo.hh (scc_and_mark_filter): Add a possibility to
specify a mask of transition to filter.
* spot/twaalgos/zlktree.hh, spot/twaalgos/zlktree.cc (acd): New class.
(acd_transform): New function.
* python/spot/__init__.py: Add SVG rendering for acd.
* tests/python/_zlktree.ipynb: Play with acd and acd_transform.
* tests/python/toparity.py: Add more tests to compare the
sizes of acd_transform and to_parity.
* NEWS: Mention this new feature.
2021-08-30 10:27:06 +02:00
Alexandre Duret-Lutz
a6aa799a17 adjust for BuDDy change
* spot/twaalgos/mealy_machine.cc, python/buddy.i: Rename
bdd_has_common_assignement to bdd_have_common_assignment.
2021-07-30 12:01:19 +02:00
Alexandre Duret-Lutz
af511707c0 introduce a zielonka_tree class
* spot/twaalgos/zlktree.cc, spot/twaalgos/zlktree.hh: New files.
* spot/twaalgos/Makefile.am: Add them.
* tests/python/_zlktree.ipynb: New file.
* tests/Makefile.am: Add it.
* python/spot/__init__.py, python/spot/impl.i: Add bindings for it.
* doc/spot.bib (casares.21.icalp): New entry.
* NEWS: Mention this.
2021-07-30 11:00:25 +02:00
philipp
f4776efb63 Adding sat-based minimization for mealy machines
* spot/twaalgos/mealy_machine.hh,
spot/twaalgos/mealy_machine.cc: Here
* spot/twaalgos/Makefile.am: Here
* tests/python/mealy.py: Added tests
* tests/Makefile.am: Adding mealy.py
* python/spot/impl.i: Here
2021-07-29 09:49:45 +02:00
philipp
08113e0e04 Adding bdd_has_common_assignement
* python/buddy.i: Here
2021-07-27 16:45:44 +02:00
Alexandre Duret-Lutz
d019ea61fe python: make sere twa::acc() survives its automaton
Fixes #468.

* python/spot/__init__.py: Add wrapper around twa::acc() and
twa::get_acceptance() to store the automaton into the acceptance
proxy, therefore ensuring that the automaton survives that proxy.
* tests/python/setacc.py: Test it.
2021-07-12 15:27:07 +02:00
Alexandre Duret-Lutz
31a681c285 twa: implement a copy_named_properties_of() method
It was noted in #470 that make_twa_graph did not copy named
properties.  Let's fix that.

* spot/twa/twa.hh, spot/twa/twa.cc (copy_named_properties_of): New
method.
* spot/twa/twagraph.hh (make_twa_graph): Add an extra argument to
call copy_named_properties_of() optionally.
* python/spot/__init__.py (twa_graph.__copy__): Use it.
* tests/python/twagraph.py: Test that.
* tests/sanity/namedprop.test: Ensure copy_named_properties_of copies
all known named properties.
2021-07-08 10:33:15 +02:00
Alexandre Duret-Lutz
0cf2d285b6 python: implement twa_graph.__copy__
Fixes #470, suggested by Cambridge Yang.

* python/spot/__init__.py (twa_graph.__copy__): Call make_twa_graph.
* tests/python/twagraph.py: Test it.
* NEWS: Mention it.
2021-07-08 09:33:57 +02:00
Alexandre Duret-Lutz
47348a9755 improve PyPy support by following PEP 3149
This implement the suggestion is issue #467 but the test suite is
still not completely passing with pypy3.

* m4/pypath.m4: Detect the suffix for extensions.
* python/Makefile.am: Use it.
* tests/run.in: Recognize pypy3 as a Python version.
2021-06-29 21:15:04 +02:00
Alexandre Duret-Lutz
093de290c1 python: add binding for spot::twa::prop_set
Fix #453.

* python/spot/impl.i: Here.
* NEWS: Mention them.
* tests/python/twagraph.py: Test them.
2021-04-17 10:38:58 +02:00
Alexandre Duret-Lutz
05449a42d3 move game.cc from misc/ to twaalgos/
* spot/misc/game.cc, spot/misc/game.hh: Move...
* spot/twaalgos/game.cc, spot/twaalgos/game.hh: ... here.
* bin/ltlsynt.cc, python/spot/impl.i, spot/misc/Makefile.am,
spot/twaalgos/Makefile.am: Adjust.
2020-12-09 16:47:18 +01:00
Alexandre Duret-Lutz
ffc0138ed6 python: rename aux.py to aux_.py
Fixes #437, reporeted by Yann Thierry-Mieg.

* python/spot/aux.py: Rename as...
* python/spot/aux_.py: ... this.
* python/spot/__init__.py, python/Makefile.am: Adjust.
* NEWS: Mention the change.
2020-11-08 14:08:13 +01:00
Alexandre Duret-Lutz
9cc1bdf10f 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.
2020-10-06 17:46:34 +02:00
philipp
29055c8109 Improving split and reorganizing
* spot/twaalgos/synthesis.cc, spot/twaalgos/synthesis.hh: New files
regrouping the functionnalities split and apply_strategy for synthesis
* python/spot/impl.i, spot/twaalgos/Makefile.am: Add them.
* spot/twaalgos/split.cc, spot/twaalgos/split.hh: No longer contains
the splits necessary for for synthesis, moved to
spot/twaalgos/synthesis.cc, spot/twaalgos/split.hh Split is now faster
and reduces the number of intermediate states, reducing the overall
size of the arena
* spot/misc/game.cc, spot/misc/game.hh: Renaming propagate_players to
alternate_players.
* tests/core/ltlsynt.test, tests/python/split.py: Update tests.
* bin/ltlsynt.cc: Adjust to new split. Swap order of split and
to_parity for lar.
2020-09-24 16:29:31 +02:00
Alexandre Duret-Lutz
9d7e6386e4 python: reduce automata width to prevent overflows with Jupyter
* python/spot/__init__.py (setup): Reduce the default maximal width of
automata so that Jupyter output does not add an horizontal scroll bar
for a few pixels.
* tests/python/automata-io.ipynb: Adjust.
2020-09-17 11:21:06 +02:00
Jerome Dubois
ae7d4504cd game: Add set_state_player() and get_state_player()
Fixes #424.

* python/spot/impl.i: Add implicit convertion for vector<bool>.
* spot/misc/game.cc, spot/misc/game.hh: Add set_state_player()
  and get_state_player().
* tests/python/parity.py: Test them.
2020-09-16 10:22:09 +02:00
Alexandre Duret-Lutz
760bde093b python: add some parity-game bindings
* python/spot/impl.i: Process game.hh.
* spot/misc/game.cc, spot/misc/game.hh: Make the output of
parity_game_solve() a solved_game object for easier manipulation in
Python.
* bin/ltlsynt.cc: Adjust usage.
* tests/python/paritygame.ipynb: New file.
* tests/Makefile.am, doc/org/tut.org: Add it.
* NEWS: Mention these bindings.
2020-09-09 15:32:44 +02:00
Alexandre Duret-Lutz
f3b8bf8e56 org: run a spell checker on the documentation
* doc/org/autcross.org, doc/org/autfilt.org, doc/org/citing.org,
doc/org/compile.org, doc/org/concepts.org, doc/org/csv.org,
doc/org/dstar2tgba.org, doc/org/genaut.org, doc/org/genltl.org,
doc/org/hierarchy.org, doc/org/hoa.org, doc/org/index.org,
doc/org/install.org, doc/org/ltl2tgba.org, doc/org/ltl2tgta.org,
doc/org/ltlcross.org, doc/org/ltlfilt.org, doc/org/ltlgrind.org,
doc/org/ltlsynt.org, doc/org/oaut.org, doc/org/randaut.org,
doc/org/randltl.org, doc/org/satmin.org, doc/org/tut.org,
doc/org/tut01.org, doc/org/tut02.org, doc/org/tut03.org,
doc/org/tut04.org, doc/org/tut10.org, doc/org/tut11.org,
doc/org/tut12.org, doc/org/tut20.org, doc/org/tut21.org,
doc/org/tut22.org, doc/org/tut23.org, doc/org/tut24.org,
doc/org/tut30.org, doc/org/tut31.org, doc/org/tut50.org,
doc/org/tut51.org, doc/org/tut52.org, doc/org/tut90.org,
doc/org/upgrade2.org: Run ispell-buffer on all these.
* bin/autfilt.cc, python/spot/__init__.py: Fix typos in
help texts noticed while spell-checking the org files.
2020-07-21 22:18:03 +02:00
Etienne Renault
e564dd1263 atomic: check if -latomic is required for std::atomic
* configure.ac,
m4/l_atomic.m4,
python/Makefile.am,
tests/Makefile.am: Here.
2020-06-03 12:22:41 +02:00
Etienne Renault
61561ee9ac raspbian: add missing library
* tests/Makefile.am,
python/Makefile.am: Here.
2020-06-03 12:22:41 +02:00
Alexandre Duret-Lutz
ed5cccba8a python: fix to_parity default option handling
* python/spot/__init__.py (to_options): Do not have options
explicitely default to to_parity_options(), because that would be
instantiated only once.
2020-04-18 07:38:18 +02:00
Alexandre Duret-Lutz
1db319267f python: simplify to_parity() interface
* python/spot/__init__.py (to_parity): Iterate over the attributes
of spot.to_parity_options instead of naming each option explicitely,
also accept a to_parity_options() instance as argument.
* tests/python/toparity.py: Add tests for both styles of calls, and
reduce the number of random tests to lower the run time of this test.
2020-04-04 15:44:27 +02:00
Alexandre Duret-Lutz
1750c0fb6d to_parity: improve doc, and rename car_option into to_parity_options
* spot/twaalgos/toparity.hh: Improve doc, and rename car_option into
to_parity_options.
* doc/spot.bib: Add one reference.
* python/spot/__init__.py, spot/twaalgos/toparity.cc,
tests/python/toparity.py: Adjust.
2020-04-04 14:43:47 +02:00
Florian Renkin
75990063f0 Moved IAR and the new version of to_parity in toparity.cc
* python/spot/__init__.py: Use keyword arguments in to_parity()
* python/spot/impl.i: remove useless includes.
* spot/twaalgos/car.cc, spot/twaalgos/car.hh,
spot/twaalgos/rabin2parity.cc, spot/twaalgos/rabin2parity.hh,
tests/Makefile.am, spot/twaalgos/Makefile.am:
content moved to toparity.
* spot/twaalgos/postproc.cc: Use the new version of to_parity in
postprocessor::run.
* spot/twaalgos/toparity.cc, spot/twaalgos/toparity.hh: Add the
content of rabin2parity and car.
* tests/python/car.py, tests/python/toparity.py: Moved all tests
from car.py to toparity.py.
* tests/python/except.py: Change iar() to iar_old().
2020-03-24 15:41:02 +01:00
Florian Renkin
96531f29f2 CAR: new algorithm for paritizing
* NEWS: Mention it.
* spot/twaalgos/car.cc, spot/twaalgos/car.hh, tests/python/car.py:
New files.
* spot/twaalgos/Makefile.am, tests/Makefile.am: Add them.
* python/spot/impl.i: Include CAR.
* spot/twa/acc.cc, spot/twa/acc.hh, spot/twa/twagraph.cc,
spot/twa/twagraph.hh: Add supporting methods.
2020-02-24 15:05:40 +01:00
Alexandre Duret-Lutz
09bb61db33 _postproc_translate_options: fix syntax error
* python/spot/__init__.py: Here.
* tests/python/except.py: Add test.
* NEWS: Mention the issue.
2020-02-10 11:37:58 +01:00
Alexandre Duret-Lutz
e778965730 python: define our own SVG DisplayObject
This is to workaround differences in minidom's pretty-printing that
occurred between Python 3.7 and 3.8.

* python/spot/jupyter.py (SVG): New class.
* python/spot/__init__.py: Use it.
* tests/python/_altscc.ipynb, tests/python/alternation.ipynb,
tests/python/automata.ipynb, tests/python/formulas.ipynb,
tests/python/gen.ipynb, tests/python/highlighting.ipynb,
tests/python/ltsmin-dve.ipynb, tests/python/ltsmin-pml.ipynb,
tests/python/product.ipynb, tests/python/randaut.ipynb,
tests/python/testingaut.ipynb, tests/python/twagraph-internals.ipynb,
tests/python/word.ipynb: Adjust.
2019-12-05 08:01:07 +01:00
Alexandre Duret-Lutz
e18616e788 work around recent GraphViz bug in SVG scaling
See https://gitlab.com/graphviz/graphviz/issues/1605.

* python/spot/aux.py (str_to_svg): Invert the scale parameters
if they are both greater than one.
2019-10-19 15:40:00 +02:00
Alexandre Duret-Lutz
878ef6e084 "import spot.foo" may now load "spot-extra/foo.py"
This is needed for tcltl.

* python/spot/__init__.py: Alter __path__ to add any spot-extra/
directory we find.
* NEWS: Mention this.
2019-10-02 13:34:44 +02:00
Alexandre Duret-Lutz
f8695e91f9 python: remove workaround for swig 2.0.2
* python/spot/gen.i, python/spot/impl.i, python/spot/ltsmin.i: Here.
2019-10-02 09:34:18 +02:00
Alexandre Duret-Lutz
1d7ad07c83 product: fix handling of output_aborter
* spot/twaalgos/product.cc: The res pointer should be
passed by reference since we reset it to nullptr when
output_aborter says "too large".
* python/spot/impl.i: Add binding for powerset.hh,
so we can use output_aborter in Python.
* tests/python/prodexpt.py: Test it.
2019-07-09 16:09:20 +02:00
Alexandre Duret-Lutz
822fe77891 python: cleanup with autopep8
* tests/python/341.py, tests/python/alarm.py, tests/python/bdddict.py,
tests/python/bddnqueen.py, tests/python/bugdet.py,
tests/python/dualize.py, tests/python/except.py, tests/python/gen.py,
tests/python/genem.py, tests/python/implies.py,
tests/python/interdep.py, tests/python/ipnbdoctest.py,
tests/python/kripke.py, tests/python/ltl2tgba.py,
tests/python/ltlf.py, tests/python/ltlparse.py,
tests/python/ltlsimple.py, tests/python/relabel.py,
tests/python/rs_like.py, tests/python/sccsplit.py,
tests/python/semidet.py, tests/python/setacc.py,
tests/python/setxor.py, tests/python/split.py,
tests/python/streett_totgba.py, tests/python/stutter.py,
tests/python/sum.py, tests/python/toparity.py, tests/python/toweak.py,
tests/python/trival.py, python/spot/__init__.py, python/spot/aux.py,
python/spot/jupyter.py: Reformat with autopep8.

fixup! * spot/tl/simplify.cc: Fix typos in tracing code.
2019-07-05 21:22:29 +02:00
Alexandre Duret-Lutz
ad2f5524bb doc: add tut90.org about bdd_dict
Fixes #372.

* doc/org/tut90.org: New file.
* doc/Makefile.am, doc/org/tut.org: Add it.
* NEWS: Mention it.
* python/spot/__init__.py: Allow make_twa_graph with
default bdd_dict.
2019-06-27 10:50:19 +02:00