Commit graph

488 commits

Author SHA1 Message Date
Alexandre Duret-Lutz
cab3ea7faf acd: rewrite Python wrapper without jQuery
* python/spot/__init__.py (acd): Rewrite javascript so that it does
not use jQuery, to make it easier to use in jupyterlab, or with
nbconvert.
* tests/python/zlktree.ipynb: Adjust.
* NEWS: Mention this.
2023-01-31 17:51:18 +01:00
Philipp Schlehuber-Caissier
37d4e513d9 game: fix appending strategies bug
When calling solve_parity_game() multiple times on the same
automaton the strategies are appended one after the other.
Reported by Dávid Smolka.

* NEWS: Mention the bug.
* spot/twaalgos/game.cc: Fix it.
* tests/python/game.py: Test it.
* THANKS: Add Dávid.
2022-12-06 16:06:04 +01:00
Philipp Schlehuber-Caissier
86c433cf80 mealy: fix incorrect assertion
* spot/twaalgos/mealy_machine.cc (minimize_mealy): Do not compare
result to the original unsplit machine without splitting it first.
* tests/python/mealy.py: Add a test case.
2022-12-06 16:04:40 +01:00
Alexandre Duret-Lutz
b36cee06a1 adjust to Swig 4.1.0
* python/spot/__init__.py: Add flatnested versions of some static
methods.
* spot/twa/acc.hh: Hide && version of & and |, causing trouble
to swig.
* tests/python/_synthesis.ipynb, tests/python/synthesis.ipynb:
Upgrade expected type names.
* tests/python/ipnbdoctest.py: Adjust for difference between 4.0 and
4.1.
2022-11-10 17:08:30 +01:00
Alexandre Duret-Lutz
5c5133348e mealy: improve error reporting
* spot/twaalgos/mealy_machine.cc: Add more exceptions.
* tests/python/except.py: Test them.
2022-11-07 09:07:31 +01:00
Alexandre Duret-Lutz
b0c299b9e9 reduce_parity: add layered option
* spot/twaalgos/parity.cc: Implement it.
* spot/twaalgos/parity.hh, NEWS: Document it.
* tests/python/parity.ipynb: Demonstrate it.  This is the only test so
far, but more uses are coming.
2022-10-17 15:42:45 +02:00
Alexandre Duret-Lutz
179672fe3b relabel: fix handling of concat and fusion
* spot/tl/relabel.cc (formula_to_fgraph): Do not assume that n-ary
operators are Boolean operators.
* tests/python/relabel.py: Add a test case found while discussing
some expression with Antoine Martin.
* NEWS: Mention it.
2022-10-13 11:39:10 +02:00
Alexandre Duret-Lutz
4ab51e1c88 toparity: cover more options
* tests/python/toparity.py: Augment test cases.
2022-10-04 09:24:03 +02:00
Alexandre Duret-Lutz
fa4500a8d3 * tests/python/ipnbdoctest.py: Also retry if Kernel does not respond. 2022-10-03 16:27:38 +02:00
Florian Renkin
4d2c096ec0 dot: fix 'g' with a Mealy machine
* spot/twaalgos/dot.cc: here
* tests/python/mealy.py: add test
2022-10-03 10:35:38 +02:00
Alexandre Duret-Lutz
3efab05cf2 introduce delay_branching_here
This is motivated by an example sent by Edmond Irani Liu,
that will be tested in next patch.

* spot/twaalgos/dbranch.cc, spot/twaalgos/dbranch.hh: New files.
* python/spot/impl.i, spot/twaalgos/Makefile.am: Add them.
* spot/twaalgos/translate.cc: Call delay_branching_here
unconditionally.
* spot/twa/twagraph.cc (defrag_states): Do not assume
that games are alternating.
* tests/core/genltl.test: Adjust expected numbers.
* tests/python/dbranch.py: New file.
* tests/Makefile.am: Add it.
2022-09-23 08:57:57 +02:00
Philipp Schlehuber-Caissier
4a24739c3f Improving minimize_mealy benchmarking
* python/spot/__init__.py: Adding helper function for
inline plot of csv
*spot/twaalgos/mealy_machine.cc, spot/twaalgos/mealy_machine.hh:
Main changes
* tests/python/_mealy.ipynb: Update
* tests/python/ipnbdoctest.py: Ignore timing table
* tests/python/synthesis.ipynb: Update
2022-09-21 21:03:06 +02:00
Philipp Schlehuber-Caissier
c63c1796b9 Improve aiger INF encoding
the encoding cna be simplified to produce less gates
when high or low is True.

* spot/twaalgos/aiger.cc: Here
* tests/python/_synthesis.ipynb: Test
2022-09-21 17:28:04 +02:00
Alexandre Duret-Lutz
bdac53511a degen: learn to work on generalized-Co-Büchi as well
* spot/twaalgos/degen.hh, spot/twaalgos/degen.cc: Adjust
degeneralize() and degeneralize_tba() to work on generalized-co-Büchi.
* NEWS: Mention this.
* spot/twaalgos/cobuchi.hh, spot/twaalgos/cobuchi.cc (to_nca): Use
degeneralization on generalized-co-Büchi.
* spot/twaalgos/postproc.cc: Use degeneralization for generalized
co-Büchi as well.
* bin/autfilt.cc: Improve chain products of co-Büchi automata by using
generalization if too many colors are needed.
* tests/core/prodchain.test, tests/python/pdegen.py: Add test cases.
2022-09-12 14:14:43 +02:00
Alexandre Duret-Lutz
0f131f2eee product: Büchi|Büchi=Büchi, CoBüchi&CoBüchi=CoBüchi
Improve the construction of the above constructions, saving colors.

* spot/twaalgos/product.cc: Here.
* spot/twaalgos/product.hh, NEWS: Mention it.
* tests/core/prodchain.test, tests/core/prodor.test,
tests/python/_product_weak.ipynb: Adjust.
2022-09-06 18:05:52 +02:00
Alexandre Duret-Lutz
d1b8495510 do not use a global variable to define the number of available threads
* python/spot/impl.i: Make parallel_policy implicitly contractible.
* spot/graph/graph.hh (sort_edges_srcfirst_): Pass a parallel_policy
explicitly.
* spot/twa/twagraph.hh, spot/twa/twagraph.cc (merge_states): Likewise.
* spot/misc/common.cc: Remove file.
* spot/misc/common.hh (set_nthreads, get_nthreads): Remove, and
replace with...
(parallel_policy): ... this.
* spot/misc/Makefile.am, tests/python/mergedge.py, NEWS: Adjust.
2022-08-14 23:09:56 +02:00
Alexandre Duret-Lutz
8b93b6967d rename pg_print() as print_pg() and add it to to_str()
* NEWS: Mention those change.
* spot/twaalgos/game.hh (print_pg): New function.
(pg_print): Mark as deprecated.
* spot/twaalgos/game.cc (pg_print): Redirect to print_pg().
(print_pg): Update to output state names.
* python/spot/__init__.py: Teach to_str() about print_pg().
* bin/ltlsynt.cc: Adjust to call print_pg().
* tests/python/games.ipynb: Add an example.
* tests/core/ltlsynt.test: Adjust to remove the "INIT" note.
2022-07-23 21:38:23 +02:00
Alexandre Duret-Lutz
444e2b5b89 parseaut: Add support for PGSolver's format
* spot/parseaut/parseaut.yy, spot/parseaut/scanaut.ll: Add rules for
PGSolver's format.
* spot/parseaut/public.hh: PGAME is a new type of output.
* tests/core/pgsolver.test: New file.
* tests/Makefile.am: Add it.
* tests/python/games.ipynb: More exemples.
* NEWS: Mention the new feature.
2022-07-22 10:54:08 +02:00
Alexandre Duret-Lutz
3e2201bd80 tests: add figures from CAV'22 paper
* tests/python/cav22-figs.ipynb: New file.
* doc/org/tut.org, tests/Makefile.am: Add it.
2022-07-12 15:05:09 +02:00
Florian Renkin
6dd99e049b to_parity: Rewrite the function and add new transformations
* spot/twaalgos/synthesis.cc: Now needs to call reduce_parity.
* spot/twaalgos/toparity.cc, spot/twaalgos/toparity.hh: here.
* spot/twaalgos/zlktree.hh: make zielonka_node public
* tests/core/ltlsynt.test, tests/python/games.ipynb,
  tests/python/synthesis.ipynb, tests/python/toparity.py:
  update tests
2022-07-07 20:43:21 +02:00
Philipp Schlehuber-Caissier
99bf152673 propagate_marks_here can break state-acc prop
* spot/twaalgos/degen.cc: Fix
* tests/python/pdegen.py: Test
2022-06-29 14:02:36 +02:00
Philipp Schlehuber-Caissier
6bc1dd0467 Use new zielonka for synthesis
Remove all now unnecessary colorize_parity and
change_parity calls.

* spot/twaalgos/synthesis.cc: Change here
* spot/twaalgos/game.cc: Adjust pg-print
* tests/core/ltlsynt.test,
  tests/python/_mealy.ipynb,
  tests/python/games.ipynb,
  tests/python/synthesis.ipynb,
  tests/python/synthesis.py: Adjust tests
2022-06-27 09:29:46 +02:00
philipp
9124484719 Modifying Zielonka
* spot/twaalgos/game.cc: solve_parity_game now works for any of
the four parity types and partially colored graphs.
 Also removing unnescessary steps from Zielonka.
h: Update
* tests/python/game.py: Update and additional tests
* tests/python/except.py: Remove outdated exception
2022-06-27 09:29:36 +02:00
Alexandre Duret-Lutz
288b1c7958 contains: generalize second argument to a twa
This was triggered by a question from Pierre Ganty on the mailing
list.

* spot/twaalgos/contains.hh, spot/twaalgos/contains.cc (contains):
Generalize second argument to const_twa_ptr instead of
const_twa_graph_ptr.
* NEWS: Mention this.
* tests/python/ltsmin-pml.ipynb: Show that it work.
* THANKS: Mention Pierre.
2022-06-22 23:43:07 +02:00
Alexandre Duret-Lutz
721d5695ec add a newer version of the generic emptiness check
As discussed with Jan Strejček.

* spot/twa/acc.cc, spot/twa/acc.hh (fin_unit_one_split): New function.
(fin_one_extract): Return the simplified acceptance condition as an
optimization.
* python/spot/impl.i: Bind this new function.
* tests/python/acc.py: New file, to test it.
* tests/Makefile.am: Add acc.py.
* spot/twaalgos/genem.cc, spot/twaalgos/genem.hh: Implement the
spot211 variant of the emptiness check.
* tests/python/genem.py: Test it.
* tests/python/acc_cond.ipynb: Adjust test for fin_one_extract.
2022-06-17 09:54:42 +02:00
Philipp Schlehuber-Caissier
d8cc0c5acb Introduce a faster merge_states
merge_states is now hash-based, uses the new edge-sorting with
src first and can be executed in parallel.

* spot/twa/twagraph.cc: Here
* tests/python/mergedge.py: Test
2022-05-24 16:58:07 +02:00
Alexandre Duret-Lutz
b11208440b zlktree: use a cache in the construction of zielonka_tree
This largely speeds up the computation for conditions
like "Rabin n" sharing a lot of subtrees.

Also implement options to stop the construction if the shape is wrong.

* spot/twaalgos/zlktree.cc, spot/twaalgos/zlktree.hh: Implement the
cache and the options.
* tests/python/zlktree.ipynb, tests/python/zlktree.py: New tests.
2022-05-20 17:07:26 +02:00
Alexandre Duret-Lutz
3b8e11322b Merge branch 'master' into next 2022-05-18 09:03:40 +02:00
Alexandre Duret-Lutz
78d7224026 twagraph: improve copy of kripke_graph
Fix #505, Reported by Edmond Irani Liu.

* spot/twa/twagraph.cc (copy): Deal with kripke_graph in a better way.
* spot/twaalgos/hoa.cc: Do not force the use of named-states since
when the input is a kripke_graph.
* tests/python/kripke.py: Adjust test cases.
* NEWS: Mention the change.
* THANKS: Add Edmund.
2022-05-18 08:52:33 +02:00
Alexandre Duret-Lutz
013c879b41 twagraph: improve copy of kripke_graph
Fix #505, Reported by Edmond Irani Liu.

* spot/twa/twagraph.cc (copy): Deal with kripke_graph in a better way.
* spot/twaalgos/hoa.cc: Do not force the use of named-states since
when the input is a kripke_graph.
* tests/python/kripke.py: Adjust test cases.
* NEWS: Mention the change.
* THANKS: Add Edmund.
2022-05-09 13:42:20 +02:00
Philipp Schlehuber-Caissier
add2fced44 Correct bug in zielonka
Optimization in Zielonka failed
under certain circumstances
todo: Devise a specialized test
for direct attr computation

* spot/twaalgos/game.cc: Correction
* tests/python/game.py: Test
2022-05-02 17:24:23 +02:00
Alexandre Duret-Lutz
2aecf9a79e fix typos and make formula_from_bdd more usable in Python
* python/spot/impl.i (formula_from_bdd): Instantiate for twa_graph.
* spot/twa/twa.hh (register_aps_from_dict): Typo in exception.
* tests/python/except.py: More tests for the above.
* tests/python/bdddict.py: Typo in comment.
2022-05-02 17:24:23 +02:00
Alexandre Duret-Lutz
64020279cb reduce_parity: fix to work on automata with deleted edges
* spot/twaalgos/parity.cc (reduce_parity): Use the
size of the edge vector to initialize piprime1 and piprime2,
not the number of edges.
* tests/python/parity.py: Add test case, based on a report
by Yann Thierry-Mieg.
2022-05-02 15:34:57 +02:00
Philipp Schlehuber-Caissier
524edea8da Propagate colors in split_2step
Reduce the amount of uncolored transitions
after split_2step by trying to color the env transitions.
This is currently only supported for parity like
acceptance conditions.

* spot/twaalgos/game.cc: Determinizatio of "colored"
game can created trivial self-loops. Fix them
* spot/twaalgos/synthesis.cc: Here
* tests/core/ltlsynt.test,
tests/python/_synthesis.ipynb,
tests/python/games.ipynb,
tests/python/synthesis.ipynb,
tests/python/synthesis.py: New and adjusted tests
2022-04-07 21:21:06 +02:00
Philipp Schlehuber-Caissier
dfb75632ba Update merge_states
Current implementation of merge_states fails
on certain self-loops.
Updated implementation to take them into
account and use a hashbased implementation
to speed up calculations.
Moreover, merge_states() is now aware
of "state-player", just like defrag_states_

* spot/twa/twagraph.cc: Here
* spot/twaalgos/game.cc: Fix odd cycle for sink
* spot/twaalgos/synthesis.cc: Adapt split_det pipeline
* tests/python/_synthesis.ipynb: Tests
2022-04-07 17:42:14 +02:00
Philipp Schlehuber-Caissier
27d455389e Correct bug in zielonka
Optimization in Zielonka failed
under certain circumstances
todo: Devise a specialized test
for direct attr computation

* spot/twaalgos/game.cc: Correction
* tests/python/game.py: Test
2022-03-29 22:36:35 +02:00
Florian Renkin
dd58747659 synthesis.ipynb: remove useless import
* tests/python/synthesis.ipynb: here.
2022-03-22 16:08:51 +01:00
Philipp Schlehuber-Caissier
bb7072402a Removing eeroneaus test
* tests/python/except.py: Here
2022-03-21 10:51:38 +01:00
Philipp Schlehuber-Caissier
97fc3f6c0b Introduce simplify_mealy
Convenience function dispatching to
minimize_mealy and reduce_mealy.
Change tests accordingly

* spot/twaalgos/mealy_machine.cc,
  spot/twaalgos/mealy_machine.hh: Here
* bin/ltlsynt.cc: Use simplify
* spot/twaalgos/synthesis.cc,
  spot/twaalgos/synthesis.hh: Remove
 minimization, Update options
* tests/core/ltlsynt.test,
  tests/python/synthesis.ipynb,
  tests/python/_synthesis.ipynb: Adapt
2022-03-18 15:35:54 +01:00
Philipp Schlehuber-Caissier
86de4d4052 Introduce mealy_prod
Product between mealy machines
with propagation of synthesis outputs
and additional assertions.
Currently it only supports input complete machines

* spot/twaalgos/mealy_machine.cc,
  spot/twaalgos/mealy_machine.hh: Here
* bin/ltlsynt.cc: Use
* tests/python/except.py,
  tests/python/synthesis.ipynb: Test
2022-03-18 15:33:15 +01:00
Alexandre Duret-Lutz
75818fde13 synthesis: fix suboptimal colorization after LAR
* spot/twaalgos/synthesis.cc (ltl_to_game): In LAR and LAR_OLD mode,
for max odd and colorize the game after the split, not before.  The
previous code used to colorize twice, and could waste up to 4 colors
in the process.
* tests/core/ltlsynt.test, tests/python/_mealy.ipynb,
tests/python/games.ipynb, tests/python/synthesis.ipynb,
tests/python/synthesis.py: Adjust all test cases to reflect the fact
that the game uses fewer colors.
2022-03-17 16:44:48 +01:00
Florian Renkin
4f69e99c45 synthesis.ipynb: correct typos
* tests/python/synthesis.ipynb: here
2022-03-17 11:53:51 +01:00
Alexandre Duret-Lutz
0745e735bb fix typos and make formula_from_bdd more usable in Python
* python/spot/impl.i (formula_from_bdd): Instantiate for twa_graph.
* spot/twa/twa.hh (register_aps_from_dict): Typo in exception.
* tests/python/except.py: More tests for the above.
* tests/python/bdddict.py: Typo in comment.
2022-03-11 09:53:04 +01:00
Alexandre Duret-Lutz
530cf7ca47 tests: replace all "assert" by unittest assertions
If the assert fails because of a comparison, it is useful that the
test suite log contains a comparison of these values.
unittest.assertEqual() and friends do that for us.

* HACKING: Add a section about Python tests.
* tests/sanity/style.test: Forbid the use of "assert" in
Python tests.
* tests/python/298.py, tests/python/341.py, tests/python/471.py,
tests/python/accparse2.py, tests/python/aiger.py,
tests/python/aliases.py, tests/python/alternating.py,
tests/python/bdddict.py, tests/python/bdditer.py,
tests/python/bugdet.py, tests/python/complement_semidet.py,
tests/python/declenv.py, tests/python/decompose_scc.py,
tests/python/det.py, tests/python/dualize.py, tests/python/ecfalse.py,
tests/python/except.py, tests/python/game.py, tests/python/gen.py,
tests/python/genem.py, tests/python/implies.py,
tests/python/intrun.py, tests/python/kripke.py,
tests/python/langmap.py, tests/python/ltl2tgba.py,
tests/python/ltlf.py, tests/python/ltlparse.py,
tests/python/ltlsimple.py, tests/python/mealy.py,
tests/python/merge.py, tests/python/mergedge.py,
tests/python/misc-ec.py, tests/python/optionmap.py,
tests/python/origstate.py, tests/python/otfcrash.py,
tests/python/parity.py, tests/python/parsetgba.py,
tests/python/pdegen.py, tests/python/prodexpt.py,
tests/python/randgen.py, tests/python/relabel.py,
tests/python/remfin.py, tests/python/removeap.py,
tests/python/rs_like.py, tests/python/satmin.py,
tests/python/sbacc.py, tests/python/sccfilter.py,
tests/python/sccinfo.py, tests/python/sccsplit.py,
tests/python/semidet.py, tests/python/setacc.py,
tests/python/setxor.py, tests/python/simplacc.py,
tests/python/simstate.py, tests/python/sonf.py, tests/python/split.py,
tests/python/streett_totgba.py, tests/python/streett_totgba2.py,
tests/python/stutter.py, tests/python/sum.py,
tests/python/synthesis.py, tests/python/toparity.py,
tests/python/toweak.py, tests/python/tra2tba.py,
tests/python/trival.py, tests/python/twagraph.py,
tests/python/zlktree.py: Replace all occurrences of "assert" by calls
to unittest.TestCase methods.
2022-03-07 09:03:21 +01:00
c71691659b 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/Makefile.am: new python tests
* tests/python/formulas.ipynb: show sample usage
* tests/python/sonf.py: test automata equivalence before/after SONF
* NEWS: mention the change
2022-03-04 17:23:58 +01:00
Alexandre Duret-Lutz
3f9f6029e7 reduce_parity: fix to work on automata with deleted edges
* spot/twaalgos/parity.cc (reduce_parity): Use the
size of the edge vector to initialize piprime1 and piprime2,
not the number of edges.
* tests/python/parity.py: Add test case, based on a report
by Yann Thierry-Mieg.
2022-02-14 09:13:36 +01:00
Alexandre Duret-Lutz
9b0a20412b dot: Add option @ to support aliases
Fixes #497.

* spot/twaalgos/dot.cc: Implement this option.
* tests/core/ltl2tgba.test, tests/core/randaut.test: @ is
now a valid option for --dot, use something else.
* tests/python/aliases.ipynb: New file.
* tests/Makefile.am, doc/org/tut.org: Add it.
* doc/org/hoa.org: Mention aliases.
* NEWS: Mention this new feature.
2022-02-04 14:35:46 +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
480289867f sccinfo: fix accepting run computation
* spot/twaalgos/sccinfo.cc (scc_info::get_accepting_run): Ignore edges
whose colors are not part of the colors gathered in the SCC up to
deciding acceptance.
* tests/python/genem.py: New test case, reported by Clément Tamines.
* THANKS: Add him.
* NEWS: Mention the bug.
2022-01-14 20:29:10 +01:00
Alexandre Duret-Lutz
da681e6b4d dot: improve output to work around GraphViz bug
The related GraphViz issue is
https://gitlab.com/graphviz/graphviz/-/issues/2179

* spot/twaalgos/dot.cc: Avoid initial newline in title.
* NEWS: Mention the bug.
* tests/core/det.test, tests/core/dstar.test,
tests/core/neverclaimread.test, tests/python/automata-io.ipynb: Adjust
test cases.
2022-01-14 20:29:10 +01:00