Commit 62f5b976 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

remove algorithms that where only used by dstar's dra2ba conversion

Since we just removed that conversion, those can go as well.  Yay!

* src/tests/kv.test, src/twa/twamask.cc,
src/twa/twamask.hh, src/twa/twaproxy.cc,
src/twa/twaproxy.hh, src/twaalgos/scc.cc,
src/twaalgos/scc.hh: Delete.
* src/twaalgos/Makefile.am, src/twa/Makefile.am,
src/tests/Makefile.am, src/tests/ikwiad.cc: adjust.
parent 9b5340b9
......@@ -199,7 +199,6 @@ TESTS_twa = \
degendet.test \
degenid.test \
degenlskip.test \
kv.test \
randomize.test \
lbttparse.test \
scc.test \
......
......@@ -53,7 +53,6 @@
#include "twaalgos/stats.hh"
#include "twaalgos/sccinfo.hh"
#include "twaalgos/emptiness_stats.hh"
#include "twaalgos/scc.hh"
#include "twaalgos/sccinfo.hh"
#include "twaalgos/isdet.hh"
#include "twaalgos/cycles.hh"
......@@ -268,8 +267,6 @@ syntax(char* prog)
<< "subtransitions)"
<< std::endl
<< " -K dump the graph of SCCs in dot format" << std::endl
<< " -KV verbosely dump the graph of SCCs in dot format"
<< std::endl
<< " -KC list cycles in automaton" << std::endl
<< " -KW list weak SCCs" << std::endl
<< " -N output the never clain for Spin (implies -DS)"
......@@ -556,10 +553,6 @@ checked_main(int argc, char** argv)
return 2;
tm.stop("reading -KP's argument");
}
else if (!strcmp(argv[formula_index], "-KV"))
{
output = 11;
}
else if (!strcmp(argv[formula_index], "-KC"))
{
output = 15;
......@@ -1485,24 +1478,7 @@ checked_main(int argc, char** argv)
break;
}
case 10:
{
auto aa =
std::dynamic_pointer_cast<const spot::twa_graph>(a);
if (!aa)
dump_scc_dot(a, std::cout, false);
else
dump_scc_info_dot(std::cout, aa);
}
break;
case 11:
{
//const spot::twa_graph_ptr g =
// dynamic_cast<const spot::twa_graph_ptr>(a);
//if (!g)
dump_scc_dot(a, std::cout, true);
//else
// dump_scc_info_dot(std::cout, g);
}
dump_scc_info_dot(std::cout, ensure_digraph(a));
break;
case 12:
stats_reachable(a).dump(std::cout);
......
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011, 2012 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/>.
. ./defs
set -e
check ()
{
run 0 ../ikwiad -f -KV "$1" > out.dot
test -z "$DOT" || "$DOT" out.dot > /dev/null
rm -f out.dot
}
# We don't check the output, but running these might be
# enough to trigger assertions in the code, or raise valgrind concerns.
check 'a R (b R c)'
check '(a U b) U (c U d)'
check '((Xp2)U(X(1)))&(p1 R(p2 R p0))'
# Make sure escaped variables print OK.
check '"G1"U"GG" && "FF"'
# Make sure we count 4 atomic propositions in
# G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"
# even after iterated simulation
# Report from Etienne Renault.
../ikwiad -KV -R3 -RIS >out \
'G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"'
x=`sed -n '/APrec/{
s/.*APrec=\[\([^]]*\)\].*/\1/p
q
}' out | tr ' ' '\n' | wc -l`
test "$x" -eq 4
......@@ -34,8 +34,6 @@ twa_HEADERS = \
taatgba.hh \
twa.hh \
twagraph.hh \
twamask.hh \
twaproxy.hh \
twaproduct.hh \
twasafracomplement.hh
......@@ -49,6 +47,4 @@ libtwa_la_SOURCES = \
twa.cc \
twagraph.cc \
twaproduct.cc \
twamask.cc \
twaproxy.cc \
twasafracomplement.cc
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 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 "twamask.hh"
#include <vector>
namespace spot
{
namespace
{
struct transition
{
const state* dest;
bdd cond;
acc_cond::mark_t acc;
};
typedef std::vector<transition> transitions;
struct succ_iter_filtered: public twa_succ_iterator
{
~succ_iter_filtered()
{
for (auto& t: trans_)
t.dest->destroy();
}
bool first()
{
it_ = trans_.begin();
return it_ != trans_.end();
}
bool next()
{
++it_;
return it_ != trans_.end();
}
bool done() const
{
return it_ == trans_.end();
}
state* current_state() const
{
return it_->dest->clone();
}
bdd current_condition() const
{
return it_->cond;
}
acc_cond::mark_t current_acceptance_conditions() const
{
return it_->acc;
}
transitions trans_;
transitions::const_iterator it_;
};
/// \ingroup twa_on_the_fly_algorithms
/// \brief A masked TGBA (abstract).
///
/// Ignores some states from a TGBA. What state are preserved or
/// ignored is controlled by the wanted() method.
///
/// This is an abstract class. You should inherit from it and
/// supply a wanted() method to specify which states to keep.
class twa_mask: public twa_proxy
{
protected:
/// \brief Constructor.
/// \param masked The automaton to mask
/// \param init Any state to use as initial state. This state will be
/// destroyed by the destructor.
twa_mask(const const_twa_ptr& masked, const state* init = 0):
twa_proxy(masked),
init_(init)
{
if (!init)
init_ = masked->get_init_state();
}
public:
virtual ~twa_mask()
{
init_->destroy();
}
virtual state* get_init_state() const
{
return init_->clone();
}
virtual twa_succ_iterator*
succ_iter(const state* local_state) const
{
succ_iter_filtered* res;
if (iter_cache_)
{
res = down_cast<succ_iter_filtered*>(iter_cache_);
res->trans_.clear();
iter_cache_ = nullptr;
}
else
{
res = new succ_iter_filtered;
}
for (auto it: original_->succ(local_state))
{
const spot::state* s = it->current_state();
auto acc = it->current_acceptance_conditions();
if (!wanted(s, acc))
{
s->destroy();
continue;
}
res->trans_.emplace_back
(transition {s, it->current_condition(), acc});
}
return res;
}
virtual bool wanted(const state* s, acc_cond::mark_t acc) const = 0;
protected:
const state* init_;
};
class twa_mask_keep: public twa_mask
{
const state_set& mask_;
public:
twa_mask_keep(const const_twa_ptr& masked,
const state_set& mask,
const state* init)
: twa_mask(masked, init),
mask_(mask)
{
}
bool wanted(const state* s, const acc_cond::mark_t) const
{
state_set::const_iterator i = mask_.find(s);
return i != mask_.end();
}
};
class twa_mask_ignore: public twa_mask
{
const state_set& mask_;
public:
twa_mask_ignore(const const_twa_ptr& masked,
const state_set& mask,
const state* init)
: twa_mask(masked, init),
mask_(mask)
{
}
bool wanted(const state* s, const acc_cond::mark_t) const
{
state_set::const_iterator i = mask_.find(s);
return i == mask_.end();
}
};
class twa_mask_acc_ignore: public twa_mask
{
unsigned mask_;
public:
twa_mask_acc_ignore(const const_twa_ptr& masked,
unsigned mask,
const state* init)
: twa_mask(masked, init),
mask_(mask)
{
}
bool wanted(const state*, const acc_cond::mark_t acc) const
{
return !acc.has(mask_);
}
};
}
const_twa_ptr
build_twa_mask_keep(const const_twa_ptr& to_mask,
const state_set& to_keep,
const state* init)
{
return std::make_shared<twa_mask_keep>(to_mask, to_keep, init);
}
const_twa_ptr
build_twa_mask_ignore(const const_twa_ptr& to_mask,
const state_set& to_ignore,
const state* init)
{
return std::make_shared<twa_mask_ignore>(to_mask, to_ignore, init);
}
const_twa_ptr
build_twa_mask_acc_ignore(const const_twa_ptr& to_mask,
unsigned to_ignore,
const state* init)
{
return std::make_shared<twa_mask_acc_ignore>(to_mask, to_ignore, init);
}
}
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014, 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/>.
#pragma once
#include <bddx.h>
#include "twaproxy.hh"
namespace spot
{
/// \ingroup twa_on_the_fly_algorithms
/// \brief Mask a TGBA, keeping a given set of states.
///
/// Mask the TGBA \a to_mask, keeping only the
/// states from \a to_keep. The initial state
/// can optionally be reset to \a init.
SPOT_API const_twa_ptr
build_twa_mask_keep(const const_twa_ptr& to_mask,
const state_set& to_keep,
const state* init = 0);
/// \ingroup twa_on_the_fly_algorithms
/// \brief Mask a TGBA, rejecting a given set of states.
///
/// Mask the TGBA \a to_mask, keeping only the states that are not
/// in \a to_ignore. The initial state can optionally be reset to
/// \a init.
SPOT_API const_twa_ptr
build_twa_mask_ignore(const const_twa_ptr& to_mask,
const state_set& to_ignore,
const state* init = 0);
/// \ingroup twa_on_the_fly_algorithms
/// \brief Mask a TGBA, rejecting some acceptance set of transitions.
///
/// This will ignore all transitions that have the TO_IGNORE
/// acceptance mark. The initial state can optionally be reset to
/// \a init.
///
/// Note that the acceptance condition of the automaton (i.e. the
/// set of all acceptance set) is not changed, because so far this
/// function is only needed in graph algorithms that do not call
/// all_acceptance_conditions().
SPOT_API const_twa_ptr
build_twa_mask_acc_ignore(const const_twa_ptr& to_mask,
unsigned to_ignore,
const state* init = 0);
}
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014, 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 "twaproxy.hh"
namespace spot
{
twa_proxy::twa_proxy(const const_twa_ptr& original)
: twa(original->get_dict()), original_(original)
{
get_dict()->register_all_variables_of(original, this);
acc_.add_sets(original->num_sets());
}
twa_proxy::~twa_proxy()
{
get_dict()->unregister_all_my_variables(this);
}
state* twa_proxy::get_init_state() const
{
return original_->get_init_state();
}
twa_succ_iterator*
twa_proxy::succ_iter(const state* state) const
{
if (iter_cache_)
{
original_->release_iter(iter_cache_);
iter_cache_ = nullptr;
}
return original_->succ_iter(state);
}
std::string
twa_proxy::format_state(const state* state) const
{
return original_->format_state(state);
}
std::string
twa_proxy::transition_annotation(const twa_succ_iterator* t) const
{
return original_->transition_annotation(t);
}
state*
twa_proxy::project_state(const state* s, const const_twa_ptr& t) const
{
return original_->project_state(s, t);
}
bdd
twa_proxy::compute_support_conditions(const state* state) const
{
return original_->support_conditions(state);
}
}
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014, 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/>.
#pragma once
#include "twa.hh"
namespace spot
{
/// \ingroup twa_on_the_fly_algorithms
/// \brief A TGBA proxy.
///
/// This implements a simple proxy to an existing
/// TGBA, forwarding all methods to the original.
/// By itself this class is pointless: better use the
/// original automaton right away. However it is useful
/// to inherit from this class and override some of its
/// methods to implement some on-the-fly algorithm.
class SPOT_API twa_proxy: public twa
{
protected:
twa_proxy(const const_twa_ptr& original);
public:
virtual ~twa_proxy();
virtual state* get_init_state() const;
virtual twa_succ_iterator*
succ_iter(const state* state) const;
virtual std::string format_state(const state* state) const;
virtual std::string
transition_annotation(const twa_succ_iterator* t) const;
virtual state* project_state(const state* s, const const_twa_ptr& t) const;
protected:
virtual bdd compute_support_conditions(const state* state) const;
const_twa_ptr original_;
};
}
......@@ -70,7 +70,6 @@ twaalgos_HEADERS = \
safety.hh \
sbacc.hh \
sccfilter.hh \
scc.hh \
sccinfo.hh \
se05.hh \
sepsets.hh \
......@@ -127,7 +126,6 @@ libtwaalgos_la_SOURCES = \
relabel.cc \
safety.cc \
sbacc.cc \
scc.cc \
sccinfo.cc \
sccfilter.cc \
se05.cc \
......
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2011, 2012, 2013, 2014, 2015 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 <queue>
#include <set>
#include <iostream>
#include <sstream>
#include "scc.hh"
#include "twa/bddprint.hh"
#include "misc/escape.hh"
namespace spot
{
scc_map::scc_map(const const_twa_ptr& aut)
: aut_(aut)
{
}
scc_map::~scc_map()
{
hash_type::iterator i = h_.begin();
while (i != h_.end())
{
// Advance the iterator before deleting the key.
const state* s = i->first;
++i;
s->destroy();
}
}
unsigned
scc_map::initial() const
{
state* in = aut_->get_init_state();
int val = scc_of_state(in);
in->destroy();
return val;
}
const scc_map::succ_type&
scc_map::succ(unsigned n) const
{
assert(scc_map_.size() > n);
return scc_map_[n].succ;
}
bool
scc_map::trivial(unsigned n) const
{
assert(scc_map_.size() > n);
return scc_map_[n].trivial;
}
bool
scc_map::accepting(unsigned n) const
{
if (scc_map_[n].trivial)
return false;
return aut_->acc().accepting(acc_set_of(n));
}
<