tl: extend F[n:m] and G[n:m] to the case of m=$

Suggested by Victor Khomenko.

* spot/tl/formula.cc, spot/tl/formula.hh, spot/parsetl/parsetl.yy:
Implement this.
* NEWS, doc/tl/tl.tex: Document it.
* tests/core/sugar.test, tests/python/ltlparse.py: Add some tests.
This commit is contained in:
Alexandre Duret-Lutz 2019-06-02 14:36:07 +02:00
parent 74786324f4
commit 58389bdb80
7 changed files with 57 additions and 16 deletions

View file

@ -30,9 +30,13 @@ G[2:4]a
G[4:2]a
F[2:4]a
F[4:2]a
F[2:$]a
F[2..]a
X [4]a | b
G [2:4] a | b
G [4:2] a | b
G [2:] a | b
G [2..] a | b
F [2:4] a | b
F [4:2]a | F[2:2]b
F[]a|G[]b|X[]c
@ -61,9 +65,13 @@ XX(a & X(a & Xa))
XX(a & X(a & Xa))
XX(a | X(a | Xa))
XX(a | X(a | Xa))
XXFa
XXFa
b | XXXXa
b | XX(a & X(a & Xa))
b | XX(a & X(a & Xa))
b | XXGa
b | XXGa
b | XX(a | X(a | Xa))
XX(a | X(a | Xa)) | XXb
FGa | Gb | XGc
@ -93,7 +101,7 @@ F[3:1]
F[3:1][2:1]
F[a
G[2:4]
G[2:]a
G[2:.]a
G[4]a
G[a
X[2
@ -163,12 +171,12 @@ syntax error, unexpected end of formula
missing right operand for "G[.] operator"
ltlfilt:err.in:6: parse error:
>>> G[2:]a
>>> G[2:.]a
^
syntax error, unexpected closing bracket, expecting $num
syntax error, unexpected $undefined, expecting closing bracket
>>> G[2:]a
^^^^^
>>> G[2:.]a
^^^^^^
treating this G[.] as a simple G
ltlfilt:err.in:7: parse error:

View file

@ -1,5 +1,5 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2009-2012, 2014-2017 Laboratoire de Recherche et
# Copyright (C) 2009-2012, 2014-2017, 2019 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
@ -199,3 +199,14 @@ for (x, msg) in [('a->', "missing right operand for \"implication operator\""),
del f9
assert spot.fnode_instances_check()
f = spot.formula_F(2, 4, spot.formula_ap("a"))
assert f == spot.formula("XX(a | X(a | X(a)))")
f = spot.formula_G(2, 4, spot.formula_ap("a"))
assert f == spot.formula("XX(a & X(a & X(a)))")
f = spot.formula_X(2, spot.formula_ap("a"))
assert f == spot.formula("XX(a)")
f = spot.formula_G(2, spot.formula_unbounded(), spot.formula_ap("a"))
assert f == spot.formula("XXG(a)")
f = spot.formula_F(2, spot.formula_unbounded(), spot.formula_ap("a"))
assert f == spot.formula("XXF(a)")