def set_logic(self, logic): self._send_silent_command(SmtLibCommand(smtcmd.SET_LOGIC, [logic]))
def _cmd_reset(self, current, tokens): """(reset)""" self.parse_atoms(tokens, current, 0) return SmtLibCommand(current, [])
def set_option(self, name, value): self._send_silent_command(SmtLibCommand(smtcmd.SET_OPTION, [name, value]))
def test_smtlib_info_quoting(self): cmd = SmtLibCommand(smtcmd.SET_INFO, [":source", "This\nis\nmultiline!"]) output = cmd.serialize_to_string() self.assertEqual(output, "(set-info :source |This\nis\nmultiline!|)")
def _cmd_set_option(self, current, tokens): """(set-option <option>)""" elements = self.parse_atoms(tokens, current, 2) return SmtLibCommand(current, elements)
def reset_assertions(self): self._send_silent_command(SmtLibCommand(smtcmd.RESET_ASSERTIONS, [])) return
def pop(self, levels=1): self.declared_vars.pop() self.declared_sorts.pop() self._send_silent_command(SmtLibCommand(smtcmd.POP, [levels]))
def _cmd_get_option(self, current, tokens): """(get-option <keyword>)""" keyword = self.parse_atoms(tokens, current, 1) return SmtLibCommand(current, keyword)
def _cmd_get_proof(self, current, tokens): """(get-proof)""" self.parse_atoms(tokens, current, 0) return SmtLibCommand(current, [])
def _cmd_get_info(self, current, tokens): """(get-info <info_flag>)""" keyword = self.parse_atoms(tokens, current, 1) return SmtLibCommand(current, keyword)
def _cmd_get_model(self, current, tokens): """(get-model)""" self.parse_atoms(tokens, current, 0) return SmtLibCommand(current, [])
def _cmd_get_value(self, current, tokens): """(get-value (<term>+)""" params = self.parse_expr_list(tokens, current) self.consume_closing(tokens, current) return SmtLibCommand(current, params)
def _cmd_check_sat(self, current, tokens): """(check-sat)""" self.parse_atoms(tokens, current, 0) return SmtLibCommand(current, [])
def _cmd_assert(self, current, tokens): """(assert <term>)""" expr = self.get_expression(tokens) self.consume_closing(tokens, current) return SmtLibCommand(current, [expr])
def _declare_sort(self, sort): cmd = SmtLibCommand(smtcmd.DECLARE_SORT, [sort]) self._send_silent_command(cmd) self.declared_sorts[-1].add(sort)
def _cmd_get_unsat_core(self, current, tokens): """(get-unsat-core)""" self.parse_atoms(tokens, current, 0) return SmtLibCommand(current, [])
def _declare_variable(self, symbol): cmd = SmtLibCommand(smtcmd.DECLARE_FUN, [symbol]) self._send_silent_command(cmd) self.declared_vars[-1].add(symbol)
def _cmd_check_sat_assuming(self, current, tokens): """(check-sat-assuming (<prop_literal>*) ) """ params = self.parse_expr_list(tokens, current) self.consume_closing(tokens, current) return SmtLibCommand(current, params)
def push(self, levels=1): self.declared_vars.append(set()) self.declared_sorts.append(set()) self._send_silent_command(SmtLibCommand(smtcmd.PUSH, [levels]))
def _cmd_echo(self, current, tokens): """(echo <string>)""" elements = self.parse_atoms(tokens, current, 1) return SmtLibCommand(current, elements)
def get_value(self, item): self._send_command(SmtLibCommand(smtcmd.GET_VALUE, [item])) lst = self._get_value_answer() assert len(lst) == 1 assert len(lst[0]) == 2 return lst[0][1]
def _cmd_get_assignment(self, current, tokens): """(get-assignment)""" self.parse_atoms(tokens, current, 0) return SmtLibCommand(current, [])
def _cmd_get_assertions(self, current, tokens): """(get_assertions)""" self.parse_atoms(tokens, current, 0) return SmtLibCommand(current, [])
def _cmd_set_info(self, current, tokens): """(set-info <attribute>)""" elements = self.parse_atoms(tokens, current, 2) return SmtLibCommand(current, elements)