3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-23 15:32:32 +00:00
Commit graph

21 commits

Author SHA1 Message Date
Copilot
634b2886ba
fix: declare type variables before use in solver display output (#10103)
`decl_collector::visit_sort` did not collect sorts with `poly_family_id`
(type variables created via `mk_type_var` / `declare-type-var`), so
`solver::display` and `ast_pp_util::display_decls` never emitted type
variable declarations before referencing them — producing invalid
SMT-LIB2 output.

## Changes

- **`src/ast/decl_collector.h`**: added a dedicated `lim_svector<sort*>
m_type_vars` field (separate from `m_sorts`) with a `get_type_vars()`
getter; `reset()` clears it; `push()`/`pop()` maintain its scope.

- **`src/ast/decl_collector.cpp` — `visit_sort`**: sorts with
`poly_family_id` are now pushed to `m_type_vars` instead of `m_sorts`,
keeping type variables distinct from uninterpreted sorts:

```cpp
if (m.is_uninterp(n))
    m_sorts.push_back(n);
else if (fid == poly_family_id)
    m_type_vars.push_back(n);
```

- **`src/ast/ast_pp_util.h`**: added a `stacked_value<unsigned>
m_type_vars` cursor to track which type variables have already been
printed.

- **`src/ast/ast_pp_util.cpp` — `display_decls`**: emits
`(declare-type-var <name>)` for each collected type variable before
other sort declarations; `reset()`/`push()`/`pop()` maintain the new
cursor.

**Example** — given `(declare-type-var A)(declare-fun f (A) A)`, the
dump now correctly produces:

```smt2
(declare-type-var A)
(declare-fun f (A) A)
(assert ...)
```

The output round-trips cleanly through the Z3 parser.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-07-12 20:56:00 -07:00
Copilot
2436943794
Standardize for-loop increments to prefix form (++i) (#8199)
* Initial plan

* Convert postfix to prefix increment in for loops

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

* Fix member variable increment conversion bug

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

* Update API generator to produce prefix increments

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>
2026-01-14 19:55:31 -08:00
Nikolaj Bjorner
1b0c76e3f0 fixes to mbqi in the new core based on #6575 2023-02-10 16:56:06 -08:00
Nikolaj Bjorner
fe8034731d fix #6501 2022-12-19 21:02:55 -08:00
Nikolaj Bjorner
88b6c4a30d pdate decl collection to include functions under arrays
Signedoff-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-12 13:45:16 -07:00
Nikolaj Bjorner
1028c80851 update pretty printer for recursive function filtering
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-15 11:59:41 -07:00
Nikolaj Bjorner
9eea5cb91a make smt2 log scope aware
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-08 18:15:59 -07:00
Nikolaj Bjorner
8bb2442a3f make smt2 log scope aware
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-08 18:14:32 -07:00
Nikolaj Bjorner
be33bb7b48 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-08 12:19:54 -07:00
Nikolaj Bjorner
f6f3ca1507 adding SMT2 log file for solver interaction #867
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-08 11:44:47 -07:00
Nikolaj Bjorner
0f0287d129 prepare release notes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-10-28 17:42:16 -05:00
Nikolaj Bjorner
c513f3ca09 merge with master
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-03-25 14:57:01 -07:00
Nikolaj Bjorner
0bbdee810d fix #1488
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-02-14 21:46:20 -08:00
Nikolaj Bjorner
35a3523fd6 fix bug in double collection of declarations
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-12-11 14:09:34 -08:00
Nikolaj Bjorner
caaf0ba33c model-add/del
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-11-01 22:32:22 -05:00
Nikolaj Bjorner
5d17e28667 support for smtlib2.6 datatype parsing
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-09-04 21:12:43 -07:00
Nikolaj Bjorner
a3dba5b2f9 hide new datatype plugin
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-09-03 20:01:59 -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
Christoph M. Wintersteiger
ef3d340c85 Improved decl_collector for uninterpreted sorts in :print_benchmark output 2017-03-31 12:04:46 +01:00
Leonardo de Moura
d92efeb0c5 Make ast_manager::get_family_id(symbol const &) side-effect free. The version with side-effects is now called ast_manager::mk_family_id
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-12-18 17:14:25 -08:00
Leonardo de Moura
ded42feeb6 Reorganizing code base
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-10-20 16:33:01 -07:00
Renamed from lib/decl_collector.cpp (Browse further)