forq: make it easier to select contains's version
* spot/twaalgos/contains.hh, spot/twaalgos/contains.cc (containment_select_version): New function. (contains): Use it. * spot/twa/twa.cc (exclusive_word): Likewise. * bin/autfilt.cc (--included-in): Adjust to use forq depending on containement_select_version. * bin/man/spot-x.x: Adjust documentation of CONTAINMENT_SELECT_VERSION. * tests/core/included.test, tests/python/forq_contains.py: Add more tests. * NEWS: Mention the new feature.
This commit is contained in:
parent
ca4e6c4b48
commit
05d7622f8f
8 changed files with 178 additions and 83 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2016, 2022 Laboratoire de Recherche et Développement
|
||||
# Copyright (C) 2016, 2022, 2023 Laboratoire de Recherche et Développement
|
||||
# de l'Epita (LRDE).
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
|
|
@ -38,6 +38,20 @@ run 0 autfilt -q gab.hoa --included-in fga.hoa --included-in fgb.hoa
|
|||
run 1 autfilt -q ga.hoa --included-in fga.hoa --included-in fgb.hoa
|
||||
run 0 autfilt -q false.hoa --included-in fga.hoa
|
||||
|
||||
SPOT_CONTAINMENT_CHECK=forq run 0 autfilt -q fga.hoa --included-in gfa.hoa
|
||||
SPOT_CONTAINMENT_CHECK=forq run 0 autfilt -q fga.hoa --included-in fga.hoa
|
||||
SPOT_CONTAINMENT_CHECK=forq run 1 autfilt -q gfa.hoa --included-in fga.hoa
|
||||
SPOT_CONTAINMENT_CHECK=forq \
|
||||
run 2 autfilt -q gab.hoa --included-in fga.hoa --included-in fgb.hoa
|
||||
SPOT_CONTAINMENT_CHECK=forq \
|
||||
run 2 autfilt -q ga.hoa --included-in fga.hoa --included-in fgb.hoa
|
||||
SPOT_CONTAINMENT_CHECK=forq run 0 autfilt -q false.hoa --included-in fga.hoa
|
||||
|
||||
SPOT_CONTAINMENT_CHECK=error \
|
||||
autfilt -q fga.hoa --included-in gfa.hoa >err && exit 1
|
||||
test $? -eq 2
|
||||
grep 'SPOT_CONTAINMENT_CHECK.*forq' error
|
||||
|
||||
run 1 autfilt -q gfa.hoa --equivalent-to fga.hoa
|
||||
run 1 autfilt -q fga.hoa --equivalent-to gfa.hoa
|
||||
|
||||
|
|
@ -61,6 +75,7 @@ ltl2tgba '!(a U c)' | autfilt --product-or a1.hoa > out.hoa
|
|||
ltl2tgba true | autfilt out.hoa --equivalent-to - && exit 1
|
||||
|
||||
# In Spot 2.10, the following was very slow.
|
||||
export SPOT_CONTAINMENT_CHECK=default
|
||||
for n in 1 2 4 8 16 512 1024 2048 4096 8192; do
|
||||
genaut --cyclist-trace-nba=$n > trace.hoa
|
||||
genaut --cyclist-proof-dba=$n > proof.hoa
|
||||
|
|
@ -68,4 +83,13 @@ for n in 1 2 4 8 16 512 1024 2048 4096 8192; do
|
|||
autfilt -q --included-in=proof.hoa trace.hoa && exit 1
|
||||
done
|
||||
|
||||
# The forq-based version does not scale well on this particular test
|
||||
export SPOT_CONTAINMENT_CHECK=forq
|
||||
for n in 1 2 4 8 16 128; do
|
||||
genaut --cyclist-trace-nba=$n > trace.hoa
|
||||
genaut --cyclist-proof-dba=$n > proof.hoa
|
||||
autfilt -q --included-in=trace.hoa proof.hoa || exit 1
|
||||
autfilt -q --included-in=proof.hoa trace.hoa && exit 1
|
||||
done
|
||||
|
||||
:
|
||||
|
|
|
|||
|
|
@ -324,3 +324,28 @@ State: 11 {0}
|
|||
--END--""")
|
||||
|
||||
do_symmetric_test(subset, superset)
|
||||
|
||||
|
||||
tba = spot.translate('GFa')
|
||||
tgba = spot.translate('GFa & GFb')
|
||||
tc.assertTrue(spot.contains(tba, tgba))
|
||||
try:
|
||||
spot.containment_select_version("fork")
|
||||
except RuntimeError as e:
|
||||
tc.assertIn("forq", str(e))
|
||||
else:
|
||||
raise RuntimeError("missing exception")
|
||||
spot.containment_select_version("forq")
|
||||
tc.assertTrue(spot.contains(tba, tgba)) # does not call contains_forq
|
||||
try:
|
||||
spot.contains_forq(tba, tgba) # because contains_forq wants Büchi
|
||||
except RuntimeError as e:
|
||||
tc.assertIn("Büchi", str(e))
|
||||
else:
|
||||
raise RuntimeError("missing exception")
|
||||
|
||||
# This shows that exclusive word also depend on
|
||||
# containment_select_version()
|
||||
tc.assertEqual(str(one.exclusive_word(both)), "!a & !b; cycle{a}")
|
||||
spot.containment_select_version("default")
|
||||
tc.assertEqual(str(one.exclusive_word(both)), "cycle{a}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue