mirror of
https://github.com/Z3Prover/z3
synced 2025-06-20 12:53:38 +00:00
re-indenting interp and duality
This commit is contained in:
parent
e1303e1eab
commit
af444beb2e
38 changed files with 20225 additions and 20225 deletions
|
@ -1,20 +1,20 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
api_interp.cpp
|
||||
api_interp.cpp
|
||||
|
||||
Abstract:
|
||||
API for interpolation
|
||||
Abstract:
|
||||
API for interpolation
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan
|
||||
Ken McMillan
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include<sstream>
|
||||
#include<vector>
|
||||
|
@ -643,69 +643,69 @@ extern "C" {
|
|||
#define IZ3_ROOT SHRT_MAX
|
||||
|
||||
/** This function uses Z3 to determine satisfiability of a set of
|
||||
constraints. If UNSAT, an interpolant is returned, based on the
|
||||
refutation generated by Z3. If SAT, a model is returned.
|
||||
constraints. If UNSAT, an interpolant is returned, based on the
|
||||
refutation generated by Z3. If SAT, a model is returned.
|
||||
|
||||
If "parents" is non-null, computes a tree interpolant. The tree is
|
||||
defined by the array "parents". This array maps each formula in
|
||||
the tree to its parent, where formulas are indicated by their
|
||||
integer index in "cnsts". The parent of formula n must have index
|
||||
greater than n. The last formula is the root of the tree. Its
|
||||
parent entry should be the constant IZ3_ROOT.
|
||||
If "parents" is non-null, computes a tree interpolant. The tree is
|
||||
defined by the array "parents". This array maps each formula in
|
||||
the tree to its parent, where formulas are indicated by their
|
||||
integer index in "cnsts". The parent of formula n must have index
|
||||
greater than n. The last formula is the root of the tree. Its
|
||||
parent entry should be the constant IZ3_ROOT.
|
||||
|
||||
If "parents" is null, computes a sequence interpolant.
|
||||
If "parents" is null, computes a sequence interpolant.
|
||||
|
||||
\param ctx The Z3 context. Must be generated by iz3_mk_context
|
||||
\param num The number of constraints in the sequence
|
||||
\param cnsts Array of constraints (AST's in context ctx)
|
||||
\param parents The parents vector defining the tree structure
|
||||
\param options Interpolation options (may be NULL)
|
||||
\param interps Array to return interpolants (size at least num-1, may be NULL)
|
||||
\param model Returns a Z3 model if constraints SAT (may be NULL)
|
||||
\param labels Returns relevant labels if SAT (may be NULL)
|
||||
\param incremental
|
||||
\param ctx The Z3 context. Must be generated by iz3_mk_context
|
||||
\param num The number of constraints in the sequence
|
||||
\param cnsts Array of constraints (AST's in context ctx)
|
||||
\param parents The parents vector defining the tree structure
|
||||
\param options Interpolation options (may be NULL)
|
||||
\param interps Array to return interpolants (size at least num-1, may be NULL)
|
||||
\param model Returns a Z3 model if constraints SAT (may be NULL)
|
||||
\param labels Returns relevant labels if SAT (may be NULL)
|
||||
\param incremental
|
||||
|
||||
VERY IMPORTANT: All the Z3 formulas in cnsts must be in Z3
|
||||
context ctx. The model and interpolants returned are also
|
||||
in this context.
|
||||
VERY IMPORTANT: All the Z3 formulas in cnsts must be in Z3
|
||||
context ctx. The model and interpolants returned are also
|
||||
in this context.
|
||||
|
||||
The return code is as in Z3_check_assumptions, that is,
|
||||
The return code is as in Z3_check_assumptions, that is,
|
||||
|
||||
Z3_L_FALSE = constraints UNSAT (interpolants returned)
|
||||
Z3_L_TRUE = constraints SAT (model returned)
|
||||
Z3_L_UNDEF = Z3 produced no result, or interpolation not possible
|
||||
Z3_L_FALSE = constraints UNSAT (interpolants returned)
|
||||
Z3_L_TRUE = constraints SAT (model returned)
|
||||
Z3_L_UNDEF = Z3 produced no result, or interpolation not possible
|
||||
|
||||
Currently, this function supports integer and boolean variables,
|
||||
as well as arrays over these types, with linear arithmetic,
|
||||
uninterpreted functions and quantifiers over integers (that is
|
||||
AUFLIA). Interpolants are produced in AULIA. However, some
|
||||
uses of array operations may cause quantifiers to appear in the
|
||||
interpolants even when there are no quantifiers in the input formulas.
|
||||
Although quantifiers may appear in the input formulas, Z3 may give up in
|
||||
this case, returning Z3_L_UNDEF.
|
||||
Currently, this function supports integer and boolean variables,
|
||||
as well as arrays over these types, with linear arithmetic,
|
||||
uninterpreted functions and quantifiers over integers (that is
|
||||
AUFLIA). Interpolants are produced in AULIA. However, some
|
||||
uses of array operations may cause quantifiers to appear in the
|
||||
interpolants even when there are no quantifiers in the input formulas.
|
||||
Although quantifiers may appear in the input formulas, Z3 may give up in
|
||||
this case, returning Z3_L_UNDEF.
|
||||
|
||||
If "incremental" is true, cnsts must contain exactly the set of
|
||||
formulas that are currently asserted in the context. If false,
|
||||
there must be no formulas currently asserted in the context.
|
||||
Setting "incremental" to true makes it posisble to incrementally
|
||||
add and remove constraints from the context until the context
|
||||
becomes UNSAT, at which point an interpolant is computed. Caution
|
||||
must be used, however. Before popping the context, if you wish to
|
||||
keep the interolant formulas, you *must* preserve them by using
|
||||
Z3_persist_ast. Also, if you want to simplify the interpolant
|
||||
formulas using Z3_simplify, you must first pop all of the
|
||||
assertions in the context (or use a different context). Otherwise,
|
||||
the formulas will be simplified *relative* to these constraints,
|
||||
which is almost certainly not what you want.
|
||||
If "incremental" is true, cnsts must contain exactly the set of
|
||||
formulas that are currently asserted in the context. If false,
|
||||
there must be no formulas currently asserted in the context.
|
||||
Setting "incremental" to true makes it posisble to incrementally
|
||||
add and remove constraints from the context until the context
|
||||
becomes UNSAT, at which point an interpolant is computed. Caution
|
||||
must be used, however. Before popping the context, if you wish to
|
||||
keep the interolant formulas, you *must* preserve them by using
|
||||
Z3_persist_ast. Also, if you want to simplify the interpolant
|
||||
formulas using Z3_simplify, you must first pop all of the
|
||||
assertions in the context (or use a different context). Otherwise,
|
||||
the formulas will be simplified *relative* to these constraints,
|
||||
which is almost certainly not what you want.
|
||||
|
||||
|
||||
Current limitations on tree interpolants. In a tree interpolation
|
||||
problem, each constant (0-ary function symbol) must occur only
|
||||
along one path from root to leaf. Function symbols (of arity > 0)
|
||||
are considered to have global scope (i.e., may appear in any
|
||||
interpolant formula).
|
||||
Current limitations on tree interpolants. In a tree interpolation
|
||||
problem, each constant (0-ary function symbol) must occur only
|
||||
along one path from root to leaf. Function symbols (of arity > 0)
|
||||
are considered to have global scope (i.e., may appear in any
|
||||
interpolant formula).
|
||||
|
||||
def_API('Z3_interpolate', BOOL, (_in(CONTEXT), _in(UINT), _in_array(1, AST), _in_array(1, UINT), _in(PARAMS), _out_array(1, AST), _out(MODEL), _out(LITERALS), _in(UINT), _in(UINT), _in_array(9, AST)))
|
||||
def_API('Z3_interpolate', BOOL, (_in(CONTEXT), _in(UINT), _in_array(1, AST), _in_array(1, UINT), _in(PARAMS), _out_array(1, AST), _out(MODEL), _out(LITERALS), _in(UINT), _in(UINT), _in_array(9, AST)))
|
||||
*/
|
||||
|
||||
Z3_lbool Z3_API Z3_interpolate(__in Z3_context ctx,
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
interpolant_cmds.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
Commands for interpolation.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-12-23
|
||||
|
||||
Notes:
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
#include<sstream>
|
||||
#include"cmd_context.h"
|
||||
#include"cmd_util.h"
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
interpolant_cmds.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
Commands for interpolation.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-12-23
|
||||
|
||||
Notes:
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
#ifndef _INTERPOLANT_CMDS_H_
|
||||
#define _INTERPOLANT_CMDS_H_
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
duality.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
main header for duality
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace Duality {
|
|||
Term ExtractStores(hash_map<ast, Term> &memo, const Term &t, std::vector<expr> &cnstrs, hash_map<ast,expr> &renaming);
|
||||
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
void SummarizeRec(hash_set<ast> &memo, std::vector<expr> &lits, int &ops, const Term &t);
|
||||
int CountOperatorsRec(hash_set<ast> &memo, const Term &t);
|
||||
|
@ -126,7 +126,7 @@ protected:
|
|||
Term DeleteBoundRec(hash_map<int,hash_map<ast,Term> > &memo, int level, int num, const Term &t);
|
||||
Term DeleteBound(int level, int num, const Term &t);
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
/** This class represents a relation post-fixed point (RPFP) problem as
|
||||
* a "problem graph". The graph consists of Nodes and hyper-edges.
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
duality_profiling.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
collection performance information for duality
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
|
||||
#include <map>
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
duality_profiling.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
collection performance information for duality
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef DUALITYPROFILING_H
|
||||
#define DUALITYPROFILING_H
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
duality_rpfp.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
implements relational post-fixedpoint problem
|
||||
(RPFP) data structure.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ Revision History:
|
|||
#ifdef Z3OPS
|
||||
|
||||
class Z3_subterm_truth {
|
||||
public:
|
||||
public:
|
||||
virtual bool eval(Z3_ast f) = 0;
|
||||
~Z3_subterm_truth(){}
|
||||
};
|
||||
|
@ -1642,7 +1642,7 @@ namespace Duality {
|
|||
else
|
||||
res = 2;
|
||||
}
|
||||
done:
|
||||
done:
|
||||
memo[f] = res;
|
||||
return res;
|
||||
}
|
||||
|
@ -1729,7 +1729,7 @@ done:
|
|||
else
|
||||
res = 2;
|
||||
}
|
||||
done:
|
||||
done:
|
||||
memo[labpos][f] = res;
|
||||
return res;
|
||||
}
|
||||
|
@ -1873,7 +1873,7 @@ done:
|
|||
lits.push_back(bv);
|
||||
}
|
||||
}
|
||||
done:
|
||||
done:
|
||||
done[truth].insert(f);
|
||||
}
|
||||
|
||||
|
@ -1907,7 +1907,7 @@ done:
|
|||
lits.push_back(bv);
|
||||
}
|
||||
}
|
||||
done:
|
||||
done:
|
||||
done.insert(f);
|
||||
}
|
||||
|
||||
|
@ -2009,9 +2009,9 @@ done:
|
|||
RPFP::Term RPFP::UnderapproxFormula(const Term &f, hash_set<ast> &dont_cares){
|
||||
/* first compute truth values of subterms */
|
||||
hash_map<ast,int> memo;
|
||||
#ifdef Z3OPS
|
||||
#ifdef Z3OPS
|
||||
stt = Z3_mk_subterm_truth(ctx,dualModel);
|
||||
#endif
|
||||
#endif
|
||||
// SubtermTruth(memo,f);
|
||||
/* now compute an implicant */
|
||||
std::vector<Term> lits;
|
||||
|
@ -4276,7 +4276,7 @@ done:
|
|||
return false;
|
||||
}
|
||||
|
||||
RPFP::~RPFP(){
|
||||
RPFP::~RPFP(){
|
||||
ClearProofCore();
|
||||
for(unsigned i = 0; i < nodes.size(); i++)
|
||||
delete nodes[i];
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
duality_solver.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
implements relational post-fixedpoint problem
|
||||
(RPFP) solver
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#pragma warning(disable:4996)
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
wrapper.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
wrap various objects in the style expected by duality
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#pragma warning(disable:4996)
|
||||
|
@ -57,12 +57,12 @@ namespace Duality {
|
|||
m_mode = m().proof_mode();
|
||||
}
|
||||
|
||||
expr context::constant(const std::string &name, const sort &ty){
|
||||
expr context::constant(const std::string &name, const sort &ty){
|
||||
symbol s = str_symbol(name.c_str());
|
||||
return cook(m().mk_const(m().mk_const_decl(s, ty)));
|
||||
}
|
||||
}
|
||||
|
||||
expr context::make(decl_kind op, int n, ::expr **args){
|
||||
expr context::make(decl_kind op, int n, ::expr **args){
|
||||
switch(op) {
|
||||
case True: return mki(m_basic_fid,OP_TRUE,n,args);
|
||||
case False: return mki(m_basic_fid,OP_FALSE,n,args);
|
||||
|
@ -108,46 +108,46 @@ expr context::make(decl_kind op, int n, ::expr **args){
|
|||
assert(0);
|
||||
return expr(*this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
expr context::mki(family_id fid, ::decl_kind dk, int n, ::expr **args){
|
||||
return cook(m().mk_app(fid, dk, 0, 0, n, (::expr **)args));
|
||||
}
|
||||
}
|
||||
|
||||
expr context::make(decl_kind op, const std::vector<expr> &args){
|
||||
expr context::make(decl_kind op, const std::vector<expr> &args){
|
||||
static std::vector< ::expr*> a(10);
|
||||
if(a.size() < args.size())
|
||||
a.resize(args.size());
|
||||
for(unsigned i = 0; i < args.size(); i++)
|
||||
a[i] = to_expr(args[i].raw());
|
||||
return make(op,args.size(), args.size() ? &a[0] : 0);
|
||||
}
|
||||
}
|
||||
|
||||
expr context::make(decl_kind op){
|
||||
expr context::make(decl_kind op){
|
||||
return make(op,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
expr context::make(decl_kind op, const expr &arg0){
|
||||
expr context::make(decl_kind op, const expr &arg0){
|
||||
::expr *a = to_expr(arg0.raw());
|
||||
return make(op,1,&a);
|
||||
}
|
||||
}
|
||||
|
||||
expr context::make(decl_kind op, const expr &arg0, const expr &arg1){
|
||||
expr context::make(decl_kind op, const expr &arg0, const expr &arg1){
|
||||
::expr *args[2];
|
||||
args[0] = to_expr(arg0.raw());
|
||||
args[1] = to_expr(arg1.raw());
|
||||
return make(op,2,args);
|
||||
}
|
||||
}
|
||||
|
||||
expr context::make(decl_kind op, const expr &arg0, const expr &arg1, const expr &arg2){
|
||||
expr context::make(decl_kind op, const expr &arg0, const expr &arg1, const expr &arg2){
|
||||
::expr *args[3];
|
||||
args[0] = to_expr(arg0.raw());
|
||||
args[1] = to_expr(arg1.raw());
|
||||
args[2] = to_expr(arg2.raw());
|
||||
return make(op,3,args);
|
||||
}
|
||||
}
|
||||
|
||||
expr context::make_quant(decl_kind op, const std::vector<expr> &bvs, const expr &body){
|
||||
expr context::make_quant(decl_kind op, const std::vector<expr> &bvs, const expr &body){
|
||||
if(bvs.size() == 0) return body;
|
||||
std::vector< ::expr *> foo(bvs.size());
|
||||
|
||||
|
@ -177,9 +177,9 @@ expr context::make_quant(decl_kind op, const std::vector<expr> &bvs, const expr
|
|||
0, 0
|
||||
);
|
||||
return cook(result.get());
|
||||
}
|
||||
}
|
||||
|
||||
expr context::make_quant(decl_kind op, const std::vector<sort> &_sorts, const std::vector<symbol> &_names, const expr &body){
|
||||
expr context::make_quant(decl_kind op, const std::vector<sort> &_sorts, const std::vector<symbol> &_names, const expr &body){
|
||||
if(_sorts.size() == 0) return body;
|
||||
|
||||
|
||||
|
@ -203,7 +203,7 @@ expr context::make_quant(decl_kind op, const std::vector<sort> &_sorts, const st
|
|||
0, 0
|
||||
);
|
||||
return cook(result.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
decl_kind func_decl::get_decl_kind() const {
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
duality_wrapper.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
wrap various Z3 classes in the style expected by duality
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
--*/
|
||||
#ifndef __DUALITY_WRAPPER_H_
|
||||
#define __DUALITY_WRAPPER_H_
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
foci2.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
An interface class for foci2.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef FOCI2_H
|
||||
#define FOCI2_H
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3base.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Base class for interpolators. Includes an AST manager and a scoping
|
||||
object as bases.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#pragma warning(disable:4996)
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3base.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Base class for interpolators. Includes an AST manager and a scoping
|
||||
object as bases.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3BASE_H
|
||||
#define IZ3BASE_H
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3checker.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
check correctness of interpolant
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#pragma warning(disable:4996)
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3checker.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
check correctness of an interpolant
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3_CHECKER_H
|
||||
#define IZ3_CHECKER_H
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3foci.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Implements a secondary solver using foci2.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3foci.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Implements a secondary solver using foci2.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3FOCI_H
|
||||
#define IZ3FOCI_H
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3hash.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Simple implementation of bucket-list hash tables conforming to SGI
|
||||
hash_map and hash_set interfaces. Just enough members are
|
||||
|
@ -18,13 +18,13 @@ Abstract:
|
|||
This package lives in namespace hash_space. Specializations of
|
||||
class "hash" should be made in this namespace.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3_HASH_H
|
||||
#define IZ3_HASH_H
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3interp.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Interpolation based on proof translation.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
/* Copyright 2011 Microsoft Research. */
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3interp.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Interpolation based on proof translation.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3_INTERP_H
|
||||
#define IZ3_INTERP_H
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3mgr.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
A wrapper around an ast manager, providing convenience methods.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
@ -648,7 +648,7 @@ void iz3mgr::get_assign_bounds_rule_coeffs(const ast &proof, std::vector<rationa
|
|||
extract_lcd(rats);
|
||||
}
|
||||
|
||||
/** Set P to P + cQ, where P and Q are linear inequalities. Assumes P is 0 <= y or 0 < y. */
|
||||
/** Set P to P + cQ, where P and Q are linear inequalities. Assumes P is 0 <= y or 0 < y. */
|
||||
|
||||
void iz3mgr::linear_comb(ast &P, const ast &c, const ast &Q, bool round_off){
|
||||
ast Qrhs;
|
||||
|
@ -825,7 +825,7 @@ iz3mgr::ast iz3mgr::cont_eq(stl_ext::hash_set<ast> &cont_eq_memo, bool truth, as
|
|||
return ast();
|
||||
}
|
||||
|
||||
// substitute a term t for unbound occurrences of variable v in e
|
||||
// substitute a term t for unbound occurrences of variable v in e
|
||||
|
||||
iz3mgr::ast iz3mgr::subst(stl_ext::hash_map<ast,ast> &subst_memo, ast var, ast t, ast e){
|
||||
if(e == var) return t;
|
||||
|
@ -865,9 +865,9 @@ iz3mgr::ast iz3mgr::subst(stl_ext::hash_map<ast,ast> &subst_memo,ast e){
|
|||
return res;
|
||||
}
|
||||
|
||||
// apply a quantifier to a formula, with some optimizations
|
||||
// 1) bound variable does not occur -> no quantifier
|
||||
// 2) bound variable must be equal to some term -> substitute
|
||||
// apply a quantifier to a formula, with some optimizations
|
||||
// 1) bound variable does not occur -> no quantifier
|
||||
// 2) bound variable must be equal to some term -> substitute
|
||||
|
||||
iz3mgr::ast iz3mgr::apply_quant(opr quantifier, ast var, ast e){
|
||||
if((quantifier == Forall && op(e) == And)
|
||||
|
@ -896,5 +896,5 @@ void iz3mgr::get_bound_substitutes(stl_ext::hash_map<ast,bool> &memo, const ast
|
|||
if(op(e) ==
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3mgr.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
A wrapper around an ast manager, providing convenience methods.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3MGR_H
|
||||
#define IZ3MGR_H
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3pp.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Pretty-print interpolation problems
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
/* Copyright 2011 Microsoft Research. */
|
||||
#include <assert.h>
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3pp.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Pretty-print interpolation problems
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3_PP_H
|
||||
#define IZ3_PP_H
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3profiling.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Some routines for measuring performance.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#pragma warning(disable:4996)
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3profiling.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Some routines for measuring performance.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3PROFILING_H
|
||||
#define IZ3PROFILING_H
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3proof.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
This class defines a simple interpolating proof system.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
@ -436,12 +436,12 @@ void iz3proof::interpolate_lemma(node_struct &n){
|
|||
pv->interpolate_clause(n.conclusion,interps[n.frame]);
|
||||
}
|
||||
|
||||
iz3proof::ast iz3proof::interpolate(const prover::range &_rng, bool _weak
|
||||
iz3proof::ast iz3proof::interpolate(const prover::range &_rng, bool _weak
|
||||
#ifdef CHECK_PROOFS
|
||||
, ast assump
|
||||
, std::vector<int> *parents
|
||||
#endif
|
||||
){
|
||||
){
|
||||
// std::cout << "proof size: " << nodes.size() << "\n";
|
||||
rng = _rng;
|
||||
weak = _weak;
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3proof.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
This class defines a simple interpolating proof system.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3PROOF_H
|
||||
#define IZ3PROOF_H
|
||||
|
@ -40,7 +40,7 @@ Revision History:
|
|||
rules Resolution, Assumption, Contra and Lemma, and that all
|
||||
clauses are strict (i.e., each literal in each clause is local).
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
class iz3proof {
|
||||
public:
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3proof.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
This class defines a simple interpolating proof system.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#pragma warning(disable:4996)
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3proof.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
This class defines a simple interpolating proof system.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef IZ3PROOF_ITP_H
|
||||
#define IZ3PROOF_ITP_H
|
||||
|
@ -32,7 +32,7 @@ Revision History:
|
|||
As opposed to iz3proof, this class directly computes interpolants,
|
||||
so the proof representation is just the interpolant itself.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
class iz3proof_itp : public iz3mgr {
|
||||
public:
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3scopes.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Calculations with scopes, for both sequence and tree interpolation.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -85,7 +85,7 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
#else
|
||||
|
||||
|
||||
namespace std {
|
||||
namespace std {
|
||||
template <>
|
||||
class hash<scopes::range_lo > {
|
||||
public:
|
||||
|
@ -93,16 +93,16 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
return p.lo + (size_t)p.next;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
template <> inline
|
||||
size_t stdext::hash_value<scopes::range_lo >(const scopes::range_lo& p)
|
||||
{
|
||||
template <> inline
|
||||
size_t stdext::hash_value<scopes::range_lo >(const scopes::range_lo& p)
|
||||
{
|
||||
std::hash<scopes::range_lo> h;
|
||||
return h(p);
|
||||
}
|
||||
}
|
||||
|
||||
namespace std {
|
||||
namespace std {
|
||||
template <>
|
||||
class less<scopes::range_lo > {
|
||||
public:
|
||||
|
@ -110,18 +110,18 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
return x.lo < y.lo || x.lo == y.lo && (size_t)x.next < (size_t)y.next;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct range_op {
|
||||
struct range_op {
|
||||
scopes::range_lo *x, *y;
|
||||
int hi;
|
||||
range_op(scopes::range_lo *_x, scopes::range_lo *_y, int _hi){
|
||||
x = _x; y = _y; hi = _hi;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace std {
|
||||
namespace std {
|
||||
template <>
|
||||
class hash<range_op > {
|
||||
public:
|
||||
|
@ -129,16 +129,16 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
return (size_t) p.x + (size_t)p.y + p.hi;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
template <> inline
|
||||
size_t stdext::hash_value<range_op >(const range_op& p)
|
||||
{
|
||||
template <> inline
|
||||
size_t stdext::hash_value<range_op >(const range_op& p)
|
||||
{
|
||||
std::hash<range_op> h;
|
||||
return h(p);
|
||||
}
|
||||
}
|
||||
|
||||
namespace std {
|
||||
namespace std {
|
||||
template <>
|
||||
class less<range_op > {
|
||||
public:
|
||||
|
@ -147,16 +147,16 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
((size_t)x.y < (size_t)y.y || x.y == y.y && x.hi < y.hi);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
struct range_tables {
|
||||
struct range_tables {
|
||||
hash_map<scopes::range_lo, scopes::range_lo *> unique;
|
||||
hash_map<range_op,scopes::range_lo *> lub;
|
||||
hash_map<range_op,scopes::range_lo *> glb;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
scopes::range_lo *scopes::find_range_lo(int lo, range_lo *next){
|
||||
scopes::range_lo *scopes::find_range_lo(int lo, range_lo *next){
|
||||
range_lo foo(lo,next);
|
||||
std::pair<range_lo,range_lo *> baz(foo,(range_lo *)0);
|
||||
std::pair<hash_map<range_lo,scopes::range_lo *>::iterator,bool> bar = rt->unique.insert(baz);
|
||||
|
@ -166,9 +166,9 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
//std::pair<hash_set<scopes::range_lo>::iterator,bool> bar = rt->unique.insert(foo);
|
||||
// const range_lo *baz = &*(bar.first);
|
||||
// return (range_lo *)baz; // coerce const
|
||||
}
|
||||
}
|
||||
|
||||
scopes::range_lo *scopes::range_lub_lo(range_lo *rng1, range_lo *rng2){
|
||||
scopes::range_lo *scopes::range_lub_lo(range_lo *rng1, range_lo *rng2){
|
||||
if(!rng1) return rng2;
|
||||
if(!rng2) return rng1;
|
||||
if(rng1->lo > rng2->lo)
|
||||
|
@ -185,10 +185,10 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
range_lo *baz = range_lub_lo(rng1->next,rng2);
|
||||
res = find_range_lo(rng1->lo,baz);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scopes::range_lo *scopes::range_glb_lo(range_lo *rng1, range_lo *rng2, int hi){
|
||||
scopes::range_lo *scopes::range_glb_lo(range_lo *rng1, range_lo *rng2, int hi){
|
||||
if(!rng1) return rng1;
|
||||
if(!rng2) return rng2;
|
||||
if(rng1->lo > rng2->lo)
|
||||
|
@ -216,55 +216,55 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
else foo = range_glb_lo(rng1->next,rng2,hi);
|
||||
res = foo;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/** computes the lub (smallest containing subtree) of two ranges */
|
||||
scopes::range scopes::range_lub(const range &rng1, const range &rng2){
|
||||
/** computes the lub (smallest containing subtree) of two ranges */
|
||||
scopes::range scopes::range_lub(const range &rng1, const range &rng2){
|
||||
int hi = tree_lca(rng1.hi,rng2.hi);
|
||||
if(hi == SHRT_MAX) return range_full();
|
||||
range_lo *lo = range_lub_lo(rng1.lo,rng2.lo);
|
||||
return range(hi,lo);
|
||||
}
|
||||
}
|
||||
|
||||
/** computes the glb (intersection) of two ranges */
|
||||
scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
||||
/** computes the glb (intersection) of two ranges */
|
||||
scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
||||
if(rng1.hi == SHRT_MAX) return rng2;
|
||||
if(rng2.hi == SHRT_MAX) return rng1;
|
||||
int hi = tree_gcd(rng1.hi,rng2.hi);
|
||||
range_lo *lo = hi == SHRT_MIN ? 0 : range_glb_lo(rng1.lo,rng2.lo,hi);
|
||||
if(!lo) hi = SHRT_MIN;
|
||||
return range(hi,lo);
|
||||
}
|
||||
}
|
||||
|
||||
/** is this range empty? */
|
||||
bool scopes::range_is_empty(const range &rng){
|
||||
/** is this range empty? */
|
||||
bool scopes::range_is_empty(const range &rng){
|
||||
return rng.hi == SHRT_MIN;
|
||||
}
|
||||
}
|
||||
|
||||
/** return an empty range */
|
||||
scopes::range scopes::range_empty(){
|
||||
/** return an empty range */
|
||||
scopes::range scopes::range_empty(){
|
||||
return range(SHRT_MIN,0);
|
||||
}
|
||||
}
|
||||
|
||||
/** return a full range */
|
||||
scopes::range scopes::range_full(){
|
||||
/** return a full range */
|
||||
scopes::range scopes::range_full(){
|
||||
return range(SHRT_MAX,0);
|
||||
}
|
||||
}
|
||||
|
||||
/** return the maximal element of a range */
|
||||
int scopes::range_max(const range &rng){
|
||||
/** return the maximal element of a range */
|
||||
int scopes::range_max(const range &rng){
|
||||
return rng.hi;
|
||||
}
|
||||
}
|
||||
|
||||
/** return a minimal (not necessarily unique) element of a range */
|
||||
int scopes::range_min(const range &rng){
|
||||
/** return a minimal (not necessarily unique) element of a range */
|
||||
int scopes::range_min(const range &rng){
|
||||
if(rng.hi == SHRT_MAX) return SHRT_MIN;
|
||||
return rng.lo ? rng.lo->lo : SHRT_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** return range consisting of downward closure of a point */
|
||||
scopes::range scopes::range_downward(int _hi){
|
||||
/** return range consisting of downward closure of a point */
|
||||
scopes::range scopes::range_downward(int _hi){
|
||||
std::vector<bool> descendants(parents.size());
|
||||
for(int i = descendants.size() - 1; i >= 0 ; i--)
|
||||
descendants[i] = i == _hi || parents[i] < parents.size() && descendants[parents[i]];
|
||||
|
@ -275,16 +275,16 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
for(int i = descendants.size() - 1; i >= 0; --i)
|
||||
if(descendants[i]) foo = find_range_lo(i,foo);
|
||||
return range(_hi,foo);
|
||||
}
|
||||
}
|
||||
|
||||
/** add an element to a range */
|
||||
void scopes::range_add(int i, range &n){
|
||||
/** add an element to a range */
|
||||
void scopes::range_add(int i, range &n){
|
||||
range foo = range(i, find_range_lo(i,0));
|
||||
n = range_lub(foo,n);
|
||||
}
|
||||
}
|
||||
|
||||
/** Choose an element of rng1 that is near to rng2 */
|
||||
int scopes::range_near(const range &rng1, const range &rng2){
|
||||
/** Choose an element of rng1 that is near to rng2 */
|
||||
int scopes::range_near(const range &rng1, const range &rng2){
|
||||
|
||||
int frame;
|
||||
int thing = tree_lca(rng1.hi,rng2.hi);
|
||||
|
@ -292,28 +292,28 @@ scopes::range scopes::range_glb(const range &rng1, const range &rng2){
|
|||
range line = range(rng1.hi,find_range_lo(rng2.hi,(range_lo *)0));
|
||||
line = range_glb(line,rng1);
|
||||
return range_min(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** test whether a tree node is contained in a range */
|
||||
bool scopes::in_range(int n, const range &rng){
|
||||
/** test whether a tree node is contained in a range */
|
||||
bool scopes::in_range(int n, const range &rng){
|
||||
range r = range_empty();
|
||||
range_add(n,r);
|
||||
r = range_glb(rng,r);
|
||||
return !range_is_empty(r);
|
||||
}
|
||||
}
|
||||
|
||||
/** test whether two ranges of tree nodes intersect */
|
||||
bool scopes::ranges_intersect(const range &rng1, const range &rng2){
|
||||
/** test whether two ranges of tree nodes intersect */
|
||||
bool scopes::ranges_intersect(const range &rng1, const range &rng2){
|
||||
range r = range_glb(rng1,rng2);
|
||||
return !range_is_empty(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool scopes::range_contained(const range &rng1, const range &rng2){
|
||||
bool scopes::range_contained(const range &rng1, const range &rng2){
|
||||
range r = range_glb(rng1,rng2);
|
||||
return r.hi == rng1.hi && r.lo == rng1.lo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3scopes.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Calculations with scopes, for both sequence and tree interpolation.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
|
||||
#ifndef IZ3SOPES_H
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3secondary
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Interface for secondary provers.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
|
||||
#ifndef IZ3SECONDARY_H
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3translate.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Translate a Z3 proof to in interpolated proof.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#pragma warning(disable:4996)
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
symb commute;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
|
||||
#define from_ast(x) (x)
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3translate.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Interface for proof translations from Z3 proofs to interpolatable
|
||||
proofs.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
|
||||
#ifndef IZ3TRANSLATION_H
|
||||
|
@ -29,7 +29,7 @@ Revision History:
|
|||
// an interpolatable proof
|
||||
|
||||
class iz3translation : public iz3base {
|
||||
public:
|
||||
public:
|
||||
virtual iz3proof::node translate(ast, iz3proof &) = 0;
|
||||
virtual ast quantify(ast e, const range &rng){return e;}
|
||||
virtual ~iz3translation(){}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
iz3translate_direct.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
Translate a Z3 proof into the interpolating proof calculus.
|
||||
Translation is direct, without transformations on the target proof
|
||||
representaiton.
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Ken McMillan (kenmcmil)
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
@ -47,7 +47,7 @@ using namespace stl_ext;
|
|||
/* This can introduce an address dependency if the range type of hash_map has
|
||||
a destructor. Since the code in this file is not used and only here for
|
||||
historical comparisons, we allow this non-determinism.
|
||||
*/
|
||||
*/
|
||||
namespace stl_ext {
|
||||
template <class T>
|
||||
class hash<T *> {
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
// Translation memo for case of non-local resolutions
|
||||
hash_map<non_local_lits *, AstToIpf> non_local_translation;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
|
||||
#define from_ast(x) (x)
|
||||
|
@ -1639,71 +1639,71 @@ public:
|
|||
++it)
|
||||
delete it->second;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef IZ3_TRANSLATE_DIRECT
|
||||
|
||||
iz3translation *iz3translation::create(iz3mgr &mgr,
|
||||
iz3translation *iz3translation::create(iz3mgr &mgr,
|
||||
iz3secondary *secondary,
|
||||
const std::vector<std::vector<ast> > &cnsts,
|
||||
const std::vector<int> &parents,
|
||||
const std::vector<ast> &theory){
|
||||
return new iz3translation_direct(mgr,secondary,cnsts,parents,theory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
|
||||
void iz3translation_direct_trace_lit(iz3translation_direct *p, iz3mgr::ast lit, iz3mgr::ast proof){
|
||||
void iz3translation_direct_trace_lit(iz3translation_direct *p, iz3mgr::ast lit, iz3mgr::ast proof){
|
||||
p->trace_lit(lit, proof);
|
||||
}
|
||||
}
|
||||
|
||||
void iz3translation_direct_show_step(iz3translation_direct *p, iz3mgr::ast proof){
|
||||
void iz3translation_direct_show_step(iz3translation_direct *p, iz3mgr::ast proof){
|
||||
p->show_step(proof);
|
||||
}
|
||||
}
|
||||
|
||||
void iz3translation_direct_show_marked(iz3translation_direct *p, iz3mgr::ast proof){
|
||||
void iz3translation_direct_show_marked(iz3translation_direct *p, iz3mgr::ast proof){
|
||||
p->show_marked(proof);
|
||||
}
|
||||
}
|
||||
|
||||
void iz3translation_direct_show_lit(iz3translation_direct *p, iz3mgr::ast lit){
|
||||
void iz3translation_direct_show_lit(iz3translation_direct *p, iz3mgr::ast lit){
|
||||
p->show_lit(lit);
|
||||
}
|
||||
}
|
||||
|
||||
void iz3translation_direct_show_z3_lit(iz3translation_direct *p, iz3mgr::ast a){
|
||||
void iz3translation_direct_show_z3_lit(iz3translation_direct *p, iz3mgr::ast a){
|
||||
p->show_z3_lit(a);
|
||||
}
|
||||
}
|
||||
|
||||
void iz3translation_direct_pfgoto(iz3translation_direct *p, iz3mgr::ast proof){
|
||||
void iz3translation_direct_pfgoto(iz3translation_direct *p, iz3mgr::ast proof){
|
||||
p->pfgoto(proof);
|
||||
}
|
||||
}
|
||||
|
||||
void iz3translation_direct_show_nll(iz3translation_direct *p, non_local_lits *nll){
|
||||
void iz3translation_direct_show_nll(iz3translation_direct *p, non_local_lits *nll){
|
||||
p->show_nll(nll);
|
||||
}
|
||||
}
|
||||
|
||||
void iz3translation_direct_pfback(iz3translation_direct *p ){
|
||||
void iz3translation_direct_pfback(iz3translation_direct *p ){
|
||||
p->pfback();
|
||||
}
|
||||
}
|
||||
|
||||
void iz3translation_direct_pffwd(iz3translation_direct *p ){
|
||||
void iz3translation_direct_pffwd(iz3translation_direct *p ){
|
||||
p->pffwd();
|
||||
}
|
||||
}
|
||||
|
||||
void iz3translation_direct_pfprem(iz3translation_direct *p, int i){
|
||||
void iz3translation_direct_pfprem(iz3translation_direct *p, int i){
|
||||
p->pfprem(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct stdio_fixer {
|
||||
struct stdio_fixer {
|
||||
stdio_fixer(){
|
||||
std::cout.rdbuf()->pubsetbuf(0,0);
|
||||
}
|
||||
|
||||
} my_stdio_fixer;
|
||||
} my_stdio_fixer;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
duality_dl_interface.cpp
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
SMT2 interface for Duality
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Krystof Hoder (t-khoder) 2011-9-22.
|
||||
Modified by Ken McMIllan (kenmcmil) 2013-4-18.
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#include "dl_context.h"
|
||||
#include "dl_mk_coi_filter.h"
|
||||
|
@ -87,28 +87,28 @@ namespace Duality {
|
|||
};
|
||||
|
||||
|
||||
dl_interface::dl_interface(datalog::context& dl_ctx) :
|
||||
dl_interface::dl_interface(datalog::context& dl_ctx) :
|
||||
engine_base(dl_ctx.get_manager(), "duality"),
|
||||
m_ctx(dl_ctx)
|
||||
|
||||
{
|
||||
{
|
||||
_d = 0;
|
||||
// dl_ctx.get_manager().toggle_proof_mode(PGM_FINE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dl_interface::~dl_interface() {
|
||||
dl_interface::~dl_interface() {
|
||||
if(_d)
|
||||
dealloc(_d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Check if the new rules are weaker so that we can
|
||||
// re-use existing context.
|
||||
//
|
||||
//
|
||||
// Check if the new rules are weaker so that we can
|
||||
// re-use existing context.
|
||||
//
|
||||
#if 0
|
||||
void dl_interface::check_reset() {
|
||||
void dl_interface::check_reset() {
|
||||
// TODO
|
||||
datalog::rule_ref_vector const& new_rules = m_ctx.get_rules().get_rules();
|
||||
datalog::rule_ref_vector const& old_rules = m_old_rules.get_rules();
|
||||
|
@ -127,11 +127,11 @@ void dl_interface::check_reset() {
|
|||
}
|
||||
m_old_rules.reset();
|
||||
m_old_rules.add_rules(new_rules.size(), new_rules.c_ptr());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
lbool dl_interface::query(::expr * query) {
|
||||
lbool dl_interface::query(::expr * query) {
|
||||
|
||||
// we restore the initial state in the datalog context
|
||||
m_ctx.ensure_opened();
|
||||
|
@ -364,29 +364,29 @@ lbool dl_interface::query(::expr * query) {
|
|||
return l_false;
|
||||
}
|
||||
return l_true;
|
||||
}
|
||||
}
|
||||
|
||||
expr_ref dl_interface::get_cover_delta(int level, ::func_decl* pred_orig) {
|
||||
expr_ref dl_interface::get_cover_delta(int level, ::func_decl* pred_orig) {
|
||||
SASSERT(false);
|
||||
return expr_ref(m_ctx.get_manager());
|
||||
}
|
||||
}
|
||||
|
||||
void dl_interface::add_cover(int level, ::func_decl* pred, ::expr* property) {
|
||||
SASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned dl_interface::get_num_levels(::func_decl* pred) {
|
||||
SASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void dl_interface::collect_statistics(::statistics& st) const {
|
||||
}
|
||||
}
|
||||
|
||||
void dl_interface::reset_statistics() {
|
||||
}
|
||||
void dl_interface::reset_statistics() {
|
||||
}
|
||||
|
||||
static hash_set<func_decl> *local_func_decls;
|
||||
static hash_set<func_decl> *local_func_decls;
|
||||
|
||||
static void print_proof(dl_interface *d, std::ostream& out, RPFP *tree, RPFP::Node *root) {
|
||||
context &ctx = d->dd()->ctx;
|
||||
|
@ -456,14 +456,14 @@ static hash_set<func_decl> *local_func_decls;
|
|||
}
|
||||
out << " )";
|
||||
out << ")\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dl_interface::display_certificate(std::ostream& out) const {
|
||||
((dl_interface *)this)->display_certificate_non_const(out);
|
||||
}
|
||||
|
||||
void dl_interface::display_certificate_non_const(std::ostream& out) {
|
||||
void dl_interface::display_certificate_non_const(std::ostream& out) {
|
||||
if(_d->status == StatusModel){
|
||||
ast_manager &m = m_ctx.get_manager();
|
||||
model_ref md = get_model();
|
||||
|
@ -499,14 +499,14 @@ void dl_interface::display_certificate_non_const(std::ostream& out) {
|
|||
model_v2_pp(out,mod);
|
||||
out << "\")\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
expr_ref dl_interface::get_answer() {
|
||||
expr_ref dl_interface::get_answer() {
|
||||
SASSERT(false);
|
||||
return expr_ref(m_ctx.get_manager());
|
||||
}
|
||||
}
|
||||
|
||||
void dl_interface::cancel() {
|
||||
void dl_interface::cancel() {
|
||||
#if 0
|
||||
if(_d && _d->ls)
|
||||
_d->ls->cancel();
|
||||
|
@ -515,15 +515,15 @@ void dl_interface::cancel() {
|
|||
std::cout << "(error \"duality canceled\")\nunknown\n";
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void dl_interface::cleanup() {
|
||||
}
|
||||
void dl_interface::cleanup() {
|
||||
}
|
||||
|
||||
void dl_interface::updt_params() {
|
||||
}
|
||||
void dl_interface::updt_params() {
|
||||
}
|
||||
|
||||
model_ref dl_interface::get_model() {
|
||||
model_ref dl_interface::get_model() {
|
||||
ast_manager &m = m_ctx.get_manager();
|
||||
model_ref md(alloc(::model, m));
|
||||
std::vector<RPFP::Node *> &nodes = _d->rpfp->nodes;
|
||||
|
@ -549,7 +549,7 @@ model_ref dl_interface::get_model() {
|
|||
}
|
||||
}
|
||||
return md;
|
||||
}
|
||||
}
|
||||
|
||||
static proof_ref extract_proof(dl_interface *d, RPFP *tree, RPFP::Node *root) {
|
||||
context &ctx = d->dd()->ctx;
|
||||
|
@ -608,9 +608,9 @@ model_ref dl_interface::get_model() {
|
|||
proof_ref res(mgr.mk_hyper_resolve(pprems.size(),&pprems[0], ctx.uncook(conc), pos, substs),mgr);
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
proof_ref dl_interface::get_proof() {
|
||||
proof_ref dl_interface::get_proof() {
|
||||
if(_d->status == StatusRefutation){
|
||||
hash_set<func_decl> locals;
|
||||
local_func_decls = &locals;
|
||||
|
@ -618,5 +618,5 @@ proof_ref dl_interface::get_proof() {
|
|||
}
|
||||
else
|
||||
return proof_ref(m_ctx.get_manager());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
Module Name:
|
||||
|
||||
duality_dl_interface.h
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
SMT2 interface for Duality
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Krystof Hoder (t-khoder) 2011-9-22.
|
||||
Modified by Ken McMIllan (kenmcmil) 2013-4-18.
|
||||
|
||||
Revision History:
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
#ifndef _DUALITY_DL_INTERFACE_H_
|
||||
#define _DUALITY_DL_INTERFACE_H_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue