from_ltlf: new LTL transformation.
Fixes #187. * spot/tl/ltlf.cc, spot/tl/ltlf.hh: New files. * spot/tl/Makefile.am: Add them. * bin/ltlfilt.cc: Add a new option. * bin/man/ltlfilt.x: Add bibliographic reference. * tests/core/ltlfilt.test: Add more tests. * tests/python/ltlf.py: New file. * tests/Makefile.am: Add it. * python/spot/impl.i: Python bindings. * NEWS: Mention it.
This commit is contained in:
parent
fe1f754d2e
commit
2e69e04583
10 changed files with 226 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
## Copyright (C) 2015 Laboratoire de Recherche et Développement de
|
||||
## Copyright (C) 2015, 2016 Laboratoire de Recherche et Développement de
|
||||
## l'Epita (LRDE).
|
||||
##
|
||||
## This file is part of Spot, a model checking library.
|
||||
|
|
@ -32,6 +32,7 @@ tl_HEADERS = \
|
|||
exclusive.hh \
|
||||
formula.hh \
|
||||
length.hh \
|
||||
ltlf.hh \
|
||||
mutation.hh \
|
||||
nenoform.hh \
|
||||
parse.hh \
|
||||
|
|
@ -53,6 +54,7 @@ libtl_la_SOURCES = \
|
|||
exclusive.cc \
|
||||
formula.cc \
|
||||
length.cc \
|
||||
ltlf.cc \
|
||||
mark.cc \
|
||||
mark.hh \
|
||||
mutation.cc \
|
||||
|
|
|
|||
66
spot/tl/ltlf.cc
Normal file
66
spot/tl/ltlf.cc
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2016 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 <spot/tl/ltlf.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace
|
||||
{
|
||||
formula from_ltlf_aux(formula f, formula alive)
|
||||
{
|
||||
auto t = [&alive] (formula f) { return from_ltlf_aux(f, alive); };
|
||||
switch (auto o = f.kind())
|
||||
{
|
||||
case op::X:
|
||||
case op::F:
|
||||
return formula::unop(o, formula::And({alive, t(f[0])}));
|
||||
case op::G:
|
||||
return formula::G(formula::Or({formula::Not(alive), t(f[0])}));
|
||||
// Note that the t() function given in the proof of Theorem 1 of
|
||||
// the IJCAI'13 paper by De Giacomo & Vardi has a typo.
|
||||
// t(a U b) should be equal to t(a) U t(b & alive).
|
||||
// This typo is fixed in the Memocode'14 paper by Dutta & Vardi.
|
||||
case op::U:
|
||||
return formula::U(t(f[0]), formula::And({alive, t(f[1])}));
|
||||
case op::R:
|
||||
return formula::R(t(f[0]),
|
||||
formula::Or({formula::Not(alive), t(f[1])}));
|
||||
case op::M:
|
||||
return formula::M(formula::And({alive, t(f[0])}), t(f[1]));
|
||||
case op::W:
|
||||
return formula::W(formula::Or({formula::Not(alive), t(f[0])}),
|
||||
t(f[1]));
|
||||
default:
|
||||
return f.map(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
formula from_ltlf(formula f, const char* alive)
|
||||
{
|
||||
if (!f.is_ltl_formula())
|
||||
throw std::runtime_error("from_ltlf() only supports LTL formulas");
|
||||
auto al = ((*alive == '!')
|
||||
? formula::Not(formula::ap(alive + 1))
|
||||
: formula::ap(alive));
|
||||
return formula::And({from_ltlf_aux(f, al),
|
||||
formula::U(al, formula::G(formula::Not(al)))});
|
||||
}
|
||||
}
|
||||
50
spot/tl/ltlf.hh
Normal file
50
spot/tl/ltlf.hh
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2016 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/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <spot/tl/formula.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
/// \ingroup tl_rewriting
|
||||
/// \brief Convert an LTLf into an LTL formula.
|
||||
///
|
||||
/// This is based on De Giacomo & Vardi (IJCAI'13) reduction from
|
||||
/// LTLf (finite-LTL) to LTL.
|
||||
///
|
||||
/// In this reduction, finite words are extended into infinite words
|
||||
/// in which a new atomic proposition <code>alive</code> marks the
|
||||
/// prefix of the infinite word that corresponds to the original
|
||||
/// finite word. The formula is rewritten to ensure that the
|
||||
/// eventualities occur during the "alive" portion. For instance
|
||||
/// <code>a U b</code> becomes
|
||||
/// <code>(a U (b & alive))&(alive U G!alive)</code>.
|
||||
///
|
||||
/// The \a alive argument can be used to change the name of the
|
||||
/// atomic property used to introduce. Additionally if \a alive is
|
||||
/// a string starting with and exclamation mark, e.g.,
|
||||
/// <code>!dead</code> then the atomic property will be built from
|
||||
/// the rest of the string, and its negation will be used in the
|
||||
/// transformation. Using <code>!dead</code> rather than
|
||||
/// <code>alive</code> makes more sense if the state-space
|
||||
/// introduces a <code>dead</code> property on states representing
|
||||
/// the end of finite computations.
|
||||
SPOT_API formula from_ltlf(formula f, const char* alive = "alive");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue