twa: store property bits as trivals

* spot/twa/twa.hh: Store property bits as trivals.
* NEWS: Mention the change.
* spot/parseaut/parseaut.yy, spot/twaalgos/are_isomorphic.cc,
spot/twaalgos/complete.cc, spot/twaalgos/dot.cc, spot/twaalgos/hoa.cc,
spot/twaalgos/isdet.cc, spot/twaalgos/isunamb.cc, spot/twaalgos/lbtt.cc,
spot/twaalgos/ltl2tgba_fm.cc, spot/twaalgos/postproc.cc,
spot/twaalgos/remfin.cc, spot/twaalgos/strength.cc,
spot/twaalgos/stutter.cc, spot/twaalgos/stutter.hh,
spot/twaalgos/totgba.cc, tests/core/ikwiad.cc,
tests/python/product.ipynb, tests/python/remfin.py: Adjust.
* doc/org/hoa.org, doc/org/tut21.org: Update documentation.
This commit is contained in:
Alexandre Duret-Lutz 2016-01-12 19:37:18 +01:00
parent 1aeb260adf
commit da391492f3
22 changed files with 337 additions and 258 deletions

View file

@ -1,6 +1,6 @@
/* -*- coding: utf-8 -*-
** Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement
** de l'Epita (LRDE).
** Copyright (C) 2014, 2015, 2016 Laboratoire de Recherche et
** Développement de l'Epita (LRDE).
**
** This file is part of Spot, a model checking library.
**
@ -132,7 +132,7 @@ extern "C" int strverscmp(const char *s1, const char *s2);
bool accept_all_seen = false;
bool aliased_states = false;
bool deterministic = false;
spot::trival deterministic = spot::trival::maybe();
bool complete = false;
bool trans_acc_seen = false;
@ -457,12 +457,25 @@ header: format-version header-items
auto& a = res.aut_or_ks;
auto& p = res.props;
auto e = p.end();
a->prop_stutter_invariant(p.find("stutter-invariant") != e);
a->prop_stutter_sensitive(p.find("stutter-sensitive") != e);
a->prop_inherently_weak(p.find("inherently-weak") != e);
a->prop_weak(p.find("weak") != e);
a->prop_terminal(p.find("terminal") != e);
a->prop_unambiguous(p.find("unambiguous") != e);
if (p.find("stutter-invariant") != e)
{
a->prop_stutter_invariant(true);
auto i = p.find("stutter-sensitive");
if (i != e)
error(i->second,
"automaton cannot be both stutter-invariant"
"and stutter-sensitive");
}
if (p.find("stutter-sensitive") != e)
a->prop_stutter_invariant(false);
if (p.find("inherently-weak") != e)
a->prop_inherently_weak(true);
if (p.find("weak") != e)
a->prop_weak(true);
if (p.find("terminal") != e)
a->prop_terminal(true);
if (p.find("unambiguous") != e)
a->prop_unambiguous(true);
}
}
@ -952,8 +965,9 @@ state: state-name labeled-edges
}
| error
{
// Assume the worse.
res.deterministic = false;
// Assume the worse. This skips the tests about determinism
// we might perform on the state.
res.deterministic = spot::trival::maybe();
res.complete = false;
}
@ -1242,8 +1256,8 @@ dstar_header: dstar_sizes
res.h->aut->new_states(res.states);;
res.info_states.resize(res.states);
}
res.h->aut->prop_state_acc(true);
res.h->aut->prop_deterministic(true);
res.acc_style = State_Acc;
res.deterministic = true;
// res.h->aut->prop_complete();
fill_guards(res);
res.cur_guard = res.guards.end();
@ -1394,8 +1408,7 @@ never: "never"
}
res.namer = res.h->aut->create_namer<std::string>();
res.h->aut->set_buchi();
res.h->aut->prop_state_acc(true);
res.acc_state = State_Acc;
res.acc_style = State_Acc;
res.pos_acc_sets = res.h->aut->acc().all_sets();
}
'{' nc-states '}'
@ -1658,8 +1671,7 @@ lbtt-header-states: LBTT
lbtt-header: lbtt-header-states INT_S
{
res.acc_mapper = new spot::acc_mapper_int(res.h->aut, $2);
res.h->aut->prop_state_acc(true);
res.acc_state = State_Acc;
res.acc_style = State_Acc;
}
| lbtt-header-states INT
{

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2011, 2013, 2014, 2015 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// Copyright (C) 2009, 2011, 2013, 2014, 2015, 2016 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
@ -34,6 +34,7 @@
#include <spot/misc/casts.hh>
#include <spot/misc/hash.hh>
#include <spot/tl/formula.hh>
#include <spot/misc/trival.hh>
namespace spot
{
@ -757,14 +758,13 @@ namespace spot
// holds, but false means the property is unknown.
struct bprop
{
bool state_based_acc:1; // State-based acceptance.
bool inherently_weak:1; // Inherently Weak automaton.
bool weak:1; // Weak automaton.
bool terminal:1; // Terminal automaton.
bool deterministic:1; // Deterministic automaton.
bool unambiguous:1; // Unambiguous automaton.
bool stutter_invariant:1; // Stutter invariant language.
bool stutter_sensitive:1; // Stutter sensitive language.
trival::repr_t state_based_acc:2; // State-based acceptance.
trival::repr_t inherently_weak:2; // Inherently Weak automaton.
trival::repr_t weak:2; // Weak automaton.
trival::repr_t terminal:2; // Terminal automaton.
trival::repr_t deterministic:2; // Deterministic automaton.
trival::repr_t unambiguous:2; // Unambiguous automaton.
trival::repr_t stutter_invariant:2; // Stutter invariant language.
};
union
{
@ -810,104 +810,92 @@ namespace spot
named_prop_.clear();
}
bool prop_state_acc() const
trival prop_state_acc() const
{
return is.state_based_acc;
}
void prop_state_acc(bool val)
void prop_state_acc(trival val)
{
is.state_based_acc = val;
is.state_based_acc = val.val();
}
bool is_sba() const
trival is_sba() const
{
return prop_state_acc() && acc().is_buchi();
}
bool prop_inherently_weak() const
trival prop_inherently_weak() const
{
return is.inherently_weak;
}
void prop_inherently_weak(bool val)
void prop_inherently_weak(trival val)
{
is.inherently_weak = val;
is.inherently_weak = val.val();
if (!val)
is.terminal = is.weak = val.val();
}
bool prop_terminal() const
trival prop_terminal() const
{
return is.terminal;
}
void prop_terminal(bool val)
void prop_terminal(trival val)
{
is.terminal = val.val();
if (val)
is.inherently_weak = is.weak = is.terminal = true;
else
is.terminal = false;
is.inherently_weak = is.weak = val.val();
}
bool prop_weak() const
trival prop_weak() const
{
return is.weak;
}
void prop_weak(bool val)
void prop_weak(trival val)
{
is.weak = val.val();
if (val)
is.inherently_weak = is.weak = true;
else
is.weak = false;
is.inherently_weak = val.val();
if (!val)
is.terminal = val.val();
}
bool prop_deterministic() const
trival prop_deterministic() const
{
return is.deterministic;
}
void prop_deterministic(bool val)
void prop_deterministic(trival val)
{
is.deterministic = val.val();
if (val)
{
// deterministic implies unambiguous
is.deterministic = true;
is.unambiguous = true;
}
else
{
is.deterministic = false;
}
// deterministic implies unambiguous
is.unambiguous = val.val();
}
bool prop_unambiguous() const
trival prop_unambiguous() const
{
return is.unambiguous;
}
void prop_unambiguous(bool val)
void prop_unambiguous(trival val)
{
is.unambiguous = val;
is.unambiguous = val.val();
if (!val)
is.deterministic = val.val();
}
bool prop_stutter_invariant() const
trival prop_stutter_invariant() const
{
return is.stutter_invariant;
}
bool prop_stutter_sensitive() const
void prop_stutter_invariant(trival val)
{
return is.stutter_sensitive;
}
void prop_stutter_invariant(bool val)
{
is.stutter_invariant = val;
}
void prop_stutter_sensitive(bool val)
{
is.stutter_sensitive = val;
is.stutter_invariant = val.val();
}
struct prop_set
@ -941,32 +929,26 @@ namespace spot
prop_unambiguous(other->prop_unambiguous());
}
if (p.stutter_inv)
{
prop_stutter_invariant(other->prop_stutter_invariant());
prop_stutter_sensitive(other->prop_stutter_sensitive());
}
prop_stutter_invariant(other->prop_stutter_invariant());
}
void prop_keep(prop_set p)
{
if (!p.state_based)
prop_state_acc(false);
prop_state_acc(trival::maybe());
if (!p.inherently_weak)
{
prop_terminal(false);
prop_weak(false);
prop_inherently_weak(false);
prop_terminal(trival::maybe());
prop_weak(trival::maybe());
prop_inherently_weak(trival::maybe());
}
if (!p.deterministic)
{
prop_deterministic(false);
prop_unambiguous(false);
prop_deterministic(trival::maybe());
prop_unambiguous(trival::maybe());
}
if (!p.stutter_inv)
{
prop_stutter_invariant(false);
prop_stutter_sensitive(false);
}
prop_stutter_invariant(trival::maybe());
}
};

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014, 2015 Laboratoire de Recherche et
// Copyright (C) 2014, 2015, 2016 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -113,9 +113,16 @@ namespace spot
isomorphism_checker::isomorphism_checker(const const_twa_graph_ptr ref)
{
ref_ = make_twa_graph(ref, twa::prop_set::all());
ref_deterministic_ = ref_->prop_deterministic();
if (!ref_deterministic_)
trival prop_det = ref_->prop_deterministic();
if (prop_det)
{
ref_deterministic_ = true;
}
else
{
// Count the number of state even if we know that the
// automaton is non-deterministic, as this can be used to
// decide if two automata are non-isomorphic.
nondet_states_ = spot::count_nondet_states(ref_);
ref_deterministic_ = (nondet_states_ == 0);
}
@ -125,10 +132,10 @@ namespace spot
bool
isomorphism_checker::is_isomorphic_(const const_twa_graph_ptr aut)
{
bool autdet = aut->prop_deterministic();
trival autdet = aut->prop_deterministic();
if (ref_deterministic_)
{
if (autdet || spot::is_deterministic(aut))
if (autdet || (!autdet && spot::is_deterministic(aut)))
return are_isomorphic_det(ref_, aut);
}
else

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et
// Copyright (C) 2013, 2014, 2015, 2016 Laboratoire de Recherche et
// Développement de l'Epita.
//
// This file is part of Spot, a model checking library.
@ -114,7 +114,7 @@ namespace spot
}
// In case the automaton use state-based acceptance, propagate
// the acceptance of the first edge to the one we add.
if (!aut->prop_state_acc())
if (aut->prop_state_acc() != true)
acc = 0U;
aut->new_edge(i, sink, missingcond, acc);
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2014, 2015 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE).
// Copyright (C) 2011, 2012, 2014, 2015, 2016 Laboratoire de Recherche
// et Developpement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -499,7 +499,8 @@ namespace spot
}
if (opt_name_)
name_ = aut_->get_named_prop<std::string>("automaton-name");
mark_states_ = !opt_force_acc_trans_ && aut_->prop_state_acc();
mark_states_ = (!opt_force_acc_trans_
&& aut_->prop_state_acc().is_true());
if (opt_shape_ == ShapeAuto)
{
if (sn_ || sprod_ || aut->num_states() > 100)

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2014, 2015 Laboratoire de Recherche et
// Copyright (C) 2011, 2012, 2014, 2015, 2016 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -159,8 +159,8 @@ namespace spot
is_colored = colored && (!has_state_acc || nodeadend);
// If the automaton declares that it is deterministic or
// state-based, make sure that it really is.
assert(!aut->prop_deterministic() || deterministic);
assert(!aut->prop_state_acc() || state_acc);
assert(deterministic || aut->prop_deterministic() != true);
assert(state_acc || aut->prop_state_acc() != true);
}
void number_all_ap()
@ -433,16 +433,15 @@ namespace spot
// in the case of deterministic automata.
if (aut->prop_unambiguous() && (verbose || !md.is_deterministic))
prop(" unambiguous");
assert(!(aut->prop_stutter_invariant() && aut->prop_stutter_sensitive()));
if (aut->prop_stutter_invariant())
prop(" stutter-invariant");
if (aut->prop_stutter_sensitive())
if (!aut->prop_stutter_invariant())
prop(" stutter-sensitive");
if (aut->prop_terminal())
prop(" terminal");
if (aut->prop_weak() && (verbose || !aut->prop_terminal()))
if (aut->prop_weak() && (verbose || aut->prop_terminal() != true))
prop(" weak");
if (aut->prop_inherently_weak() && (verbose || !aut->prop_weak()))
if (aut->prop_inherently_weak() && (verbose || aut->prop_weak() != true))
prop(" inherently-weak");
os << nl;

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2012, 2013, 2014, 2015, 2016 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -63,8 +63,9 @@ namespace spot
bool
is_deterministic(const const_twa_graph_ptr& aut)
{
if (aut->prop_deterministic())
return true;
trival d = aut->prop_deterministic();
if (d.is_known())
return d.is_true();
return !count_nondet_states_aux<false>(aut);
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2015 Laboratoire de Recherche et Developpement
// Copyright (C) 2013, 2015, 2016 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -27,20 +27,23 @@ namespace spot
{
bool is_unambiguous(const const_twa_graph_ptr& aut)
{
if (aut->prop_unambiguous())
return true;
trival u = aut->prop_unambiguous();
if (u.is_known())
return u.is_true();
auto clean_a = scc_filter_states(aut);
if (clean_a->num_edges() == 0)
return true;
auto prod = product(clean_a, clean_a);
auto clean_p = scc_filter_states(prod);
return clean_a->num_states() == clean_p->num_states()
&& clean_a->num_edges() == clean_p->num_edges();
return (clean_a->num_states() == clean_p->num_states()
&& clean_a->num_edges() == clean_p->num_edges());
}
bool check_unambiguous(const twa_graph_ptr& aut)
{
aut->prop_unambiguous(is_unambiguous(aut));
return aut->prop_unambiguous();
bool u = is_unambiguous(aut);
aut->prop_unambiguous(u);
return u;
}
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013, 2014, 2015 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
@ -133,7 +133,7 @@ namespace spot
throw std::runtime_error
("LBTT only supports generalized Büchi acceptance");
bool sba = g->prop_state_acc();
bool sba = g->prop_state_acc().is_true();
if (opt)
switch (char c = *opt++)
{

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
// Laboratoire de Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005, 2006 Laboratoire
// d'Informatique de Paris 6 (LIP6), département Systèmes Répartis
@ -2182,16 +2182,18 @@ namespace spot
acc.set_generalized_buchi();
a->prop_inherently_weak(f2.is_syntactic_persistence());
a->prop_stutter_invariant(f2.is_syntactic_stutter_invariant());
if (f2.is_syntactic_persistence())
a->prop_inherently_weak(true);
if (f2.is_syntactic_stutter_invariant())
a->prop_stutter_invariant(true);
if (orig_f.is_syntactic_guarantee())
{
a->prop_terminal(true);
assert(a->num_sets() <= 1);
}
// Currently the unambiguous option work only with LTL.
a->prop_unambiguous(f2.is_ltl_formula() && unambiguous);
if (unambiguous)
a->prop_unambiguous();
// Set the following to true to preserve state names.
a->release_formula_namer(namer, false);

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013, 2014, 2015 Laboratoire de Recherche et
// Copyright (C) 2012, 2013, 2014, 2015, 2016 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -146,7 +146,8 @@ namespace spot
return a;
// If the automaton is weak, using transition-based acceptance
// won't help, so let's preserve it.
if ((state_based_ || a->prop_inherently_weak()) && a->prop_state_acc())
if ((state_based_ || a->prop_inherently_weak().is_true())
&& a->prop_state_acc().is_true())
return scc_filter_states(a, arg);
else
return scc_filter(a, arg);
@ -253,7 +254,9 @@ namespace spot
{
bool reject_bigger = (PREF_ == Small) && (level_ == Medium);
dba = minimize_obligation(a, f, nullptr, reject_bigger);
if (dba && dba->prop_inherently_weak() && dba->prop_deterministic())
if (dba
&& dba->prop_inherently_weak().is_true()
&& dba->prop_deterministic().is_true())
{
// The WDBA is a BA, so no degeneralization is required.
// We just need to add an acceptance set if there is none.
@ -272,7 +275,7 @@ namespace spot
// at hard levels if we want a small output.
if (!dba || (level_ == High && PREF_ == Small))
{
if (((SBACC_ && a->prop_state_acc())
if (((SBACC_ && a->prop_state_acc().is_true())
|| (type_ == BA && a->is_sba()))
&& !tba_determinisation_)
{

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2015 Laboratoire de Recherche et
// Copyright (C) 2015, 2016 Laboratoire de Recherche et
// Développement de l'Epita.
//
// This file is part of Spot, a model checking library.
@ -227,7 +227,7 @@ namespace spot
res->new_states(nst);
res->set_buchi();
res->set_init_state(aut->get_init_state_number());
bool deterministic = aut->prop_deterministic();
trival deterministic = aut->prop_deterministic();
std::vector<unsigned> state_map(aut->num_states());
for (unsigned n = 0; n < scc_max; ++n)
@ -307,7 +307,7 @@ namespace spot
static twa_graph_ptr
rabin_to_buchi_maybe(const const_twa_graph_ptr& aut)
{
if (!aut->prop_state_acc())
if (!aut->prop_state_acc().is_true())
return nullptr;
auto code = aut->get_acceptance();
@ -508,7 +508,7 @@ namespace spot
return std::const_pointer_cast<twa_graph>(aut);
// FIXME: we should check whether the automaton is weak.
if (aut->prop_inherently_weak() && is_deterministic(aut))
if (aut->prop_inherently_weak().is_true() && is_deterministic(aut))
return remove_fin_det_weak(aut);
if (auto maybe = streett_to_generalized_buchi_maybe(aut))
@ -668,7 +668,7 @@ namespace spot
res->set_acceptance(aut->num_sets() + extra_sets, new_code);
res->set_init_state(aut->get_init_state_number());
bool sbacc = aut->prop_state_acc();
bool sbacc = aut->prop_state_acc().is_true();
scc_info si(aut);
unsigned nscc = si.scc_count();
std::vector<unsigned> state_map(nst);

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2013, 2014, 2015 Laboratoire de Recherche
// et Développement de l'Epita (LRDE)
// Copyright (C) 2010, 2011, 2013, 2014, 2015, 2016 Laboratoire de
// Recherche et Développement de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
//
@ -84,10 +84,12 @@ namespace spot
delete si;
if (set)
{
if (terminal)
aut->prop_terminal(is_term && is_weak);
aut->prop_weak(is_weak);
aut->prop_inherently_weak(is_inweak);
if (terminal && is_term && is_weak)
aut->prop_terminal(true);
if (is_weak)
aut->prop_weak(true);
if (is_inweak)
aut->prop_inherently_weak(true);
}
if (inweak)
return is_inweak;
@ -98,25 +100,30 @@ namespace spot
bool
is_terminal_automaton(const const_twa_graph_ptr& aut, scc_info* si)
{
return (aut->prop_terminal() ||
is_type_automaton<true>(std::const_pointer_cast<twa_graph>(aut),
si));
trival v = aut->prop_terminal();
if (v.is_known())
return v.is_true();
return is_type_automaton<true>(std::const_pointer_cast<twa_graph>(aut), si);
}
bool
is_weak_automaton(const const_twa_graph_ptr& aut, scc_info* si)
{
return (aut->prop_weak() ||
is_type_automaton<false>(std::const_pointer_cast<twa_graph>(aut),
si));
trival v = aut->prop_weak();
if (v.is_known())
return v.is_true();
return is_type_automaton<false>(std::const_pointer_cast<twa_graph>(aut),
si);
}
bool
is_inherently_weak_automaton(const const_twa_graph_ptr& aut, scc_info* si)
{
return (aut->prop_inherently_weak() ||
is_type_automaton<false, true>
(std::const_pointer_cast<twa_graph>(aut), si));
trival v = aut->prop_inherently_weak();
if (v.is_known())
return v.is_true();
return is_type_automaton<false, true>
(std::const_pointer_cast<twa_graph>(aut), si);
}
void check_strength(const twa_graph_ptr& aut, scc_info* si)

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014, 2015 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// Copyright (C) 2014, 2015, 2016 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -410,10 +410,10 @@ namespace spot
}
if (num_states != a->num_states())
a->prop_keep({true, // state_based
false, // inherently_weak
false, // deterministic
false, // stutter inv.
});
false, // inherently_weak
false, // deterministic
false, // stutter inv.
});
a->merge_edges();
return a;
}
@ -430,10 +430,10 @@ namespace spot
closure(twa_graph_ptr&& a)
{
a->prop_keep({false, // state_based
false, // inherently_weak
false, // deterministic
false, // stutter inv.
});
false, // inherently_weak
false, // deterministic
false, // stutter inv.
});
unsigned n = a->num_states();
std::vector<unsigned> todo;
@ -612,12 +612,12 @@ namespace spot
}
}
bool
trival
check_stutter_invariance(const twa_graph_ptr& aut, formula f)
{
bool is_stut = aut->prop_stutter_invariant();
if (is_stut)
return is_stut;
trival is_stut = aut->prop_stutter_invariant();
if (is_stut.is_known())
return is_stut.is_true();
twa_graph_ptr neg = nullptr;
if (f)
@ -630,14 +630,13 @@ namespace spot
// know how to complement it.
aut->prop_deterministic(is_deterministic(aut));
if (!aut->prop_deterministic())
return false;
return trival::maybe();
neg = remove_fin(dtwa_complement(aut));
}
is_stut = is_stutter_invariant(make_twa_graph(aut, twa::prop_set::all()),
std::move(neg), aut->ap_var());
aut->prop_stutter_invariant(is_stut);
aut->prop_stutter_sensitive(!is_stut);
return is_stut;
}
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014, 2015 Laboratoire de Recherche
// Copyright (C) 2014, 2015, 2016 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -63,7 +63,10 @@ namespace spot
/// This procedure only works if \a aut is deterministic, or if the
/// equivalent formula \a f is given. The stutter-invariant property
/// of the automaton is updated and also returned.
SPOT_API bool
///
/// If no formula is given and the automaton is not deterministic,
/// the result will be returned as trival::maybe().
SPOT_API trival
check_stutter_invariance(const twa_graph_ptr& aut,
formula f = nullptr);
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2015 Laboratoire de Recherche et Développement
// Copyright (C) 2015, 2016 Laboratoire de Recherche et Développement
// de l'Epita.
//
// This file is part of Spot, a model checking library.
@ -164,7 +164,7 @@ namespace spot
bs2num[s] = out->new_state();
todo.push_back(s);
bool sbacc = in->prop_state_acc();
bool sbacc = in->prop_state_acc().is_true();
// States of the original automaton are marked with s.pend == -1U.
const acc_cond::mark_t orig_copy(-1U);