Commit 27a2de33 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

ltl2tgba.html: Preliminary support for TA

* wrap/python/spot.i: Add wrapper the new TA algorithms.
* wrap/python/ajax/ltl2tgba.html: Add a testing automaton tab.
* wrap/python/ajax/protocol.txt, wrap/python/ajax/ Support it.
parent 20c3f9f8
......@@ -439,6 +439,7 @@ an identifier: <span class="formula">aUb</span> is an atomic proposition, unlike
<li><a href="#tabs-om" class="btip" title="Create a monitor accepting all finite prefixes compatible with the formula.">Monitor</a></li>
<li><a href="#tabs-oa" class="btip" title="Translate the LTL formula into B&uuml;chi automaton.">B&uuml;chi Automaton</a></li>
<li><a href="#tabs-or" class="btip" title="Translate the LTL formula into B&uuml;chi automaton, and exhibit an accepting run.">B&uuml;chi Run</a></li>
<li><a href="#tabs-ot" class="btip" title="Translate the LTL formula into a Testing Automaton, or some variant.">Testing Automaton</a></li>
<li class="ui-icon ui-icon-circle-arrow-n ftip">Fold</li>
<input type="hidden" name="o">
......@@ -504,6 +505,21 @@ an identifier: <span class="formula">aUb</span> is an atomic proposition, unlike
draw an accepting run on top of the automaton
<div id="tabs-ot">
Translate the (simplified) formula as:<br>
<label class="rtip" title="Instead of reading valuations of all atomic propositions testing automata only watch the changes to these valuation. A transitions labeled by <span class='formula'>a</span> may be crossed only if these atomic proposition change in the system. Additionally, testing automata have two acceptance conditions: states can be Büchi accepting or livelock accepting (or both, or none).">
<INPUT type="radio" name="tf" value="t">
a Testing Automaton (TA)
<label class="rtip" title="GTA are testing automata extended with multiple Büchi acceptance conditions.">
<INPUT type="radio" name="tf" value="g">
a Generalized Testing Automaton (GTA)
<label class="rtip" title="TGTA are similar to TGBA except instead of reading valuations of all atomic propositions testing automata only watch the changes to these valuation. They have multiple Büchi acceptance conditions on transitions, but no livelock acceptance.">
<INPUT type="radio" name="tf" value="a" checked>
a Transition-based Generalized Testing Automaton (TGTA)
<div id="translator-tabs" class="tabs collapsible shadow">
......@@ -20,6 +20,7 @@ Choosing the desired output (pick one)
o=m output monitor
o=a output automaton
o=r output run
o=t output testing automaton
o=v3 output LTL3BA's version (no other argument needed)
Type of formula output if o=f (pick one)
......@@ -49,6 +50,12 @@ Type of run output if o=r (pick one)
rf=p print run as text
rf=d draw run
Type of testing automaton if o=t (pick one)
tf=t TA
tf=g GTA
tf=a TGTA
Translator algorithm (pick one)
t=fm Couvreur/FM
......@@ -287,6 +287,9 @@ However you may download the <a href="''' + cgi.escape(autprefix)
def render_automaton(automaton, dont_run_dot, issba, deco = None):
dotsrc = spot.ostringstream()
if isinstance(automaton, spot.ta):
spot.dotty_reachable(dotsrc, automaton)
spot.dotty_reachable(dotsrc, automaton, issba, deco)
render_dot_maybe(dotsrc.str(), dont_run_dot)
......@@ -303,6 +306,7 @@ def print_stats(automaton):
unbufprint(", %d transition" % stats.transitions)
if stats.transitions > 1:
if hasattr(automaton, 'number_of_acceptance_conditions'):
count = automaton.number_of_acceptance_conditions()
if count > 0:
unbufprint(", %d acceptance condition" % count)
......@@ -578,10 +582,15 @@ for s in form.getlist('as'):
elif s == 'ds':
direct_simul = True
ta_type = None
buchi_type = None
if output_type == 'a':
buchi_type = form.getfirst('af', 't')
elif output_type == 'r':
buchi_type = form.getfirst('ra', 't')
elif output_type == 't':
ta_type = form.getfirst('tf', 't')
unbufprint("Unkown output type 'o=%s'.\n" % output_type)
automaton = 0
......@@ -589,12 +598,18 @@ else:
degen = False
neverclaim = False
if buchi_type == 's':
if buchi_type == 's' or ta_type == 't':
degen = True
elif buchi_type == 'i':
degen = True
neverclaim = True
if output_type == 't':
ta_type = form.getfirst('tf', 't')
if ta_type == 't':
degen = True
if prune_scc:
# Do not suppress all useless acceptance conditions if
# degeneralization or simulation is requested: keeping those that
......@@ -638,6 +653,23 @@ if output_type == 'a':
automaton = 0
# Testing automaton Output
if output_type == 't':
propset = spot.atomic_prop_collect_as_bdd(f, automaton)
if ta_type == 'a':
tautomaton = spot.tgba_to_tgta(degen, propset)
tautomaton = spot.minimize_tgta(tautomaton)
tautomaton = spot.tgba_to_ta(degen, propset,
False, False, False, False)
tautomaton = spot.minimize_ta(tautomaton)
dont_run_dot = print_stats(tautomaton)
render_automaton(tautomaton, dont_run_dot, False)
tautomaton = 0
degen = 0
automaton = 0
# Buchi Run Output
if output_type == 'r':
......@@ -73,6 +73,7 @@ namespace std {
#include "ltlvisit/simplify.hh"
#include "ltlvisit/tostring.hh"
#include "ltlvisit/tunabbrev.hh"
#include "ltlvisit/apcollect.hh"
#include "tgba/bdddict.hh"
#include "tgba/bddprint.hh"
......@@ -111,6 +112,15 @@ namespace std {
#include "tgbaparse/public.hh"
#include "ta/ta.hh"
#include "ta/tgta.hh"
#include "ta/taexplicit.hh"
#include "ta/tgtaexplicit.hh"
#include "taalgos/tgba2ta.hh"
#include "taalgos/dotty.hh"
#include "taalgos/stats.hh"
#include "taalgos/minimize.hh"
using namespace spot::ltl;
using namespace spot;
......@@ -176,6 +186,7 @@ using namespace spot;
%include "ltlvisit/simplify.hh"
%include "ltlvisit/tostring.hh"
%include "ltlvisit/tunabbrev.hh"
%include "ltlvisit/apcollect.hh"
%feature("new") spot::emptiness_check::check;
%feature("new") spot::emptiness_check_instantiator::construct;
......@@ -197,6 +208,8 @@ using namespace spot;
%feature("new") spot::simulation;
%feature("new") spot::degeneralize;
%feature("new") spot::tgba_parse;
%feature("new") spot::tgba_to_ta;
%feature("new") spot::tgba_to_tgta;
// Help SWIG with namespace lookups.
#define ltl spot::ltl
......@@ -261,6 +274,17 @@ using namespace spot;
%include "tgbaparse/public.hh"
%include "ta/ta.hh"
%include "ta/tgta.hh"
%include "ta/taexplicit.hh"
%include "ta/tgtaexplicit.hh"
%include "taalgos/tgba2ta.hh"
%include "taalgos/dotty.hh"
%include "taalgos/stats.hh"
%include "taalgos/minimize.hh"
#undef ltl
%extend spot::ltl::formula {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment