Skip to content

Commit 536f4f8

Browse files
committed
Merge branch 'master' of https://github.com/z3prover/z3
2 parents fc23a49 + 0f4e96a commit 536f4f8

28 files changed

+188
-116
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
cmake_minimum_required(VERSION 3.16)
33

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

77
################################################################################
88
# Project version

RELEASE_NOTES.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ Version 4.next
99
- polysat
1010
- native word level bit-vector solving.
1111
- introduction of simple induction lemmas to handle a limited repertoire of induction proofs.
12-
- Light quantifier elimination based on term graphs (egraphs), and corresponding Model Based Projection for arrays and ADTs. Used by Spacer and QSAT.
12+
13+
Version 4.12.5
14+
==============
15+
16+
Version 4.12.4
17+
==============
18+
- Re-release fixing a few issues with 4.12:
19+
- 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.
20+
- Missing release of arm64 for Ubuntu.
21+
- 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.
1322

1423
Version 4.12.3
1524
==============
@@ -23,6 +32,12 @@ Version 4.12.3
2332
- Various (ongoing) performance fixes and improvements to smt.arith.solver=6
2433
- A working version of solver.proof.trim=true option. Proofs logs created when using sat.smt=true may be trimmed by running z3
2534
on the generated proof log using the option solver.proof.trim=true.
35+
- Optimizations LIA and NIA (linear integer arithmetic and non-linear integer (and real) arithmetic reasoning).
36+
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.
37+
smt.arith.solver=6 is complete for integrations of non-linear real arithmetic and theories, smt.arith.solver=2 is not.
38+
- qel: Light quantifier elimination based on term graphs (egraphs), and corresponding Model Based Projection for arrays and ADTs. Used by Spacer and QSAT.
39+
- added real-closed fields features to C API, exposed more RCF over OCaml API
40+
- fixes to FP
2641

2742
Version 4.12.2
2843
==============

scripts/mk_nuget_task.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ def mk_dir(d):
2424
os_info = { 'ubuntu-latest' : ('so', 'linux-x64'),
2525
'ubuntu-18' : ('so', 'linux-x64'),
2626
'ubuntu-20' : ('so', 'linux-x64'),
27-
'x64-glibc-2.31' : ('so', 'linux-x64'),
27+
'x64-glibc-2.35' : ('so', 'linux-x64'),
2828
'x64-win' : ('dll', 'win-x64'),
2929
'x86-win' : ('dll', 'win-x86'),
3030
'x64-osx' : ('dylib', 'osx-x64'),
31-
'arm64-osx' : ('dylib', 'osx-arm64'),
3231
'debian' : ('so', 'linux-x64') }
3332

33+
# Nuget not supported for ARM
34+
#'arm-glibc-2.35' : ('so', 'linux-arm64'),
35+
#'arm64-osx' : ('dylib', 'osx-arm64'),
36+
3437

3538

3639
def classify_package(f, arch):
@@ -85,6 +88,8 @@ def mk_targets(source_root):
8588
def mk_icon(source_root):
8689
mk_dir("out/content")
8790
shutil.copy(f"{source_root}/resources/icon.jpg", "out/content/icon.jpg")
91+
shutil.copy(f"{source_root}/src/api/dotnet/README.md", "out/content/README.md")
92+
8893

8994

9095
def create_nuget_spec(version, repo, branch, commit, symbols, arch):
@@ -104,6 +109,7 @@ def create_nuget_spec(version, repo, branch, commit, symbols, arch):
104109
<copyright>&#169; Microsoft Corporation. All rights reserved.</copyright>
105110
<tags>smt constraint solver theorem prover</tags>
106111
<icon>content/icon.jpg</icon>
112+
<readme>content/README.md</readme>
107113
<projectUrl>https://github.com/Z3Prover/z3</projectUrl>
108114
<license type="expression">MIT</license>
109115
<repository type="git" url="{1}" branch="{2}" commit="{3}" />
@@ -113,6 +119,10 @@ def create_nuget_spec(version, repo, branch, commit, symbols, arch):
113119
<group targetFramework=".netstandard2.0" />
114120
</dependencies>
115121
</metadata>
122+
<files>
123+
<file src="content/README.md" target="content/README.md"/>
124+
<file src="content/icon.jpg" target="content/icon.jpg"/>
125+
</files>
116126
</package>""".format(version, repo, branch, commit, arch)
117127
print(contents)
118128
sym = "sym." if symbols else ""

scripts/mk_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from mk_util import *
99

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

1313
# Z3 Project definition
1414
def init_project_def():

scripts/mk_util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,7 @@ def mk_makefile(self, out):
17361736
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
17371737
<Authors>Microsoft</Authors>
17381738
<Company>Microsoft</Company>
1739+
<PackageReadmeFile>README.md</PackageReadmeFile>
17391740
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
17401741
<Description>Z3 is a satisfiability modulo theories solver from Microsoft Research.</Description>
17411742
<Copyright>Copyright Microsoft Corporation. All rights reserved.</Copyright>
@@ -1745,9 +1746,10 @@ def mk_makefile(self, out):
17451746
17461747
<ItemGroup>
17471748
<Compile Include="..\%s\*.cs;*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
1749+
<None Include="..\%s\README.md" Pack="true" PackagePath="/"/>
17481750
</ItemGroup>
17491751
1750-
</Project>""" % (version, key, self.to_src_dir)
1752+
</Project>""" % (version, key, self.to_src_dir, self.to_src_dir)
17511753

17521754
mk_dir(os.path.join(BUILD_DIR, 'dotnet'))
17531755
csproj = os.path.join('dotnet', 'z3.csproj')

scripts/nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
variables:
22
Major: '4'
33
Minor: '12'
4-
Patch: '3'
4+
Patch: '5'
55
AssemblyVersion: $(Major).$(Minor).$(Patch).$(Build.BuildId)
66
NightlyVersion: $(AssemblyVersion)-$(Build.DefinitionName)
77

scripts/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
trigger: none
77

88
variables:
9-
ReleaseVersion: '4.12.3'
9+
ReleaseVersion: '4.12.5'
1010

1111
stages:
1212

@@ -504,7 +504,7 @@ stages:
504504
displayName: "Download Ubuntu Arm64"
505505
inputs:
506506
artifactName: 'UbuntuArm64'
507-
targetPath: tmp
507+
path: $(Agent.TempDirectory)
508508
- task: DownloadPipelineArtifact@2
509509
displayName: "Download Doc"
510510
inputs:
@@ -583,7 +583,7 @@ stages:
583583

584584
# Enable on release:
585585
- job: PyPIPublish
586-
condition: eq(1,0)
586+
condition: eq(1,1)
587587
displayName: "Publish to PyPI"
588588
pool:
589589
vmImage: "ubuntu-latest"

scripts/update_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# - !/usr/bin/env python
1+
#!/usr/bin/env python
22
############################################
33
# Copyright (c) 2012 Microsoft Corporation
44
#
@@ -1831,7 +1831,10 @@ def write_core_py_preamble(core_py):
18311831
import sys, os
18321832
import contextlib
18331833
import ctypes
1834-
import importlib_resources
1834+
if sys.version_info >= (3, 9):
1835+
import importlib.resources as importlib_resources
1836+
else:
1837+
import importlib_resources
18351838
from .z3types import *
18361839
from .z3consts import *
18371840

src/api/dotnet/Microsoft.Z3.csproj.in

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<AssemblyName>Microsoft.Z3</AssemblyName>
88
<RootNamespace>Microsoft.Z3</RootNamespace>
99

10+
<PackageReadmeFile>README.md</PackageReadmeFile>
11+
1012
<Title>Z3 .NET Interface</Title>
1113
<AssemblyTitle>Z3 .NET Interface</AssemblyTitle>
1214

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

18-
<Copyright>Copyright (C) 2006-2019 Microsoft Corporation</Copyright>
19-
<AssemblyCopyright>Copyright (C) 2006-2019 Microsoft Corporation</AssemblyCopyright>
20+
<Copyright>Copyright (C) 2006- Microsoft Corporation</Copyright>
21+
<AssemblyCopyright>Copyright (C) 2006- Microsoft Corporation</AssemblyCopyright>
2022

2123
<Company>Microsoft Corporation</Company>
2224
<AssemblyCompany>Microsoft Corporation</AssemblyCompany>
@@ -65,6 +67,11 @@
6567
${Z3_DOTNET_COMPILE_ITEMS}
6668
</ItemGroup>
6769

70+
<!-- Readme -->
71+
<ItemGroup>
72+
<None Include="${CMAKE_CURRENT_LIST_DIR}/README.md" Pack="true" PackagePath="\"/>
73+
</ItemGroup>
74+
6875
<!-- Legacy .NET framework native library helper routines -->
6976
<ItemGroup>
7077
<Content Include="${CMAKE_CURRENT_LIST_DIR}/Microsoft.Z3.props">

src/api/dotnet/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Z3 Nuget Package
2+
3+
For more information see [the Z3 github page](https://github.com/z3prover/z3.git)

src/api/python/setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

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

2323
# determine where we're building and where sources are
2424
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
@@ -313,6 +313,8 @@ def run(self):
313313
osver = RELEASE_METADATA[3]
314314
if osver.count('.') > 1:
315315
osver = '.'.join(osver.split('.')[:2])
316+
if osver.startswith("11"):
317+
osver = "11_0"
316318
if arch == 'x64':
317319
plat_name ='macosx_%s_x86_64' % osver.replace('.', '_')
318320
elif arch == 'arm64':
@@ -339,6 +341,7 @@ def run(self):
339341
license='MIT License',
340342
keywords=['z3', 'smt', 'sat', 'prover', 'theorem'],
341343
packages=['z3'],
344+
install_requires = ['importlib-resources'],
342345
include_package_data=True,
343346
package_data={
344347
'z3': [os.path.join('lib', '*'), os.path.join('include', '*.h'), os.path.join('include', 'c++', '*.h')]

src/api/python/z3/z3.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,12 @@ def sort(self):
15721572
return BoolSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
15731573

15741574
def __add__(self, other):
1575-
return If(self, 1, 0) + If(other, 1, 0)
1575+
if isinstance(other, BoolRef):
1576+
other = If(other, 1, 0)
1577+
return If(self, 1, 0) + other
1578+
1579+
def __radd__(self, other):
1580+
return self + other
15761581

15771582
def __rmul__(self, other):
15781583
return self * other
@@ -1593,6 +1598,9 @@ def __and__(self, other):
15931598

15941599
def __or__(self, other):
15951600
return Or(self, other)
1601+
1602+
def __xor__(self, other):
1603+
return Xor(self, other)
15961604

15971605
def __invert__(self):
15981606
return Not(self)

src/ast/polymorphism_inst.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ namespace polymorphism {
9494
t.push(value_trail(m_decl_qhead));
9595
for (; m_decl_qhead < num_decls; ++m_decl_qhead) {
9696
func_decl* p = m_decl_queue.get(m_decl_qhead);
97-
for (expr* e : m_occurs[m.poly_root(p)])
97+
func_decl* r = m.poly_root(p);
98+
if (!m_occurs.contains(r))
99+
continue;
100+
for (expr* e : m_occurs[r])
98101
instantiate(p, e, instances);
99102
}
100103
}

src/math/lp/emonics.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,4 +611,19 @@ void emonics::set_propagated(monic const& m) {
611611
m_u_f_stack.push(set_unpropagated(*this, m.var()));
612612
}
613613

614+
void emonics::set_bound_propagated(monic const& m) {
615+
struct set_bound_unpropagated : public trail {
616+
emonics& em;
617+
unsigned var;
618+
public:
619+
set_bound_unpropagated(emonics& em, unsigned var): em(em), var(var) {}
620+
void undo() override {
621+
em[var].set_bound_propagated(false);
622+
}
623+
};
624+
SASSERT(!m.is_bound_propagated());
625+
(*this)[m.var()].set_bound_propagated(true);
626+
m_u_f_stack.push(set_bound_unpropagated(*this, m.var()));
627+
}
628+
614629
}

src/math/lp/emonics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class emonics {
143143
void after_merge_eh(unsigned r2, unsigned r1, unsigned v2, unsigned v1) {}
144144

145145
void set_propagated(monic const& m);
146+
void set_bound_propagated(monic const& m);
146147

147148
// this method is required by union_find
148149
trail_stack & get_trail_stack() { return m_u_f_stack; }

src/math/lp/monic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class monic: public mon_eq {
5959
bool m_rsign;
6060
mutable unsigned m_visited;
6161
bool m_propagated = false;
62+
bool m_bound_propagated = false;
6263
public:
6364
// constructors
6465
monic(lpvar v, unsigned sz, lpvar const* vs, unsigned idx):
@@ -77,6 +78,8 @@ class monic: public mon_eq {
7778
void sort_rvars() { std::sort(m_rvars.begin(), m_rvars.end()); }
7879
void set_propagated(bool p) { m_propagated = p; }
7980
bool is_propagated() const { return m_propagated; }
81+
void set_bound_propagated(bool p) { m_bound_propagated = p; }
82+
bool is_bound_propagated() const { return m_bound_propagated; }
8083

8184
svector<lpvar>::const_iterator begin() const { return vars().begin(); }
8285
svector<lpvar>::const_iterator end() const { return vars().end(); }

src/math/lp/nla_core.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,9 @@ void core::add_bounds() {
15171517
for (lpvar j : m.vars()) {
15181518
if (!var_is_free(j))
15191519
continue;
1520+
if (m.is_bound_propagated())
1521+
continue;
1522+
m_emons.set_bound_propagated(m);
15201523
// split the free variable (j <= 0, or j > 0), and return
15211524
m_literals.push_back(ineq(j, lp::lconstraint_kind::EQ, rational::zero()));
15221525
TRACE("nla_solver", print_ineq(m_literals.back(), tout) << "\n");

0 commit comments

Comments
 (0)