Safra: Fix usage of multiple acceptance conditions and fix text output.

* src/tgba/tgbasafracomplement.cc
(tgba_safra_complement::tgba_safra_complement)
(tgba_safra_complement::succ_iter): Correct the declaration and
use of multiple acceptance conditions.
(state_complement::to_string): Output the L set, not U.  The previous
code caused different states to share the same names, causing issues
with the text-based output (state with identical names get merged).
* src/tgba/tgbasafracomplement.hh
(tgba_safra_complement::acceptance_cond_vec_): Adjust type to
store BDDs.
* src/tgbatest/complementation.cc: Implement a new "-b" option
to output automata in Spot's syntax.
* src/tgbatest/complementation.test: Add a test-case supplied
by Martin Dieguez Lodeiro.
* THANKS: Add Martin.
This commit is contained in:
Alexandre Duret-Lutz 2011-10-23 23:06:35 +02:00
parent ff3c02f51d
commit a4d1e18bf3
6 changed files with 77 additions and 23 deletions

View file

@ -21,6 +21,7 @@
#include <iomanip>
#include <iostream>
#include "tgbaalgos/dotty.hh"
#include "tgbaalgos/save.hh"
#include "tgbaparse/public.hh"
#include "tgba/tgbaproduct.hh"
#include "tgbaalgos/gtec/gtec.hh"
@ -40,6 +41,7 @@ void usage(const char* prog)
{
std::cout << "usage: " << prog << " [options]" << std::endl;
std::cout << "with options" << std::endl
<< "-b Output in spot's format" << std::endl
<< "-S Use Safra's complementation "
<< "instead of Kupferman&Vardi's" << std::endl
<< "-s buchi_automaton display the safra automaton"
@ -63,6 +65,7 @@ int main(int argc, char* argv[])
bool formula = false;
bool safra = false;
bool print_formula = false;
bool save_spot = false;
if (argc < 3)
{
@ -74,6 +77,12 @@ int main(int argc, char* argv[])
{
if (argv[i][0] == '-')
{
if (strcmp(argv[i] + 1, "b") == 0)
{
save_spot = true;
continue;
}
if (strcmp(argv[i] + 1, "astat") == 0)
{
stats = true;
@ -134,7 +143,12 @@ int main(int argc, char* argv[])
complement = new spot::tgba_kv_complement(a);
if (print_automaton)
spot::dotty_reachable(std::cout, complement);
{
if (save_spot)
spot::tgba_save_reachable(std::cout, complement);
else
spot::dotty_reachable(std::cout, complement);
}
if (print_safra)
{

View file

@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (C) 2009 Laboratoire de Recherche et Développement
# Copyright (C) 2009, 2011 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
#
# This file is part of Spot, a model checking library.
@ -42,3 +42,25 @@ GFa&&FGa
[] (p2 -> ((! p0 && ! p1) U (p1 || ((p0 && ! p1) U (p1 || ((! p0 && ! p1) \
U (p1 || ((p0 && ! p1) U ((p1 || (! p0 U (p1 || [] ! p0))) || [] p0)))))))))
EOF
# The following test-case was supplied by Martin Dieguez Lodeiro to
# demonstrate a bug in our Safra implementation.
cat >x.tgba <<EOF
acc = "1";
"1", "1", "1",;
"1", "2", "p",;
"2", "3", "p", "1";
"2", "2", "1",;
"3", "3", "p", "1";
"3", "2", "1",;
EOF
# x.tgba accepts some run
run 0 ../ltl2tgba -X -e x.tgba
# so does its complement
run 0 ../complement -b -S -a x.tgba > nx.tgba
run 0 ../ltl2tgba -X -e nx.tgba
# however the intersection of both should not
# accept any run.
run 0 ../ltl2tgba -X -E -Pnx.tgba x.tgba