Make uninterpreted sort owner non-static (#8144)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Thu, 24 Feb 2022 05:25:57 +0000 (23:25 -0600)
committerGitHub <noreply@github.com>
Thu, 24 Feb 2022 05:25:57 +0000 (05:25 +0000)
commitb55ee5396848d20ac502293fc58d2fd915a42f1d
tree61b6f5b20d24d895b43ccd6ad36b4da9ff009024
parent74d327467f2fc93a2a6a416cc2d95b7d493cb77f
Make uninterpreted sort owner non-static (#8144)

This eliminates the static member `s_uninterpretedSortOwner` from Theory which seems to be the cause of several issues related to the array solver in incremental mode, and with check-unsat-cores. This is moved to a data member of Env.  This eliminates a static access to `theoryOfMode` from within theoryOf calls.

Note that static calls to `Theory::theoryOf` or `Theory::isLeafOf` now assume type-based theoryOf mode as a default argument. Thus, the preferred method for determining theoryOf types and terms is through `Env` now.

This fixes issues with the array solver in incremental mode.

The root issue is that spawning subsolvers (e.g. for check-unsat-core) can overwrite `s_uninterpretedSortOwner`. This means that a second call to `check-sat` (which does not reinitialize set_defaults) will use the *overwrtten* setting, which can be different from what was used for the first check-sat.  In particular, for #5720, the uninterpreted sort owner changes from ARRAYS to UF at the 2nd call, and the array theory solver fails to send an extensionality lemma.

This commit also simplifies `Theory::theoryOf` slightly.

Fixes https://github.com/cvc5/cvc5-wishues/issues/52.
Fixes https://github.com/cvc5/cvc5/issues/5720.
Fixes https://github.com/cvc5/cvc5/issues/6276 .
Fixes https://github.com/cvc5/cvc5/issues/5836.
31 files changed:
src/preprocessing/util/ite_utilities.cpp
src/prop/cnf_stream.cpp
src/prop/cnf_stream.h
src/prop/proof_cnf_stream.cpp
src/prop/proof_cnf_stream.h
src/prop/prop_engine.cpp
src/smt/env.cpp
src/smt/env.h
src/smt/expand_definitions.cpp
src/smt/proof_post_processor.cpp
src/smt/set_defaults.cpp
src/theory/arith/branch_and_bound.cpp
src/theory/arith/theory_arith.cpp
src/theory/bv/bv_solver_bitblast.cpp
src/theory/bv/theory_bv_utils.cpp
src/theory/evaluator.cpp
src/theory/quantifiers/cegqi/ceg_instantiator.cpp
src/theory/term_registration_visitor.cpp
src/theory/theory.cpp
src/theory/theory.h
src/theory/theory_engine.cpp
src/theory/theory_engine.h
test/regress/CMakeLists.txt
test/regress/regress0/arrays/issue5720.smt2 [new file with mode: 0644]
test/regress/regress0/arrays/issue5836-2.smt2 [new file with mode: 0644]
test/regress/regress0/arrays/issue5836.smt2 [new file with mode: 0644]
test/regress/regress0/arrays/issue6276-2.smt2 [new file with mode: 0644]
test/regress/regress0/arrays/issue6276.smt2 [new file with mode: 0644]
test/regress/regress0/bug421.smt2
test/regress/regress0/bug421b.smt2
test/unit/prop/cnf_stream_white.cpp