Commit graph

539 commits

Author SHA1 Message Date
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
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
dddc7920e4 Add several options to CAR
* spot/twa/acc.hh: Remove useless comment.
* spot/twaalgos/car.cc: Rewrite the implementation to try
  multiple algorithms and choose the best, add the possibility
  to force the order of the colors/pairs in LAR and use
  propagate_marks_here.
* spot/twaalgos/car.hh, tests/python/car.py: Create a new system of
  options for CAR.
* spot/twaalgos/degen.cc, spot/twaalgos/degen.hh: Add the possibility
  to forbid some marks in is_partially_degeneralizable.
2020-03-24 15:41:02 +01:00
Alexandre Duret-Lutz
b5d688dc97 stutter: fix sl, sl2 to never accept on added self-loop
Fixes #401, reported by Victor Khomenko.

* spot/twaalgos/stutter.cc (sl, sl2): If {} is accepting, upgrade the
acceptance condition.
* tests/core/stutter-tgba.test, tests/python/stutter.py: Add test cases.
2020-03-12 21:54:13 +01:00
Alexandre Duret-Lutz
d8a0f307eb product: fix handling of operand with false acceptance
* NEWS: Mention the issue.
* spot/twaalgos/product.cc: Fix it.
* tests/python/prodexpt.py: Test it.
2020-03-08 09:15:06 +01:00
Alexandre Duret-Lutz
7f0ef7ad59 genem: improve the worst case
* spot/twaalgos/genem.cc, spot/twaalgos/genem.hh: Improve the worst
case by not recurring twice into each disjunct individually.  Keep
the previous two implementation available and add a function
generic_emptiness_check_select_version() so we can benchmark the
difference.
* tests/python/genem.py: Test the three versions.
2020-03-06 12:38:20 +01:00
Florian Renkin
6f3208a783 CAR: Correct the value of the max color of the acceptance condition
* spot/twaalgos/car.cc: Update the max_color in apply_to_Buchi.
* tests/python/car.py: Add some tests that showed this issue.
2020-02-26 15:40:52 +01:00
Florian Renkin
a62241376f Add mores cases in car.py
* tests/python/car.py: Add more combinaisons of options
when testing CAR.
2020-02-26 15:40:52 +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
8a4a4b9fff simplify_acceptance: fix erroneous simplification
Reported by Florian Renkin.

* spot/twaalgos/cleanacc.cc: Do not rewrite
...Fin(0)&(Fin(1)|(Fin(3)&Inf(4)))... as Fin(0)&f when it appears that
{1,3} cannot receive {0}, because {1} is used elsewhere in the
acceptance.
* tests/python/simplacc.py: Add test case.
2020-02-24 12:17:07 +01:00
Alexandre Duret-Lutz
5afa528df0 pdegen: fix another original-states related issue
* spot/twaalgos/degen.cc (keep_bottommost_copies): Fix intialisation
of bottommost_occurence.
* tests/python/pdegen.py: Add test case sent by Florian Renkin.
2020-02-16 20:02:48 +01:00
Alexandre Duret-Lutz
10f40041b1 pdegen: fix the place with original-states are composed
doing it too early breaks the "redirect all-accepting transitions"
optimization

* spot/twaalgos/degen.cc: move the original-states composition
code.
* tests/python/pdegen.py: Add test-case from Florian Renkin.
2020-02-16 16:38:31 +01:00
Alexandre Duret-Lutz
b5e464e05a autfilt add support for --partial-degeneralize
* bin/autfilt.cc: Add a --partial-degeneralize option.
* NEWS: Mention it.
* spot/twaalgos/degen.cc: Do not restrict partial_degeneralize() to
deterministic automata.
* spot/twaalgos/degen.hh: Adjust documentation.
* tests/core/pdegen.test: New test case.
* tests/Makefile.am: Add it.
* tests/python/pdegen.py: Adjust.
2020-02-15 10:31:28 +01:00
Alexandre Duret-Lutz
dd8c00fff0 partial_degeneralize: force purge_unreachable in some corner case
* spot/twaalgos/degen.cc: If an all-accepting transition has been
redirected, we need to force purge_unreachable_state() to be called,
otherwise we may have unreachable states.
* tests/python/pdegen.py: Add test case.
2020-02-10 14:08:05 +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
71f1f2fb96 partial_degeneralize: handle original-state correctly
Reported by Florian Renkin

* spot/twaalgos/degen.cc (partial_degeneralize): Update
original-state when partial_degeneralize is executed more
than once in a loop.
* tests/python/pdegen.py: Add test case.
2020-02-07 12:27:53 +01:00
Alexandre Duret-Lutz
febbe5c2e3 rabin_to_buchi_if_realizable: new function
* spot/twaalgos/remfin.cc, spot/twaalgos/remfin.hh: Implement it.
* tests/python/tra2tba.py: Test it.
* NEWS: Mention it.
2020-02-05 17:44:45 +01:00
Alexandre Duret-Lutz
bf4a0ccffd partial_degeneralize: add a version that takes no "todegen" argument
* spot/twaalgos/degen.cc,
spot/twaalgos/degen.hh (is_partially_degeneralizable): New function.
(partial_degeneralize): New version without todegen argument.
* tests/python/pdegen.py: Add test cases.
2020-02-04 17:31:12 +01:00
Alexandre Duret-Lutz
8df616ee0d partial_degeneralization: generalize to terms that contain todegen
* spot/twaalgos/degen.cc: Implement this.
* tests/python/pdegen.py: Add tests.
2020-02-04 13:47:44 +01:00
Alexandre Duret-Lutz
b733d486be fix degeneralize_tba after accepting transition
* spot/twaalgos/degen.cc (degeneralize_tba): Here.
* tests/python/pdegen.py, tests/python/simstate.py: Adjust expected
values.
* NEWS: Mention the bug.
2020-02-03 15:38:51 +01:00
Alexandre Duret-Lutz
f9e75de647 partial_degeneralize: a support for disjunction of Fin
* spot/twaalgos/degen.cc, spot/twaalgos/degen.hh: Implement this.
Also throw a runtime error in case were todegen does not match any
subformula.
* tests/python/pdegen.py: Add tests.
2020-02-03 11:08:20 +01:00
Alexandre Duret-Lutz
f1008c156b improve partial_degeneralize() on several cases
On these 4 cases, added to pdegen.py, and supplied by Florian Renkin,
partial_degeneralize() is now at least as good as degeneralize_tba(),
and sometimes better.  This is achieved as follows: (1) a
propagate_marks procedure is introduced to propagate marks as far as
possible on the automaton (e.g., common outgoing marks can be push
onto the incoming transitions and vice-versa), (2) the
degeneralization order is compute dynamically, and (3) whenever and
fully-accepting transition is taken in the original automaton, the
destination level is chosen to be the highest existing level.

* spot/twaalgos/degen.cc,
spot/twaalgos/degen.hh (propagate_marks_vector, propagate_marks_here):
New functions.
(partial_degeneralize): Improve, as described above.
* tests/python/pdegen.py: Add test cases.
2020-02-03 09:52:54 +01:00
Alexandre Duret-Lutz
50c0f880dc Inf(i)|Inf(j) -> Inf(k) and Fin(i)&Fin(j) -> Fin(k)
Implement those rules in simplify_acceptance_here().

* NEWS: Mention the change.
* spot/twa/acc.cc,
spot/twa/acc.hh (acc_cond::acc_code::used_once_sets): New method.
* spot/twaalgos/cleanacc.cc, spot/twaalgos/cleanacc.hh:
Implement the above rule.
* tests/core/remfin.test: Adjust expected results.
* tests/python/simplacc.py: New file.
* tests/Makefile.am: Add it.
2020-01-28 09:37:28 +01:00
Alexandre Duret-Lutz
5dc6da0b20 ipnbdoctest: attempt to restart when the kernel dies
* tests/python/ipnbdoctest.py: Catch kernel deaths, wait a random
number of seconds, and try again up to three times.
2020-01-04 18:05:45 +01:00
Alexandre Duret-Lutz
5e6de9dad4 ipnbdoctest: attempt to deal with buildfarm timeouts
* tests/python/ipnbdoctest.py: Use shorter timeouts, and flush the
shell messages without expecting them.
2020-01-03 15:22:05 +01:00
Alexandre Duret-Lutz
bf7ccfe7e6 new partial_degeneralize() algorithm
* spot/twaalgos/degen.hh, spot/twaalgos/degen.cc: Implement it.
* tests/python/pdegen.py: New file.
* tests/Makefile.am: Add it.
* NEWS: Mention the new function.
2019-12-11 17:09:55 +01:00
Alexandre Duret-Lutz
935c412df0 remfin: simplify tra_to_tba using generic emptiness check
* spot/twaalgos/remfin.cc (tra_to_tba): Remove the SCC-emptiness
check that was done by creating a temporary automaton.  Use the
scc_info::check_scc_emptiness() function instead.
* spot/twaalgos/sccinfo.cc,
spot/twaalgos/sccinfo.hh (scc_info::check_scc_emptiness): Mark
this function as const.
(scc_and_mark_filter): Make sure we only combine with a lower filter
of the same type.
* spot/twaalgos/genem.cc: Remove one stray debugging statement.
* tests/python/genem.py: Remove a duplicate test.
2019-12-07 12:51:59 +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
cc9659bca0 acc: improve diagnostics for algorithms that use too many colors
* spot/twa/acc.hh (acc_cond::mark_t): Diagnose mark_t with set numbers
that are too larges.
* tests/python/except.py: Adjust.
* tests/core/acc.cc: Remove most of asserts, as those can be disabled,
and adjust expected exception.
2019-10-18 17:01:07 +02:00