forgot to add sugar module + fix breakage due to sugar module
This commit is contained in:
parent
7002246850
commit
6075df175b
3 changed files with 33 additions and 4 deletions
29
mtl/sugar.py
Normal file
29
mtl/sugar.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from mtl import ast
|
||||
|
||||
|
||||
def alw(phi, *, lo=0, hi=float('inf')):
|
||||
return ast.G(ast.Interval(lo, hi), phi)
|
||||
|
||||
|
||||
def env(phi, *, lo=0, hi=float('inf')):
|
||||
return ~alw(~phi, lo=lo, hi=hi)
|
||||
|
||||
|
||||
def implies(x, y):
|
||||
return ~x | y
|
||||
|
||||
|
||||
def xor(x, y):
|
||||
return (x | y) & ~(x & y)
|
||||
|
||||
|
||||
def iff(x, y):
|
||||
return (x & y) | (~x & ~y)
|
||||
|
||||
|
||||
def until(phi, psi):
|
||||
return ast.WeakUntil(phi, psi) & env(psi)
|
||||
|
||||
|
||||
def timed_until(phi, psi, lo, hi):
|
||||
return env(psi, lo=lo, hi=hi) & alw(until(phi, psi), lo=0, hi=lo)
|
||||
Loading…
Add table
Add a link
Reference in a new issue