Preliminary implementation of Testing Automata.

* configure.ac: Generate src/ta/Makefile and src/taalgos/Makefile.
* src/Makefile.am (SUBDIRS): Add them.
* src/tgbatest/ltl2tgba.cc (main): Add option -TA.
* src/ta/Makefile.am, src/ta/ta.hh, src/ta/taexplicit.cc,
src/ta/taexplicit.hh, src/taalgos/Makefile.am,
src/taalgos/dotty.cc, src/taalgos/dotty.hh,
src/taalgos/reachiter.cc, src/taalgos/reachiter.hh,
src/taalgos/sba2ta.cc, src/taalgos/sba2ta.hh: New files.
This commit is contained in:
Ala Eddine 2010-12-02 12:04:29 +01:00 committed by Alexandre Duret-Lutz
parent c373a2f35e
commit ba47b821c6
14 changed files with 1738 additions and 8 deletions

197
src/ta/taexplicit.hh Normal file
View file

@ -0,0 +1,197 @@
// Copyright (C) 2010 Laboratoire de Recherche et Developpement
// de l Epita_explicit (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 2 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 MERCHANta_explicitBILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more deta_explicitils.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#ifndef SPOT_TA_TAEXPLICIT_HH
# define SPOT_TA_TAEXPLICIT_HH
#include "misc/hash.hh"
#include <list>
#include "tgba/tgba.hh"
#include <set>
#include "ltlast/formula.hh"
#include <cassert>
#include "misc/bddlt.hh"
#include "ta.hh"
namespace spot
{
// Forward declarations. See below.
class state_ta_explicit;
class ta_explicit_succ_iterator;
class ta_explicit;
/// ta_explicit explicit representa_explicittion of a Testing Automata_explicit
class ta_explicit : public ta
{
public:
ta_explicit(const tgba* tgba_);
const tgba*
get_tgba() const;
state_ta_explicit*
add_state(state_ta_explicit* s);
state_ta_explicit*
add_initial_state(state_ta_explicit* s);
void
create_transition(state_ta_explicit* source, bdd condition, state_ta_explicit* dest);
void
delete_stuttering_transitions();
// ta interface
virtual
~ta_explicit();
virtual const states_set_t*
get_initial_states_set() const;
virtual ta_succ_iterator*
succ_iter(const spot::state* s) const;
virtual bdd_dict*
get_dict() const;
virtual std::string
format_state(const spot::state* s) const;
virtual bool
is_accepting_state(const spot::state* s) const;
virtual bool
is_livelock_accepting_state(const spot::state* s) const;
virtual bool
is_initial_state(const spot::state* s) const;
virtual bdd
get_state_condition(const spot::state* s) const;
private:
// Disallow copy.
ta_explicit(const ta_explicit& other);
ta_explicit&
operator=(const ta_explicit& other);
ta::states_set_t states_set_;
ta::states_set_t initial_states_set_;
const tgba* tgba_;
};
/// states used by spot::ta_explicit.
/// \ingroup ta_
class state_ta_explicit : public spot::state
{
public:
struct transition
{
bdd condition;
state_ta_explicit* dest;
};
typedef std::list<transition*> transitions;
state_ta_explicit(const state* tgba_state, const bdd tgba_condition,
bool is_initial_state = false, bool is_accepting_state = false,
bool is_livelock_accepting_state = false, transitions* trans = 0) :
tgba_state_(tgba_state), tgba_condition_(tgba_condition),
is_initial_state_(is_initial_state), is_accepting_state_(
is_accepting_state), is_livelock_accepting_state_(
is_livelock_accepting_state), transitions_(trans)
{
}
virtual int
compare(const spot::state* other) const;
virtual size_t
hash() const;
virtual state_ta_explicit*
clone() const;
virtual
~state_ta_explicit()
{
}
transitions*
get_transitions() const;
void
add_transition(transition* t);
const state*
get_tgba_state() const;
const bdd
get_tgba_condition() const;
bool
is_accepting_state() const;
void
set_accepting_state(bool is_accepting_state);
bool
is_livelock_accepting_state() const;
void
set_livelock_accepting_state(bool is_livelock_accepting_state);
bool
is_initial_state() const;
void
set_initial_state(bool is_initial_state);
private:
const state* tgba_state_;
const bdd tgba_condition_;
bool is_initial_state_;
bool is_accepting_state_;
bool is_livelock_accepting_state_;
transitions* transitions_;
};
/// Successor iterators used by spot::ta_explicit.
class ta_explicit_succ_iterator : public ta_succ_iterator
{
public:
ta_explicit_succ_iterator(const state_ta_explicit* s);
virtual void
first();
virtual void
next();
virtual bool
done() const;
virtual state*
current_state() const;
virtual bdd
current_condition() const;
private:
state_ta_explicit::transitions* transitions_;
state_ta_explicit::transitions::const_iterator i_;
};
}
#endif // SPOT_TA_TAEXPLICIT_HH