twaalgos: extract internal sere2dfa
This commit is contained in:
parent
4709bd36fe
commit
95dcbc5acd
2 changed files with 58 additions and 0 deletions
|
|
@ -2271,4 +2271,59 @@ namespace spot
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
twa_graph_ptr
|
||||||
|
sere_to_tgba(formula f, const bdd_dict_ptr& dict)
|
||||||
|
{
|
||||||
|
f = negative_normal_form(f);
|
||||||
|
|
||||||
|
tl_simplifier* s = new tl_simplifier(dict);
|
||||||
|
twa_graph_ptr a = make_twa_graph(dict);
|
||||||
|
|
||||||
|
translate_dict d(a, s, false, false, false);
|
||||||
|
ratexp_to_dfa sere2dfa(d);
|
||||||
|
|
||||||
|
auto [dfa, namer, state] = sere2dfa.succ(f);
|
||||||
|
|
||||||
|
// language was empty, build an automaton with one non accepting state
|
||||||
|
if (dfa == nullptr)
|
||||||
|
{
|
||||||
|
auto res = make_twa_graph(dict);
|
||||||
|
res->set_init_state(res->new_state());
|
||||||
|
res->prop_universal(true);
|
||||||
|
res->prop_complete(false);
|
||||||
|
res->prop_stutter_invariant(true);
|
||||||
|
res->prop_terminal(true);
|
||||||
|
res->prop_state_acc(true);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto res = make_twa_graph(dfa, {false, false, true, false, false, false});
|
||||||
|
|
||||||
|
// HACK: translate_dict registers the atomic propositions in the "final"
|
||||||
|
// automaton that would be produced by a full translation, not in the
|
||||||
|
// intermediate automaton we're interested in. We can copy them from the
|
||||||
|
// resulting automaton.
|
||||||
|
res->copy_ap_of(a);
|
||||||
|
|
||||||
|
res->prop_state_acc(true);
|
||||||
|
const auto acc_mark = res->set_buchi();
|
||||||
|
|
||||||
|
size_t sn = namer->state_to_name.size();
|
||||||
|
for (size_t i = 0; i < sn; ++i)
|
||||||
|
{
|
||||||
|
formula g = namer->state_to_name[i];
|
||||||
|
if (g.accepts_eword())
|
||||||
|
{
|
||||||
|
if (res->get_graph().state_storage(i).succ == 0)
|
||||||
|
res->new_edge(i, i, bddfalse, acc_mark);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (auto& e : res->out(i))
|
||||||
|
e.acc = acc_mark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,4 +88,7 @@ namespace spot
|
||||||
tl_simplifier* simplifier = nullptr,
|
tl_simplifier* simplifier = nullptr,
|
||||||
bool unambiguous = false,
|
bool unambiguous = false,
|
||||||
const output_aborter* aborter = nullptr);
|
const output_aborter* aborter = nullptr);
|
||||||
|
|
||||||
|
SPOT_API twa_graph_ptr
|
||||||
|
sere_to_tgba(formula f, const bdd_dict_ptr& dict);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue