Esempio n. 1
0
 def test_check_realizable(self):
     assert not gr1c.check_realizable(self.f_un)
     self.f_un.sys_safety = []
     assert gr1c.check_realizable(self.f_un)
     self.f_un.qinit = '\A \A'
     self.f_un.env_init = ['x', 'y = 0', 'y = 5']
     self.f_un.sys_init = list()
     assert gr1c.check_realizable(self.f_un)
     assert gr1c.check_realizable(self.dcounter)
     self.dcounter.qinit = '\A \A'
     self.dcounter.sys_init = list()
     assert gr1c.check_realizable(self.dcounter)
Esempio n. 2
0
    def test_check_realizable(self):
        assert not gr1c.check_realizable(self.f_un,
                                         init_option="ALL_ENV_EXIST_SYS_INIT")
        self.f_un.sys_safety = []
        assert gr1c.check_realizable(self.f_un,
                                     init_option="ALL_ENV_EXIST_SYS_INIT")
        assert gr1c.check_realizable(self.f_un, init_option="ALL_INIT")

        assert gr1c.check_realizable(self.dcounter,
                                     init_option="ALL_ENV_EXIST_SYS_INIT")
        self.dcounter.sys_init = []
        assert gr1c.check_realizable(self.dcounter, init_option="ALL_INIT")
Esempio n. 3
0
 def test_check_realizable(self):
     assert not gr1c.check_realizable(self.f_un)
     self.f_un.sys_safety = []
     assert gr1c.check_realizable(self.f_un)
     self.f_un.qinit = '\A \A'
     self.f_un.env_init = ['x', '!y']
     self.f_un.sys_init = list()
     assert gr1c.check_realizable(self.f_un)
     assert gr1c.check_realizable(self.dcounter)
     self.dcounter.qinit = '\A \A'
     self.dcounter.sys_init = list()
     assert gr1c.check_realizable(self.dcounter)
Esempio n. 4
0
    def test_check_realizable(self):
        assert not gr1c.check_realizable(self.f_un,
                                         init_option="ALL_ENV_EXIST_SYS_INIT")
        self.f_un.sys_safety = []
        assert gr1c.check_realizable(self.f_un,
                                     init_option="ALL_ENV_EXIST_SYS_INIT")
        assert gr1c.check_realizable(self.f_un,
                                     init_option="ALL_INIT")

        assert gr1c.check_realizable(self.dcounter,
                                     init_option="ALL_ENV_EXIST_SYS_INIT")
        self.dcounter.sys_init = []
        assert gr1c.check_realizable(self.dcounter,
                                     init_option="ALL_INIT")
Esempio n. 5
0
def is_realizable(
    option, specs, env=None, sys=None,
    ignore_env_init=False, ignore_sys_init=False,
    bool_states=False, action_vars=None,
    bool_actions=False
):
    """Check realizability.
    
    For details see L{synthesize}.
    """
    bool_states, action_vars, bool_actions = _check_solver_options(
        option, bool_states, action_vars, bool_actions
    )
    
    specs = spec_plus_sys(
        specs, env, sys,
        ignore_env_init, ignore_sys_init,
        bool_states, action_vars, bool_actions
    )
    
    if option == 'gr1c':
        r = gr1c.check_realizable(specs)
    elif option == 'jtlv':
        r = jtlv.check_realizable(specs)
    else:
        raise Exception('Undefined synthesis option. '+\
                        'Current options are "jtlv" and "gr1c"')
    
    if r:
        logger.debug('is realizable')
    else:
        logger.debug('is not realizable')
    
    return r
Esempio n. 6
0
def is_realizable(
    option, specs, env=None, sys=None,
    ignore_env_init=False, ignore_sys_init=False,
    bool_states=False,
    bool_actions=False
):
    """Check realizability.

    For details see L{synthesize}.
    """
    specs = _spec_plus_sys(
        specs, env, sys,
        ignore_env_init, ignore_sys_init,
        bool_states, bool_actions)
    if option == 'gr1c':
        r = gr1c.check_realizable(specs)
    elif option == 'slugs':
        if slugs is None:
            raise ValueError('Import of slugs interface failed. ' +
                             'Please verify installation of "slugs".')
        r = slugs.check_realizable(specs)
    elif option == 'jtlv':
        r = jtlv.check_realizable(specs)
    else:
        raise Exception('Undefined synthesis option. ' +
                        'Current options are "jtlv", "gr1c", and "slugs"')
    if r:
        logger.debug('is realizable')
    else:
        logger.debug('is not realizable')
    return r
Esempio n. 7
0
def realiz_init_illegal_check(init_option):
    spc = GRSpec(moore=False, plus_one=False, qinit=init_option)
    gr1c.check_realizable(spc)
Esempio n. 8
0
def realiz_init_illegal_check(init_option):
    spc = GRSpec()
    gr1c.check_realizable(spc, init_option=init_option)
Esempio n. 9
0
def realiz_init_illegal_test(init_option):
    with pytest.raises(ValueError):
        spc = GRSpec(moore=False, plus_one=False, qinit=init_option)
        gr1c.check_realizable(spc)
Esempio n. 10
0
def realiz_init_illegal_check(init_option):
    spc = GRSpec(moore=False, plus_one=False, qinit=init_option)
    gr1c.check_realizable(spc)