Commit graph

159 commits

Author SHA1 Message Date
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
Alexandre Duret-Lutz
1cb92f8da1 work around another swig4 change
* python/spot/impl.i: Make sure spot::acc_cond::mark_t::operator<<
exceptions are not ignored.
2019-06-01 22:27:06 +02:00
Alexandre Duret-Lutz
52e2d11330 work around swig4 regression
* python/Makefile.am: Here.
2019-06-01 20:30:32 +02:00
Alexandre Duret-Lutz
72d6527b6c work around new import statements generated by swig-4.0
Those statements are not compatible with the fact that
libtool-generated modules are in .libs/ until they get installed.

* python/spot/__init__.py: Add sys.path to __path__ if SPOT_BUILD is
  set.
* tests/run.in: Set SPOT_BUILD.
2019-05-31 21:16:45 +02:00
Alexandre Duret-Lutz
377285b1d6 python: remove the -nofastproxy option
This was introduced by b893b5597 to work around some IPython 2 issue
(https://github.com/ipython/ipython/issues/7003).

* python/Makefile.am (SWIGFLAGS): Remove obsolete option.
* python/spot/__init__.py: Adjust.
2019-05-29 10:21:34 +02:00
Alexandre Duret-Lutz
0623965b43 genem: improve handling of co-Büchi
* spot/twaalgos/sccinfo.cc, spot/twaalgos/sccinfo.hh: Make sure
scc_and_mark_filter does not install a filter if there is nothing
to filter.
* tests/python/genem.py, spot/twaalgos/genem.cc,
python/spot/impl.i: Adjust.
2019-04-12 23:14:29 +02:00
Alexandre Duret-Lutz
2178684528 sccinfo: rename scc_info(x,opt) into scc_info_with_options(x,opt)
* spot/twaalgos/sccinfo.hh, python/spot/impl.i: Here.  This avoid
ambiguities where options (integer in Python) are interpreted as
initial states.
* tests/python/genem.py: Adjust.
2019-04-11 18:06:00 +02:00
Alexandre Duret-Lutz
55db24e00e scc_info: introduce scc_and_mark_filter
* spot/twaalgos/sccinfo.hh, spot/twaalgos/sccinfo.cc: Here.
* spot/twaalgos/genem.cc: Use it.
* python/spot/impl.i, python/spot/__init__.py: Add bindings.
* tests/python/genem.py: Test it.
* NEWS: Mention it.
2019-03-30 12:09:32 +01:00
Alexandre Duret-Lutz
0d9c81a6d9 acc: extend top_disjuncts and top_conjuncts to acc_cond as well
* spot/twa/acc.hh, spot/twa/acc.cc: Implement the new methods.
* python/spot/impl.i: Add bindings for vectors of acc_cond.
* tests/python/acc_cond.ipynb: Test the two methods.
* NEWS: Adjust.
2019-03-29 11:41:52 +01:00
Alexandre Duret-Lutz
510a18b156 acc: introduce top_conjuncts() and top_disjuncts()
* spot/twa/acc.cc, spot/twa/acc.hh: Add the new functions.
* python/spot/impl.i: Add bindings.
* tests/python/acc_cond.ipynb: Add tests.
* NEWS: Mention it.
2019-03-22 13:50:05 +01:00
Alexandre Duret-Lutz
eb02db85da python: improve kripke_graph bindings
Related to issue #376.

* spot/kripke/kripkegraph.hh: Avoid indirect type definitions for the
benefit of Swig.
* python/spot/impl.i: Add bindings for iterators over kripke_graph
states and edges.
* tests/python/kripke.py: New file.
* tests/Makefile.am: Add it.
* NEWS: Update.
2019-02-21 22:02:31 +01:00
Alexandre Duret-Lutz
f26dd904ff python: better support for explicit Kripke
Part of issue #376, reported by Hashim Ali.

* python/spot/impl.i: Add bindings for kripke_graph.
* python/spot/__init__.py (automaton): Add a want_kripke option.
* spot/kripke/kripkegraph.hh: Honnor the "state-names" property
when displaying states.
* spot/twaalgos/hoa.cc: Preserve names of Kripke states.
* tests/python/ltsmin-dve.ipynb: Illustrate all the above.
* NEWS: Mention those changes.
* THANKS: Add Hashim.
2019-02-13 17:47:53 +01:00
Alexandre Duret-Lutz
188d210521 python: suggest installing GraphViz when dot is not found
This fixes an issue mentioned in #375.

* python/spot/aux.py (str_to_svg): Catch a missing 'dot' and instruct
the user to install GraphViz.
* THANKS: Add reporter.
2019-01-25 23:16:46 +01:00
Alexandre Duret-Lutz
3908cc1bca python: improve bdd_dict bindings
Fixes #372.

* python/spot/impl.i: Refactor the handling of exceptions using a
Lippincott function.  Map out_of_range to IndexError.  Add
PyObject* version for bdd_dict's register and unregister functions
so we can use Python objects as well.
* tests/python/bdddict.py: New file.
* tests/Makefile.am: Add it.
* NEWS: Mention the changes.
2019-01-14 16:42:30 +01:00
Alexandre Duret-Lutz
fd32ab5dd7 fix is_generalized_rabin and is_generalized_streett
* spot/twa/acc.cc: Recoginize the single-pair case.
* python/spot/impl.i: Return the vector instead of taking it
by reference.
* tests/python/setacc.py: Add test cases.
* NEWS: Mention those changes.
2018-11-08 11:35:15 +01:00
Alexandre Duret-Lutz
60296317c7 python: more conventional __repr__ for several types
* NEWS: Mention the change.
* python/spot/__init__.py: Add _repr_latex_ for twa_word, and
remove __repr__ and __str__ for atomic_prop_set.
* python/spot/impl.i: Implement __repr__ and __str__ for
atomic_prop_set.  Fix __repr__ for trival, acc_code, acc_cond,
mark_t.  Remove __repr__ for twa_run and twa_word.
* tests/python/acc_cond.ipynb, tests/python/accparse.ipynb,
tests/python/atva16-fig2a.ipynb, tests/python/automata.ipynb,
tests/python/bdditer.py, tests/python/contains.ipynb,
tests/python/gen.ipynb, tests/python/highlighting.ipynb,
tests/python/ltlsimple.py, tests/python/ltsmin-dve.ipynb,
tests/python/product.ipynb, tests/python/relabel.py,
tests/python/satmin.ipynb tests/python/stutter-inv.ipynb,
tests/python/word.ipynb: Adjust test cases.
* tests/python/formulas.ipynb: Add test for atomic_prop_set.
2018-11-03 07:53:26 +01:00
Alexandre Duret-Lutz
c3b7a691e4 python: add __repr__ for rs_pair
* spot/twa/acc.hh: Hide default constructors, so that we can have
keyword arguments on the main constructor.
* python/spot/impl.i: Add __repr__.
* tests/python/setacc.py: Test it.
2018-11-02 11:10:11 +01:00
Alexandre Duret-Lutz
5bb9c87d4c python: fix return of is_rabin_like() and is_streett_like()
* python/spot/impl.i: Fix instantiation of vector_rs_pairs.
* tests/python/setacc.py: Add test cases.
* NEWS: Mention the bugs.
2018-10-31 19:44:19 +01:00
Alexandre Duret-Lutz
266581b272 python: fix binding of used_inf_fin_sets()
* python/spot/impl.i: Here.
* tests/python/setacc.py: Test it.
* NEWS: Mention the bug.
2018-10-31 15:48:39 +01:00
Alexandre Duret-Lutz
e0958ee7c6 python: add xargs support to translate() and postprocess()
Fixes #361.

* python/spot/__init__.py: Implement it.
* tests/python/optionmap.py: Test it.
* NEWS: Mention it.
2018-10-17 18:16:46 +02:00
Alexandre Duret-Lutz
2c3852597a remove more references to the old cgi-based translator
* debian/source/lintian-overrides, python/.gitignore: Here
2018-08-28 20:48:44 +02:00
Alexandre Duret-Lutz
d147ad2510 Adjust to Automake 1.16
* python/Makefile.am: Adjust for Automake 1.16.
2018-08-11 17:33:53 +02:00
Alexandre Duret-Lutz
03d9b0c2bb get rid of the Python-based CGI translator
We now have a separate project for its replacement at
https://gitlab.lrde.epita.fr/spot/spot-web-app/

* python/ajax/: Remove directory.
* python/Makefile.am, configure.ac, README: Adjust.
* NEWS: Mention this.
2018-08-11 17:33:53 +02:00
Alexandre Duret-Lutz
8a26744720 fix python bindings for spot::parsed_formula::f getter
* python/spot/impl.i: Add a typemap.
* tests/python/ltlsimple.py: Add a test case for an issue.
* NEWS: Mention the bug.
2018-08-02 23:05:22 +02:00
Alexandre Duret-Lutz
23722c031f contains: fix the semantics
spot::contains(a, b) should test a⊇b.  It was testing a⊆b instead.

* NEWS: Mention the bug.
* spot/twaalgos/contains.cc, spot/twaalgos/contains.hh: Fix the
code and documentation.
* tests/python/contains.ipynb: Adjust description and expected
results.
* python/spot/__init__.py: Also swap the argument of
language_containment_checker.contains()
* bin/autfilt.cc: Adjust usage.
2018-08-01 17:17:25 +02:00
Maximilien Colange
465536d1fe translate any automaton to a parity automaton
* spot/twaalgos/toparity.cc, spot/twaalgos/toparity.hh: implement it,
  based on last-appearance record (LAR)
* spot/twaalgos/Makefile.am: build it
* NEWS: document it
* python/spot/impl.i: add to python bindings
* tests/Makefile.am, tests/python/toparity.py: test it
2018-07-24 14:58:53 +02:00
Alexandre Duret-Lutz
d708174cfe genem: implement a generic emptiness check for twa_graph_ptr
* spot/twa/acc.cc, spot/twa/acc.hh (fin_unit, one_fin): New function.
* spot/twaalgos/genem.cc, spot/twaalgos/genem.hh: New files.
* spot/twaalgos/Makefile.am: Add it.
* tests/python/genem.py: New file.
* tests/Makefile.am: Add it.
* python/spot/impl.i: Add bindings for genem.hh.
* NEWS: Mention the new function.
2018-07-24 13:36:04 +02:00
Alexandre Duret-Lutz
46590af693 more documentation for twa_graph internals
* spot/graph/graph.hh, spot/twa/twagraph.hh, spot/twa/twagraph.cc:
Implement a dump_storage_as_dot() method.
* python/spot/__init__.py (twa_graph.show_storage): New method, above
dump_storage_as_dot().
* tests/python/twagraph-internals.ipynb: New file, with documentation
about the twa_graph internals, using show_storage() to illustrate
everything.
* tests/Makefile.am, doc/org/tut.org: Add it.
* python/spot/impl.i: Add bindings for out_iterasor, demonstrated in
the Python notebook.
* spot/twa/twa.hh: Add prop_reset().  Used in the notebook.
* NEWS: Mention the new notebook and function.
* doc/org/tut50.org: Link to the notebook.
* tests/python/ipnbdoctest.py: Adjust for twa_graph_ptr being
redefined in the spot namespace.
2018-07-12 15:23:23 +02:00
Alexandre Duret-Lutz
0411099506 trival: prefer a global operator== relying on implicit conversion
Hopefully fixes #359.

* spot/misc/trival.hh: Declare a global operator==(trival,trival) that
replace the specialized operator==(bool,trival), and the in class
trival::operator(trival), thanks to the implicit construction from
bool to trival.  Make the repr_t/value_t constructor explicit, are
those are mostly internal to the library and may cause conflicts.
* spot/twa/twa.hh: Adjust to construct trival explicitly.
* python/spot/impl.i: Since Swig/Python does not support global
comparison operators, implement a member version, supporting
only __eq__(trival,bool) as before.
* tests/python/setacc.py: Adjust erroneous code.
* tests/python/trival.py: Add test cases.
2018-07-04 16:00:00 +02:00
Alexandre Duret-Lutz
2402d721a9 modernize the logo
* doc/org/spot2.svg: New file.
* doc/Makefile.am: Distribute it.
* doc/org/.gitignore: Adjust.
* doc/org/setup.org: Display it.
* 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/ioltl.org, doc/org/ltl2tgba.org,
doc/org/ltl2tgta.org, doc/org/ltlcross.org, doc/org/ltldo.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/tools.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/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/upgrade2.org: Include setup.org instead of declaring it as
SETUPFILE.
* doc/org/spot.css: Add entries for the logo.
* python/ajax/trans.html: Use the new logo.
* python/ajax/logos/mail.png, python/ajax/logos/spot64s.png: Delete.
* python/ajax/Makefile.am: Adjust.
2018-06-27 16:18:15 +02:00
Alexandre Duret-Lutz
4532c0c13c python: install everythin into pyexecdir
Reported by Antoine Martin.

* python/Makefile.am: Here.
* NEWS: Mention the bug.
2018-06-22 14:55:16 +02:00
Alexandre Duret-Lutz
939f63eec9 genltl: add support for --sejk-f=n,m
Together with the previous patch, this Fixes #353.

Implementing this required to extend our interface two support
two-parameter patterns.

* spot/gen/formulas.cc, spot/gen/formulas.hh: Implement it.
* bin/genltl.cc: Add --sejk-f.
* bin/common_output.cc, bin/common_output.hh: Adjust to handle
"line numbers" that are not integers (e.g., "3,2"), since those
are used to display pattern parameters.
* bin/ltlfilt.cc: Adjust.
* python/spot/gen.i: Add support for two-parameters patterns.
* tests/core/genltl.test, tests/python/gen.ipynb: Augment.
* NEWS: Mention it.
2018-06-05 08:48:40 +02:00
Alexandre Duret-Lutz
fc0ed01a45 randomltl: avoid #define
As this pollutes the user's namespace.

* spot/tl/randomltl.hh: Use class-level enum and constexpr instead
of #define.
* spot/tl/randomltl.cc, python/spot/__init__.py, bin/randltl.cc,
tests/python/dualize.py, tests/python/sum.py: Adjust usage.
2018-05-16 18:35:36 +02:00
Alexandre Duret-Lutz
36b5b76ca5 python: improve formating of double-quoted AP in MathJax
* python/spot/impl.i: Move the rendering code...
* python/spot/__init__.py: ... here, and ajust it for MathJax.
* tests/python/formulas.ipynb, tests/python/ltsmin-dve.ipynb: Adjust
expected results.
2018-05-15 17:27:21 +02:00
Alexandre Duret-Lutz
6a808492c1 python: implicit str->formula conversion
* python/spot/impl.i, python/spot/__init__.py: Implement it.
* NEWS: Mention it.
* tests/python/atva16-fig2a.ipynb, tests/python/atva16-fig2b.ipynb,
tests/python/formulas.ipynb, tests/python/ltsmin-dve.ipynb,
tests/python/ltsmin-pml.ipynb, tests/python/stutter-inv.ipynb,
doc/org/tut02.org: Modernize.
2018-05-15 16:16:11 +02:00
Alexandre Duret-Lutz
9361bd9401 python: add a show= keyword to display_inline()
* python/spot/jupyter.py: Here.
* tests/python/alternation.ipynb: Use it.
* NEWS: Mention the above notebook as usage example.
2018-05-12 09:23:05 +02:00
Alexandre Duret-Lutz
d6f9618172 introduce containement checks functions
* spot/twaalgos/contains.hh, spot/twaalgos/contains.cc: New files.
* spot/twaalgos/Makefile.am, python/spot/impl.i: Add them.
* python/spot/__init__.py: Also attach these functions as methods,
and support string arguments.
* tests/python/contains.ipynb: New file.
* tests/Makefile.am, doc/org/tut.org: Add it.
* bin/autfilt.cc, tests/python/streett_totgba.py, tests/python/sum.py,
tests/python/toweak.py: Use the new function.
2018-05-04 17:18:49 +02:00
Alexandre Duret-Lutz
58d9a12495 python: introduce spot.jupyter.display_inline()
* python/spot/jupyter.py: New file.
* python/Makefile.am: Add it.
* tests/python/product.ipynb: Use it.
* NEWS: Mention it.
2018-05-04 15:27:51 +02:00
Alexandre Duret-Lutz
c2e177ee09 Merge branch 'master' into next 2018-04-20 08:06:33 +02:00
Alexandre Duret-Lutz
af6b09408a python: make sure spot.automata() terminates the command
Fixes #341.

* python/spot/__init__.py (automata): Rewrite and simplify using
the subprocess context manager.
* tests/python/341.py: New file.
* tests/Makefile.am: Add it.
* NEWS: Mention the issue.
2018-04-03 16:40:16 +02:00
Alexandre Duret-Lutz
cbfbf53617 python: make sure spot.automata() terminates the command
Fixes #341.

* python/spot/__init__.py (automata): Rewrite and simplify using
the subprocess context manager.
* tests/python/341.py: New file.
* tests/Makefile.am: Add it.
* NEWS: Mention the issue.
2018-04-03 15:12:58 +02:00
Alexandre Duret-Lutz
c766f58d5d sat_minimize: improve logs and document Python bindings
* spot/priv/satcommon.cc, spot/priv/satcommon.hh: Make it possible to
set the log file without setting the environment variable.  Adjust
print_log to take the input state and print it as a new column.
* spot/twaalgos/dtbasat.cc, spot/twaalgos/dtwasat.cc: Adjust all
calls to print_log.  Fix log output for incremental approaches.
Prefer purge_unreachable_states() over stats_reachable().  Do
not call scc_filter() on colored automata.
* spot/twaalgos/dtwasat.hh: Document the new "log" option.
* NEWS: Mention the changes.
* tests/python/satmin.ipynb: New file.
* tests/Makefile.am: Add it.
* doc/org/satmin.org, doc/org/tut.org: Link to it.
* doc/org/satmin.org, bin/man/spot-x.x: Adjust description
of CSV files.
* bench/dtgbasat/gen.py, bench/dtgbasat/tabl.pl,
bench/dtgbasat/tabl1.pl, bench/dtgbasat/tabl2.pl,
bench/dtgbasat/tabl3.pl, bench/dtgbasat/tabl4.pl: Adjust for
the new column.
* spot/misc/satsolver.cc, spot/misc/satsolver.hh (stats): Make it
const.
* python/spot/__init__.py (sat_minimize): Add display_log and
return_log options.
* tests/python/ipnbdoctest.py: Adjust to not compare SAT-minimization
logs as they contain timings.
2018-03-30 18:01:59 +02:00
Alexandre Duret-Lutz
71fbca8b0d python: fix error message of translate()/posprocess()
* python/spot/__init__.py: Here.
* NEWS: Mention the bug.
2018-03-28 18:22:31 +02:00