def test_realizable(): for f, expected in [(LTL('([]<>a) -> ([]<>(a && b))', input_variables={'a': 'boolean'}, output_variables={'b': 'boolean'}), True), (LTL('[]<>(a && b)', input_variables={'a': 'boolean'}, output_variables={'b': 'boolean'}), False)]: yield check_realizable, f, expected
class LTL_test: def setUp(self): self.f = LTL("[](p -> <>q)", input_variables={"p": "boolean"}, output_variables={"q": "boolean"}) def tearDown(self): self.f = None def test_loads_dumps_id(self): # Dump/load identity test: Dumping the result from loading a # dump should be identical to the original dump. assert self.f.dumps() == LTL.loads(self.f.dumps()).dumps()
class LTL_test(object): def setUp(self): self.f = LTL("[](p -> <>q)", input_variables={"p": "boolean"}, output_variables={"q": "boolean"}) def tearDown(self): self.f = None def test_loads_dumps_id(self): # Dump/load identity test: Dumping the result from loading a # dump should be identical to the original dump. assert self.f.dumps() == LTL.loads(self.f.dumps()).dumps()
def test_loads_dumps_id(self): # Dump/load identity test: Dumping the result from loading a # dump should be identical to the original dump. assert self.f.dumps() == LTL.loads(self.f.dumps()).dumps()
def setUp(self): self.f = LTL("[](p -> <>q)", input_variables={"p": "boolean"}, output_variables={"q": "boolean"})
#!/usr/bin/env python from __future__ import print_function from tulip.spec.form import LTL from tulip.interfaces import lily f = LTL('([]<>(!a)) -> ([](a -> <> b) && [](a -> !X b))', input_variables={'a': 'boolean'}, output_variables={'b': 'boolean'}) # Try appending # # && [](!b -> !X b) # # to the above LTL formula. The result will not be realizable. M = lily.synthesize(f) if M is not None: print(M) else: print('Not realizable.')
def test_nonbool(): f = LTL('[](a -> <>b)', input_variables={'a': (0, 1)}, output_variables={'b': 'boolean'}) M = lily.synthesize(f)
#!/usr/bin/env python """ Tests for the interface with Lily. """ import pytest from tulip.spec.form import LTL, GRSpec from tulip.interfaces import lily @pytest.mark.parametrize('f,expected', [(LTL('([]<>a) -> ([]<>(a && b))', input_variables={'a': 'boolean'}, output_variables={'b': 'boolean'}), True), (LTL('[]<>(a && b)', input_variables={'a': 'boolean'}, output_variables={'b': 'boolean'}), False)]) def test_realizable(f, expected): M = lily.synthesize(f) if expected: assert M is not None else: assert M is None def test_GRSpec(): f = GRSpec(env_vars={'a'}, sys_vars={'b'}, env_init=['!a'], sys_init=['!b'], env_safety=['a -> X !a', '!a -> X a'], sys_prog=['a && b'])