Introduce some masked tgba.
* src/tgba/tgbamask.cc, src/tgba/tgbamask.hh, src/tgba/tgbaproxy.cc, src/tgba/tgbaproxy.hh: New files. * src/tgba/Makefile.am: Add them. * src/tgbatest/explicit3.cc, src/tgbatest/explicit3.test: New files. * src/tgbatest/Makefile.am: Add them.
This commit is contained in:
parent
68ce9980d1
commit
ce0aec604c
9 changed files with 607 additions and 0 deletions
1
src/tgbatest/.gitignore
vendored
1
src/tgbatest/.gitignore
vendored
|
|
@ -8,6 +8,7 @@ eltl2tgba
|
|||
expldot
|
||||
explicit
|
||||
explicit2
|
||||
explicit3
|
||||
explprod
|
||||
input
|
||||
intvcomp
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ check_PROGRAMS = \
|
|||
complement \
|
||||
explicit \
|
||||
explicit2 \
|
||||
explicit3 \
|
||||
expldot \
|
||||
explprod \
|
||||
intvcomp \
|
||||
|
|
@ -53,6 +54,7 @@ bitvect_SOURCES = bitvect.cc
|
|||
complement_SOURCES = complementation.cc
|
||||
explicit_SOURCES = explicit.cc
|
||||
explicit2_SOURCES = explicit2.cc
|
||||
explicit3_SOURCES = explicit3.cc
|
||||
expldot_SOURCES = powerset.cc
|
||||
expldot_CXXFLAGS = -DDOTTY
|
||||
explprod_SOURCES = explprod.cc
|
||||
|
|
|
|||
98
src/tgbatest/explicit3.cc
Normal file
98
src/tgbatest/explicit3.cc
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
// Copyright (C) 2013 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
// Spot is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include "ltlenv/defaultenv.hh"
|
||||
#include "tgba/tgbaexplicit.hh"
|
||||
#include "tgbaalgos/dotty.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "tgba/tgbamask.hh"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
spot::ltl::default_environment& e =
|
||||
spot::ltl::default_environment::instance();
|
||||
|
||||
const spot::ltl::formula* a = e.require("a");
|
||||
const spot::ltl::formula* b = e.require("b");
|
||||
const spot::ltl::formula* c = e.require("c");
|
||||
|
||||
spot::bdd_dict* dict = new spot::bdd_dict();
|
||||
spot::tgba_explicit_number* aut = new spot::tgba_explicit_number(dict);
|
||||
|
||||
typedef spot::state_explicit_number::transition trans;
|
||||
|
||||
{
|
||||
trans* t = aut->create_transition(0, 1);
|
||||
aut->add_condition(t, a->clone());
|
||||
}
|
||||
{
|
||||
trans* t = aut->create_transition(1, 2);
|
||||
aut->add_condition(t, a->clone());
|
||||
}
|
||||
{
|
||||
trans* t = aut->create_transition(2, 0);
|
||||
aut->add_condition(t, a->clone());
|
||||
}
|
||||
{
|
||||
trans* t = aut->create_transition(1, 3);
|
||||
aut->add_condition(t, b->clone());
|
||||
}
|
||||
{
|
||||
trans* t = aut->create_transition(3, 4);
|
||||
aut->add_condition(t, c->clone());
|
||||
}
|
||||
{
|
||||
trans* t = aut->create_transition(4, 3);
|
||||
aut->add_condition(t, c->clone());
|
||||
aut->declare_acceptance_condition(b->clone());
|
||||
aut->add_acceptance_condition(t, b->clone());
|
||||
}
|
||||
|
||||
a->destroy();
|
||||
b->destroy();
|
||||
c->destroy();
|
||||
|
||||
spot::dotty_reachable(std::cout, aut);
|
||||
|
||||
spot::state_set s;
|
||||
s.insert(aut->get_state(0));
|
||||
s.insert(aut->get_state(1));
|
||||
s.insert(aut->get_state(2));
|
||||
|
||||
const spot::tgba* mk = build_tgba_mask_keep(aut, s);
|
||||
spot::dotty_reachable(std::cout, mk);
|
||||
delete mk;
|
||||
|
||||
const spot::tgba* mi = build_tgba_mask_ignore(aut, s);
|
||||
spot::dotty_reachable(std::cout, mi);
|
||||
delete mi;
|
||||
|
||||
const spot::tgba* mi2 = build_tgba_mask_ignore(aut, s, aut->get_state(1));
|
||||
spot::dotty_reachable(std::cout, mi2);
|
||||
delete mi2;
|
||||
|
||||
delete aut;
|
||||
delete dict;
|
||||
assert(spot::ltl::atomic_prop::instance_count() == 0);
|
||||
assert(spot::ltl::unop::instance_count() == 0);
|
||||
assert(spot::ltl::binop::instance_count() == 0);
|
||||
assert(spot::ltl::multop::instance_count() == 0);
|
||||
}
|
||||
68
src/tgbatest/explicit3.test
Executable file
68
src/tgbatest/explicit3.test
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2013 Laboratoire de Recherche et Développement
|
||||
# de l'Epita (LRDE).
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
#
|
||||
# Spot is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
# License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
run 0 ../explicit3 | tee stdout
|
||||
cat >expected <<EOF
|
||||
digraph G {
|
||||
0 [label="", style=invis, height=0]
|
||||
0 -> 1
|
||||
1 [label="0"]
|
||||
1 -> 2 [label="a\n"]
|
||||
2 [label="1"]
|
||||
2 -> 3 [label="a\n"]
|
||||
2 -> 4 [label="b\n"]
|
||||
3 [label="2"]
|
||||
3 -> 1 [label="a\n"]
|
||||
4 [label="3"]
|
||||
4 -> 5 [label="c\n"]
|
||||
5 [label="4"]
|
||||
5 -> 4 [label="c\n{Acc[b]}"]
|
||||
}
|
||||
digraph G {
|
||||
0 [label="", style=invis, height=0]
|
||||
0 -> 1
|
||||
1 [label="0"]
|
||||
1 -> 2 [label="a\n"]
|
||||
2 [label="1"]
|
||||
2 -> 3 [label="a\n"]
|
||||
3 [label="2"]
|
||||
3 -> 1 [label="a\n"]
|
||||
}
|
||||
digraph G {
|
||||
0 [label="", style=invis, height=0]
|
||||
0 -> 1
|
||||
1 [label="0"]
|
||||
}
|
||||
digraph G {
|
||||
0 [label="", style=invis, height=0]
|
||||
0 -> 1
|
||||
1 [label="1"]
|
||||
1 -> 2 [label="b\n"]
|
||||
2 [label="3"]
|
||||
2 -> 3 [label="c\n"]
|
||||
3 [label="4"]
|
||||
3 -> 2 [label="c\n{Acc[b]}"]
|
||||
}
|
||||
EOF
|
||||
|
||||
cmp expected stdout
|
||||
Loading…
Add table
Add a link
Reference in a new issue