3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-05 00:20:50 +00:00
Commit graph

28 commits

Author SHA1 Message Date
Nikolaj Bjorner
d025b34606 prepare for enodes over lambdas 2026-06-01 13:00:35 -07:00
Nikolaj Bjorner
dbe986fdf7 move closure conversion to solver internalization
- only the internalizer performs closure conversion
- theory_array treats propagation of lambdas similar to stores
- ho_matcher treats top-level flex patterns as first-order
- pattern-inference fix to handle quantifiers (lambdas) in patterns that are computed
2026-05-30 18:41:37 -07:00
Nikolaj Bjorner
2cc4422018 use expr based access to enodes to allow for storing first-class lambas 2026-05-30 15:13:08 -07:00
Copilot
51da9db615
Add SMT-LIB choice support via array OP_CHOICE and instantiate choice axioms in array solvers (#9649)
This change wires SMT-LIB Hilbert choice parsing to a concrete
array-theory operator and ensures both array backends enforce the
expected semantic axiom. Previously, `(choice ((x T)) phi)` parsed as
NYI and had no solver-side instantiation path.

- **Parser: lower `choice_k` into array `OP_CHOICE`**
- `pop_quant_frame(choice_k)` now builds `(choice p)` instead of
throwing.
- Added parser include/use of array utilities to construct the term
directly from the generated lambda predicate.

- **Array decl plugin: add `OP_CHOICE` typing + surface syntax**
  - Added declaration support for `choice` with signature:
- `(Array T Bool) -> T` (encoded as `('a -> Bool) -> 'a` in HO view).
- Added recognizer/util helpers (`is_choice`, `mk_choice`) and exposed
`"choice"` in op names.

- **SMT array theory (`theory_array_full`): instantiate choice axiom**
  - Added instantiation for each encountered `choice(p)`:
    - `forall x . p(x) => p(choice(p))`
  - Integrated into internalization/relevancy paths and statistics.

- **SAT/SMT array backend (`sat/smt/array_*`): instantiate choice
axiom**
- Added new axiom record kind for choice, internalization hook,
assertion routine, and diagnostics/stat tracking.
  - Uses the same quantified implication schema as above.

- **Regression coverage**
- Extended SMT2 parser regression with an HO `choice` example to ensure
parser/eval pipeline accepts and processes choice terms.

Example of the now-supported input:

```smt2
(set-logic HO_ALL)
(declare-sort U 0)
(declare-fun P () (-> U Bool))
(assert (exists ((x U)) (P x)))
(assert (= witness (choice ((x U)) (P x))))
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-05-27 10:05:06 -07:00
Nikolaj Bjorner
62b3668beb remove set cardinality operators from array theory. Make final-check use priority levels
Issue #7502 shows that running nlsat eagerly during final check can block quantifier instantiation.
To give space for quantifier instances we introduce two levels for final check such that nlsat is only applied in the second and final level.
2025-11-26 15:35:19 -08:00
Nikolaj Bjorner
9da6895276 add option to select with folding 2022-08-04 16:59:26 +03:00
Nikolaj Bjorner
8efa3c8ade introduce notion of beta redex to deal with lambdas in non-extensional positions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-06-10 17:35:01 -07:00
Nikolaj Bjorner
4a6083836a call it data instead of c_ptr for approaching C++11 std::vector convention. 2021-04-13 18:17:35 -07:00
Nikolaj Bjorner
026065ff71 streamline pb solver interface and naming after removal of xor 2021-02-28 12:32:04 -08:00
Nikolaj Bjorner
937b61fc88 fix build, refactor 2021-02-02 05:26:57 -08:00
Nikolaj Bjorner
9bcda408ba towards closing small domain equality enforcement gap #4515
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-08 11:43:31 -07:00
Nikolaj Bjorner
d0e20e44ff booyah
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-04 15:56:30 -07:00
Nikolaj Bjorner
becf423c77
remove level of indirection for context and ast_manager in smt_theory (#4253)
* remove level of indirection for context and ast_manager in smt_theory

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* add request by #4252

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* move to def

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* int

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-08 16:46:03 -07:00
Nikolaj Bjorner
f74079de01 fix #3529
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-03-30 11:00:02 -07:00
Nikolaj Bjorner
c142f99127 fix #3532
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-03-30 11:00:02 -07:00
Nikolaj Bjorner
566eacd424 change handling of weak array mode. Insert weak delay variables into a queue that gets consumed by the next propagation when the array_weak parameter is changed #2686
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-11-19 21:17:36 -08:00
Nikolaj Bjorner
ca498e20d1 move value factories to model
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-16 19:48:35 -07:00
Nikolaj Bjorner
0a29002c2f return unknown if m_array_weak was used and result is satisfiable
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-08-02 00:20:41 +08:00
Nikolaj Bjorner
4fcc4d07ae fix #2277 fix #2221
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-05-14 19:05:40 +02:00
Nikolaj Bjorner
28ce701e17 fixing 2267
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-05-06 15:31:55 +02:00
Nikolaj Bjorner
7e2afca2c6 add card operator to bapa
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-04-20 13:24:07 -07:00
Nikolaj Bjorner
1123b47fb7 bapa
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-04-13 16:15:38 -07:00
Bruce Mitchener
7167fda1dc Use override rather than virtual. 2018-02-10 09:56:33 +07:00
Nikolaj Bjorner
b19f94ae5b make include paths uniformly use path relative to src. #534
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-07-31 13:24:11 -07:00
Nikolaj Bjorner
34a0d7dfed remove python_install target from all
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2015-12-07 09:59:46 -08:00
Nikolaj Bjorner
4685a5f8ba add array-ext to externally exposed functions to enable interpolants with arrays to be usable in feedback loops with Z3. Addresses one issue raised in #292
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2015-11-07 16:42:13 -08:00
Nikolaj Bjorner
4bc044c982 update header guards to be C++ style. Fixes issue #9
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2015-07-08 23:18:40 -07:00
Leonardo de Moura
add684d8e9 checkpoint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-10-21 13:32:12 -07:00
Renamed from lib/theory_array_base.h (Browse further)