(self, expr)
return r
Back convert a Z3 Expression by translation to SMT-LIB.
Back convert a Z3 Expression by translation to SMT-LIB.
Back convert a Z3 Expression by translation to SMT - LIB .
def back_via_smtlib(self, expr):
        """Back convert a Z3 Expression by translation to SMT-LIB."""
        from io import StringIO
        from pysmt.smtlib.parser import SmtLibZ3Parser
        parser = SmtLibZ3Parser(self.env)

        z3.Z3_set_ast_print_mode(expr.ctx.ref(), z3.Z3_PRINT_SMTLIB2_COMPLIANT)
        s = z3.Z3_benchmark_to_smtlib_string(expr.ctx.ref(),
                                             None, None,
                                             None, None,
                                             0, None,
                                             expr.ast)
        stream_in = StringIO(s)
        r = parser.get_script(stream_in).get_last_formula(self.mgr)
        key = (askey(expr), None)
        self._back_memoization[key] = r
        return r
def back_via_smtlib ( self , expr ) : from io import StringIO from pysmt . smtlib . parser import SmtLibZ3Parser parser = SmtLibZ3Parser ( self . env ) z3 . Z3_set_ast_print_mode ( expr . ctx . ref ( ) , z3 . Z3_PRINT_SMTLIB2_COMPLIANT ) s = z3 . Z3_benchmark_to_smtlib_string ( expr . ctx . ref ( ) , None , None , None , None , 0 , None , expr . ast ) stream_in = StringIO ( s ) r = parser . get_script ( stream_in ) . get_last_formula ( self . mgr ) key = ( askey ( expr ) , None ) self . _back_memoization [ key ] = r return r