Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sls #7439

Merged
merged 206 commits into from
Nov 2, 2024
Merged

Sls #7439

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
5ebcc3e
reorg sls
NikolajBjorner Jul 5, 2024
3e57a9c
sls
NikolajBjorner Jul 6, 2024
5253313
na
NikolajBjorner Jul 6, 2024
3ff60a4
split into base and plugin
NikolajBjorner Jul 6, 2024
833f524
move sat_params to params directory, add op_def repair options
NikolajBjorner Jul 6, 2024
e7104eb
move sat_ddfw to sls, initiate sls-bv-plugin
NikolajBjorner Jul 7, 2024
ef54fee
porting bv-sls
NikolajBjorner Jul 8, 2024
8357ac1
adding basic plugin
NikolajBjorner Jul 10, 2024
586343c
na
NikolajBjorner Jul 14, 2024
1cd95e9
add sls-sms solver
NikolajBjorner Jul 14, 2024
402fdf6
bv updates
NikolajBjorner Jul 15, 2024
16c8836
updated dependencies
NikolajBjorner Jul 15, 2024
f00f92c
updated dependencies
NikolajBjorner Jul 15, 2024
5a9161e
use portable ptr-initializer
NikolajBjorner Jul 15, 2024
ff104c4
move definitions to cpp
NikolajBjorner Jul 15, 2024
5f4ca8c
use template<> syntax
NikolajBjorner Jul 15, 2024
706e629
fix compiler errors for gcc
NikolajBjorner Jul 15, 2024
6168402
Bump docker/build-push-action from 6.0.0 to 6.1.0 (#7265)
dependabot[bot] Jun 26, 2024
962e04b
set clean shutdown for local search and re-enable local search when i…
NikolajBjorner Jun 30, 2024
36686ef
Bump docker/build-push-action from 6.1.0 to 6.2.0 (#7269)
dependabot[bot] Jul 1, 2024
0961ebb
Fix a comment for Z3_solver_from_string (#7271)
ligurio Jul 2, 2024
baaad3a
trigger the build with a comment change
levnach Jul 8, 2024
6bd9ea5
remove macro distinction #7270
NikolajBjorner Jul 8, 2024
fd95a0c
fix #7268
NikolajBjorner Jul 8, 2024
d24cf68
kludge to address #7232, probably superseeded by planned revision to …
NikolajBjorner Jul 8, 2024
265ca2f
add new ema invariant (#7288)
ChuyueSun Jul 15, 2024
40a01d7
Bump docker/build-push-action from 6.2.0 to 6.3.0 (#7280)
dependabot[bot] Jul 15, 2024
428361b
merge
NikolajBjorner Jul 15, 2024
04ad63c
fix unit test build
NikolajBjorner Jul 15, 2024
cc20839
remove shared attribute
NikolajBjorner Jul 15, 2024
c7f67f9
remove stale files
NikolajBjorner Jul 16, 2024
5767dfa
fix build of unit test
NikolajBjorner Jul 16, 2024
6bd2a39
fixes and rename sls-cc to sls-euf-plugin
NikolajBjorner Jul 16, 2024
ae55d30
na
NikolajBjorner Jul 16, 2024
5b0d49c
testing / debugging arithmetic
NikolajBjorner Jul 19, 2024
5e62984
updates to repair logic, mainly arithmetic
NikolajBjorner Jul 22, 2024
fce2198
fixes to sls
NikolajBjorner Jul 27, 2024
8dac67d
evolve sls arith
NikolajBjorner Aug 6, 2024
849385c
bugfixes in sls-arith
NikolajBjorner Aug 13, 2024
920c207
fix typo
NikolajBjorner Aug 13, 2024
afef727
bug fixes
NikolajBjorner Aug 13, 2024
74c6eaf
Update sls_test.cpp
NikolajBjorner Aug 13, 2024
4978f5a
fixes
NikolajBjorner Aug 14, 2024
7d765dd
fixes
NikolajBjorner Aug 14, 2024
4383897
fix build
NikolajBjorner Aug 14, 2024
98f4b51
refactor basic plugin and clause generation
NikolajBjorner Aug 15, 2024
de8faa2
fixes to ite and other
NikolajBjorner Aug 16, 2024
8b281b6
updates
NikolajBjorner Aug 19, 2024
f6dd6a3
update
NikolajBjorner Aug 20, 2024
988a46d
fix division by 0
NikolajBjorner Aug 22, 2024
42289c2
disable fail restart
NikolajBjorner Aug 22, 2024
80e7f6d
disable tabu when using reset moves
NikolajBjorner Aug 22, 2024
cfc4448
update sls_test
NikolajBjorner Aug 22, 2024
3884fc7
add factoring
NikolajBjorner Aug 23, 2024
a2b8b72
fixes to semantics
NikolajBjorner Aug 23, 2024
69dd247
re-add tabu override
NikolajBjorner Aug 23, 2024
0b8177c
generalize factoring
NikolajBjorner Aug 23, 2024
b2bc51e
fix bug
NikolajBjorner Aug 23, 2024
11ed990
remove restart
NikolajBjorner Aug 24, 2024
3c92119
disable tabu in fallback modes
NikolajBjorner Aug 24, 2024
67d3f3b
localize impact of factoring
NikolajBjorner Aug 24, 2024
87d556d
delay factoring
NikolajBjorner Aug 24, 2024
29aca5b
flatten products
NikolajBjorner Aug 24, 2024
c643672
perform lookahead update + nested mul
NikolajBjorner Aug 24, 2024
059ccd6
disable nested mul
NikolajBjorner Aug 24, 2024
47b793a
disable nested mul, use non-lookahead
NikolajBjorner Aug 24, 2024
d6b89ba
make reset updates recursive
NikolajBjorner Aug 24, 2024
32c3a5a
include linear moves
NikolajBjorner Aug 25, 2024
ebbcfaf
include 5% reset probability
NikolajBjorner Aug 25, 2024
ab66239
separate linear update
NikolajBjorner Aug 25, 2024
7f02ee4
separate linear update remove 20% threshold
NikolajBjorner Aug 25, 2024
803fd2a
remove linear opt
NikolajBjorner Aug 25, 2024
0df6fe6
enable multiplier expansion, enable linear move
NikolajBjorner Aug 25, 2024
df980ac
use unit coefficients for muls
NikolajBjorner Aug 25, 2024
2bcb56f
disable non-tabu version of find_nl_moves
NikolajBjorner Aug 25, 2024
fa6091d
remove coefficient from multiplication definition
NikolajBjorner Aug 25, 2024
8a49002
reorg monomials
NikolajBjorner Aug 26, 2024
ace3472
add smt params to path
NikolajBjorner Aug 26, 2024
cd92b38
avoid negative reward
NikolajBjorner Aug 26, 2024
2549a2c
use reward as proxy for score
NikolajBjorner Aug 26, 2024
62a8512
use reward as proxy for score
NikolajBjorner Aug 26, 2024
e3b92fe
use exponential decay with breaks
NikolajBjorner Aug 26, 2024
eb555ee
use std::pow
NikolajBjorner Aug 26, 2024
9fcddc5
fixes to bv
NikolajBjorner Aug 27, 2024
6488e33
fixes to fixed
NikolajBjorner Aug 27, 2024
a0ae5c8
fixup repairs
NikolajBjorner Aug 27, 2024
6b0a106
reserve for multiplication
NikolajBjorner Aug 27, 2024
7699ce5
fixing repair
NikolajBjorner Aug 27, 2024
3bcd98b
include bounds checks in set random
NikolajBjorner Aug 27, 2024
4146e93
na
NikolajBjorner Aug 27, 2024
ed0ffc1
fixes to mul
NikolajBjorner Aug 27, 2024
b1f7965
fix mul inverse
NikolajBjorner Aug 27, 2024
677b5b4
fixes to handling signed operators
NikolajBjorner Aug 27, 2024
43a5b3d
logging and fixes
NikolajBjorner Aug 28, 2024
5f9eb89
gcm
NikolajBjorner Aug 29, 2024
e31881b
peli
NikolajBjorner Aug 29, 2024
323003a
Add .env to gitignore to prevent environment files from being tracked
NikolajBjorner Aug 29, 2024
6312ab2
Add m_num_pelis counter to stats in sls_context
NikolajBjorner Aug 29, 2024
dba9670
Remove m_num_pelis member from stats struct in sls_context
NikolajBjorner Aug 30, 2024
7be2c3a
Enhance bv_sls_eval with improved repair and logging, refine is_bv_pr…
NikolajBjorner Aug 30, 2024
d0da026
Remove verbose logging in register_term function of sls_basic_plugin …
NikolajBjorner Aug 30, 2024
27702ba
Rename source files for consistency in `src/ast/sls` directory
NikolajBjorner Aug 31, 2024
6b66e81
Refactor bv_sls files to sls_bv with namespace and class name adjustm…
NikolajBjorner Aug 31, 2024
39eaf62
Remove typename from member declarations in bv_fixed class
NikolajBjorner Sep 1, 2024
27e3d28
fixing conca
NikolajBjorner Sep 1, 2024
027dd9c
Add initial implementation of bit-vector SLS evaluation module in bv_…
NikolajBjorner Sep 1, 2024
8319832
Remove bv_sls_eval.cpp as part of code cleanup and refactoring
NikolajBjorner Sep 1, 2024
a8486d6
Refactor alignment of member variables in bv_plugin of sls namespace
NikolajBjorner Sep 2, 2024
2d3f92a
Rename SLS engine related files to reflect their specific use for bit…
NikolajBjorner Sep 3, 2024
ffa53fe
Refactor SLS engine and evaluator components for bit-vector specifics…
NikolajBjorner Sep 3, 2024
02393c3
Enhance bv_eval with use_current, lookahead strategies, and randomiza…
NikolajBjorner Sep 4, 2024
0308a92
Refactor verbose logging and fix logic in range adjustment functions …
NikolajBjorner Sep 5, 2024
acd6f1d
Remove commented verbose output in sls_bv_plugin.cpp during repair pr…
NikolajBjorner Sep 5, 2024
cc77ff5
Add early return after setting fixed subterms in sls_bv_fixed.cpp
NikolajBjorner Sep 5, 2024
33364c3
Remove redundant return statement in sls_bv_fixed.cpp
NikolajBjorner Sep 5, 2024
fe7dcb0
fixes to new value propagation
NikolajBjorner Sep 6, 2024
1d3891f
Refactor sls bv evaluation and fix logic checks for bit operations
NikolajBjorner Sep 6, 2024
f9ec6b4
Add array plugin support and update bv_eval in ast_sls module
NikolajBjorner Sep 6, 2024
2f2559d
Add array, model value, and user sort plugins to SLS module with enha…
NikolajBjorner Sep 7, 2024
25c19b6
Refactor array_plugin in sls to improve handling of select expression…
NikolajBjorner Sep 7, 2024
a24b948
Enhance array plugin with early termination and propagation verificat…
NikolajBjorner Sep 8, 2024
dda5dd7
Add support for handling 'distinct' expressions in SLS context and us…
NikolajBjorner Sep 8, 2024
b7be589
Remove model value and user sort plugins from SLS theory
NikolajBjorner Sep 9, 2024
554b325
replace user plugin by euf plugin
NikolajBjorner Sep 9, 2024
633ea63
remove extra file
NikolajBjorner Sep 9, 2024
c9bd8d5
Refactor handling of term registration and enhance distinct handling …
NikolajBjorner Sep 9, 2024
45c0bda
Add TODO list for enhancements in sls_euf_plugin.cpp
NikolajBjorner Sep 12, 2024
f8fa2de
add incremental mode
NikolajBjorner Oct 11, 2024
5d9d134
Merge branch 'master' into sls
NikolajBjorner Oct 11, 2024
73f09fe
updated package
NikolajBjorner Oct 11, 2024
2ecb1c8
fix sls build
NikolajBjorner Oct 11, 2024
9b6c161
break sls build
NikolajBjorner Oct 11, 2024
d278a16
fix build
NikolajBjorner Oct 11, 2024
d2ce7b0
break build again
NikolajBjorner Oct 11, 2024
9eb6f97
fix build
NikolajBjorner Oct 11, 2024
46252b6
fixes
NikolajBjorner Oct 11, 2024
2af713e
fixing incremental
NikolajBjorner Oct 11, 2024
d7b8236
avoid units
NikolajBjorner Oct 12, 2024
766b9df
fixup handling of disequality propagation
NikolajBjorner Oct 12, 2024
1765141
fx
NikolajBjorner Oct 12, 2024
609c463
recover shift-weight loop
NikolajBjorner Oct 12, 2024
2bd335d
alternate
NikolajBjorner Oct 12, 2024
9b54254
throttle save model
NikolajBjorner Oct 13, 2024
c1b9a3c
allow for alternating
NikolajBjorner Oct 13, 2024
0482478
fix test for new signature of flip
NikolajBjorner Oct 13, 2024
f136d46
bug fixes
NikolajBjorner Oct 14, 2024
54cce7b
restore use of value_hash
NikolajBjorner Oct 14, 2024
ef20237
fixes
NikolajBjorner Oct 14, 2024
5fdf300
adding dt plugin
NikolajBjorner Oct 15, 2024
b551f22
adt
NikolajBjorner Oct 15, 2024
a4275df
dt updates
NikolajBjorner Oct 15, 2024
295be75
added cycle detection
NikolajBjorner Oct 15, 2024
af68753
updated sls-datatype
NikolajBjorner Oct 15, 2024
1806143
Refactor context management, improve datatype handling, and enhance l…
NikolajBjorner Oct 16, 2024
0755b2b
axiomatize dt
NikolajBjorner Oct 17, 2024
6143070
add missing factory plugins to model
NikolajBjorner Oct 17, 2024
8ababaf
fixup finite domain search
NikolajBjorner Oct 17, 2024
0218a15
fixup finite domain search
NikolajBjorner Oct 17, 2024
69c28f8
fixes
NikolajBjorner Oct 17, 2024
7b42ab5
redo dfs
NikolajBjorner Oct 17, 2024
5864fcb
fixing model construction for underspecified operators
NikolajBjorner Oct 18, 2024
aa2292d
fixes to occurs check
NikolajBjorner Oct 18, 2024
a72ad44
fixup interpretation building
NikolajBjorner Oct 18, 2024
6c3fe3c
saturate worklist
NikolajBjorner Oct 18, 2024
3f33e2c
delay distinct axiom
NikolajBjorner Oct 18, 2024
a48044c
adding model-based sls for datatatypes
NikolajBjorner Oct 20, 2024
68ee510
update the interface in sls_solver to transfer phase between SAT and SLS
NikolajBjorner Oct 20, 2024
cc43098
add value transfer option
NikolajBjorner Oct 20, 2024
59b0e46
rename aux functions
NikolajBjorner Oct 20, 2024
185ddd6
Track shared variables using a unit set
NikolajBjorner Oct 21, 2024
b0dd83c
debugging parallel integration
NikolajBjorner Oct 21, 2024
9308614
fix dirty flag setting
NikolajBjorner Oct 22, 2024
f453cde
update log level
NikolajBjorner Oct 22, 2024
ef95b4e
add plugin to smt_context, factor out sls_smt_plugin functionality.
NikolajBjorner Oct 26, 2024
22ab598
bug fixes
NikolajBjorner Oct 26, 2024
894bfc7
fixes
NikolajBjorner Oct 26, 2024
848bfb1
use common infrastructure for sls-smt
NikolajBjorner Oct 26, 2024
ba1630f
fix build
NikolajBjorner Oct 26, 2024
a88daf2
fix build
NikolajBjorner Oct 26, 2024
0c2e09d
remove declaration of context
NikolajBjorner Oct 26, 2024
d7b1a5e
add virtual destructor
NikolajBjorner Oct 26, 2024
ab2c992
build warnings
NikolajBjorner Oct 26, 2024
f902feb
reorder inclusion order to define smt_context before theory_sls
NikolajBjorner Oct 26, 2024
fb78a9e
change namespace for single threaded
NikolajBjorner Oct 26, 2024
646eacd
check delayed eqs before nla
NikolajBjorner Oct 26, 2024
c6f5e32
use independent completion flag for sls to avoid conflating with genu…
NikolajBjorner Oct 26, 2024
6f37da5
validate sls-arith lemmas
NikolajBjorner Oct 26, 2024
aa67c36
bugfixes
NikolajBjorner Oct 26, 2024
7e2acad
add intblast to legacy SMT solver
NikolajBjorner Oct 27, 2024
98bc3d3
fixup model generation for theory_intblast
NikolajBjorner Oct 27, 2024
bdf3689
na
NikolajBjorner Oct 28, 2024
5e2cefe
mk_value needs to accept more cases where integer expression doesn't …
NikolajBjorner Oct 28, 2024
e35eab0
use th-axioms to track origins of assertions
NikolajBjorner Oct 28, 2024
077b173
add missing operator handling for bitwise operators
NikolajBjorner Oct 28, 2024
9a5fa60
add missing operator handling for bitwise operators
NikolajBjorner Oct 28, 2024
7e9d053
normalizing inequality
NikolajBjorner Oct 28, 2024
fbf3012
add virtual destructor
NikolajBjorner Oct 28, 2024
0a404f9
rework elim_unconstrained
NikolajBjorner Oct 30, 2024
289f836
fix non-termination
NikolajBjorner Oct 30, 2024
55b64e1
use glue as computed without adjustment
NikolajBjorner Nov 1, 2024
040c29a
update model generation to fix model bug
NikolajBjorner Nov 1, 2024
c7ec2af
fixes to model construction
NikolajBjorner Nov 1, 2024
7875c95
Merge branch 'master' into sls
NikolajBjorner Nov 2, 2024
40b927f
remove package and package lock
NikolajBjorner Nov 2, 2024
d702e68
fix build warning
NikolajBjorner Nov 2, 2024
6559584
use original gai
NikolajBjorner Nov 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ rebase.cmd
callgrind.out.*
# .hpp files are automatically generated
*.hpp
.env
.z3-trace
.env
.genaiscript
Expand All @@ -28,6 +29,8 @@ ocamlz3
# Emacs temp files
\#*\#
# Directories with generated code and documentation
node_modules/*
.genaiscript/*
release/*
build/*
trace/*
Expand Down Expand Up @@ -105,3 +108,4 @@ CMakeSettings.json
.DS_Store
dbg/**
*.wsp
CppProperties.json
14 changes: 7 additions & 7 deletions scripts/mk_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ def init_project_def():
add_lib('parser_util', ['ast'], 'parsers/util')
add_lib('euf', ['ast'], 'ast/euf')
add_lib('grobner', ['ast', 'dd', 'simplex'], 'math/grobner')
add_lib('sat', ['params', 'util', 'dd', 'grobner'])
add_lib('nlsat', ['polynomial', 'sat'])
add_lib('lp', ['util', 'nlsat', 'grobner', 'interval', 'smt_params'], 'math/lp')
add_lib('rewriter', ['ast', 'polynomial', 'interval', 'automata', 'params'], 'ast/rewriter')
add_lib('bit_blaster', ['rewriter'], 'ast/rewriter/bit_blaster')
add_lib('normal_forms', ['rewriter'], 'ast/normal_forms')
add_lib('substitution', ['rewriter'], 'ast/substitution')
add_lib('proofs', ['rewriter'], 'ast/proofs')
add_lib('macros', ['rewriter'], 'ast/macros')
add_lib('model', ['macros'])
add_lib('converters', ['model'], 'ast/converters')
add_lib('ast_sls', ['ast','normal_forms','converters','smt_params','euf'], 'ast/sls')
add_lib('sat', ['params', 'util', 'dd', 'ast_sls', 'grobner'])
add_lib('nlsat', ['polynomial', 'sat'])
add_lib('lp', ['util', 'nlsat', 'grobner', 'interval', 'smt_params'], 'math/lp')
add_lib('bit_blaster', ['rewriter'], 'ast/rewriter/bit_blaster')
add_lib('substitution', ['rewriter'], 'ast/substitution')
add_lib('proofs', ['rewriter'], 'ast/proofs')
add_lib('simplifiers', ['euf', 'normal_forms', 'bit_blaster', 'converters', 'substitution'], 'ast/simplifiers')
add_lib('ast_sls', ['ast','normal_forms','converters'], 'ast/sls')
add_lib('tactic', ['simplifiers'])
add_lib('mbp', ['model', 'simplex'], 'qe/mbp')
add_lib('qe_lite', ['tactic', 'mbp'], 'qe/lite')
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ add_subdirectory(ast/euf)
add_subdirectory(ast/converters)
add_subdirectory(ast/substitution)
add_subdirectory(ast/simplifiers)
add_subdirectory(ast/sls)
add_subdirectory(tactic)
add_subdirectory(qe/mbp)
add_subdirectory(qe/lite)
Expand All @@ -74,6 +73,7 @@ add_subdirectory(parsers/smt2)
add_subdirectory(solver/assertions)
add_subdirectory(ast/pattern)
add_subdirectory(math/lp)
add_subdirectory(ast/sls)
add_subdirectory(sat/smt)
add_subdirectory(sat/tactic)
add_subdirectory(nlsat/tactic)
Expand Down
1 change: 1 addition & 0 deletions src/ast/arith_decl_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ class arith_recognizers {
MATCH_BINARY(is_div0);
MATCH_BINARY(is_idiv0);
MATCH_BINARY(is_power);
MATCH_BINARY(is_power0);

MATCH_UNARY(is_sin);
MATCH_UNARY(is_asin);
Expand Down
2 changes: 1 addition & 1 deletion src/ast/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,7 @@ ast * ast_manager::register_node_core(ast * n) {

n->m_id = is_decl(n) ? m_decl_id_gen.mk() : m_expr_id_gen.mk();

// track_id(*this, n, 77);
// track_id(*this, n, 9213);

// TRACE("ast", tout << (s_count++) << " Object " << n->m_id << " was created.\n";);
TRACE("mk_var_bug", tout << "mk_ast: " << n->m_id << "\n";);
Expand Down
4 changes: 2 additions & 2 deletions src/ast/bv_decl_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,13 +932,13 @@ unsigned bv_util::get_int2bv_size(parameter const& p) {
return static_cast<unsigned>(sz);
}

app * bv_util::mk_bv2int(expr* e) {
app * bv_util::mk_bv2int(expr* e) const {
sort* s = m_manager.mk_sort(m_manager.mk_family_id("arith"), INT_SORT);
parameter p(s);
return m_manager.mk_app(get_fid(), OP_BV2INT, 1, &p, 1, &e);
}

app* bv_util::mk_int2bv(unsigned sz, expr* e) {
app* bv_util::mk_int2bv(unsigned sz, expr* e) const {
parameter p(sz);
return m_manager.mk_app(get_fid(), OP_INT2BV, 1, &p, 1, &e);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ast/bv_decl_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,8 @@ class bv_util : public bv_recognizers {
app * mk_bv_ashr(expr* arg1, expr* arg2) { return m_manager.mk_app(get_fid(), OP_BASHR, arg1, arg2); }
app * mk_bv_lshr(expr* arg1, expr* arg2) { return m_manager.mk_app(get_fid(), OP_BLSHR, arg1, arg2); }

app * mk_bv2int(expr* e);
app * mk_int2bv(unsigned sz, expr* e);
app * mk_bv2int(expr* e) const;
app * mk_int2bv(unsigned sz, expr* e) const;

app* mk_bv_rotate_left(expr* arg1, expr* arg2) { return m_manager.mk_app(get_fid(), OP_EXT_ROTATE_LEFT, arg1, arg2); }
app* mk_bv_rotate_right(expr* arg1, expr* arg2) { return m_manager.mk_app(get_fid(), OP_EXT_ROTATE_RIGHT, arg1, arg2); }
Expand Down
2 changes: 2 additions & 0 deletions src/ast/datatype_decl_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,10 @@ namespace datatype {
ast_manager & get_manager() const { return m; }
// sort * mk_datatype_sort(symbol const& name, unsigned n, sort* const* params);
bool is_datatype(sort const* s) const { return is_sort_of(s, fid(), DATATYPE_SORT); }
bool is_datatype(expr* e) const { return is_datatype(e->get_sort()); }
bool is_enum_sort(sort* s);
bool is_recursive(sort * ty);
bool is_recursive(expr* e) { return is_recursive(e->get_sort()); }
bool is_recursive_nested(sort * ty);
bool is_constructor(func_decl * f) const { return is_decl_of(f, fid(), OP_DT_CONSTRUCTOR); }
bool is_recognizer(func_decl * f) const { return is_recognizer0(f) || is_is(f); }
Expand Down
17 changes: 16 additions & 1 deletion src/ast/euf/euf_egraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ namespace euf {

void egraph::reinsert_equality(enode* p) {
SASSERT(p->is_equality());
if (p->value() != l_true && p->get_arg(0)->get_root() == p->get_arg(1)->get_root())
if (p->value() != l_true && p->get_arg(0)->get_root() == p->get_arg(1)->get_root()) {
queue_literal(p, nullptr);
if (p->value() == l_false && !m_on_propagate_literal)
set_conflict(p->get_arg(0), p->get_arg(1), p->m_lit_justification);
}
}

void egraph::queue_literal(enode* p, enode* ante) {
Expand Down Expand Up @@ -201,6 +204,18 @@ namespace euf {
}
}

void egraph::new_diseq(enode* n, void* reason) {
force_push();
SASSERT(m.is_eq(n->get_expr()));
auto j = justification::external(reason);
auto a = n->get_arg(0), b = n->get_arg(1);
auto r1 = a->get_root(), r2 = b->get_root();
if (r1 == r2)
set_conflict(a, b, j);
else
set_value(n, l_false, j);
}

void egraph::new_diseq(enode* n) {
SASSERT(n->is_equality());
SASSERT(n->value() == l_false);
Expand Down
3 changes: 2 additions & 1 deletion src/ast/euf/euf_egraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,11 @@ namespace euf {
*/
void merge(enode* n1, enode* n2, void* reason) { merge(n1, n2, justification::external(reason)); }
void new_diseq(enode* n);
void new_diseq(enode* n, void* reason);


/**
\brief propagate set of merges.
\brief propagate set of merges.
This call may detect an inconsistency. Then inconsistent() is true.
Use then explain() to extract an explanation for the conflict.

Expand Down
1 change: 1 addition & 0 deletions src/ast/rewriter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ z3_add_component(rewriter
array_rewriter.cpp
ast_counter.cpp
bit2int.cpp
bv2int_translator.cpp
bool_rewriter.cpp
bv_bounds.cpp
bv_elim.cpp
Expand Down
125 changes: 124 additions & 1 deletion src/ast/rewriter/arith_rewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,129 @@ br_status arith_rewriter::reduce_power(expr * arg1, expr * arg2, op_kind kind, e
}
}

bool arith_rewriter::is_mul_factor(expr* s, expr* t) {
if (m_util.is_mul(t))
return any_of(*to_app(t), [&](expr* m) { return is_mul_factor(s, m); });
return s == t;
}

bool arith_rewriter::is_add_factor(expr* s, expr* t) {
if (m_util.is_add(t))
return all_of(*to_app(t), [&](expr* f) { return is_add_factor(s, f); });
return is_mul_factor(s, t);
}

expr_ref arith_rewriter::remove_factor(expr* s, expr* t) {

if (m_util.is_mul(t)) {
ptr_buffer<expr> r;
r.push_back(t);
for (unsigned i = 0; i < r.size(); ++i) {
expr* arg = r[i];
if (m_util.is_mul(arg)) {
r.append(to_app(arg)->get_num_args(), to_app(arg)->get_args());
r[i] = r.back();
r.pop_back();
--i;
continue;
}
if (s == arg) {
r[i] = r.back();
r.pop_back();
break;
}
}
switch (r.size()) {
case 0:
return expr_ref(m_util.mk_numeral(rational(1), m_util.is_int(t)), m);
case 1:
return expr_ref(r[0], m);
default:
return expr_ref(m_util.mk_mul(r.size(), r.data()), m);
}
}
if (m_util.is_add(t)) {
expr_ref_vector sum(m);
sum.push_back(t);
for (unsigned i = 0; i < sum.size(); ++i) {
expr* arg = sum.get(i);
if (m_util.is_add(arg)) {
sum.append(to_app(arg)->get_num_args(), to_app(arg)->get_args());
sum[i] = sum.back();
sum.pop_back();
--i;
continue;
}
sum[i] = remove_factor(s, arg);
}
if (sum.size() == 1)
return expr_ref(sum.get(0), m);
else
return expr_ref(m_util.mk_add(sum.size(), sum.data()), m);
}
else {
SASSERT(s == t);
return expr_ref(m_util.mk_numeral(rational(1), m_util.is_int(t)), m);
}
}


void arith_rewriter::get_nl_muls(expr* t, ptr_buffer<expr>& muls) {
if (m_util.is_mul(t)) {
for (expr* arg : *to_app(t))
get_nl_muls(arg, muls);
}
else if (!m_util.is_numeral(t))
muls.push_back(t);
}

expr* arith_rewriter::find_nl_factor(expr* t) {
ptr_buffer<expr> sum, muls;
sum.push_back(t);

for (unsigned i = 0; i < sum.size(); ++i) {
expr* arg = sum[i];
if (m_util.is_add(arg))
sum.append(to_app(arg)->get_num_args(), to_app(arg)->get_args());
else if (m_util.is_mul(arg)) {
muls.reset();
get_nl_muls(arg, muls);
if (muls.size() <= 1)
continue;
for (auto m : muls) {
if (is_add_factor(m, t))
return m;
}
return nullptr;
}
}
return nullptr;
}

br_status arith_rewriter::factor_le_ge_eq(expr * arg1, expr * arg2, op_kind kind, expr_ref & result) {

if (is_zero(arg2)) {
expr* f = find_nl_factor(arg1);
if (!f)
return BR_FAILED;
expr_ref f2 = remove_factor(f, arg1);
expr* z = m_util.mk_numeral(rational(0), m_util.is_int(arg1));
result = m.mk_or(m_util.mk_eq(f, z), m_util.mk_eq(f2, z));
switch (kind) {
case EQ:
break;
case GE:
result = m.mk_or(m.mk_iff(m_util.mk_ge(f, z), m_util.mk_ge(f2, z)), result);
break;
case LE:
result = m.mk_or(m.mk_not(m.mk_iff(m_util.mk_ge(f, z), m_util.mk_ge(f2, z))), result);
break;
}
return BR_REWRITE3;
}
return BR_FAILED;
}

br_status arith_rewriter::mk_le_ge_eq_core(expr * arg1, expr * arg2, op_kind kind, expr_ref & result) {
expr *orig_arg1 = arg1, *orig_arg2 = arg2;
expr_ref new_arg1(m);
Expand Down Expand Up @@ -655,7 +778,7 @@ br_status arith_rewriter::mk_le_ge_eq_core(expr * arg1, expr * arg2, op_kind kin
default: result = m.mk_eq(arg1, arg2); return BR_DONE;
}
}
return BR_FAILED;
return factor_le_ge_eq(arg1, arg2, kind, result);
}


Expand Down
6 changes: 6 additions & 0 deletions src/ast/rewriter/arith_rewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ class arith_rewriter : public poly_rewriter<arith_rewriter_core> {
br_status is_separated(expr * arg1, expr * arg2, op_kind kind, expr_ref & result);
bool is_non_negative(expr* e);
br_status mk_le_ge_eq_core(expr * arg1, expr * arg2, op_kind kind, expr_ref & result);
bool is_add_factor(expr* s, expr* t);
bool is_mul_factor(expr* s, expr* t);
expr* find_nl_factor(expr* t);
void get_nl_muls(expr* t, ptr_buffer<expr>& muls);
expr_ref remove_factor(expr* s, expr* t);
br_status factor_le_ge_eq(expr * arg1, expr * arg2, op_kind kind, expr_ref & result);

bool elim_to_real_var(expr * var, expr_ref & new_var);
bool elim_to_real_mon(expr * monomial, expr_ref & new_monomial);
Expand Down
Loading
Loading