flake8 fixes + unregister LinEq in boolean eval

This commit is contained in:
Marcell Vazquez-Chanlatte 2018-09-06 01:28:19 -07:00
parent d2cd678018
commit 5fd66cfd2c
4 changed files with 3 additions and 17 deletions

View file

@ -177,16 +177,6 @@ def eval_stl_ap(phi, _):
return _eval
@eval_stl.register(stl.LinEq)
def eval_stl_lineq(phi, _):
def _eval(x):
out = x[phi]
out.compact()
return out
return _eval
@eval_stl.register(type(stl.TOP))
def eval_stl_top(_, _1):
return lambda *_: TRUE_TRACE

View file

@ -1,15 +1,14 @@
import operator as op
from functools import reduce, singledispatch
from operator import and_, or_
import funcy as fn
from bitarray import bitarray
from lenses import bind
import stl.ast
oo = float('inf')
def get_times(x, tau, lo, hi):
end = min(v.domain.end() for v in x.values())

View file

@ -1,18 +1,14 @@
# -*- coding: utf-8 -*-
# TODO: allow multiplication to be distributive
# TODO: support variables on both sides of ineq
import operator as op
from functools import partialmethod, reduce
from lenses import bind
from parsimonious import Grammar, NodeVisitor
from stl import ast
from stl.utils import iff, implies, xor, timed_until
STL_GRAMMAR = Grammar(u'''
phi = (neg / paren_phi / next / bot / top
/ xor_outer / iff_outer / implies_outer / and_outer / or_outer
/ xor_outer / iff_outer / implies_outer / and_outer / or_outer
/ timed_until / until / g / f / AP)
paren_phi = "(" __ phi __ ")"

View file

@ -24,6 +24,7 @@ def test_identities(phi):
assert (phi | phi) | phi == phi | (phi | phi)
assert ~~phi == phi
def test_walk():
phi = stl.parse(
'(([ ][0, 1] ap1 & < >[1,2] ap2) | (@ap1 U ap2))')