3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-11-05 05:49:13 +00:00
Commit graph

95 commits

Author SHA1 Message Date
Copilot
c526c20cfc
Implement finite_set_rewriter with basic algebraic simplification rules (#7972)
* Initial plan

* Add finite_set_rewriter implementation with basic rewrite rules

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix finite_set_decl_plugin bug and complete implementation

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Revert finite_set_decl_plugin changes and disable difference rule

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Re-enable difference rule using set_sort directly

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Update finite_set_rewriter.h

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-14 17:13:18 +02:00
Copilot
df4052ec69
Implement finite_set_decl_plugin with complete operator support and polymorphism infrastructure (#7961)
* Initial plan

* Implement finite_sets_decl_plugin with all specified operations

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Add tests for finite_sets_decl_plugin

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Add set.singleton operator to finite_sets_decl_plugin

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Refactor finite_sets_decl_plugin to use polymorphic signatures and Array sorts

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Rename finite_sets to finite_set everywhere including file names

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Rename set.filter to set.select

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Refactor finite_set_decl_plugin to use polymorphism_util

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Move psig and match method to polymorphism_util

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Add MATCH macros and fix is_fully_interp return value

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Add is_finite_set helper and parameter count validation

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2025-10-13 10:58:53 +02:00
Don Syme
b17df988ed
Daily Test Coverage Improver: Add comprehensive API special relations tests (#7925)
* Add comprehensive API special relations tests

- Implement tests for all 5 special relations API functions:
  * Z3_mk_linear_order - Linear order relation
  * Z3_mk_partial_order - Partial order relation
  * Z3_mk_piecewise_linear_order - Piecewise linear order relation
  * Z3_mk_tree_order - Tree order relation
  * Z3_mk_transitive_closure - Transitive closure of a relation

- Test coverage achieved: 100% (5/5 lines) in src/api/api_special_relations.cpp
- Added comprehensive test cases covering:
  * Basic functionality with different sorts
  * Different index parameters
  * Expression creation and integration
  * Edge cases and variations

🤖 Generated with Claude Code

* staged files

* remove files

---------

Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
2025-09-18 09:20:14 -07:00
Don Syme
cda0a922b9
Daily Test Coverage Improver: Add comprehensive API polynomial tests (#7905)
* Add comprehensive API polynomial subresultants tests

- Add tests for Z3_polynomial_subresultants function in api_polynomial.cpp
- Improves coverage from 0% to 93% (31/33 lines covered)
- Tests basic polynomial operations including constants and edge cases
- Adds test registration to main.cpp and CMakeLists.txt

* staged files

* remove files

---------

Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-17 20:47:22 -07:00
Don Syme
82ab6741a0
Daily Test Coverage Improver: Add comprehensive API pseudo-boolean constraint tests (#7898)
Added comprehensive test coverage for Z3's pseudo-boolean constraint API functions, improving coverage from 0% to 100% for src/api/api_pb.cpp.

- Created comprehensive test suite in src/test/api_pb.cpp
- Added test registration in src/test/main.cpp and src/test/CMakeLists.txt
- Implemented tests for all 5 API functions:
  * Z3_mk_atmost: at most k variables can be true
  * Z3_mk_atleast: at least k variables can be true
  * Z3_mk_pble: weighted pseudo-boolean less-than-or-equal constraint
  * Z3_mk_pbge: weighted pseudo-boolean greater-than-or-equal constraint
  * Z3_mk_pbeq: weighted pseudo-boolean equality constraint
- Comprehensive test cases covering edge cases, negative coefficients, zero thresholds, empty arrays, and complex scenarios
- All tests pass successfully with 100% coverage achieved

Coverage improvement: api_pb.cpp went from 0% (0/64 lines) to 100% (64/64 lines)

Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-17 20:45:43 -07:00
Don Syme
4e1a9d1ef7
Daily Test Coverage Improver: Add comprehensive API Datalog tests (#7921)
* Daily Test Coverage Improver: Add comprehensive API Datalog tests

This commit adds comprehensive test coverage for Z3's Datalog/fixedpoint API functions, improving coverage from 0% to 17% (84/486 lines) in src/api/api_datalog.cpp.

Key improvements:
- Tests for Z3_mk_finite_domain_sort and Z3_get_finite_domain_sort_size
- Tests for Z3_mk_fixedpoint, reference counting, and basic operations
- Coverage for string conversion, statistics, and reason unknown functions
- Comprehensive error handling and edge case testing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* staged files

* remove files

---------

Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-09-17 20:07:24 -07:00
Don Syme
ee083a2e6c
Daily Test Coverage Improver: Add comprehensive API AST map tests (#7890)
* Add comprehensive tests for AST map API functions

Improved test coverage from 0% to 84% for src/api/api_ast_map.cpp by adding comprehensive tests for:
- Basic map operations (creation, insertion, lookup, size)
- Map manipulation (overwrite values, erase entries, reset)
- Reference counting (inc_ref/dec_ref)
- String representation (to_string function)

This contributes 94 newly covered lines to overall project test coverage.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* staged files

* Delete coverage-steps.log

* Delete coverage-summary.txt

* Delete coverage.html

* Delete z3.log

---------

Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-16 17:26:07 -07:00
Don Syme
44d2bba3e5
Add comprehensive tests for API algebraic number functions (#7888)
- Created new test file api_algebraic.cpp with tests for all algebraic API functions
- Tests cover basic operations (add, sub, mul, div, power, root)
- Tests cover comparison operations (lt, le, gt, ge, eq, neq)
- Tests cover sign detection (is_zero, is_pos, is_neg, sign)
- Tests cover algebraic value detection (is_value)
- Added comprehensive test cases for rational numbers and fractions
- Updated main.cpp and CMakeLists.txt to include the new test module

Coverage improvements:
- src/api/api_algebraic.cpp: 0% -> 52% (136/258 lines covered)
- Overall project coverage: ~47% (gained 71 covered lines)

Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
2025-09-16 15:32:23 -07:00
Copilot
41491d79be
Add comprehensive test coverage for math/lp and math/polynomial modules (#7877)
* Initial plan

* Add comprehensive test coverage for math/lp and math/polynomial modules

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Finalize test coverage improvements with corrected implementations

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix compilation errors in test files

- Fix algebraic_numbers.cpp: Simplified tests to use basic algebraic operations without polynomial manager dependencies
- Fix polynomial_factorization.cpp: Corrected upolynomial::factors usage and API calls
- Fix nla_intervals.cpp: Changed 'solver' to 'nla::core' and fixed lar_solver constructor
- Fix monomial_bounds.cpp: Updated class names and method calls to match current NLA API

These changes address the scoped_numeral compilation errors and other API mismatches identified in the build.

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix monomial bounds test assertions to use consistent values

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2025-09-14 14:57:21 -07:00
Nikolaj Bjorner
951554e883 ho matcher draft
Draft implementation of higher-order matcher.
No specific tuning at this point.
2025-07-04 18:01:47 -07:00
Nikolaj Bjorner
d37336eb07 remove trace by default from tests
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-06-08 09:22:43 -07:00
Nikolaj Bjorner
b529a58b91 add unit test for incremental equation edit distance with repair 2024-12-15 05:53:28 -08:00
Nikolaj Bjorner
92065462b4 use std::exception as base class to z3_exception
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-11-04 11:08:15 -08:00
LiviaSun
7c30cbfe48
add scoped_vector invariants and unit tests (#7327)
* add scoped vector unit test

* fix dlist tests

* add new scoped vector invariants

* remove all loop invariants
2024-08-02 19:21:40 -07:00
Nikolaj Bjorner
5fcc50f606
Revert "add scoped vector unit test (#7307)" (#7317)
This reverts commit 2ae3d87b21.
2024-07-30 11:34:02 -07:00
LiviaSun
2ae3d87b21
add scoped vector unit test (#7307)
* add scoped vector unit test

* fix dlist tests

* add new scoped vector invariants
2024-07-29 11:08:54 -07:00
LiviaSun
9803e9ef6e
unit tests for dlist.h (#7293) 2024-07-18 10:08:41 -07:00
Nikolaj Bjorner
ddf2d28350 add tests for evaluation 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner
b52fd8d954 add EUF plugin framework.
plugin setting allows adding equality saturation within the E-graph propagation without involving externalizing theory solver dispatch. It makes equality saturation independent of SAT integration.
Add a special relation operator to support ad-hoc AC symbols.
2023-11-30 13:58:30 -08:00
Nikolaj Bjorner
624907823d add tests for distribution utility and fix loose ends 2023-04-13 11:19:06 -07:00
Nikolaj Bjorner
5afcb489e0 adding totalizer 2022-06-29 08:20:01 -07:00
Nikolaj Bjorner
96e871c826 add stub for testing updates to scoped_timer
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-12-12 12:31:23 -08:00
Luca Bruno
b918f121ef
zstring: fix encode rountrip for '\' as printable ASCII (#5120)
This fixes encode roundtripping for all printable ASCII characters.
In particular, this now leaves a plain '\' untouched by the
encoding logic, instead of converting it to escaped hex-digits.
It also adds unit testing covering this specific zstring encoding
property, in order to avoid future regressions.
2021-03-23 11:25:59 -07:00
Nikolaj Bjorner
65e6d942ac euf
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-24 01:55:13 -07:00
Nikolaj Bjorner
19409a25a6 value sweep 2020-04-27 18:58:43 -07:00
Nikolaj Bjorner
9ea1cf3c5c na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-25 13:13:25 -07:00
Mathias Soeken
ff3baffadc Testcase for npn3_finder. 2020-03-01 04:10:25 -08:00
Nikolaj Bjorner
6b4ddf352d port fixes from lev's branch. Rename pdd_grobner to pdd_solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-01 20:14:20 -08:00
Nikolaj Bjorner
58be42d2a9 initial unit test for pdd_grobner
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-12-22 10:59:12 -08:00
Nikolaj Bjorner
9e4a7ae4b8 add pdd
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-12-17 16:59:33 -08:00
Bruce Mitchener
258b798a6b test-z3: Improve help output. Provide help when no args. 2019-08-16 03:20:57 -07:00
Bruce Mitchener
f02170feb4 Clean up whitespace. 2019-08-16 03:20:57 -07:00
Nuno Lopes
d1cbde3390 fix crash in 'test-z3 prime_generator' 2019-06-13 14:35:52 +01:00
Nikolaj Bjorner
b6bf299b8b update upolynmial test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-12-17 17:41:50 -08:00
Bruce Mitchener
cdfc19a885 Use nullptr. 2018-10-02 09:11:19 +07:00
Nikolaj Bjorner
0ae246ad2b add defs to arith solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-06-14 16:08:52 -07:00
Nikolaj Bjorner
005a6d93bb cube and clause
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-06-14 16:08:50 -07:00
Nikolaj Bjorner
b649cd93cb change pool solver to enable external control of pool allocation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-06-14 16:08:48 -07:00
Nikolaj Bjorner
fd49a0c89c added facility to persist model transformations
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-11-02 00:05:52 -05:00
Nikolaj Bjorner
7f8a7c3d83 fix the fixme of #1307
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-10-14 11:59:09 -07:00
Nikolaj Bjorner
d7b6373601 adding bdd package
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-10-14 10:41:17 -07:00
Nikolaj Bjorner
6ecd77d91c Merge branch 'master' of https://github.com/z3prover/z3 2017-10-12 14:17:57 -07:00
Nikolaj Bjorner
3554554533 command to exit tests early
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-10-12 14:17:52 -07:00
Nikolaj Bjorner
d338fab4f6 fix #1305
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-10-12 13:58:14 -07:00
Nikolaj Bjorner
11f1a81d7b disable failing unit tests
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-10-12 10:12:37 -07:00
Nikolaj Bjorner
ae9a6664d4 add cube mode
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-09-24 10:53:57 -07:00
Nikolaj Bjorner
2751cbc270 n/a
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-09-23 22:36:36 -05:00
Nikolaj Bjorner
edb3569599 updates to sorting networks
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-09-23 22:36:19 -05:00
Nikolaj Bjorner
651587ce01 merge with master branch
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-09-19 09:39:22 -07:00
Christoph M. Wintersteiger
00651f8f21 Tabs, formatting. 2017-09-17 14:54:09 +01:00