def __init__(self, environment, logic, user_options=None, debugFile=None): IncrementalTrackingSolver.__init__(self, environment=environment, logic=logic, user_options=user_options) self.msat_config = mathsat.msat_create_default_config(str(logic)) self._prepare_config(self.options, debugFile) self.msat_env = mathsat.msat_create_env(self.msat_config) self.realType = mathsat.msat_get_rational_type(self.msat_env) self.intType = mathsat.msat_get_integer_type(self.msat_env) self.boolType = mathsat.msat_get_bool_type(self.msat_env) self.mgr = environment.formula_manager self.converter = MSatConverter(environment, self.msat_env) return
def __init__(self, environment, logic=None, algorithm='fm'): """Algorithm can be either 'fm' (for Fourier-Motzkin) or 'lw' (for Loos-Weisspfenning)""" IdentityDagWalker.__init__(self, env=environment) self.set_function(self.walk_identity, op.SYMBOL, op.REAL_CONSTANT, op.BOOL_CONSTANT, op.INT_CONSTANT) self.logic = logic assert algorithm in ['fm', 'lw'] self.algorithm = algorithm self.msat_config = mathsat.msat_create_default_config("QF_LRA") self.msat_env = mathsat.msat_create_env(self.msat_config) self.converter = MSatConverter(environment, self.msat_env) self._destroyed = False
def sequence_interpolant(self, formulas): cfg, env = None, None try: self._check_logic(formulas) if len(formulas) < 2: raise Exception("interpolation needs at least 2 formulae") cfg = mathsat.msat_create_config() mathsat.msat_set_option(cfg, "interpolation", "true") if self.logic == QF_BV: mathsat.msat_set_option(cfg, "theory.bv.eager", "false") mathsat.msat_set_option(cfg, "theory.eq_propagaion", "false") env = mathsat.msat_create_env(cfg, self.msat_env()) groups = [] for f in formulas: f = self.converter.convert(f) g = mathsat.msat_create_itp_group(env) mathsat.msat_set_itp_group(env, g) groups.append(g) mathsat.msat_assert_formula(env, f) res = mathsat.msat_solve(env) if res == mathsat.MSAT_UNKNOWN: raise Exception("error in mathsat interpolation: %s" % mathsat.msat_last_error_message(env)) if res == mathsat.MSAT_SAT: return None pysmt_ret = [] for i in xrange(1, len(groups)): itp = mathsat.msat_get_interpolant(env, groups[:i]) f = self.converter.back(itp) pysmt_ret.append(f) return pysmt_ret finally: if cfg: mathsat.msat_destroy_config(cfg) if env: mathsat.msat_destroy_env(env)
def sequence_interpolant(self, formulas): cfg, env = None, None try: self._check_logic(formulas) if len(formulas) < 2: raise Exception("interpolation needs at least 2 formulae") cfg = mathsat.msat_create_config() mathsat.msat_set_option(cfg, "interpolation", "true") if self.logic == QF_BV: mathsat.msat_set_option(cfg, "theory.bv.eager", "false") mathsat.msat_set_option(cfg, "theory.eq_propagaion", "false") env = mathsat.msat_create_env(cfg, self.msat_env) groups = [] for f in formulas: f = self.converter.convert(f) g = mathsat.msat_create_itp_group(env) mathsat.msat_set_itp_group(env, g) groups.append(g) mathsat.msat_assert_formula(env, f) res = mathsat.msat_solve(env) if res == mathsat.MSAT_UNKNOWN: raise Exception("error in mathsat interpolation: %s" % mathsat.msat_last_error_message(env)) if res == mathsat.MSAT_SAT: return None pysmt_ret = [] for i in xrange(1, len(groups)): itp = mathsat.msat_get_interpolant(env, groups[:i]) f = self.converter.back(itp) pysmt_ret.append(f) return pysmt_ret finally: if cfg: mathsat.msat_destroy_config(cfg) if env: mathsat.msat_destroy_env(env)
def __init__(self, environment, logic=None, algorithm='fm'): """Initialize the Quantifier Eliminator using 'fm' or 'lw'. fm: Fourier-Motzkin (default) lw: Loos-Weisspfenning """ if algorithm not in ['fm', 'lw']: raise ValueError("Algorithm can be either 'fm' or 'lw'") QuantifierEliminator.__init__(self) IdentityDagWalker.__init__(self, env=environment) self.set_function(self.walk_identity, op.SYMBOL, op.REAL_CONSTANT, op.BOOL_CONSTANT, op.INT_CONSTANT) self.logic = logic self.algorithm = algorithm self.msat_config = mathsat.msat_create_default_config("QF_LRA") self.msat_env = mathsat.msat_create_env(self.msat_config) self.converter = MSatConverter(environment, self.msat_env)
def __init__(self, environment, logic, options=None, debugFile=None): Solver.__init__(self, environment=environment, logic=logic, options=options) self.config = mathsat.msat_create_default_config(str(logic)) check = mathsat.msat_set_option(self.config, "model_generation", "true") assert check == 0 if debugFile is not None: mathsat.msat_set_option(self.config, "debug.api_call_trace", "1") mathsat.msat_set_option(self.config, "debug.api_call_trace_filename", debugFile) self.msat_env = mathsat.msat_create_env(self.config) self.realType = mathsat.msat_get_rational_type(self.msat_env) self.intType = mathsat.msat_get_integer_type(self.msat_env) self.boolType = mathsat.msat_get_bool_type(self.msat_env) self.mgr = environment.formula_manager self.converter = MSatConverter(environment, self.msat_env) return
def __init__(self, msat_config=None): if msat_config is None: self.msat_env = mathsat.msat_create_env() else: self.msat_env = mathsat.msat_create_env(msat_config)
def __init__(self, environment, logic=None): self.msat_env = mathsat.msat_create_env() self.converter = MSatConverter(environment, self.msat_env) self.environment = environment self.logic = logic
def __init__(self, environment, logic=None): Interpolator.__init__(self) self.msat_env = mathsat.msat_create_env() self.converter = MSatConverter(environment, self.msat_env) self.environment = environment self.logic = logic