3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-27 01:12:40 +00:00
z3/src/smt
Copilot 63730fefaf
Fix swapped assert_expr arguments in smt_solver::translate for named assertions (#10135)
With `parallel.enable=true`, Z3 could return a SAT model for a QF_BV
instance that violates its own assertions. The bug traces to solver
translation: named assertions were re-registered with swapped
formula/indicator arguments, corrupting the translated solver's
assertion state.

## Bug

`m_name2assertion` stores `indicator → formula`. In
`smt_solver::translate()`, the structured binding `[k, v]` gives `k =
indicator`, `v = formula`, but `assert_expr(t, a)` expects `(formula,
indicator)`:

```cpp
// Before — args reversed
for (auto& [k, v] : m_name2assertion) {
    expr* val = translator(k);  // indicator
    expr* key = translator(v);  // formula
    result->assert_expr(val, key);  // assert_expr(indicator, formula) ← wrong
}
```

## Fix

```cpp
// After — correct order
for (auto& [k, v] : m_name2assertion) {
    expr* fml = translator(v);  // formula
    expr* ind = translator(k);  // indicator
    result->assert_expr(fml, ind);  // assert_expr(formula, indicator) ✓
}
```

This affects any code path that calls `smt_solver::translate()` and uses
named assertions (`assert_and_track` / `Z3_solver_assert_and_track`),
including all parallel solving modes.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-07-16 13:46:19 -07:00
..
proto_model Remove copies (#8583) 2026-02-18 21:02:22 -08:00
tactic Parallel tactic (#9824) (#9825) 2026-06-26 10:36:15 -06:00
arith_eq_adapter.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
arith_eq_adapter.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
arith_eq_solver.cpp Fix static analysis issues: null dereferences, unsafe casts, branch clones, uninitialized members (#9424) 2026-04-29 13:37:11 -07:00
arith_eq_solver.h Remove redundant non-virtual destructors with = default (#8462) 2026-02-18 20:58:01 -08:00
CMakeLists.txt remove lattice component 2026-02-19 15:49:45 -08:00
database.h Make sure all headers do #pragma once. (#6188) 2022-07-23 10:41:14 -07:00
database.smt
diff_logic.h Replace fall-through comments with Z3_fallthrough macro (#8219) 2026-02-18 20:57:31 -08:00
dyn_ack.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
dyn_ack.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
expr_context_simplifier.cpp Fix static analysis issues: null dereferences, unsafe casts, branch clones, uninitialized members (#9424) 2026-04-29 13:37:11 -07:00
expr_context_simplifier.h move smt params to params directory, update release.yml 2025-06-09 10:47:22 -07:00
fingerprints.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
fingerprints.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
mam.cpp Improve generation accounting (#10008) (#10009) 2026-07-08 15:43:41 -07:00
mam.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
old_interval.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
old_interval.h Use noexcept more. (#7058) 2023-12-16 12:14:53 +00:00
qi_queue.cpp disable instantiation for inconsistent states 2026-07-15 20:55:11 -07:00
qi_queue.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
seq_axioms.cpp add options for logging learned lemmas and theory axioms 2022-08-08 11:18:56 +03:00
seq_axioms.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
seq_eq_solver.cpp tweaks to string solver 2026-06-28 17:16:52 -07:00
seq_ne_solver.cpp Adopt C++17 structured bindings for map/pair iteration (#8159) 2026-02-18 20:57:09 -08:00
seq_offset_eq.cpp Refactor seq_offset_eq::find to use std::optional (#8300) 2026-02-18 20:57:53 -08:00
seq_offset_eq.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
seq_regex.cpp fix #10137 2026-07-16 13:44:38 -07:00
seq_regex.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt2_extra_cmds.cpp
smt2_extra_cmds.h
smt_almost_cg_table.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_almost_cg_table.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_arith_value.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_arith_value.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_b_justification.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_bool_var_data.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_case_split_queue.cpp Improve generation accounting (#10008) (#10009) 2026-07-08 15:43:41 -07:00
smt_case_split_queue.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_cg_table.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_cg_table.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_checker.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_checker.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_clause.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_clause.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_clause_proof.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_clause_proof.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_conflict_resolution.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_conflict_resolution.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_consequences.cpp fix crash 2026-02-18 21:02:17 -08:00
smt_context.cpp Improve generation accounting (#10008) (#10009) 2026-07-08 15:43:41 -07:00
smt_context.h remove relvancy marking code 2026-07-15 15:17:14 -07:00
smt_context_inv.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_context_pp.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_context_stat.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_enode.cpp Improve generation accounting (#10008) (#10009) 2026-07-08 15:43:41 -07:00
smt_enode.h Improve generation accounting (#10008) (#10009) 2026-07-08 15:43:41 -07:00
smt_eq_justification.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_failure.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_farkas_util.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
smt_farkas_util.h
smt_for_each_relevant_expr.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_for_each_relevant_expr.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_implied_equalities.cpp Refactor mk_and/mk_or call sites to use vector overloads (#8286) 2026-02-18 20:57:52 -08:00
smt_implied_equalities.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_induction.cpp.disabled Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
smt_induction.h.disabled
smt_internalizer.cpp disable term enumeration by default 2026-07-10 14:23:40 -07:00
smt_justification.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_justification.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_kernel.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_kernel.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_literal.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_literal.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_lookahead.cpp disable pre-processing during cubing 2025-07-31 20:58:58 -07:00
smt_lookahead.h Revert "Parallel solving (#7775)" (#7777) 2025-08-14 18:16:35 -07:00
smt_model_checker.cpp Improve generation accounting (#10008) (#10009) 2026-07-08 15:43:41 -07:00
smt_model_checker.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_model_finder.cpp Improve generation accounting (#10008) (#10009) 2026-07-08 15:43:41 -07:00
smt_model_finder.h smt: instrument ho-matching and ho-var term-enumeration statistics 2026-07-06 17:14:39 -07:00
smt_model_generator.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_model_generator.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_parallel.cpp Fix unsigned overflow in parallel solver conflict budget escalation (#10076) 2026-07-10 15:25:57 -07:00
smt_parallel.h Fix unsigned overflow in parallel solver conflict budget escalation (#10076) 2026-07-10 15:25:57 -07:00
smt_quantifier.cpp fix warnings 2026-07-12 16:45:24 -07:00
smt_quantifier.h smt: instrument ho-matching and ho-var term-enumeration statistics 2026-07-06 17:14:39 -07:00
smt_quantifier_instances.h
smt_quick_checker.cpp Improve generation accounting (#10008) (#10009) 2026-07-08 15:43:41 -07:00
smt_quick_checker.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_relevancy.cpp bug fixes to ho_matching - offset alignment inv_var_shift, callback scopes should not be nested, allow bindings that are not ground 2026-07-09 19:16:12 -07:00
smt_relevancy.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_setup.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_setup.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_solver.cpp Fix swapped assert_expr arguments in smt_solver::translate for named assertions (#10135) 2026-07-16 13:46:19 -07:00
smt_solver.h
smt_statistics.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_statistics.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_theory.cpp disable term enumeration by default 2026-07-10 14:23:40 -07:00
smt_theory.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_types.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
smt_value_sort.cpp
smt_value_sort.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
spanning_tree.h
spanning_tree_base.h
spanning_tree_def.h Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
theory_arith.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_arith.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_arith_aux.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_arith_core.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_arith_def.h
theory_arith_eq.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_arith_int.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_arith_inv.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_arith_nl.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_arith_pp.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_array.cpp prepare ground for general projection 2026-07-12 15:59:56 -07:00
theory_array.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_array_base.cpp fixup pattern inference 2026-07-14 21:01:15 -07:00
theory_array_base.h debug array models 2026-07-14 13:52:14 -07:00
theory_array_full.cpp disable term enumeration by default 2026-07-10 14:23:40 -07:00
theory_array_full.h handle lambda equalities 2026-07-05 12:52:01 -07:00
theory_bv.cpp Issue 438 (#10085) 2026-07-12 13:35:57 -07:00
theory_bv.h Issue 438 (#10085) 2026-07-12 13:35:57 -07:00
theory_char.cpp Refactor theory_char::get_char_value to use std::optional (#8302) 2026-02-18 20:57:53 -08:00
theory_char.h Refactor theory_char::get_char_value to use std::optional (#8302) 2026-02-18 20:57:53 -08:00
theory_datatype.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_datatype.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_dense_diff_logic.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_dense_diff_logic.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_dense_diff_logic_def.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_diff_logic.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_diff_logic.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_diff_logic_def.h prepare for enodes over lambdas 2026-06-01 13:00:35 -07:00
theory_dl.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_dl.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_dummy.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_dummy.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_finite_set.cpp fix build warnings 2026-06-22 18:20:23 -07:00
theory_finite_set.h use expr based access to enodes to allow for storing first-class lambas 2026-05-30 15:13:08 -07:00
theory_finite_set_size.cpp build warnings 2026-05-29 10:17:46 -07:00
theory_finite_set_size.h add functions that create unique sets for model construction based on solving cardinality constraints 2025-12-29 11:57:48 -08:00
theory_fpa.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_fpa.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_intblast.cpp use expr based access to enodes to allow for storing first-class lambas 2026-05-30 15:13:08 -07:00
theory_intblast.h Fix intblast ubv_to_int bug: add bv2int axioms for compound expressions 2026-02-25 00:46:13 +00:00
theory_lra.cpp theory_lra: eagerly propagate offset equalities x=y (fixes #10065) 2026-07-14 22:46:06 -07:00
theory_lra.h use expr based access to enodes to allow for storing first-class lambas 2026-05-30 15:13:08 -07:00
theory_opt.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_opt.h
theory_pb.cpp prepare for enodes over lambdas 2026-06-01 13:00:35 -07:00
theory_pb.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_polymorphism.h Fix TPTP polymorphism crashes in final-check and model checking 2026-07-03 20:32:04 -07:00
theory_recfun.cpp use expr based access to enodes to allow for storing first-class lambas 2026-05-30 15:13:08 -07:00
theory_recfun.h use expr based access to enodes to allow for storing first-class lambas 2026-05-30 15:13:08 -07:00
theory_seq.cpp Fix invalid sequence models for seq.foldl results observed through seq.nth (#10111) 2026-07-13 17:33:39 -07:00
theory_seq.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_seq_empty.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_sls.cpp remove set cardinality operators from array theory. Make final-check use priority levels 2026-02-18 20:56:51 -08:00
theory_sls.h Eliminate unused private fields and local variables. (#9875) 2026-06-16 14:55:18 +01:00
theory_special_relations.cpp use expr based access to enodes to allow for storing first-class lambas 2026-05-30 15:13:08 -07:00
theory_special_relations.h remove set cardinality operators from array theory. Make final-check use priority levels 2026-02-18 20:56:51 -08:00
theory_user_propagator.cpp remove set cardinality operators from array theory. Make final-check use priority levels 2026-02-18 20:56:51 -08:00
theory_user_propagator.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_utvpi.cpp Fix some typos. (#7115) 2024-02-07 23:06:43 -08:00
theory_utvpi.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_utvpi_def.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_wmaxsat.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
theory_wmaxsat.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
uses_theory.cpp AIX compat (#8113) 2026-02-18 20:57:04 -08:00
uses_theory.h
watch_list.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
watch_list.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00