def encode_run_graph(self, impl: BlankImpl, global_states_to_encode): for a in impl.get_architecture_requirements(): # TODO: looks hacky! replace with two different encoders? self._underlying_solver.assert_(a) # TODO: see 'todo' above, make sense if there are architecture assertions and no automaton if not impl.automaton: return assert len(impl.automaton.initial_sets_list) == 1, "nondet not supported" init_sys_states = impl.init_states for init_spec_state in impl.automaton.initial_sets_list[0]: for init_sys_state in init_sys_states: init_state_condition = self._make_init_states_condition(init_spec_state, init_sys_state) self._underlying_solver.assert_(init_state_condition) state_to_rejecting_scc = build_state_to_rejecting_scc(impl.automaton) spec_states = impl.automaton.nodes for global_state in global_states_to_encode: for spec_state in spec_states: for label, dst_set_list in spec_state.transitions.items(): transition_condition = self._encode_transition( spec_state, global_state, label, state_to_rejecting_scc, impl ) self._underlying_solver.assert_(transition_condition) self._underlying_solver.comment("encoded state " + self._get_smt_name_sys_state(global_state))
def encode_run_graph(self, impl:BlankImpl, global_states_to_encode): for a in impl.get_architecture_requirements(): # TODO: looks hacky! replace with two different encoders? self._underlying_solver.assert_(a) # TODO: see 'todo' above, make sense if there are architecture assertions and no automaton if not impl.automaton: return assert len(impl.automaton.initial_sets_list) == 1, 'nondet not supported' init_sys_states = impl.init_states for init_spec_state in impl.automaton.initial_sets_list[0]: for init_sys_state in init_sys_states: init_state_condition = self._make_init_states_condition(init_spec_state, init_sys_state) self._underlying_solver.assert_(init_state_condition) state_to_rejecting_scc = build_state_to_rejecting_scc(impl.automaton) spec_states = impl.automaton.nodes for global_state in global_states_to_encode: for spec_state in spec_states: for label, dst_set_list in spec_state.transitions.items(): transition_condition = self._encode_transition(spec_state, global_state, label, state_to_rejecting_scc, impl) self._underlying_solver.assert_(transition_condition) self._underlying_solver.comment('encoded state ' + self._get_smt_name_sys_state(global_state))
def is_safety_automaton(ucw_automaton): #TODO: are there better ways to identify safety props than checking corresponding UCW? from synthesis.rejecting_states_finder import build_state_to_rejecting_scc #TODO: bad circular dependence #ltl3ba creates transitional rejecting nodes, so filter them node_to_rej_scc = build_state_to_rejecting_scc(ucw_automaton) for node in ucw_automaton.rejecting_nodes: #TODO: does not work with rejecting edges automaton if node not in node_to_rej_scc: #shitty transitional rejecting node continue assert self_looped(node) or len(node_to_rej_scc[node]) > 1 #TODO: debug purposes if not is_absorbing(node): return False return True
def is_safety_automaton(ucw_automaton): #TODO: are there better ways to identify safety props than checking corresponding UCW? from synthesis.rejecting_states_finder import build_state_to_rejecting_scc #TODO: bad circular dependence #ltl3ba creates transitional rejecting nodes, so filter them node_to_rej_scc = build_state_to_rejecting_scc(ucw_automaton) for node in ucw_automaton.rejecting_nodes: #TODO: does not work with rejecting edges automaton if node not in node_to_rej_scc: #shitty transitional rejecting node continue assert self_looped(node) or len( node_to_rej_scc[node]) > 1 #TODO: debug purposes if not is_absorbing(node): return False return True