Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rtamt/pastifier/stl/pastifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def visitPredicate(self, node, *args, **kwargs):
node_horizon = self.subformula_horizons[node]
remaining_horizon = args[0]
horizon = remaining_horizon - node_horizon
child1_node = self.visit(node.children[0], *args, **kwargs)
child2_node = self.visit(node.children[1], *args, **kwargs)
child1_node = self.visit(node.children[0], node_horizon)
child2_node = self.visit(node.children[1], node_horizon)
node = Predicate(child1_node, child2_node, node.operator)
if horizon > 0:
node = TimedOnce(node, Interval(horizon, horizon))
Expand Down
24 changes: 24 additions & 0 deletions tests/python/api/test_stl_pastification.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,5 +487,29 @@ def test_complex_mixed_1(self):

self.assertEqual('(once[0,1](req))->(once[4,5](gnt))', ast.specs[0].name, 'Complex pastification assertion')

def test_implication_1(self):
ast = StlAst()
ast.declare_var('req', 'float')
ast.declare_var('gnt', 'float')
ast.spec = 'req==1 -> (eventually[0,3] gnt==2)'
ast.parse()

pastifier = StlPastifier()
ast = pastifier.pastify(ast)

self.assertEqual('(once[3,3]((req)==(1.0)))->(once[0,3]((gnt)==(2.0)))', ast.specs[0].name, 'Complex pastification assertion')

def test_implication_2(self):
ast = StlAst()
ast.declare_var('req', 'float')
ast.declare_var('gnt', 'float')
ast.spec = 'always[0,6](req==1 -> (eventually[0,3] gnt==2))'
ast.parse()

pastifier = StlPastifier()
ast = pastifier.pastify(ast)

self.assertEqual('historically[0,6]((once[3,3]((req)==(1.0)))->(once[0,3]((gnt)==(2.0))))', ast.specs[0].name, 'Complex pastification assertion')

if __name__ == '__main__':
unittest.main()
Loading