mirror of
https://github.com/Z3Prover/z3
synced 2025-06-19 04:13:38 +00:00
Merge branch 'master' of https://github.com/Z3Prover/z3
This commit is contained in:
commit
37f7c30e23
7 changed files with 124 additions and 33 deletions
|
@ -363,7 +363,7 @@ def mk_dotnet(dotnet):
|
|||
dotnet.write(' {\n\n')
|
||||
dotnet.write(' [UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n')
|
||||
dotnet.write(' public delegate void Z3_error_handler(Z3_context c, Z3_error_code e);\n\n')
|
||||
dotnet.write(' public unsafe class LIB\n')
|
||||
dotnet.write(' public class LIB\n')
|
||||
dotnet.write(' {\n')
|
||||
dotnet.write(' const string Z3_DLL_NAME = \"libz3.dll\";\n'
|
||||
' \n')
|
||||
|
|
59
src/api/dotnet/core/DummyContracts.cs
Normal file
59
src/api/dotnet/core/DummyContracts.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*++
|
||||
Copyright (<c>) 2016 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
Contracts.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Dummy Code Contracts class for .NET
|
||||
frameworks that don't support them (e.g., CoreCLR).
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2016-10-06
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
namespace System.Diagnostics.Contracts
|
||||
{
|
||||
public class ContractClass : Attribute
|
||||
{
|
||||
public ContractClass(Type t) { }
|
||||
}
|
||||
|
||||
public class ContractClassFor : Attribute
|
||||
{
|
||||
public ContractClassFor(Type t) { }
|
||||
}
|
||||
|
||||
public class ContractInvariantMethod : Attribute
|
||||
{
|
||||
public ContractInvariantMethod() { }
|
||||
}
|
||||
|
||||
public class ContractVerification : Attribute
|
||||
{
|
||||
public ContractVerification(bool b) { }
|
||||
}
|
||||
|
||||
public class Pure : Attribute { }
|
||||
|
||||
public static class Contract
|
||||
{
|
||||
public static void Ensures(bool b) { }
|
||||
public static void Requires(bool b) { }
|
||||
public static void Assume(bool b, string msg) { }
|
||||
public static void Assert(bool b) { }
|
||||
public static bool ForAll(bool b) { return true; }
|
||||
public static bool ForAll(Object c, Func<Object, bool> p) { return true; }
|
||||
public static bool ForAll(int from, int to, Predicate<int> p) { return true; }
|
||||
public static void Invariant(bool b) { }
|
||||
public static T[] Result<T>() { return new T[1]; }
|
||||
public static void EndContractBlock() { }
|
||||
public static T ValueAtReturn<T>(out T v) { T[] t = new T[1]; v = t[0]; return v; }
|
||||
}
|
||||
}
|
21
src/api/dotnet/core/project.json
Normal file
21
src/api/dotnet/core/project.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"debugType": "portable",
|
||||
"emitEntryPoint": false,
|
||||
"outputName": "Microsoft.Z3",
|
||||
"compile": [ "../*.cs", "*.cs" ]
|
||||
},
|
||||
"dependencies": { },
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
"imports": "dnxcore50"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,6 +10,8 @@ from .z3core import *
|
|||
from .z3printer import *
|
||||
from fractions import Fraction
|
||||
|
||||
from .z3 import _get_ctx
|
||||
|
||||
def _to_numeral(num, ctx=None):
|
||||
if isinstance(num, Numeral):
|
||||
return num
|
||||
|
@ -86,7 +88,7 @@ class Numeral:
|
|||
def __init__(self, num, ctx=None):
|
||||
if isinstance(num, Ast):
|
||||
self.ast = num
|
||||
self.ctx = z3._get_ctx(ctx)
|
||||
self.ctx = _get_ctx(ctx)
|
||||
elif isinstance(num, RatNumRef) or isinstance(num, AlgebraicNumRef):
|
||||
self.ast = num.ast
|
||||
self.ctx = num.ctx
|
||||
|
|
|
@ -1997,9 +1997,9 @@ extern "C" {
|
|||
\param c logical context.
|
||||
\param constr constructor container. The container must have been passed in to a #Z3_mk_datatype call.
|
||||
\param num_fields number of accessor fields in the constructor.
|
||||
\param constructor constructor function declaration.
|
||||
\param tester constructor test function declaration.
|
||||
\param accessors array of accessor function declarations.
|
||||
\param constructor constructor function declaration, allocated by user.
|
||||
\param tester constructor test function declaration, allocated by user.
|
||||
\param accessors array of accessor function declarations allocated by user. The array must contain num_fields elements.
|
||||
|
||||
def_API('Z3_query_constructor', VOID, (_in(CONTEXT), _in(CONSTRUCTOR), _in(UINT), _out(FUNC_DECL), _out(FUNC_DECL), _out_array(2, FUNC_DECL)))
|
||||
*/
|
||||
|
|
|
@ -90,8 +90,7 @@ void fpa2bv_converter::mk_eq(expr * a, expr * b, expr_ref & result) {
|
|||
}
|
||||
|
||||
void fpa2bv_converter::mk_ite(expr * c, expr * t, expr * f, expr_ref & result) {
|
||||
SASSERT(m_util.is_fp(t) && m_util.is_fp(f));
|
||||
|
||||
if (m_util.is_fp(t) && m_util.is_fp(f)) {
|
||||
expr *t_sgn, *t_sig, *t_exp;
|
||||
expr *f_sgn, *f_sig, *f_exp;
|
||||
split_fp(t, t_sgn, t_exp, t_sig);
|
||||
|
@ -103,6 +102,16 @@ void fpa2bv_converter::mk_ite(expr * c, expr * t, expr * f, expr_ref & result) {
|
|||
m_simp.mk_ite(c, t_exp, f_exp, e);
|
||||
|
||||
result = m_util.mk_fp(sgn, e, s);
|
||||
}
|
||||
else if (m_util.is_rm(t) && m_util.is_rm(f))
|
||||
{
|
||||
SASSERT(m_util.is_bv2rm(t) && m_util.is_bv2rm(f));
|
||||
TRACE("fpa2bv", tout << "ite rm: t=" << mk_ismt2_pp(t, m) << " f=" << mk_ismt2_pp(f, m) << std::endl; );
|
||||
m_simp.mk_ite(c, to_app(t)->get_arg(0), to_app(f)->get_arg(0), result);
|
||||
result = m_util.mk_bv2rm(result);
|
||||
}
|
||||
else
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void fpa2bv_converter::mk_distinct(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||
|
|
|
@ -89,7 +89,7 @@ br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * co
|
|||
}
|
||||
else if (m().is_ite(f)) {
|
||||
SASSERT(num == 3);
|
||||
if (m_conv.is_float(args[1])) {
|
||||
if (m_conv.is_float(args[1]) || m_conv.is_rm(args[1])) {
|
||||
m_conv.mk_ite(args[0], args[1], args[2], result);
|
||||
return BR_DONE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue