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.
This commit is contained in:
Alexandre Duret-Lutz 2018-05-04 17:00:38 +02:00
parent 58d9a12495
commit d6f9618172
13 changed files with 547 additions and 60 deletions

View file

@ -1,5 +1,5 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2017 Laboratoire de Recherche et Développement
# Copyright (C) 2017, 2018 Laboratoire de Recherche et Développement
# de l'Epita
#
# This file is part of Spot, a model checking library.
@ -29,16 +29,10 @@ GF!b
(b & GF!b) | (!b & FGb)
b | (a & XF(b R a)) | (!a & XG(!b U !a))"""
def equivalent(a, phi):
negphi = spot.formula.Not(phi)
nega = spot.dualize(a)
return not (spot.translate(negphi).intersects(a)
or spot.translate(phi).intersects(nega))
def test_phi(phi):
a = spot.translate(phi, 'TGBA', 'SBAcc')
res = spot.to_weak_alternating(spot.dualize(a))
assert equivalent(res, spot.formula.Not(spot.formula(phi)))
assert res.equivalent_to(spot.formula.Not(spot.formula(phi)))
for p in phi1.split('\n'):
print(p)
@ -87,4 +81,4 @@ State: 6
--END--
""")
a2 = spot.to_weak_alternating(a2)
assert equivalent(a2, phi2)
assert a2.equivalent_to(phi2)