fixed inline context + added tests for inline context

This commit is contained in:
Marcell Vazquez-Chanlatte 2017-11-14 09:58:56 -08:00
parent f7f322148e
commit 7aed260d5d
3 changed files with 38 additions and 13 deletions

View file

@ -6,7 +6,7 @@ from lenses import bind
import stl.ast
from stl.ast import (And, F, G, Interval, LinEq, Neg,
Or, AP_lens, Next, Until, AtomicPred,
Or, Next, Until, AtomicPred,
_Top, _Bot)
from stl.types import STL
@ -50,18 +50,6 @@ def linear_stl_lipschitz(phi):
return float(max(map(_lineq_lipschitz, phi.lineqs)))
def inline_context(phi, context):
phi2 = None
def update(ap):
return context.get(ap, ap)
while phi2 != phi:
phi2, phi = phi, AP_lens(phi).modify(update)
# TODO: this is hack to flatten the AST. Fix!
return stl.parse(str(phi))
op_lookup = {
">": op.gt,
">=": op.ge,