示例#1
0
文件: yices.py 项目: idkwim/pysmt
 def walk_int_constant(self, formula, **kwargs):
     assert type(formula.constant_value()) == int or \
         type(formula.constant_value()) == long
     rep = str(formula.constant_value())
     res = libyices.yices_parse_rational(String(rep))
     self._check_term_result(res)
     return res
示例#2
0
文件: yices.py 项目: idkwim/pysmt
 def walk_symbol(self, formula, **kwargs):
     symbol_type = formula.symbol_type()
     var_type = self._type_to_yices(symbol_type)
     term = libyices.yices_new_uninterpreted_term(var_type)
     libyices.yices_set_term_name(term, String(formula.symbol_name()))
     self._check_term_result(term)
     return term
示例#3
0
 def declare_variable(self, var):
     if not var.is_symbol(): raise TypeError
     if var.symbol_name() not in self.symbol_to_decl:
         tp = self._type_to_yices(var.symbol_type())
         decl = libyices.yices_new_uninterpreted_term(tp)
         libyices.yices_set_term_name(decl, String(var.symbol_name()))
         self.symbol_to_decl[var] = decl
         self.decl_to_symbol[decl] = var
示例#4
0
文件: yices.py 项目: idkwim/pysmt
 def walk_real_constant(self, formula, **kwargs):
     assert type(formula.constant_value()) == Fraction
     frac = formula.constant_value()
     n,d = frac.numerator, frac.denominator
     rep = str(n) + "/" + str(d)
     res = libyices.yices_parse_rational(String(rep))
     self._check_term_result(res)
     return res
示例#5
0
 def walk_int_constant(self, formula, args):
     assert type(formula.constant_value()) == int or \
         type(formula.constant_value()) == long
     rep = str(formula.constant_value())
     return libyices.yices_parse_rational(String(rep))
示例#6
0
 def _bound_symbol(self, var):
     symbol_type = var.symbol_type()
     var_type = self._type_to_yices(symbol_type)
     term = libyices.yices_new_variable(var_type)
     libyices.yices_set_term_name(term, String(var.symbol_name()))
     return term