revamp the formula hierarchy (montro-patch)
Flatten the formula ltl::formula hiearchy into a single ltl::vnode that has an enumerator to distinguish the types of node, and a common interface to access children, update reference counts, etc. The ltl::formula class is now a thin wrapper around an ltl::vnode pointer to keep track of reference counts automatically. Visitor are not used anymore; we now have map() and traversor() methods that are more concise. This basically fixes #43, but should be followed by some fine tuning that should now be localized to the formula.hh and formula.cc files. Some statistics about this patch. I started working on it on Sep 9, had a first compiling version two weeks later on Sep 22, and it then took 5 days to fixes the ~70 distincts bugs that were introduced during the conversion. About 13200 lines were modified, and one third of those were removed. * src/ltlast/formula.cc, src/ltlast/formula.hh: Complete rewrite, including what was in separate nearby files. * src/ltlast/allnodes.hh, src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh, src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/bunop.cc, src/ltlast/bunop.hh, src/ltlast/constant.cc, src/ltlast/constant.hh, src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/unop.cc, src/ltlast/unop.hh, src/ltlvisit/dump.cc, src/ltlvisit/dump.hh, src/ltlast/predecl.hh: Delete these files. Their feature have been merged in formula.hh and formula.cc. * src/ltlast/visitor.hh, src/ltlvisit/clone.cc, src/ltlvisit/clone.hh, src/ltlvisit/dump.hh, src/ltlvisit/postfix.cc, src/ltlvisit/postfix.hh: Delete these files, as we do not use visitors anymore. * bench/stutter/stutter_invariance_formulas.cc, bench/stutter/stutter_invariance_randomgraph.cc, doc/org/tut01.org, doc/org/tut02.org, doc/org/tut10.org, doc/org/tut22.org, iface/ltsmin/ltsmin.cc, iface/ltsmin/ltsmin.hh, iface/ltsmin/modelcheck.cc, src/bin/autfilt.cc, src/bin/common_aoutput.cc, src/bin/common_aoutput.hh, src/bin/common_finput.cc, src/bin/common_finput.hh, src/bin/common_output.cc, src/bin/common_output.hh, src/bin/common_trans.cc, src/bin/common_trans.hh, src/bin/dstar2tgba.cc, src/bin/genltl.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc, src/bin/ltlcross.cc, src/bin/ltldo.cc, src/bin/ltlfilt.cc, src/bin/ltlgrind.cc, src/bin/randaut.cc, src/bin/randltl.cc, src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh, src/kripkeparse/kripkeparse.yy, src/ltlast/Makefile.am, src/ltlenv/declenv.cc, src/ltlenv/declenv.hh, src/ltlenv/defaultenv.cc, src/ltlenv/defaultenv.hh, src/ltlenv/environment.hh, src/ltlparse/ltlparse.yy, src/ltlparse/public.hh, src/ltlvisit/Makefile.am, src/ltlvisit/apcollect.cc, src/ltlvisit/apcollect.hh, src/ltlvisit/contain.cc, src/ltlvisit/contain.hh, src/ltlvisit/dot.cc, src/ltlvisit/dot.hh, src/ltlvisit/exclusive.cc, src/ltlvisit/exclusive.hh, src/ltlvisit/length.cc, src/ltlvisit/length.hh, src/ltlvisit/mark.cc, src/ltlvisit/mark.hh, src/ltlvisit/mutation.cc, src/ltlvisit/mutation.hh, src/ltlvisit/nenoform.cc, src/ltlvisit/nenoform.hh, src/ltlvisit/print.cc, src/ltlvisit/print.hh, src/ltlvisit/randomltl.cc, src/ltlvisit/randomltl.hh, src/ltlvisit/relabel.cc, src/ltlvisit/relabel.hh, src/ltlvisit/remove_x.cc, src/ltlvisit/remove_x.hh, src/ltlvisit/simpfg.cc, src/ltlvisit/simpfg.hh, src/ltlvisit/simplify.cc, src/ltlvisit/simplify.hh, src/ltlvisit/snf.cc, src/ltlvisit/snf.hh, src/ltlvisit/unabbrev.cc, src/ltlvisit/unabbrev.hh, src/parseaut/parseaut.yy, src/ta/taexplicit.cc, src/ta/tgtaexplicit.cc, src/taalgos/minimize.cc, src/taalgos/tgba2ta.cc, src/tests/bare.test, src/tests/checkpsl.cc, src/tests/checkta.cc, src/tests/complementation.cc, src/tests/consterm.cc, src/tests/emptchk.cc, src/tests/equalsf.cc, src/tests/ikwiad.cc, src/tests/isop.test, src/tests/kind.cc, src/tests/length.cc, src/tests/ltldo.test, src/tests/ltlfilt.test, src/tests/ltlgrind.test, src/tests/ltlprod.cc, src/tests/ltlrel.cc, src/tests/parse_print_test.cc, src/tests/parseaut.test, src/tests/parseerr.test, src/tests/randtgba.cc, src/tests/readltl.cc, src/tests/reduc.cc, src/tests/syntimpl.cc, src/tests/taatgba.cc, src/tests/tostring.cc, src/tests/twagraph.cc, src/tests/utf8.test, src/twa/acc.cc, src/twa/bdddict.cc, src/twa/bdddict.hh, src/twa/bddprint.cc, src/twa/formula2bdd.cc, src/twa/formula2bdd.hh, src/twa/taatgba.cc, src/twa/taatgba.hh, src/twa/twa.cc, src/twa/twa.hh src/twa/twagraph.cc, src/twa/twagraph.hh, src/twa/twasafracomplement.cc, src/twaalgos/compsusp.cc, src/twaalgos/compsusp.hh, src/twaalgos/dtgbasat.cc, src/twaalgos/hoa.cc, src/twaalgos/lbtt.cc, src/twaalgos/ltl2taa.cc, src/twaalgos/ltl2taa.hh, src/twaalgos/ltl2tgba_fm.cc, src/twaalgos/ltl2tgba_fm.hh, src/twaalgos/minimize.cc, src/twaalgos/minimize.hh, src/twaalgos/neverclaim.cc, src/twaalgos/postproc.cc, src/twaalgos/postproc.hh, src/twaalgos/powerset.cc, src/twaalgos/powerset.hh, src/twaalgos/randomgraph.cc, src/twaalgos/remprop.cc, src/twaalgos/remprop.hh, src/twaalgos/stats.cc, src/twaalgos/stats.hh, src/twaalgos/stutter.cc, src/twaalgos/stutter.hh, src/twaalgos/translate.cc, src/twaalgos/translate.hh, wrap/python/ajax/spotcgi.in, wrap/python/spot.py, wrap/python/spot_impl.i, wrap/python/Makefile.am, wrap/python/tests/automata-io.ipynb, wrap/python/tests/formulas.ipynb, wrap/python/tests/ltl2tgba.py, wrap/python/tests/ltlparse.py, wrap/python/tests/ltlsimple.py, wrap/python/tests/randltl.ipynb: Adjust to use the new interface. * src/sanity/style.test: Accept more C++11 patterns. * NEWS: Mention the change.
This commit is contained in:
parent
1628b188fe
commit
b77f7e24c3
177 changed files with 8295 additions and 13332 deletions
|
|
@ -1,5 +1,5 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
## Copyright (C) 2010, 2011, 2013, 2014 Laboratoire de Recherche et Development de
|
||||
## Copyright (C) 2010, 2011, 2013, 2014, 2015 Laboratoire de Recherche et Development de
|
||||
## l'Epita (LRDE).
|
||||
## Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
## département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -35,7 +35,7 @@ MAINTAINERCLEANFILES = \
|
|||
|
||||
## spot
|
||||
|
||||
_spot_impl_la_SOURCES = $(srcdir)/spot_impl_wrap.cxx $(srcdir)/spot_impl_wrap.h
|
||||
_spot_impl_la_SOURCES = $(srcdir)/spot_impl_wrap.cxx
|
||||
_spot_impl_la_LDFLAGS = -avoid-version -module
|
||||
_spot_impl_la_LIBADD = $(top_builddir)/src/libspot.la
|
||||
|
||||
|
|
|
|||
|
|
@ -478,12 +478,9 @@ for r in form.getlist('r'):
|
|||
simpopt.containment_checks = True
|
||||
simpopt.containment_checks_stronger = True
|
||||
if dored:
|
||||
simp = spot.ltl_simplifier(simpopt)
|
||||
f2 = simp.simplify(f)
|
||||
f.destroy()
|
||||
f = f2
|
||||
# This also clears the as_bdd() cache.
|
||||
simp = None
|
||||
# Not keeping the ltl simplifier aive will also clear the as_bdd()
|
||||
# cache.
|
||||
f = spot.ltl_simplifier(simpopt).simplify(f)
|
||||
|
||||
# Formula manipulation only.
|
||||
if output_type == 'f':
|
||||
|
|
|
|||
|
|
@ -433,9 +433,8 @@ def randltl(ap, n = -1, **kwargs):
|
|||
|
||||
if isinstance(ap, list):
|
||||
aprops = atomic_prop_set()
|
||||
e = default_environment.instance()
|
||||
for elt in ap:
|
||||
aprops.insert(is_atomic_prop(e.require(elt)))
|
||||
aprops.insert(formula.ap(elt))
|
||||
ap = aprops
|
||||
ltl_priorities = kwargs.get("ltl_priorities", None)
|
||||
sere_priorities = kwargs.get("sere_priorities", None)
|
||||
|
|
|
|||
|
|
@ -26,13 +26,15 @@
|
|||
#include <cstddef>
|
||||
%}
|
||||
|
||||
%module(directors="1") spot_impl
|
||||
%module(director="1") spot_impl
|
||||
|
||||
%include "std_shared_ptr.i"
|
||||
%include "std_vector.i"
|
||||
%include "std_string.i"
|
||||
%include "std_list.i"
|
||||
%include "std_set.i"
|
||||
%include "std_map.i"
|
||||
%include "stdint.i"
|
||||
%include "exception.i"
|
||||
%include "typemaps.i"
|
||||
|
||||
|
|
@ -64,10 +66,6 @@
|
|||
%shared_ptr(spot::emptiness_check_instantiator)
|
||||
%shared_ptr(spot::tgbasl)
|
||||
|
||||
namespace std {
|
||||
%template(liststr) list<string>;
|
||||
};
|
||||
|
||||
%import "buddy.i"
|
||||
|
||||
%{
|
||||
|
|
@ -83,12 +81,6 @@ namespace std {
|
|||
#include "misc/random.hh"
|
||||
|
||||
#include "ltlast/formula.hh"
|
||||
#include "ltlast/atomic_prop.hh"
|
||||
#include "ltlast/binop.hh"
|
||||
#include "ltlast/constant.hh"
|
||||
#include "ltlast/multop.hh"
|
||||
#include "ltlast/unop.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
|
||||
#include "ltlenv/environment.hh"
|
||||
#include "ltlenv/defaultenv.hh"
|
||||
|
|
@ -99,7 +91,6 @@ namespace std {
|
|||
|
||||
#include "ltlvisit/apcollect.hh"
|
||||
#include "ltlvisit/dot.hh"
|
||||
#include "ltlvisit/dump.hh"
|
||||
#include "ltlvisit/nenoform.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
#include "ltlvisit/simplify.hh"
|
||||
|
|
@ -158,6 +149,8 @@ using namespace spot::ltl;
|
|||
using namespace spot;
|
||||
%}
|
||||
|
||||
|
||||
|
||||
// For spot::emptiness_check_instantiator::construct and any other
|
||||
// function that return errors via a "char **err" argument.
|
||||
%typemap(in, numinputs=0) char** OUTPUT (char* temp)
|
||||
|
|
@ -216,36 +209,17 @@ using namespace spot;
|
|||
%include "misc/optionmap.hh"
|
||||
%include "misc/random.hh"
|
||||
|
||||
%implicitconv std::vector<spot::ltl::formula>;
|
||||
|
||||
%include "ltlast/formula.hh"
|
||||
%include "ltlast/atomic_prop.hh"
|
||||
%include "ltlast/binop.hh"
|
||||
%include "ltlast/constant.hh"
|
||||
%include "ltlast/multop.hh"
|
||||
%include "ltlast/unop.hh"
|
||||
%include "ltlast/visitor.hh"
|
||||
|
||||
namespace std {
|
||||
%template(atomic_prop_set) set<const spot::ltl::atomic_prop*,
|
||||
spot::ltl::formula_ptr_less_than>;
|
||||
|
||||
%template(mapff) map<const spot::ltl::formula*, const spot::ltl::formula*,
|
||||
spot::ltl::formula_ptr_less_than>;
|
||||
%template(liststr) list<std::string>;
|
||||
%template(vectorformula) vector<spot::ltl::formula>;
|
||||
%template(atomic_prop_set) set<spot::ltl::formula>;
|
||||
%template(relabeling_map) map<spot::ltl::formula, spot::ltl::formula>;
|
||||
}
|
||||
|
||||
%{
|
||||
namespace swig {
|
||||
template <> struct traits<atomic_prop> {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() { return "spot::ltl::atomic_prop"; }
|
||||
};
|
||||
template <> struct traits<formula> {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() { return "spot::ltl::formula"; }
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
%include "ltlenv/environment.hh"
|
||||
%include "ltlenv/defaultenv.hh"
|
||||
|
||||
|
|
@ -263,7 +237,6 @@ namespace std {
|
|||
|
||||
%include "ltlvisit/apcollect.hh"
|
||||
%include "ltlvisit/dot.hh"
|
||||
%include "ltlvisit/dump.hh"
|
||||
%include "ltlvisit/nenoform.hh"
|
||||
%include "ltlvisit/print.hh"
|
||||
%include "ltlvisit/simplify.hh"
|
||||
|
|
@ -323,33 +296,16 @@ namespace std {
|
|||
#undef ltl
|
||||
|
||||
%extend spot::ltl::formula {
|
||||
|
||||
// When comparing formula, make sure Python compare our
|
||||
// pointers, not the pointers to its wrappers.
|
||||
|
||||
// __cmp__ is for Python 2.0
|
||||
int __cmp__(const spot::ltl::formula* b) { return self - b; }
|
||||
// These are for Python 2.1+ or 3.x. They more closely match
|
||||
// the logic in Spot.
|
||||
bool __lt__(const spot::ltl::formula* b)
|
||||
{ spot::ltl::formula_ptr_less_than lt; return lt(self, b); }
|
||||
bool __le__(const spot::ltl::formula* b)
|
||||
{ spot::ltl::formula_ptr_less_than lt; return !lt(b, self); }
|
||||
bool __eq__(const spot::ltl::formula* b) { return self == b; }
|
||||
bool __ne__(const spot::ltl::formula* b) { return self != b; }
|
||||
bool __gt__(const spot::ltl::formula* b)
|
||||
{ spot::ltl::formula_ptr_less_than lt; return lt(b, self); }
|
||||
bool __ge__(const spot::ltl::formula* b)
|
||||
{ spot::ltl::formula_ptr_less_than lt; return !lt(self, b); }
|
||||
int __cmp__(spot::ltl::formula b) { return self->id() - b.id(); }
|
||||
size_t __hash__() { return self->id(); }
|
||||
|
||||
size_t __hash__() { return self->hash(); }
|
||||
|
||||
std::string __repr__() { return spot::ltl::str_psl(self); }
|
||||
std::string __repr__() { return spot::ltl::str_psl(*self); }
|
||||
std::string _repr_latex_()
|
||||
{
|
||||
return std::string("$") + spot::ltl::str_sclatex_psl(self) + '$';
|
||||
return std::string("$") + spot::ltl::str_sclatex_psl(*self) + '$';
|
||||
}
|
||||
std::string __str__() { return spot::ltl::str_psl(self); }
|
||||
std::string __str__() { return spot::ltl::str_psl(*self); }
|
||||
}
|
||||
|
||||
%extend spot::acc_cond::acc_code {
|
||||
|
|
@ -387,6 +343,11 @@ namespace std {
|
|||
}
|
||||
|
||||
%inline %{
|
||||
bool fnode_instances_check()
|
||||
{
|
||||
return spot::ltl::fnode::instances_check();
|
||||
}
|
||||
|
||||
spot::ltl::parse_error_list
|
||||
empty_parse_error_list()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
"never {\n",
|
||||
"T0_init:\n",
|
||||
" if\n",
|
||||
" :: ((b)) -> goto accept_all\n",
|
||||
" :: (b) -> goto accept_all\n",
|
||||
" :: ((a) && (!(b))) -> goto T0_init\n",
|
||||
" fi;\n",
|
||||
"accept_all:\n",
|
||||
|
|
@ -805,4 +805,4 @@
|
|||
"metadata": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:08d5f61ba93d2879f4f77ca0c4434c1a60ffcb195505e6065dd5a1c79e07c26a"
|
||||
"signature": "sha256:049261ec6b13505007796a9e9d1d8279783233b9b1eb8f9b8e5727070a38db7a"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
|
|
@ -405,7 +405,7 @@
|
|||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"155\" y=\"-158.3\">Concat</text>\n",
|
||||
"</g>\n",
|
||||
"<!-- 0->1 -->\n",
|
||||
"<g class=\"edge\" id=\"edge1\"><title>0->1</title>\n",
|
||||
"<g class=\"edge\" id=\"edge6\"><title>0->1</title>\n",
|
||||
"<path d=\"M117.612,-216.411C123.593,-207.868 131.005,-197.278 137.649,-187.787\" fill=\"none\" stroke=\"black\"/>\n",
|
||||
"<polygon fill=\"black\" points=\"140.604,-189.669 143.471,-179.47 134.869,-185.655 140.604,-189.669\" stroke=\"black\"/>\n",
|
||||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"113.112\" y=\"-205.211\">L</text>\n",
|
||||
|
|
@ -416,7 +416,7 @@
|
|||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"58\" y=\"-158.3\">G</text>\n",
|
||||
"</g>\n",
|
||||
"<!-- 0->7 -->\n",
|
||||
"<g class=\"edge\" id=\"edge7\"><title>0->7</title>\n",
|
||||
"<g class=\"edge\" id=\"edge9\"><title>0->7</title>\n",
|
||||
"<path d=\"M94.6247,-216.411C88.6815,-207.744 81.2945,-196.971 74.7146,-187.375\" fill=\"none\" stroke=\"black\"/>\n",
|
||||
"<polygon fill=\"black\" points=\"77.5052,-185.256 68.9633,-178.988 71.732,-189.215 77.5052,-185.256\" stroke=\"black\"/>\n",
|
||||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"89.6247\" y=\"-205.211\">R</text>\n",
|
||||
|
|
@ -427,7 +427,7 @@
|
|||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"234\" y=\"-14.3\">a</text>\n",
|
||||
"</g>\n",
|
||||
"<!-- 1->2 -->\n",
|
||||
"<g class=\"edge\" id=\"edge2\"><title>1->2</title>\n",
|
||||
"<g class=\"edge\" id=\"edge1\"><title>1->2</title>\n",
|
||||
"<path d=\"M173.171,-146.485C184.356,-136.683 198.19,-122.858 207,-108 218.359,-88.8432 225.316,-64.4933 229.316,-46.1073\" fill=\"none\" stroke=\"black\"/>\n",
|
||||
"<polygon fill=\"black\" points=\"232.797,-46.5497 231.341,-36.0554 225.935,-45.1672 232.797,-46.5497\" stroke=\"black\"/>\n",
|
||||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"169.671\" y=\"-135.285\">1</text>\n",
|
||||
|
|
@ -435,7 +435,7 @@
|
|||
"<!-- 3 -->\n",
|
||||
"<g class=\"node\" id=\"node4\"><title>3</title>\n",
|
||||
"<ellipse cx=\"99\" cy=\"-90\" fill=\"none\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
|
||||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"99\" y=\"-86.3\">[*]</text>\n",
|
||||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"99\" y=\"-86.3\">Star</text>\n",
|
||||
"</g>\n",
|
||||
"<!-- 1->3 -->\n",
|
||||
"<g class=\"edge\" id=\"edge3\"><title>1->3</title>\n",
|
||||
|
|
@ -446,7 +446,7 @@
|
|||
"<!-- 5 -->\n",
|
||||
"<g class=\"node\" id=\"node6\"><title>5</title>\n",
|
||||
"<ellipse cx=\"171\" cy=\"-90\" fill=\"none\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
|
||||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"171\" y=\"-86.3\">[+]</text>\n",
|
||||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"171\" y=\"-86.3\">Star</text>\n",
|
||||
"</g>\n",
|
||||
"<!-- 1->5 -->\n",
|
||||
"<g class=\"edge\" id=\"edge5\"><title>1->5</title>\n",
|
||||
|
|
@ -460,7 +460,7 @@
|
|||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"54\" y=\"-14.3\">b</text>\n",
|
||||
"</g>\n",
|
||||
"<!-- 3->4 -->\n",
|
||||
"<g class=\"edge\" id=\"edge4\"><title>3->4</title>\n",
|
||||
"<g class=\"edge\" id=\"edge2\"><title>3->4</title>\n",
|
||||
"<path d=\"M88.7888,-73.1159C83.4437,-64.8013 76.7639,-54.4105 70.6903,-44.9627\" fill=\"none\" stroke=\"black\"/>\n",
|
||||
"<polygon fill=\"black\" points=\"73.4681,-42.8113 65.1164,-36.2921 67.5799,-46.5966 73.4681,-42.8113\" stroke=\"black\"/>\n",
|
||||
"</g>\n",
|
||||
|
|
@ -470,7 +470,7 @@
|
|||
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"162\" y=\"-14.3\">c</text>\n",
|
||||
"</g>\n",
|
||||
"<!-- 5->6 -->\n",
|
||||
"<g class=\"edge\" id=\"edge6\"><title>5->6</title>\n",
|
||||
"<g class=\"edge\" id=\"edge4\"><title>5->6</title>\n",
|
||||
"<path d=\"M168.821,-72.055C167.83,-64.3456 166.632,-55.0269 165.518,-46.3642\" fill=\"none\" stroke=\"black\"/>\n",
|
||||
"<polygon fill=\"black\" points=\"168.968,-45.7473 164.221,-36.2753 162.025,-46.64 168.968,-45.7473\" stroke=\"black\"/>\n",
|
||||
"</g>\n",
|
||||
|
|
@ -485,7 +485,7 @@
|
|||
"<polygon fill=\"black\" points=\"41.5434,-115.196 34.2938,-107.47 35.1429,-118.031 41.5434,-115.196\" stroke=\"black\"/>\n",
|
||||
"</g>\n",
|
||||
"<!-- 8->4 -->\n",
|
||||
"<g class=\"edge\" id=\"edge9\"><title>8->4</title>\n",
|
||||
"<g class=\"edge\" id=\"edge7\"><title>8->4</title>\n",
|
||||
"<path d=\"M33.3986,-72.411C36.4351,-64.5386 40.1417,-54.9289 43.5695,-46.0421\" fill=\"none\" stroke=\"black\"/>\n",
|
||||
"<polygon fill=\"black\" points=\"46.9373,-47.0364 47.2705,-36.4468 40.4062,-44.5172 46.9373,-47.0364\" stroke=\"black\"/>\n",
|
||||
"</g>\n",
|
||||
|
|
@ -493,7 +493,7 @@
|
|||
"</svg>"
|
||||
],
|
||||
"text": [
|
||||
"<IPython.core.display.SVG at 0x7f9852c56588>"
|
||||
"<IPython.core.display.SVG at 0x7f4dfea9c710>"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ if f:
|
|||
a = spot.ensure_digraph(a)
|
||||
a = spot.minimize_obligation(a, f)
|
||||
|
||||
f.destroy()
|
||||
del f
|
||||
|
||||
degeneralized = None
|
||||
|
|
@ -128,7 +127,5 @@ if f:
|
|||
else:
|
||||
exit_code = 1
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 0
|
||||
assert spot.unop.instance_count() == 0
|
||||
assert spot.binop.instance_count() == 0
|
||||
assert spot.multop.instance_count() == 0
|
||||
del dict
|
||||
assert spot.fnode_instances_check()
|
||||
|
|
|
|||
|
|
@ -33,16 +33,13 @@ for str1 in l:
|
|||
if spot.format_parse_errors(spot.get_cout(), str1, p):
|
||||
sys.exit(1)
|
||||
str2 = str(f)
|
||||
f.destroy()
|
||||
del f
|
||||
sys.stdout.write(str2 + "\n")
|
||||
# Try to reparse the stringified formula
|
||||
f = spot.parse_infix_psl(str2, p, e)
|
||||
if spot.format_parse_errors(spot.get_cout(), str2, p):
|
||||
sys.exit(1)
|
||||
sys.stdout.write(str(f) + "\n")
|
||||
f.destroy()
|
||||
del f
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 0
|
||||
assert spot.binop.instance_count() == 0
|
||||
assert spot.unop.instance_count() == 0
|
||||
assert spot.multop.instance_count() == 0
|
||||
assert spot.fnode_instances_check()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- mode: python; coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et Développement
|
||||
# Copyright (C) 2009, 2010, 2012, 2015 Laboratoire de Recherche et Développement
|
||||
# de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
# département Systemes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -23,19 +23,19 @@
|
|||
import spot
|
||||
import sys
|
||||
|
||||
e = spot.default_environment.instance()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
a = e.require('a')
|
||||
b = e.require('b')
|
||||
c = e.require('c')
|
||||
c2 = e.require('c')
|
||||
a = spot.formula.ap('a')
|
||||
b = spot.formula.ap('b')
|
||||
c = spot.formula.ap('c')
|
||||
c2 = spot.formula.ap('c')
|
||||
|
||||
assert c == c2
|
||||
assert spot.atomic_prop.instance_count() == 3
|
||||
|
||||
op = spot.multop.instance(spot.multop.And, a.clone(), b.clone())
|
||||
op2 = spot.multop.instance(spot.multop.And, op, c)
|
||||
op = spot.formula.And([a, b])
|
||||
op2 = spot.formula.And([op, c])
|
||||
op3 = spot.formula.And([a, c, b])
|
||||
|
||||
assert op2 == op3
|
||||
|
||||
# The symbol for a subformula which hasn't been cloned is better
|
||||
# suppressed, so we don't attempt to reuse it elsewhere.
|
||||
|
|
@ -43,87 +43,31 @@ del op, c
|
|||
|
||||
sys.stdout.write('op2 = %s\n' % str(op2))
|
||||
|
||||
op3 = spot.multop.instance(spot.multop.And, b,
|
||||
spot.multop.instance(spot.multop.And, c2, a))
|
||||
del a, b, c2
|
||||
|
||||
sys.stdout.write('op3 = %s\n' % str(op3))
|
||||
assert op2 == op3
|
||||
|
||||
op4 = spot.multop.instance(spot.multop.Or, op2, op3)
|
||||
op4 = spot.formula.Or([op2, op3])
|
||||
|
||||
sys.stdout.write('op4 = %s\n' % str(op4))
|
||||
assert op4 == op2
|
||||
|
||||
del op2, op3
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 3
|
||||
assert spot.multop.instance_count() == 1
|
||||
|
||||
op4.destroy()
|
||||
del op4
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 0
|
||||
assert spot.multop.instance_count() == 0
|
||||
del op2, op3, op4
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
a = e.require('a')
|
||||
b = e.require('b')
|
||||
c = e.require('c')
|
||||
T = spot.constant.true_instance()
|
||||
F = spot.constant.false_instance()
|
||||
a = spot.formula.ap('a')
|
||||
b = spot.formula.ap('b')
|
||||
c = spot.formula.ap('c')
|
||||
T = spot.formula.tt()
|
||||
F = spot.formula.ff()
|
||||
|
||||
f1 = spot.binop.instance(spot.binop.Equiv, c.clone(), a.clone())
|
||||
f2 = spot.binop.instance(spot.binop.Implies, a.clone(), b.clone())
|
||||
f3 = spot.binop.instance(spot.binop.Xor, b.clone(), c.clone())
|
||||
f4 = spot.unop.instance(spot.unop.Not, f3); del f3
|
||||
f5 = spot.binop.instance(spot.binop.Xor, F, c.clone())
|
||||
f1 = spot.formula.Equiv(c, a)
|
||||
f2 = spot.formula.Implies(a, b)
|
||||
f3 = spot.formula.Xor(b, c)
|
||||
f4 = spot.formula.Not(f3); del f3
|
||||
f5 = spot.formula.Xor(F, c)
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 3
|
||||
assert spot.binop.instance_count() == 3
|
||||
assert spot.unop.instance_count() == 1
|
||||
assert spot.multop.instance_count() == 0
|
||||
del a, b, c, T, F, f1, f2, f4, f5
|
||||
|
||||
a.destroy()
|
||||
del a
|
||||
b.destroy()
|
||||
del b
|
||||
c.destroy()
|
||||
del c
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 3
|
||||
assert spot.binop.instance_count() == 3
|
||||
assert spot.unop.instance_count() == 1
|
||||
assert spot.multop.instance_count() == 0
|
||||
|
||||
f1.destroy()
|
||||
del f1
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 3
|
||||
assert spot.binop.instance_count() == 2
|
||||
assert spot.unop.instance_count() == 1
|
||||
assert spot.multop.instance_count() == 0
|
||||
|
||||
f5.destroy()
|
||||
del f5
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 3
|
||||
assert spot.binop.instance_count() == 2
|
||||
assert spot.unop.instance_count() == 1
|
||||
assert spot.multop.instance_count() == 0
|
||||
|
||||
f4.destroy()
|
||||
del f4
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 2
|
||||
assert spot.binop.instance_count() == 1
|
||||
assert spot.unop.instance_count() == 0
|
||||
assert spot.multop.instance_count() == 0
|
||||
|
||||
f2.destroy()
|
||||
del f2
|
||||
|
||||
assert spot.atomic_prop.instance_count() == 0
|
||||
assert spot.binop.instance_count() == 0
|
||||
assert spot.unop.instance_count() == 0
|
||||
assert spot.multop.instance_count() == 0
|
||||
assert spot.fnode_instances_check()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:b16de2c9883c0fecb450f9d7f4885937abcfc1d1fef584d47109fcee13a68c9a"
|
||||
"signature": "sha256:54b0c9570ca91322c466f914d622a3723cd3e450612a055a188927bf50dfdaf8"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
|
|
@ -164,11 +164,11 @@
|
|||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": [
|
||||
"G(p1 U Gp0)\n"
|
||||
"G(p2 U Gp0)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 12
|
||||
"prompt_number": 5
|
||||
},
|
||||
{
|
||||
"cell_type": "heading",
|
||||
|
|
@ -199,11 +199,11 @@
|
|||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": [
|
||||
"{{p0 && p2}[*]}<>-> (Fp2 & Fp0)\n"
|
||||
"{{p0 && p1}[*]}<>-> (Fp1 & Fp0)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 26
|
||||
"prompt_number": 6
|
||||
},
|
||||
{
|
||||
"cell_type": "heading",
|
||||
|
|
@ -242,7 +242,7 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 27
|
||||
"prompt_number": 7
|
||||
},
|
||||
{
|
||||
"cell_type": "heading",
|
||||
|
|
@ -273,11 +273,11 @@
|
|||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": [
|
||||
"G(((p0 U !Xp2) M Gp2) U Gp0)\n"
|
||||
"G(((p0 U !Xp1) M Gp1) U Gp0)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 29
|
||||
"prompt_number": 8
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
|
@ -301,12 +301,12 @@
|
|||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": [
|
||||
"X!(Gp2 M p1) R (!p1 M Xp2)\n",
|
||||
"F(G(F(Gp0 R (1 U Fp1)) M (p1 -> Gp0)) M F((p0 | Fp0) W Gp1))\n"
|
||||
"X!(Gp1 M p2) R (!p2 M Xp1)\n",
|
||||
"F(G(F(Gp0 R (1 U Fp2)) M (p2 -> Gp0)) M F((p0 | Fp0) W Gp2))\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 30
|
||||
"prompt_number": 9
|
||||
},
|
||||
{
|
||||
"cell_type": "heading",
|
||||
|
|
@ -332,14 +332,14 @@
|
|||
"stream": "stdout",
|
||||
"text": [
|
||||
"0\n",
|
||||
"!p1 & (p1 <-> p2)\n",
|
||||
"p1\n",
|
||||
"!p2 & (p1 <-> p2)\n",
|
||||
"p2\n",
|
||||
"p0 & ((p1 & p2) <-> !(!p0 & p1 & p2))\n",
|
||||
"1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 31
|
||||
"prompt_number": 10
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
|
@ -461,7 +461,7 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 32
|
||||
"prompt_number": 11
|
||||
},
|
||||
{
|
||||
"cell_type": "heading",
|
||||
|
|
@ -498,12 +498,12 @@
|
|||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": [
|
||||
"G!(!p2 & (Xp1 | F(p0 R Xp1)))\n",
|
||||
"G(p2 | (X!p1 & G(!p0 U X!p1)))\n"
|
||||
"G!(!p1 & (Xp2 | F(p0 R Xp2)))\n",
|
||||
"G(p1 | (X!p2 & G(!p0 U X!p2)))\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 36
|
||||
"prompt_number": 12
|
||||
},
|
||||
{
|
||||
"cell_type": "heading",
|
||||
|
|
@ -536,17 +536,17 @@
|
|||
"stream": "stdout",
|
||||
"text": [
|
||||
"0\n",
|
||||
"0 R p1\n",
|
||||
"F(p0 R !p2)\n",
|
||||
"G(p0 | Fp1) W (FGp1 R !p1)\n",
|
||||
"(p1 R G!p2) | G(p1 U !p0)\n",
|
||||
"(p1 W p0) U p1\n",
|
||||
"F!G(!Gp2 W p2)\n",
|
||||
"G!p2 & (!((p1 & Fp2) M p2) U p2)\n"
|
||||
"0 R p2\n",
|
||||
"F(p0 R !p1)\n",
|
||||
"G(p0 | Fp2) W (FGp2 R !p2)\n",
|
||||
"(p2 R G!p1) | G(p2 U !p0)\n",
|
||||
"(p2 W p0) U p2\n",
|
||||
"F!G(!Gp1 W p1)\n",
|
||||
"G!p1 & (!((p2 & Fp1) M p1) U p1)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 40
|
||||
"prompt_number": 13
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
|
@ -571,15 +571,15 @@
|
|||
"stream": "stdout",
|
||||
"text": [
|
||||
"0\n",
|
||||
"!(F!p1 M 1)\n",
|
||||
"(Fp1 | Gp0) M 1\n",
|
||||
"F!(!p1 <-> FGp1)\n",
|
||||
"Gp1 U (p1 U GFp1)\n",
|
||||
"(!p1 U p1) U ((p0 & (p0 U (!p0 & (!p0 -> Fp1))) & ((p1 U !p0) | (!p1 U !p0))) | (!p0 & (!p0 U (p0 & (!p0 -> Fp1))) & ((!p1 U p0) | (p1 U p0))) | (p1 & (p1 U (!p1 & (!p0 -> Fp1))) & ((!p0 U !p1) | (p0 U !p1))) | (!p1 & (!p1 U (p1 & (!p0 -> Fp1))) & ((!p0 U p1) | (p0 U p1))) | ((!p0 -> Fp1) & (Gp0 | G!p0) & (Gp1 | G!p1)))\n"
|
||||
"!(F!p0 M 1)\n",
|
||||
"(Gp1 | Fp0) M 1\n",
|
||||
"F!(!p0 <-> FGp0)\n",
|
||||
"Gp0 U (p0 U GFp0)\n",
|
||||
"(!p0 U p0) U ((p1 & (p1 U (!p1 & (!p1 -> Fp0))) & ((!p0 U !p1) | (p0 U !p1))) | (!p1 & (!p1 U (p1 & (!p1 -> Fp0))) & ((!p0 U p1) | (p0 U p1))) | (p0 & (p0 U (!p0 & (!p1 -> Fp0))) & ((!p1 U !p0) | (p1 U !p0))) | (!p0 & (!p0 U (p0 & (!p1 -> Fp0))) & ((!p1 U p0) | (p1 U p0))) | ((!p1 -> Fp0) & (Gp1 | G!p1) & (Gp0 | G!p0)))\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 42
|
||||
"prompt_number": 14
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
|
@ -615,15 +615,7 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 44
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
"prompt_number": 15
|
||||
}
|
||||
],
|
||||
"metadata": {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue