payed off testing technical debt + bug fixes + traces based evaluator

This commit is contained in:
Marcell Vazquez-Chanlatte 2017-11-11 17:35:48 -08:00
parent 72639bc59f
commit cba8a83c8e
12 changed files with 302 additions and 172 deletions

View file

@ -5,21 +5,18 @@ import stl
GRAMMAR = {
'phi': (('Unary', '(', 'phi', ')'), ('(', 'phi', ')', 'Binary', '(', 'phi',
')'), ('AP', ), ('LINEQ', )),
')'), ('AP', ), ('LINEQ', ), ('', ),
('', )),
'Unary': (('~', ), ('G', 'Interval'), ('F', 'Interval'), ('X', )),
'Interval': (('',), ('[1, 3]',)),
'Binary': ((' | ', ), (' & ', ), (' U ',)),
'Interval': (('', ), ('[1, 3]', )),
'Binary': ((' | ', ), (' & ', ), (' U ', ), (' -> ', ), (' <-> ',),
(' ^ ',)),
'AP': (('AP1', ), ('AP2', ), ('AP3', ), ('AP4', ), ('AP5', )),
'LINEQ': (('x > 4', ), ('y < 2', ), ('y >= 3', ), ('x + y >= 2',)),
'LINEQ': (('x > 4', ), ('y < 2', ), ('y >= 3', ), ('x + 2.0y >= 2', )),
}
def to_stl(term):
return stl.parse(''.join(term))
SignalTemporalLogicStrategy = st.builds(to_stl,
SignalTemporalLogicStrategy = st.builds(lambda term: stl.parse(''.join(term)),
ContextFreeGrammarStrategy(
GRAMMAR,
max_length=27,
max_length=35,
start='phi'))