ltldo: automatic renaming of AP
* src/bin/ltldo.cc: Relabel formula and output automata as needed. * src/tgbaalgos/relabel.cc, src/tgbaalgos/relabel.hh: New files. * src/tgbaalgos/Makefile.am: Add them. * src/tgbatest/ltldo.test: Add some tests. * doc/org/ltldo.org: Document this.
This commit is contained in:
parent
a4a0cf3bb2
commit
259c9faaae
6 changed files with 246 additions and 1 deletions
|
|
@ -60,6 +60,7 @@ tgbaalgos_HEADERS = \
|
|||
randomize.hh \
|
||||
reachiter.hh \
|
||||
reducerun.hh \
|
||||
relabel.hh \
|
||||
replayrun.hh \
|
||||
safety.hh \
|
||||
save.hh \
|
||||
|
|
@ -111,6 +112,7 @@ libtgbaalgos_la_SOURCES = \
|
|||
reachiter.cc \
|
||||
reducerun.cc \
|
||||
replayrun.cc \
|
||||
relabel.cc \
|
||||
safety.cc \
|
||||
save.cc \
|
||||
scc.cc \
|
||||
|
|
|
|||
43
src/tgbaalgos/relabel.cc
Normal file
43
src/tgbaalgos/relabel.cc
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2015 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 "relabel.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
void
|
||||
relabel_here(tgba_digraph_ptr& aut, ltl::relabeling_map* relmap)
|
||||
{
|
||||
bddPair* pairs = bdd_newpair();
|
||||
auto d = aut->get_dict();
|
||||
std::vector<int> vars;
|
||||
vars.reserve(relmap->size());
|
||||
for (auto& p: *relmap)
|
||||
{
|
||||
int oldv = d->register_proposition(p.first, aut);
|
||||
int newv = d->register_proposition(p.second, aut);
|
||||
bdd_setpair(pairs, oldv, newv);
|
||||
vars.push_back(oldv);
|
||||
}
|
||||
for (auto& t: aut->transitions())
|
||||
t.cond = bdd_replace(t.cond, pairs);
|
||||
for (auto v: vars)
|
||||
d->unregister_variable(v, aut);
|
||||
}
|
||||
}
|
||||
34
src/tgbaalgos/relabel.hh
Normal file
34
src/tgbaalgos/relabel.hh
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2015 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/>.
|
||||
|
||||
#ifndef SPOT_TGBAALGOS_RELABEL_HH
|
||||
#define SPOT_TGBAALGOS_RELABEL_HH
|
||||
|
||||
#include "ltlvisit/relabel.hh"
|
||||
#include "tgba/tgbagraph.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
/// replace atomic propositions in an automaton
|
||||
SPOT_API void
|
||||
relabel_here(tgba_digraph_ptr& aut,
|
||||
ltl::relabeling_map* relmap);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_RELABEL_HH
|
||||
Loading…
Add table
Add a link
Reference in a new issue