def _theory_from_type(self, ty): theory = None if ty.is_real_type(): theory = Theory(real_arithmetic=True, real_difference=True) elif ty.is_int_type(): theory = Theory(integer_arithmetic=True, integer_difference=True) elif ty.is_bool_type(): theory = Theory() elif ty.is_bv_type(): theory = Theory(bit_vectors=True) elif ty.is_array_type(): theory = Theory(arrays=True) theory = theory.combine(self._theory_from_type(ty.index_type)) theory = theory.combine(self._theory_from_type(ty.elem_type)) else: assert ty.is_function_type() theory = Theory(uninterpreted=True) return theory
def _theory_from_type(self, ty): theory = Theory() if ty.is_real_type(): theory.real_arithmetic = True theory.real_difference = True elif ty.is_int_type(): theory.integer_arithmetic = True theory.integer_difference = True elif ty.is_bool_type(): pass elif ty.is_bv_type(): theory.bit_vectors = True elif ty.is_array_type(): theory.arrays = True theory = theory.combine(self._theory_from_type(ty.index_type)) theory = theory.combine(self._theory_from_type(ty.elem_type)) elif ty.is_custom_type(): theory.custom_type = True else: # ty is either a function type theory.uninterpreted = True return theory
def _theory_from_type(self, ty): theory = Theory() if ty.is_real_type(): theory.real_arithmetic = True theory.real_difference = True elif ty.is_int_type(): theory.integer_arithmetic = True theory.integer_difference = True elif ty.is_bool_type(): pass elif ty.is_bv_type(): theory.bit_vectors = True elif ty.is_array_type(): theory.arrays = True theory = theory.combine(self._theory_from_type(ty.index_type)) theory = theory.combine(self._theory_from_type(ty.elem_type)) elif ty.is_string_type(): theory.strings = True elif ty.is_custom_type(): theory.custom_type = True else: # ty is either a function type theory.uninterpreted = True return theory
def walk_function(self, formula, args, **kwargs): """Extends the Theory with UF.""" #pylint: disable=unused-argument if len(args) == 1: theory_out = args[0].copy() elif len(args) > 1: theory_out = args[0] for t in args[1:]: theory_out = theory_out.combine(t) else: theory_out = Theory() # Extend Theory with function return type rtype = formula.function_name().symbol_type().return_type theory_out = theory_out.combine(self._theory_from_type(rtype)) theory_out.uninterpreted = True return theory_out