psl: add support for the [:*i..j] operator

This operator is to ':' what [*i..j] is to ';'.

Part of issue #51.

* doc/tl/tl.tex: Document syntax, semantic, and trivial
simplifications.
* doc/tl/spotltl.sty: Add macros for new operators.
* src/ltlast/bunop.cc, src/ltlast/bunop.hh: Implement it.
* src/ltlast/multop.cc: Add some trivial simplifications.
* src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll: Parse it.
* src/ltltest/equals.test, src/ltltest/latex.test,
src/tgbatest/ltl2tgba.test: Add more tests.
* src/ltlvisit/randomltl.cc: Output this operator in
random PSL formulas.
* src/ltltest/rand.test: Adjust.
* src/tgbaalgos/ltl2tgba_fm.cc: Add translation rules.
* src/ltlvisit/tostring.cc: Add pretty printing code.
* src/ltlvisit/simplify.cc, src/ltlvisit/snf.cc: Adjust
switches.
* NEWS: Mention the new operator.
This commit is contained in:
Alexandre Duret-Lutz 2015-01-15 18:50:32 +01:00
parent eebbcac281
commit a79db4eefe
17 changed files with 442 additions and 162 deletions

View file

@ -308,7 +308,7 @@ namespace spot
// SEREs
random_sere::random_sere(const atomic_prop_set* ap)
: random_formula(9, ap), rb(ap)
: random_formula(11, ap), rb(ap)
{
proba_[0].setup("eword", 1, eword_builder);
proba_2_ = proba_ + 1;
@ -316,11 +316,13 @@ namespace spot
proba_[1].setup("boolform", 1, boolform_builder);
proba_[2].setup("star", 2, bunop_unbounded_builder<bunop::Star>);
proba_[3].setup("star_b", 2, bunop_bounded_builder<bunop::Star>);
proba_[4].setup("and", 3, multop_builder<multop::AndRat>);
proba_[5].setup("andNLM", 3, multop_builder<multop::AndNLM>);
proba_[6].setup("or", 3, multop_builder<multop::OrRat>);
proba_[7].setup("concat", 3, multop_builder<multop::Concat>);
proba_[8].setup("fusion", 3, multop_builder<multop::Fusion>);
proba_[4].setup("fstar", 2, bunop_unbounded_builder<bunop::FStar>);
proba_[5].setup("fstar_b", 2, bunop_bounded_builder<bunop::FStar>);
proba_[6].setup("and", 3, multop_builder<multop::AndRat>);
proba_[7].setup("andNLM", 3, multop_builder<multop::AndNLM>);
proba_[8].setup("or", 3, multop_builder<multop::OrRat>);
proba_[9].setup("concat", 3, multop_builder<multop::Concat>);
proba_[10].setup("fusion", 3, multop_builder<multop::Fusion>);
update_sums();
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013, 2014 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE).
// Copyright (C) 2011, 2012, 2013, 2014, 2015 Laboratoire de Recherche
// et Developpement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -1085,6 +1085,9 @@ namespace spot
}
result_ = bunop::instance(op, h, min, bo->max());
break;
case bunop::FStar:
result_ = bunop::instance(op, h, min, bo->max());
break;
}
}
@ -3274,6 +3277,8 @@ namespace spot
r->destroy();
f = 0;
break;
case bunop::FStar:
goto common;
}
break;
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2014 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE).
// Copyright (C) 2012, 2014, 2015 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -70,6 +70,11 @@ namespace spot
// Strip the star.
result_ = recurse(bo->child());
break;
case bunop::FStar:
// FIXME: Can we deal with FStar in a better way?
result_ = bo->clone();
break;
}
}
@ -171,6 +176,9 @@ namespace spot
std::max(bo->min(), 1U),
bo->max());
break;
case bunop::FStar:
result_ = bo->clone();
break;
}
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2010, 2012, 2013, 2014 Laboratoire de Recherche
// et Développement de l'Epita (LRDE)
// Copyright (C) 2008, 2010, 2012, 2013, 2014, 2015 Laboratoire de
// Recherche et Développement 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.
@ -71,6 +71,8 @@ namespace spot
KCloseBunop,
KStarBunop,
KPlusBunop,
KFStarBunop,
KFPlusBunop,
KEqualBunop,
KGotoBunop,
};
@ -108,6 +110,8 @@ namespace spot
"]",
"[*",
"[+]",
"[:*",
"[:+]",
"[=",
"[->",
};
@ -121,7 +125,7 @@ namespace spot
" <-> ", // rewritten, although supported
" U ",
" V ",
" W ", // rewritten, although supported
" W ", // rewritten
" M ", // rewritten
"<>-> ", // not supported
"<>=> ", // not supported
@ -145,6 +149,8 @@ namespace spot
"]", // not supported
"[*", // not supported
"[+]", // not supported
"[:*", // not supported
"[:+]", // not supported
"[=", // not supported
"[->", // not supported
};
@ -182,6 +188,8 @@ namespace spot
"]", // not supported
"[*", // not supported
"[+]", // not supported
"[:*", // not supported
"[:+]", // not supported
"[=", // not supported
"[->", // not supported
};
@ -219,6 +227,8 @@ namespace spot
"]",
"[*",
"[+]",
"[:*",
"[:+]",
"[=",
"[->",
};
@ -256,6 +266,8 @@ namespace spot
"}",
"\\SereStar{",
"\\SerePlus{}",
"\\SereFStar{",
"\\SereFPlus{}",
"\\SereEqual{",
"\\SereGoto{",
};
@ -297,6 +309,8 @@ namespace spot
"}",
"^{\\star",
"^+",
"^{\\mathsf{:}\\star",
"^{\\mathsf{:}+}",
"^{=",
"^{\\to",
};
@ -577,17 +591,18 @@ namespace spot
visit(const bunop* bo)
{
const formula* c = bo->child();
enum { Star, Goto, Equal } sugar = Star;
enum { Star, FStar, Goto } sugar = Star;
unsigned default_min = 0;
unsigned default_max = bunop::unbounded;
bunop::type op = bo->op();
// Abbreviate "1[*]" as "[*]".
if (c != constant::true_instance())
if (c != constant::true_instance() || op != bunop::Star)
{
bunop::type op = bo->op();
switch (op)
{
case bunop::Star:
// Is this a Goto?
if (const multop* mo = is_Concat(c))
{
unsigned s = mo->size();
@ -599,6 +614,9 @@ namespace spot
}
}
break;
case bunop::FStar:
sugar = FStar;
break;
}
emit_bunop_child(c);
@ -616,8 +634,13 @@ namespace spot
}
emit(KStarBunop);
break;
case Equal:
emit(KEqualBunop);
case FStar:
if (min == 1 && max == bunop::unbounded)
{
emit(KFPlusBunop);
return;
}
emit(KFStarBunop);
break;
case Goto:
emit(KGotoBunop);