Commit graph

368 commits

Author SHA1 Message Date
Alexandre Duret-Lutz
fca6513604 simulation: fix merging transiant SCCs
This fixes #452, and also fix a bug related to transiant SCCs
incorrectly merged in cosimulation: the source of the edges was
updated without fixing the chaining of the edges.

* spot/twaalgos/simulation.cc: Fix all the above.
* tests/python/simstate.py: Add test case from issue #452.
* tests/core/det.test, tests/core/ltlsynt.test,
tests/core/satmin.test: Lower expected sizes.
* tests/python/decompose.ipynb: Adjust for changed order.
2021-04-19 23:38:50 +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
2a38328a5c replace bdd_satoneset(x,y,bddtrue) loops by minterms_of(x,y)
Because the loops iterate in the opposite order, multiple
test cases need to be adjusted.

* spot/taalgos/tgba2ta.cc, spot/twaalgos/alternation.cc,
spot/twaalgos/dualize.cc, spot/twaalgos/ltl2tgba_fm.cc,
spot/twaalgos/simulation.cc, spot/twaalgos/stutter.cc,
spot/twaalgos/toweak.cc: Replace loops based on
bdd_satonest(x,y,bddtrue) by loops based on minterms_of(x,y).
* tests/core/degenscc.test, tests/core/dualize.test,
tests/core/genltl.test, tests/core/readsave.test,
tests/python/alternation.ipynb, tests/python/automata.ipynb,
tests/python/decompose.ipynb, tests/python/decompose_scc.py,
tests/python/dualize.py, tests/python/sccinfo.py,
tests/python/simstate.py, tests/python/testingaut.ipynb,
tests/python/word.ipynb: Adjust expected test cases.  The
only regression is in genltl.test, but the worsened case
should eventually be fixed as discussed in issue #425 anyway.
2021-04-14 17:31:45 +02:00
Jerome Dubois
fb066ada0a simulation: Add simulation based reduction
* spot/twaalgos/simulation.hh, spot/twaalgos/simulation.cc: Add
  reduce_direct_sim(), reduce_direct_cosim() and
  reduce_direct_iterated() wich reduce an automaton using simulation.
  This functions wrap the class direct_sim wich compute simulation
  with a new method.
* doc/spot.bib: Add ref.
* tests/python/simstate.py: Add tests for the new simulation.
2021-03-29 11:25:56 +02:00
Alexandre Duret-Lutz
93d8f43285 translate: speed up some -G -D cases
When gf-guarentee works and produce a deterministic automaton, use it
right away without comparing it with the automaton produced by the
regular translation.  This used to be the case for all -D scenarios
except -G -D.

Reported by Florian Renkin.

* spot/twaalgos/translate.cc: Use the result of
gf_guarantee_to_ba_maybe() or fg_safety_to_dca_maybe() whenever -D is
used.
* spot/twaalgos/postproc.cc: Call remove_unused_ap() in finalize(), to
iron out some slight output differences.
* tests/core/ltl2tgba2.test, tests/python/toparity.py: Lower expected
results in the test cases.
* tests/python/automata.ipynb, tests/core/prodor.test: Adjust to new
order.
2021-01-27 13:26:49 +01:00
Alexandre Duret-Lutz
2072151499 twa_graph: swap the two passes of merge_edges()
This improves the determinism in a few cases.

* spot/twa/twagraph.cc (merge_edges): Encapsulate the two
passes into lambdas so that they are very easy to swap.
* spot/twa/twagraph.hh (merge_edges): Adjust documentation.
* tests/python/mergedge.py: Add test case.
* tests/core/alternating.test, tests/python/alternation.ipynb:
Determinism was improved.
* tests/core/parity2.test, tests/core/readsave.test,
tests/core/sbacc.test, tests/python/_product_susp.ipynb,
tests/python/atva16-fig2a.ipynb, tests/python/decompose.ipynb,
tests/python/highlighting.ipynb, tests/python/satmin.ipynb,
tests/python/simstate.py: Adjust expected order of edges.
* NEWS: Mention the change.
2021-01-20 00:16:12 +01:00
Alexandre Duret-Lutz
44c074bbad python: fix incorrect assertions on temporary objects
* tests/python/stutter.py: Do not call acc() on a temporary
object, and fix the last two asserts.
2021-01-17 20:48:56 +01:00
Alexandre Duret-Lutz
a8ee291abe * tests/python/ipnbdoctest.py: Work around failures on Fedora. 2021-01-16 16:33:30 +01:00
Alexandre Duret-Lutz
7e2f091839 determinize: do not copy the "incomplete" property
Mentioned in issue #298.

* spot/twaalgos/determinize.cc: Do not copy prop_complete of
the input if it is false.
* tests/python/298.py: Test it.
* NEWS: Mention the bug.
2020-12-15 10:47:25 +01:00
Alexandre Duret-Lutz
f6be083050 determinize: don't emit colors for temporary braces
Related to issue #298.

* spot/twaalgos/determinize.cc: Recognize braces that are temporary
to avoid emitting colors when they become empty.
* tests/python/298.py: New file, showing a reduction of colors.
* tests/Makefile.am: Add it.
* tests/core/ltlsynt.test: Adjust expected output (now smaller).
* tests/core/genltl.test: Adjust one expected output (now larger).
* NEWS: Mention the issue.
2020-12-15 07:58:42 +01:00
Alexandre Duret-Lutz
9a17f5676c game: rewrite, document, and rename solve_reachability_game
* spot/twaalgos/game.hh, spot/twaalgos/game.cc: Rename
solve_reachability_game() as solve_safety_game(), rewrite it (the old
implementation incorrectly marked dead states as winning for their
owner).
* tests/python/paritygame.ipynb: Rename as...
* tests/python/games.ipynb: ... this, and illustrate
solve_safety_game().
* tests/Makefile.am, NEWS, doc/org/tut.org: Adjust.
* tests/python/except.py: Add more tests.
2020-12-10 15:04:07 +01:00
Alexandre Duret-Lutz
fb224d3f63 twagraph: fix merge_edges() ignoring the first edge
This fixes #441, reported by Jérôme Dubois.

* tests/python/mergedge.py: New file.
* tests/Makefile.am: Add it.
* spot/twa/twagraph.cc (merge_edges): Fix initialization of second
loop.
* NEWS: Mention the bug.
2020-11-24 16:08:21 +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
392c1a0ec3 game: fix handling of useless SCCs
This is a bug I introduced while merging Philipp's patch.

* spot/misc/game.cc (parity_game::solve): Set the strategy for player
0 in useless SCCs.
(parity_game::fix_scc): Do not use sub_game_ to detect edges exiting
the SCC.
* tests/python/game.py: New file.
* tests/Makefile.am: Add it.
2020-09-24 12:18:14 +02:00
philipp
133896d584 game: reimplement parity game solving
* spot/misc/game.cc, spot/misc/game.hh: More efficient implementation
of Zielonka's algorithm to solve parity games.  Now supports SCC
decomposition and efficient handling of certain special cases.
* doc/org/concepts.org: Document "strategy" and "state-winner"
properties.
* bin/ltlsynt.cc, tests/python/paritygame.ipynb: Adjust.
* tests/core/ltlsynt.test: Add more tests.
2020-09-22 23:15:30 +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
Alexandre Duret-Lutz
69c821154c postproc: add simul-max and wdba-det-max options
* NEWS, bin/spot-x.cc: Document them.
* spot/twaalgos/postproc.cc, spot/twaalgos/postproc.hh: Implement
them.
* tests/python/stutter-inv.ipynb: Adjust result.
* tests/core/minusx.test: Add test case.
2020-09-16 20:40:16 +02:00
Jerome Dubois
229be9a5db python: add check for panda
* tests/python/ipnbdoctest.py: Skip test if panda is not installed.
2020-09-16 10:22:39 +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
a375089e52 simplify_acceptance: generalize the complementary mark rewriting
Fixes #403.

* spot/twaalgos/cleanacc.cc (simplify_complementary_marks_here):
Assume that two colors are complementary in a broad sense, i.e., on is
present if (but not only if) the other is missing before applying
those rewritings.  Technically, this is usually not necessary, because
the changes done in #418 will cause such "covering-the-full-automaton"
pair of colors to be disjoint so complementary in a strict sense.  It
might make a difference (this is not tested) in presence of reused
colors which #418 cannot remove.  In any case, it's simply less code
to implement the broad sense.
* tests/python/toparity.py: Add test case from #403, which is
reduced to two states with recent optimizations.
2020-07-29 15:01:55 +02:00
Alexandre Duret-Lutz
0c4b701630 improve acceptance simplifications using useless colors
This fixes issue #418.

* spot/twa/acc.cc,
spot/twa/acc.hh (acc_cond::acc_code::useless_colors_patterns): New
method to detect patterns of colors allowing other colors to be added
or removed at will.
* spot/twaalgos/cleanacc.cc (simplify_acceptance_here): Use the above
patterns to remove some useless colors from transitions and hope that
this can help simplify the acceptance condition.
* spot/twaalgos/degen.cc (propagate_marks_vector): Use the pattern to
add more colors.
* tests/core/ltl2tgba2.test: Add the test case from issue #418.
* tests/core/ltl2dstar4.test, tests/core/satmin3.test,
tests/core/sccdot.test, tests/core/sim3.test,
tests/python/automata.ipynb, tests/python/decompose.ipynb,
tests/python/merge.py, tests/python/pdegen.py, tests/python/remfin.py,
tests/python/toparity.py, tests/python/tra2tba.py: Adjust all test
cases.
* NEWS: Mention this new feature.
2020-07-28 22:26:28 +02:00
Alexandre Duret-Lutz
3220da6605 tra_to_tba: finish 05e6e0885
* spot/twaalgos/remfin.cc: Actually use propmarks.
* tests/core/det.test, tests/core/remfin.test,
tests/python/automata.ipynb, tests/python/remfin.py,
tests/python/tra2tba.py: Adjust test cases.
2020-07-27 14:43:27 +02:00
Alexandre Duret-Lutz
ff3a3f8144 * tests/python/ipnbdoctest.py: Ignore matplotlib font cache messages. 2020-07-27 14:43:27 +02:00
Florian Renkin
5ec9d55fea simplify_acceptance: Use color inclusions to simplify a condition
This fixes #406.

* spot/twaalgos/cleanacc.cc: Add the simplification.
* tests/core/remfin.test, tests/python/automata.ipynb,
tests/python/remfin.py: Update tests.
* tests/python/simplacc.py: Update and add tests.
2020-07-25 19:15:17 +02:00
Alexandre Duret-Lutz
05e6e08859 tra_to_tba: remove more useless edges
* spot/twaalgos/remfin.cc (tra_to_tba): Implement the same
optimization has in the generic remove_fin transformation.
* tests/python/tra2tba.py: Adjust.
2020-07-24 16:32:00 +02:00
Alexandre Duret-Lutz
7fbf4e0e3c remove_fin: ignore more useless transitions
Do not clone transitions that are necessarily part of on accepting
cycle in the main copy of the automaton.

* spot/twaalgos/remfin.cc: Use propagate_marks_vector to ignore more
edges.
* tests/core/remfin.test, tests/python/remfin.py,
tests/python/automata.ipynb: Adjust.
* tests/sanity/style.test: Do not choke on C++17 if statements with
initializer.
2020-07-24 15:38:42 +02:00
Alexandre Duret-Lutz
b17376879d translate: add a quick syntactic simplification before relabeling
This fixes #412.

* spot/twaalgos/translate.cc: Add the quick syntactic simplification.
* spot/twaalgos/relabel.cc: Do not register old unused APs.
* tests/core/ltl2tgba2.test: Add test case.
* tests/core/bdd.test, tests/python/automata.ipynb: Adjust.
* NEWS: Mention this.
2020-07-22 17:02:47 +02:00
Alexandre Duret-Lutz
1c5468a93a simplify: fix handling of keep_top_xor
Under that option, !(a ^ b) was converted
to (!a <=> !b) instead of simply (a <=> b).

* spot/tl/simplify.cc (equiv_or_xor): Improve
rewriting.
* tests/core/ltl2tgba2.test, tests/python/simstate.py: Adjust test
cases.
2020-07-22 17:02:22 +02:00
Alexandre Duret-Lutz
918548a03d run: fix reduce on automata with Fin
Reported by Florian Renkin.

* spot/twaalgos/emptiness.cc (reduce): If the automaton uses Fin
acceptance, check the reduced cycle and revert to the original cycle
if necessary.
* tests/python/intrun.py: New file.
* tests/Makefile.am: Add it.
* spot/twaalgos/emptiness.hh: Improve documentation.
2020-07-10 18:05:18 +02:00
Alexandre Duret-Lutz
6074202b9b remfin: do not clone transitions that are accepting in main
* spot/twaalgos/remfin.cc (default_strategy): Detect transitions
from the main copy that are completely accepting and that do not
need to be repeated in the clones.
* tests/python/remfin.py: Add a test case.
* tests/core/ltl2dstar4.test: Improve expected results.
* NEWS: Mention the change.
2020-05-23 11:56:16 +02:00
Alexandre Duret-Lutz
260a141b1c improve fuse_marks_here by detecting more patterns
This remove some restrictions that prevented fuse_marks_here from
simplifying certain patterns, as noted in the first comment of
issue #405.

* spot/twaalgos/cleanacc.cc (find_interm_rec, find_fusable): Remove
some unnecessary restrictions to singleton marks, and replace the hack
put one non-singleton mark at the beginning of the singleton list by a
sort.
* tests/python/simplacc.py: Add two test cases.
* tests/python/automata.ipynb, tests/core/remfin.test: Improve
expected results.
* NEWS: Mention the bug.
2020-05-22 20:53:57 +02:00
Alexandre Duret-Lutz
6bfa9793d6 translate: improve handling of Xor and Equiv at top-level for -G -D
* spot/tl/formula.hh: Add variant of formula::is that support 4
arguments.
* spot/tl/simplify.hh, spot/tl/simplify.cc: Add option keep_top_xor
to preserve Xor and Equiv at the top-level.
* spot/twaalgos/translate.cc: Adjust ltl-split to deal with Xor and
Equiv for the -D -G case.
* NEWS: Mention that.
* tests/core/ltl2tgba2.test: Add test case.
* tests/python/simstate.py: Adjust expected result.
2020-05-16 18:19:26 +02:00
Alexandre Duret-Lutz
3ab2dd17a7 product: add product_xor() and product_xnor()
* spot/twaalgos/product.cc, spot/twaalgos/product.hh: Add those
functions.
* tests/python/_product_weak.ipynb, tests/python/except.py: Test them.
* NEWS: Mention them.
2020-05-16 17:55:36 +02:00
Alexandre Duret-Lutz
a7051b32c8 dot: fix #393
* spot/twaalgos/dot.cc: Add support for option 'E', and default to
rectangle nodes for large labels.
* bin/common_aoutput.cc, NEWS: Document it.
* tests/core/alternating.test, tests/core/dstar.test,
tests/core/readsave.test, tests/core/sccdot.test,
tests/core/tgbagraph.test, tests/python/_product_weak.ipynb,
tests/python/alternation.ipynb, tests/python/atva16-fig2b.ipynb,
tests/python/automata.ipynb, tests/python/decompose.ipynb,
tests/python/gen.ipynb, tests/python/highlighting.ipynb,
tests/python/ltsmin-dve.ipynb, tests/python/ltsmin-pml.ipynb,
tests/python/parity.ipynb, tests/python/pdegen.py,
tests/python/satmin.ipynb, tests/python/stutter-inv.ipynb: Adjust all
test cases.
2020-04-29 21:14:36 +02:00
Alexandre Duret-Lutz
3ea63e9a75 dot: fix #392
* spot/twaalgos/dot.cc: Add tooltips to "..." states and edges.
* tests/core/readsave.test: Test this.
* tests/python/highlighting.ipynb: Adjust.
2020-04-29 12:28:17 +02:00
Alexandre Duret-Lutz
c0e1b3e52a cleanacc: keep acceptance order when removing complementary colors
* spot/twaalgos/cleanacc.cc (remove_compl_rec): Rewrite to preserve
the original order of the acceptance condition while rewriting it.
* tests/core/sccdot.test, tests/python/merge.py,
tests/python/simplacc.py, tests/python/toparity.py: Adjust test cases.
2020-04-18 23:02:11 +02:00
Alexandre Duret-Lutz
fd0d752bc3 to_parity: only call reduce_parity() when prefix_parity is enabled
Calling reduce_parity() in to_parity() is confusing, because then
running to_parity() on one SCC does not necessarily produce the same
output as running to_parity() on the entire automaton.  However it is
necessary for the implementation of parity_prefix.  As a compromise,
disable reduce_parity() when parity_prefix is disabled, this way we
can use that to demonstrate how the algorithm works.

* spot/twaalgos/toparity.hh, spot/twaalgos/toparity.cc: Do not
call reduce_parity() when parity_prefix is disabled.
* tests/python/toparity.py: Adjust.
2020-04-17 22:04:32 +02:00
Alexandre Duret-Lutz
102ef04364 simplify_acc: loop over the simplifications
* spot/twaalgos/cleanacc.cc (simplify_acceptance_here): Run the
simplifications in a loop until the condition does not change anymore.
* tests/python/simplacc.py, tests/core/accsimpl.test,
tests/core/remfin.test, tests/python/merge.py,
tests/python/simplacc.py, tests/python/toparity.py: Update expected
results.
* tests/python/automata.ipynb: Update the failing example to a more
interesting one, matching the one in doc/org/autfilt.org.
2020-04-17 21:54:12 +02:00
Alexandre Duret-Lutz
b62e1bb13c simplify_acc: fix an infinite loop
* spot/twaalgos/cleanacc.cc (fuse_mark_here): Fix incorrect cancelling
of n-ary subterms, causing an invalid acceptance condition, and then
an infinite loop.
* tests/python/simplacc.py: Add test case.
2020-04-17 21:42:53 +02:00
Florian Renkin
68012e6a85 to_parity: Correct the expected number of states
* tests/python/toparity.py: here.
2020-04-17 16:47:02 +02:00
Florian Renkin
527b62c5ff to_parity: Remove merge_states
* spot/twaalgos/toparity.cc: Remove merge_states.
* tests/python/automata.ipynb, tests/python/toparity.py: Update tests.
2020-04-17 14:59:42 +02:00
Florian Renkin
8c48003943 to_parity: Use merge_states
* spot/twaalgos/toparity.cc: Use merge_states at the end
of to_parity.
* tests/python/toparity.py: Update tests.
2020-04-16 22:10:40 +02:00
Alexandre Duret-Lutz
875846f51f toparity: false transitions are not a problem anymore
* spot/twaalgos/toparity.cc: Do not remove false transitions.
* tests/python/toparity.py: Add a test case with false transitions.
2020-04-16 21:12:30 +02:00
Florian Renkin
0ba1097636 to_parity: Improve to_parity and update tests
* spot/twaalgos/toparity.cc: Use a better search of the
transitions when we search compatible states.
* spot/twaalgos/toparity.hh: Use less that 80 columns.
* tests/python/merge.py, tests/python/toparity.py: Update tests.
2020-04-12 19:44:58 +02:00
Florian Renkin
630b8333fe Impove simplify_acceptance
* spot/twaalgos/cleanacc.cc: Use cleanup_acceptance if
propagate_fin_inf was useful.
* spot/twa/acc.hh: Avoid to reverse the order of the condition in
propagate_fin_inf.
* tests/core/accsimpl.test, tests/core/remfin.test,
tests/python/merge.py, tests/python/automata.ipynb: Update tests.
* tests/python/toparity.py: Update tests and add tests to check the
number of states.
2020-04-12 18:31:28 +02:00
Alexandre Duret-Lutz
0b25820211 ignore false edges in emptiness checks and scc_info
Based on reports by Florian Renkin and Jens Kreber.

* spot/twaalgos/bfssteps.cc, spot/twaalgos/couvreurnew.cc,
spot/twaalgos/gtec/gtec.cc, spot/twaalgos/gv04.cc,
spot/twaalgos/magic.cc, spot/twaalgos/sccinfo.cc
spot/twaalgos/se05.cc, spot/twaalgos/tau03.cc: Ignore bddfalse edges.
* spot/twaalgos/gtec/gtec.hh: Remove debugging function.
* tests/core/neverclaimread.test: Adjust.
* tests/python/ecfalse.py: New test file.
* tests/Makefile.am: Add it.
* NEWS: Mention the bug.
2020-04-11 11:24:55 +02:00
Alexandre Duret-Lutz
2b918d1c02 toparity: rename iar_old()/iar_maybe_old() to iar()/iar_maybe()
* spot/twaalgos/toparity.hh, spot/twaalgos/toparity.cc: Use the
original names, to minimize differences with spot 2.8.  Deprecate
them.
* tests/python/except.py: Adjust.
* NEWS: Mention the change.
2020-04-05 14:12:40 +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