Commit 51fe5108 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

Remove support for state-based alternating automata.

This was never actually used and we have a new implementation of
alternating automata coming.

* src/saba/, src/sabaalgos/, src/sabatest/: Remove.
* src/Makefile.am, configure.ac, README: Adjust.
* NEWS: Mention it.
parent 2c764fb3
...@@ -119,6 +119,9 @@ New in spot 1.99a (not yet released) ...@@ -119,6 +119,9 @@ New in spot 1.99a (not yet released)
has been removed too, because it was only used by the KV has been removed too, because it was only used by the KV
complementation. complementation.
- The unused implementation of state-based alternating Büchi automata
has been removed.
New in spot 1.2.5a (not yet released) New in spot 1.2.5a (not yet released)
* New features: * New features:
......
...@@ -166,9 +166,6 @@ src/ Sources for libspot. ...@@ -166,9 +166,6 @@ src/ Sources for libspot.
ta/ TA objects and cousins (TGTA). ta/ TA objects and cousins (TGTA).
taalgos/ Algorithms on TA/TGTA. taalgos/ Algorithms on TA/TGTA.
tgbatest/ Tests for tgba/, tgbaalgos/, tgbaparse/, ta/ and taalgos/. tgbatest/ Tests for tgba/, tgbaalgos/, tgbaparse/, ta/ and taalgos/.
saba/ SABA (State-labeled Alternating Büchi Automata) objects.
sabaalgos/ Algorithms on SABA.
sabatest/ Tests for saba/, sabaalgos/.
sanity/ Sanity tests for the whole project. sanity/ Sanity tests for the whole project.
doc/ Documentation for libspot. doc/ Documentation for libspot.
org/ Source of userdoc/ as org-mode files. org/ Source of userdoc/ as org-mode files.
......
...@@ -193,10 +193,6 @@ AC_CONFIG_FILES([ ...@@ -193,10 +193,6 @@ AC_CONFIG_FILES([
src/neverparse/Makefile src/neverparse/Makefile
src/priv/Makefile src/priv/Makefile
src/sanity/Makefile src/sanity/Makefile
src/saba/Makefile
src/sabaalgos/Makefile
src/sabatest/defs
src/sabatest/Makefile
src/tgbaalgos/gtec/Makefile src/tgbaalgos/gtec/Makefile
src/tgbaalgos/Makefile src/tgbaalgos/Makefile
src/tgba/Makefile src/tgba/Makefile
......
...@@ -26,9 +26,9 @@ AUTOMAKE_OPTIONS = subdir-objects ...@@ -26,9 +26,9 @@ AUTOMAKE_OPTIONS = subdir-objects
# end, after building '.' (since the current directory contains # end, after building '.' (since the current directory contains
# libspot.la needed by the tests) # libspot.la needed by the tests)
SUBDIRS = misc priv ltlenv ltlast ltlvisit ltlparse graph tgba \ SUBDIRS = misc priv ltlenv ltlast ltlvisit ltlparse graph tgba \
tgbaalgos tgbaparse ta taalgos kripke saba sabaalgos \ tgbaalgos tgbaparse ta taalgos kripke neverparse \
neverparse kripkeparse dstarparse . bin ltltest graphtest \ kripkeparse dstarparse . bin ltltest graphtest tgbatest \
tgbatest sabatest kripketest sanity kripketest sanity
lib_LTLIBRARIES = libspot.la lib_LTLIBRARIES = libspot.la
libspot_la_SOURCES = libspot_la_SOURCES =
...@@ -44,8 +44,6 @@ libspot_la_LIBADD = \ ...@@ -44,8 +44,6 @@ libspot_la_LIBADD = \
misc/libmisc.la \ misc/libmisc.la \
neverparse/libneverparse.la \ neverparse/libneverparse.la \
priv/libpriv.la \ priv/libpriv.la \
sabaalgos/libsabaalgos.la \
saba/libsaba.la \
taalgos/libtaalgos.la \ taalgos/libtaalgos.la \
ta/libta.la \ ta/libta.la \
tgbaalgos/libtgbaalgos.la \ tgbaalgos/libtgbaalgos.la \
......
## -*- coding: utf-8 -*-
## Copyright (C) 2009, 2011, 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/>.
AM_CPPFLAGS = -I$(srcdir)/.. -I.. $(BUDDY_CPPFLAGS)
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
sabadir = $(pkgincludedir)/saba
saba_HEADERS = \
explicitstateconjunction.hh \
saba.hh \
sabastate.hh \
sabasucciter.hh \
sabacomplementtgba.hh
noinst_LTLIBRARIES = libsaba.la
libsaba_la_SOURCES = \
explicitstateconjunction.cc \
saba.cc \
sabacomplementtgba.cc
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012 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 "explicitstateconjunction.hh"
namespace spot
{
/// explicit_state_conjunction
////////////////////////////////////////
explicit_state_conjunction::explicit_state_conjunction()
{
}
explicit_state_conjunction::
explicit_state_conjunction(const explicit_state_conjunction* other)
: set_(other->set_)
{
}
explicit_state_conjunction&
explicit_state_conjunction::operator=(const explicit_state_conjunction& o)
{
if (this != &o)
{
this->~explicit_state_conjunction();
new (this) explicit_state_conjunction(&o);
}
return *this;
}
explicit_state_conjunction::~explicit_state_conjunction()
{
}
void
explicit_state_conjunction::first()
{
it_ = set_.begin();
}
void
explicit_state_conjunction::next()
{
++it_;
}
bool
explicit_state_conjunction::done() const
{
return it_ == set_.end();
}
explicit_state_conjunction*
explicit_state_conjunction::clone() const
{
return new explicit_state_conjunction(this);
}
saba_state*
explicit_state_conjunction::current_state() const
{
return (*it_)->clone();
}
void
explicit_state_conjunction::add(saba_state* state)
{
set_.insert(shared_saba_state(state));
}
} // end namespace spot.
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012, 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/>.
#ifndef SPOT_SABA_EXPLICITSTATECONJUNCTION_HH
# define SPOT_SABA_EXPLICITSTATECONJUNCTION_HH
#include "misc/common.hh"
#include "misc/hash.hh"
#include "sabasucciter.hh"
namespace spot
{
/// \ingroup saba_essentials
/// \brief Basic implementation of saba_state_conjunction.
///
/// This class provides a basic implementation to
/// iterate over a conjunction of states of a saba.
class SPOT_API explicit_state_conjunction : public saba_state_conjunction
{
public:
explicit_state_conjunction();
explicit_state_conjunction(const explicit_state_conjunction* other);
virtual ~explicit_state_conjunction();
explicit_state_conjunction& operator=(const explicit_state_conjunction& o);
/// \name Iteration
//@{
virtual void first();
virtual void next();
virtual bool done() const;
//@}
/// \name Inspection
//@{
/// Duplicate a this conjunction.
explicit_state_conjunction* clone() const;
/// Return the a new instance on the current state.
/// This is the caller responsibility to delete the returned state.
virtual saba_state* current_state() const;
//@}
/// Add a new state in the conjunction.
/// The class becomes owner of \a state.
void add(saba_state* state);
private:
typedef std::unordered_set<shared_saba_state,
saba_state_shared_ptr_hash,
saba_state_shared_ptr_equal> saba_state_set_t;
saba_state_set_t set_;
saba_state_set_t::iterator it_;
};
} // end namespace spot.
#endif // SPOT_SABA_EXPLICITSTATECONJUNCTION_HH
// Copyright (C) 2009 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 "saba.hh"
namespace spot
{
saba::saba()
: num_acc_(-1)
{
}
saba::~saba()
{
}
unsigned int
saba::number_of_acceptance_conditions() const
{
if (num_acc_ < 0)
{
bdd all = all_acceptance_conditions();
unsigned int n = 0;
while (all != bddfalse)
{
++n;
all -= bdd_satone(all);
}
num_acc_ = n;
}
return num_acc_;
}
} // end namespace spot.
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 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/>.
#ifndef SPOT_SABA_SABA_HH
# define SPOT_SABA_SABA_HH
#include "sabastate.hh"
#include "sabasucciter.hh"
#include <tgba/bdddict.hh>
namespace spot
{
/// \defgroup saba SABA (State-based Alternating Büchi Automata)
///
/// Spot was centered around non-deterministic \ref tgba.
/// Alternating automata are an extension to non-deterministic
/// automata, and are presented with spot::saba.
/// This type and its cousins are listed \ref saba_essentials "here".
/// This is an abstract interface.
/// \addtogroup saba_essentials Essential SABA types
/// \ingroup saba
/// \ingroup saba_essentials
/// \brief A State-based Alternating (Generalized) Büchi Automaton.
///
/// Browsing such automaton can be achieved using two functions:
/// \c get_init_state, and \c succ_iter. The former returns
/// the initial state while the latter lists the
/// successor states of any state.
///
/// Note that although this is a transition-based automata,
/// we never represent transitions! Transition informations are
/// obtained by querying the iterator over the successors of
/// a state.
class SPOT_API saba
{
protected:
saba();
public:
virtual ~saba();
/// \brief Get the initial state of the automaton.
///
/// The state has been allocated with \c new. It is the
/// responsability of the caller to \c delete it when no
/// longer needed.
virtual saba_state* get_init_state() const = 0;
/// \brief Get an iterator over the successors of \a local_state.
///
/// The iterator has been allocated with \c new. It is the
/// responsability of the caller to \c delete it when no
/// longer needed.
///
/// \param local_state The state whose successors are to be explored.
/// This pointer is not adopted in any way by \c succ_iter, and
/// it is still the caller's responsability to delete it when
/// appropriate (this can be done during the lifetime of
/// the iterator).
virtual saba_succ_iterator*
succ_iter(const saba_state* local_state) const = 0;
/// \brief Get the dictionary associated to the automaton.
///
/// State are represented as BDDs. The dictionary allows
/// to map BDD variables back to formulae, and vice versa.
/// This is useful when dealing with several automata (which
/// may use the same BDD variable for different formula),
/// or simply when printing.
virtual bdd_dict_ptr get_dict() const = 0;
/// \brief Format the state as a string for printing.
///
/// This formating is the responsability of the automata
/// that owns the state.
virtual std::string format_state(const saba_state* state) const = 0;
/// \brief Return the set of all acceptance conditions used
/// by this automaton.
///
/// The goal of the emptiness check is to ensure that
/// a strongly connected component walks through each
/// of these acceptiong conditions. I.e., the union
/// of the acceptiong conditions of all transition in
/// the SCC should be equal to the result of this function.
virtual bdd all_acceptance_conditions() const = 0;
/// The number of acceptance conditions.
virtual unsigned int number_of_acceptance_conditions() const;
private:
mutable int num_acc_;
};
typedef std::shared_ptr<saba> saba_ptr;
typedef std::shared_ptr<const saba> const_saba_ptr;
} // end namespace spot.
#endif // SPOT_SABA_SABA_HH
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2012, 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 <vector>
#include <cassert>
#include <sstream>
#include "bdd.h"
#include "tgba/bddprint.hh"
#include "tgba/tgba.hh"
#include "misc/hash.hh"
#include "misc/bddlt.hh"
#include "tgbaalgos/degen.hh"
#include "tgbaalgos/bfssteps.hh"
#include "misc/hashfunc.hh"
#include "ltlast/formula.hh"
#include "ltlast/constant.hh"
#include "priv/countstates.hh"
#include "sabacomplementtgba.hh"
#include "explicitstateconjunction.hh"
namespace spot
{
namespace
{
// typedefs.
typedef int rank_t;
////////////////////////////////////////
// saba_state_complement_tgba
/// States used by spot::saba_complement_tgba.
/// A state gather a spot::state* and a rank.
/// \ingroup saba_representation
class saba_state_complement_tgba : public saba_state
{
public:
saba_state_complement_tgba();
saba_state_complement_tgba(const saba_state_complement_tgba* state_taa);
saba_state_complement_tgba(shared_state state, rank_t rank,
bdd condition);
virtual ~saba_state_complement_tgba() {}
virtual int compare(const saba_state* other) const;
virtual size_t hash() const;
virtual saba_state_complement_tgba* clone() const;
virtual bdd acceptance_conditions() const;
const state* get_state() const;
rank_t get_rank() const;
private:
shared_state state_;
rank_t rank_;
bdd condition_;
};
saba_state_complement_tgba::saba_state_complement_tgba(shared_state state,
rank_t rank,
bdd condition)
: state_(state), rank_(rank), condition_(condition)
{
}
saba_state_complement_tgba::
saba_state_complement_tgba(const saba_state_complement_tgba* state_taa)
: state_(state_taa->state_), rank_(state_taa->rank_),
condition_(state_taa->condition_)
{
}
int
saba_state_complement_tgba::compare(const saba_state* o) const
{
const saba_state_complement_tgba* other =
dynamic_cast<const saba_state_complement_tgba*>(o);
int compare_value = get_state()->compare(other->get_state());
if (compare_value != 0)
return compare_value;
if (get_rank() != other->get_rank())
return get_rank() - other->get_rank();
return acceptance_conditions().id() -
other->acceptance_conditions().id();
}
size_t
saba_state_complement_tgba::hash() const
{
size_t hash = get_state()->hash() ^ wang32_hash(get_rank());
hash ^= wang32_hash(acceptance_conditions().id());
return hash;
}
saba_state_complement_tgba*
saba_state_complement_tgba::clone() const
{
return new saba_state_complement_tgba(*this);
}
bdd
saba_state_complement_tgba::acceptance_conditions() const
{
if ((get_rank() & 1) == 1)
return condition_;
else
return bddfalse;
}
const state*
saba_state_complement_tgba::get_state() const
{
return state_.get();
}
rank_t
saba_state_complement_tgba::get_rank() const
{
return rank_;
}
/// Successor iterators used by spot::saba_complement_tgba.
/// \ingroup saba_representation
///
/// Since the algorithm works on-the-fly, the key components of the
/// algorithm are implemented in this class.
///
class saba_complement_tgba_succ_iterator: public saba_succ_iterator
{
public:
typedef std::list<saba_state_conjunction*> state_conjunction_list_t;
typedef std::map<bdd, state_conjunction_list_t, bdd_less_than>
bdd_list_t;
saba_complement_tgba_succ_iterator(const const_tgba_digraph_ptr&
automaton,
bdd the_acceptance_cond,
const saba_state_complement_tgba*
origin);
virtual ~saba_complement_tgba_succ_iterator();
virtual void first();
virtual void next();
virtual bool done() const;
virtual saba_state_conjunction* current_conjunction() const;
virtual bdd current_condition() const;
private:
void get_atomics(std::set<int>& list, bdd c);
void get_conj_list();
void state_conjunction();
void delete_condition_list();
const_tgba_digraph_ptr automaton_;
bdd the_acceptance_cond_;
const saba_state_complement_tgba* origin_;
bdd_list_t condition_list_;
bdd_list_t::const_iterator current_condition_;
state_conjunction_list_t::const_iterator current_conjunction_;
state_conjunction_list_t::const_iterator current_end_conjunction_;
};
saba_complement_tgba_succ_iterator::
saba_complement_tgba_succ_iterator(const const_tgba_digraph_ptr& automaton,
bdd the_acceptance_cond,
const saba_state_complement_tgba* origin)
: automaton_(automaton), the_acceptance_cond_(the_acceptance_cond),