Automatic mass renaming. * src/bin/autfilt.cc, src/bin/common_aoutput.cc, src/bin/common_aoutput.hh, src/bin/common_conv.cc, src/bin/common_conv.hh, src/bin/common_output.hh, src/bin/dstar2tgba.cc, src/bin/ltlcross.cc, src/bin/ltldo.cc, src/bin/randaut.cc, src/dstarparse/dra2ba.cc, src/dstarparse/dstar2tgba.cc, src/dstarparse/dstarparse.yy, src/dstarparse/nra2nba.cc, src/dstarparse/nsa2tgba.cc, src/dstarparse/public.hh, src/graphtest/tgbagraph.cc, src/hoaparse/hoaparse.yy, src/hoaparse/public.hh, src/ltlvisit/contain.hh, src/ltlvisit/exclusive.cc, src/ltlvisit/exclusive.hh, src/priv/accmap.hh, src/taalgos/minimize.cc, src/tgba/fwd.hh, src/tgba/tgba.cc, src/tgba/tgbagraph.cc, src/tgba/tgbagraph.hh, src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh, src/tgbaalgos/are_isomorphic.cc, src/tgbaalgos/are_isomorphic.hh, src/tgbaalgos/canonicalize.cc, src/tgbaalgos/canonicalize.hh, src/tgbaalgos/cleanacc.cc, src/tgbaalgos/cleanacc.hh, src/tgbaalgos/complete.cc, src/tgbaalgos/complete.hh, src/tgbaalgos/compsusp.cc, src/tgbaalgos/compsusp.hh, src/tgbaalgos/cycles.hh, src/tgbaalgos/degen.cc, src/tgbaalgos/degen.hh, src/tgbaalgos/dotty.cc, src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtbasat.hh, src/tgbaalgos/dtgbacomp.cc, src/tgbaalgos/dtgbacomp.hh, src/tgbaalgos/dtgbasat.cc, src/tgbaalgos/dtgbasat.hh, src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh, src/tgbaalgos/emptiness.cc, src/tgbaalgos/emptiness.hh, src/tgbaalgos/hoa.cc, src/tgbaalgos/isdet.cc, src/tgbaalgos/isdet.hh, src/tgbaalgos/lbtt.cc, src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/mask.cc, src/tgbaalgos/mask.hh, src/tgbaalgos/minimize.cc, src/tgbaalgos/minimize.hh, src/tgbaalgos/neverclaim.cc, src/tgbaalgos/postproc.cc, src/tgbaalgos/postproc.hh, src/tgbaalgos/powerset.cc, src/tgbaalgos/powerset.hh, src/tgbaalgos/product.cc, src/tgbaalgos/product.hh, src/tgbaalgos/randomgraph.cc, src/tgbaalgos/randomgraph.hh, src/tgbaalgos/randomize.cc, src/tgbaalgos/randomize.hh, src/tgbaalgos/relabel.cc, src/tgbaalgos/relabel.hh, src/tgbaalgos/remfin.cc, src/tgbaalgos/remfin.hh, src/tgbaalgos/remprop.cc, src/tgbaalgos/remprop.hh, src/tgbaalgos/safety.cc, src/tgbaalgos/safety.hh, src/tgbaalgos/sbacc.cc, src/tgbaalgos/sbacc.hh, src/tgbaalgos/sccfilter.cc, src/tgbaalgos/sccfilter.hh, src/tgbaalgos/sccinfo.cc, src/tgbaalgos/sccinfo.hh, src/tgbaalgos/simulation.cc, src/tgbaalgos/simulation.hh, src/tgbaalgos/stats.cc, src/tgbaalgos/stats.hh, src/tgbaalgos/stripacc.cc, src/tgbaalgos/stripacc.hh, src/tgbaalgos/stutter.cc, src/tgbaalgos/stutter.hh, src/tgbaalgos/totgba.cc, src/tgbaalgos/totgba.hh, src/tgbaalgos/translate.cc, src/tgbaalgos/translate.hh, src/tgbatest/checkpsl.cc, src/tgbatest/complementation.cc, src/tgbatest/emptchk.cc, src/tgbatest/ltl2tgba.cc, src/tgbatest/randtgba.cc, wrap/python/spot_impl.i, wrap/python/tests/automata-io.ipynb, wrap/python/tests/automata.ipynb, wrap/python/tests/piperead.ipynb, wrap/python/tests/testingaut.ipynb: Rename tgba_digraph as twa_graph.
95 lines
2.6 KiB
C++
95 lines
2.6 KiB
C++
// -*- coding: utf-8 -*-
|
|
// Copyright (C) 2014 Laboratoire de Recherche et Développement de
|
|
// l'Epita.
|
|
//
|
|
// 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 "tgba/tgbagraph.hh"
|
|
#include "tgbaalgos/dotty.hh"
|
|
#include "ltlenv/defaultenv.hh"
|
|
|
|
void f1()
|
|
{
|
|
auto d = spot::make_bdd_dict();
|
|
|
|
auto& e = spot::ltl::default_environment::instance();
|
|
|
|
auto tg = make_twa_graph(d);
|
|
|
|
auto* f1 = e.require("p1");
|
|
auto* f2 = e.require("p2");
|
|
bdd p1 = bdd_ithvar(d->register_proposition(f1, tg));
|
|
bdd p2 = bdd_ithvar(d->register_proposition(f2, tg));
|
|
tg->acc().add_sets(2);
|
|
f1->destroy();
|
|
f2->destroy();
|
|
|
|
auto s1 = tg->new_state();
|
|
auto s2 = tg->new_state();
|
|
auto s3 = tg->new_state();
|
|
tg->new_transition(s1, s1, bddfalse, 0U);
|
|
tg->new_transition(s1, s2, p1, 0U);
|
|
tg->new_transition(s1, s3, p2, tg->acc().mark(1));
|
|
tg->new_transition(s2, s3, p1 & p2, tg->acc().mark(0));
|
|
tg->new_transition(s3, s1, p1 | p2, tg->acc().marks({0, 1}));
|
|
tg->new_transition(s3, s2, p1 >> p2, 0U);
|
|
tg->new_transition(s3, s3, bddtrue, tg->acc().marks({0, 1}));
|
|
|
|
spot::dotty_reachable(std::cout, tg);
|
|
|
|
{
|
|
auto i = tg->get_graph().out_iteraser(s3);
|
|
++i;
|
|
i.erase();
|
|
i.erase();
|
|
assert(!i);
|
|
spot::dotty_reachable(std::cout, tg);
|
|
}
|
|
|
|
{
|
|
auto i = tg->get_graph().out_iteraser(s3);
|
|
i.erase();
|
|
assert(!i);
|
|
spot::dotty_reachable(std::cout, tg);
|
|
}
|
|
|
|
auto all = tg->acc().marks({0, 1});
|
|
tg->new_transition(s3, s1, p1 | p2, all);
|
|
tg->new_transition(s3, s2, p1 >> p2, 0U);
|
|
tg->new_transition(s3, s1, bddtrue, all);
|
|
|
|
std::cerr << tg->num_transitions() << '\n';
|
|
assert(tg->num_transitions() == 7);
|
|
|
|
spot::dotty_reachable(std::cout, tg);
|
|
tg->merge_transitions();
|
|
spot::dotty_reachable(std::cout, tg);
|
|
|
|
std::cerr << tg->num_transitions() << '\n';
|
|
assert(tg->num_transitions() == 5);
|
|
|
|
// Add enough states so that the state vector is reallocated.
|
|
for (unsigned i = 0; i < 100; ++i)
|
|
tg->new_state();
|
|
spot::dotty_reachable(std::cout, tg);
|
|
}
|
|
|
|
int main()
|
|
{
|
|
f1();
|
|
}
|