From 5b7fea39538fa0893a23f923e61ac91e5cf52941 Mon Sep 17 00:00:00 2001 From: Marcell Vazquez-Chanlatte Date: Thu, 7 Dec 2017 19:00:07 -0800 Subject: [PATCH] add rshift (>>) : SLT x Int -> STL as next(self, i) --- stl/ast.py | 10 ++++++++++ stl/utils.py | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/stl/ast.py b/stl/ast.py index 4491a2f..2c08252 100644 --- a/stl/ast.py +++ b/stl/ast.py @@ -37,6 +37,16 @@ class AST(object): return self.arg return Neg(self) + def __rshift__(self, t): + if self in (BOT, TOP): + return self + + phi = self + for _ in range(t): + phi = Next(phi) + + return phi + @property def children(self): return tuple() diff --git a/stl/utils.py b/stl/utils.py index 32d933f..b5414e1 100644 --- a/stl/utils.py +++ b/stl/utils.py @@ -207,9 +207,7 @@ def iff(x, y): def next(phi, i=1): - for _ in range(i): - phi = Next(phi) - return phi + return phi >> i def timed_until(phi, psi, lo, hi):