Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/z3prover/z3
Browse files Browse the repository at this point in the history
  • Loading branch information
levnach committed Dec 13, 2023
2 parents fc23a49 + 0f4e96a commit 536f4f8
Show file tree
Hide file tree
Showing 28 changed files with 188 additions and 116 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.16)

set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_compiler_flags_overrides.cmake")
project(Z3 VERSION 4.12.3.0 LANGUAGES CXX)
project(Z3 VERSION 4.12.5.0 LANGUAGES CXX)

################################################################################
# Project version
Expand Down
17 changes: 16 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ Version 4.next
- polysat
- native word level bit-vector solving.
- introduction of simple induction lemmas to handle a limited repertoire of induction proofs.
- Light quantifier elimination based on term graphs (egraphs), and corresponding Model Based Projection for arrays and ADTs. Used by Spacer and QSAT.

Version 4.12.5
==============

Version 4.12.4
==============
- Re-release fixing a few issues with 4.12:
- Python dependency on importlib.resources vs importlib_resources break automatic pypi installations. Supposedly fixed by conditioning dependency on Python 3.9 where the feature is built-in.
- Missing release of arm64 for Ubuntu.
- Futile attempt to streamline adding readme.md file as part of Nuget distribution. Nuget.org now requires a readme file. I was able to integrate the readme with the cmake build, but the cross-platform repackage in scripts/mk_nuget_task.py does not ingest a similar readme file with the CI pipelines.

Version 4.12.3
==============
Expand All @@ -23,6 +32,12 @@ Version 4.12.3
- Various (ongoing) performance fixes and improvements to smt.arith.solver=6
- A working version of solver.proof.trim=true option. Proofs logs created when using sat.smt=true may be trimmed by running z3
on the generated proof log using the option solver.proof.trim=true.
- Optimizations LIA and NIA (linear integer arithmetic and non-linear integer (and real) arithmetic reasoning).
smt.arith.solver=6 is the default for most use cases. It trails smt.arith.solver=2 in some scenarios and the gap has been either removed or reduced.
smt.arith.solver=6 is complete for integrations of non-linear real arithmetic and theories, smt.arith.solver=2 is not.
- qel: Light quantifier elimination based on term graphs (egraphs), and corresponding Model Based Projection for arrays and ADTs. Used by Spacer and QSAT.
- added real-closed fields features to C API, exposed more RCF over OCaml API
- fixes to FP

Version 4.12.2
==============
Expand Down
14 changes: 12 additions & 2 deletions scripts/mk_nuget_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ def mk_dir(d):
os_info = { 'ubuntu-latest' : ('so', 'linux-x64'),
'ubuntu-18' : ('so', 'linux-x64'),
'ubuntu-20' : ('so', 'linux-x64'),
'x64-glibc-2.31' : ('so', 'linux-x64'),
'x64-glibc-2.35' : ('so', 'linux-x64'),
'x64-win' : ('dll', 'win-x64'),
'x86-win' : ('dll', 'win-x86'),
'x64-osx' : ('dylib', 'osx-x64'),
'arm64-osx' : ('dylib', 'osx-arm64'),
'debian' : ('so', 'linux-x64') }

# Nuget not supported for ARM
#'arm-glibc-2.35' : ('so', 'linux-arm64'),
#'arm64-osx' : ('dylib', 'osx-arm64'),



def classify_package(f, arch):
Expand Down Expand Up @@ -85,6 +88,8 @@ def mk_targets(source_root):
def mk_icon(source_root):
mk_dir("out/content")
shutil.copy(f"{source_root}/resources/icon.jpg", "out/content/icon.jpg")
shutil.copy(f"{source_root}/src/api/dotnet/README.md", "out/content/README.md")



def create_nuget_spec(version, repo, branch, commit, symbols, arch):
Expand All @@ -104,6 +109,7 @@ def create_nuget_spec(version, repo, branch, commit, symbols, arch):
<copyright>&#169; Microsoft Corporation. All rights reserved.</copyright>
<tags>smt constraint solver theorem prover</tags>
<icon>content/icon.jpg</icon>
<readme>content/README.md</readme>
<projectUrl>https://github.com/Z3Prover/z3</projectUrl>
<license type="expression">MIT</license>
<repository type="git" url="{1}" branch="{2}" commit="{3}" />
Expand All @@ -113,6 +119,10 @@ def create_nuget_spec(version, repo, branch, commit, symbols, arch):
<group targetFramework=".netstandard2.0" />
</dependencies>
</metadata>
<files>
<file src="content/README.md" target="content/README.md"/>
<file src="content/icon.jpg" target="content/icon.jpg"/>
</files>
</package>""".format(version, repo, branch, commit, arch)
print(contents)
sym = "sym." if symbols else ""
Expand Down
2 changes: 1 addition & 1 deletion scripts/mk_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from mk_util import *

def init_version():
set_version(4, 12, 3, 0) # express a default build version or pick up ci build version
set_version(4, 12, 5, 0) # express a default build version or pick up ci build version

# Z3 Project definition
def init_project_def():
Expand Down
4 changes: 3 additions & 1 deletion scripts/mk_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,7 @@ def mk_makefile(self, out):
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Microsoft</Authors>
<Company>Microsoft</Company>
<PackageReadmeFile>README.md</PackageReadmeFile>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Description>Z3 is a satisfiability modulo theories solver from Microsoft Research.</Description>
<Copyright>Copyright Microsoft Corporation. All rights reserved.</Copyright>
Expand All @@ -1745,9 +1746,10 @@ def mk_makefile(self, out):
<ItemGroup>
<Compile Include="..\%s\*.cs;*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
<None Include="..\%s\README.md" Pack="true" PackagePath="/"/>
</ItemGroup>
</Project>""" % (version, key, self.to_src_dir)
</Project>""" % (version, key, self.to_src_dir, self.to_src_dir)

mk_dir(os.path.join(BUILD_DIR, 'dotnet'))
csproj = os.path.join('dotnet', 'z3.csproj')
Expand Down
2 changes: 1 addition & 1 deletion scripts/nightly.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variables:
Major: '4'
Minor: '12'
Patch: '3'
Patch: '5'
AssemblyVersion: $(Major).$(Minor).$(Patch).$(Build.BuildId)
NightlyVersion: $(AssemblyVersion)-$(Build.DefinitionName)

Expand Down
6 changes: 3 additions & 3 deletions scripts/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
trigger: none

variables:
ReleaseVersion: '4.12.3'
ReleaseVersion: '4.12.5'

stages:

Expand Down Expand Up @@ -504,7 +504,7 @@ stages:
displayName: "Download Ubuntu Arm64"
inputs:
artifactName: 'UbuntuArm64'
targetPath: tmp
path: $(Agent.TempDirectory)
- task: DownloadPipelineArtifact@2
displayName: "Download Doc"
inputs:
Expand Down Expand Up @@ -583,7 +583,7 @@ stages:

# Enable on release:
- job: PyPIPublish
condition: eq(1,0)
condition: eq(1,1)
displayName: "Publish to PyPI"
pool:
vmImage: "ubuntu-latest"
Expand Down
7 changes: 5 additions & 2 deletions scripts/update_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# - !/usr/bin/env python
#!/usr/bin/env python
############################################
# Copyright (c) 2012 Microsoft Corporation
#
Expand Down Expand Up @@ -1831,7 +1831,10 @@ def write_core_py_preamble(core_py):
import sys, os
import contextlib
import ctypes
import importlib_resources
if sys.version_info >= (3, 9):
import importlib.resources as importlib_resources
else:
import importlib_resources
from .z3types import *
from .z3consts import *
Expand Down
11 changes: 9 additions & 2 deletions src/api/dotnet/Microsoft.Z3.csproj.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<AssemblyName>Microsoft.Z3</AssemblyName>
<RootNamespace>Microsoft.Z3</RootNamespace>

<PackageReadmeFile>README.md</PackageReadmeFile>

<Title>Z3 .NET Interface</Title>
<AssemblyTitle>Z3 .NET Interface</AssemblyTitle>

Expand All @@ -15,8 +17,8 @@
<Description>Z3 is a satisfiability modulo theories solver from Microsoft Research.</Description>
<AssemblyDescription>.NET Interface to the Z3 Theorem Prover</AssemblyDescription>

<Copyright>Copyright (C) 2006-2019 Microsoft Corporation</Copyright>
<AssemblyCopyright>Copyright (C) 2006-2019 Microsoft Corporation</AssemblyCopyright>
<Copyright>Copyright (C) 2006- Microsoft Corporation</Copyright>
<AssemblyCopyright>Copyright (C) 2006- Microsoft Corporation</AssemblyCopyright>

<Company>Microsoft Corporation</Company>
<AssemblyCompany>Microsoft Corporation</AssemblyCompany>
Expand Down Expand Up @@ -65,6 +67,11 @@
${Z3_DOTNET_COMPILE_ITEMS}
</ItemGroup>

<!-- Readme -->
<ItemGroup>
<None Include="${CMAKE_CURRENT_LIST_DIR}/README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<!-- Legacy .NET framework native library helper routines -->
<ItemGroup>
<Content Include="${CMAKE_CURRENT_LIST_DIR}/Microsoft.Z3.props">
Expand Down
3 changes: 3 additions & 0 deletions src/api/dotnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Z3 Nuget Package

For more information see [the Z3 github page](https://github.com/z3prover/z3.git)
5 changes: 4 additions & 1 deletion src/api/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

build_env = dict(os.environ)
build_env['PYTHON'] = sys.executable
build_env['CXXFLAGS'] = build_env.get('CXXFLAGS', '') + " -std=c++11"
build_env['CXXFLAGS'] = build_env.get('CXXFLAGS', '') + " -std=c++17"

# determine where we're building and where sources are
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -313,6 +313,8 @@ def run(self):
osver = RELEASE_METADATA[3]
if osver.count('.') > 1:
osver = '.'.join(osver.split('.')[:2])
if osver.startswith("11"):
osver = "11_0"
if arch == 'x64':
plat_name ='macosx_%s_x86_64' % osver.replace('.', '_')
elif arch == 'arm64':
Expand All @@ -339,6 +341,7 @@ def run(self):
license='MIT License',
keywords=['z3', 'smt', 'sat', 'prover', 'theorem'],
packages=['z3'],
install_requires = ['importlib-resources'],
include_package_data=True,
package_data={
'z3': [os.path.join('lib', '*'), os.path.join('include', '*.h'), os.path.join('include', 'c++', '*.h')]
Expand Down
10 changes: 9 additions & 1 deletion src/api/python/z3/z3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,12 @@ def sort(self):
return BoolSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)

def __add__(self, other):
return If(self, 1, 0) + If(other, 1, 0)
if isinstance(other, BoolRef):
other = If(other, 1, 0)
return If(self, 1, 0) + other

def __radd__(self, other):
return self + other

def __rmul__(self, other):
return self * other
Expand All @@ -1593,6 +1598,9 @@ def __and__(self, other):

def __or__(self, other):
return Or(self, other)

def __xor__(self, other):
return Xor(self, other)

def __invert__(self):
return Not(self)
Expand Down
5 changes: 4 additions & 1 deletion src/ast/polymorphism_inst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ namespace polymorphism {
t.push(value_trail(m_decl_qhead));
for (; m_decl_qhead < num_decls; ++m_decl_qhead) {
func_decl* p = m_decl_queue.get(m_decl_qhead);
for (expr* e : m_occurs[m.poly_root(p)])
func_decl* r = m.poly_root(p);
if (!m_occurs.contains(r))
continue;
for (expr* e : m_occurs[r])
instantiate(p, e, instances);
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/math/lp/emonics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,4 +611,19 @@ void emonics::set_propagated(monic const& m) {
m_u_f_stack.push(set_unpropagated(*this, m.var()));
}

void emonics::set_bound_propagated(monic const& m) {
struct set_bound_unpropagated : public trail {
emonics& em;
unsigned var;
public:
set_bound_unpropagated(emonics& em, unsigned var): em(em), var(var) {}
void undo() override {
em[var].set_bound_propagated(false);
}
};
SASSERT(!m.is_bound_propagated());
(*this)[m.var()].set_bound_propagated(true);
m_u_f_stack.push(set_bound_unpropagated(*this, m.var()));
}

}
1 change: 1 addition & 0 deletions src/math/lp/emonics.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class emonics {
void after_merge_eh(unsigned r2, unsigned r1, unsigned v2, unsigned v1) {}

void set_propagated(monic const& m);
void set_bound_propagated(monic const& m);

// this method is required by union_find
trail_stack & get_trail_stack() { return m_u_f_stack; }
Expand Down
3 changes: 3 additions & 0 deletions src/math/lp/monic.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class monic: public mon_eq {
bool m_rsign;
mutable unsigned m_visited;
bool m_propagated = false;
bool m_bound_propagated = false;
public:
// constructors
monic(lpvar v, unsigned sz, lpvar const* vs, unsigned idx):
Expand All @@ -77,6 +78,8 @@ class monic: public mon_eq {
void sort_rvars() { std::sort(m_rvars.begin(), m_rvars.end()); }
void set_propagated(bool p) { m_propagated = p; }
bool is_propagated() const { return m_propagated; }
void set_bound_propagated(bool p) { m_bound_propagated = p; }
bool is_bound_propagated() const { return m_bound_propagated; }

svector<lpvar>::const_iterator begin() const { return vars().begin(); }
svector<lpvar>::const_iterator end() const { return vars().end(); }
Expand Down
3 changes: 3 additions & 0 deletions src/math/lp/nla_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,9 @@ void core::add_bounds() {
for (lpvar j : m.vars()) {
if (!var_is_free(j))
continue;
if (m.is_bound_propagated())
continue;
m_emons.set_bound_propagated(m);
// split the free variable (j <= 0, or j > 0), and return
m_literals.push_back(ineq(j, lp::lconstraint_kind::EQ, rational::zero()));
TRACE("nla_solver", print_ineq(m_literals.back(), tout) << "\n");
Expand Down
Loading

0 comments on commit 536f4f8

Please sign in to comment.