From 0a93ff515d6dfbdb460454946c94b06f74500fc1 Mon Sep 17 00:00:00 2001 From: LeeYoungJoon <68523399+IamYJLee@users.noreply.github.com> Date: Wed, 28 May 2025 22:31:25 +0900 Subject: [PATCH] Centralize and document TRACE tags using X-macros (#7657) * Introduce X-macro-based trace tag definition - Created trace_tags.def to centralize TRACE tag definitions - Each tag includes a symbolic name and description - Set up enum class TraceTag for type-safe usage in TRACE macros * Add script to generate Markdown documentation from trace_tags.def - Python script parses trace_tags.def and outputs trace_tags.md * Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled * trace: improve trace tag handling system with hierarchical tagging - Introduce hierarchical tag-class structure: enabling a tag class activates all child tags - Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag - Implement initial version of trace_tag.def using X(tag, tag_class, description) (class names and descriptions to be refined in a future update) * trace: replace all string-based TRACE tags with enum TraceTag - Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals * trace : add cstring header * trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py * trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h. * trace : Add TODO comment for future implementation of tag_class activation * trace : Disable code related to tag_class until implementation is ready (#7663). --- doc/mk_api_doc.py | 55 + .../ackermannize_bv_tactic.cpp | 6 +- src/ackermannization/ackr_bound_probe.cpp | 2 +- src/ackermannization/ackr_model_converter.cpp | 16 +- src/ackermannization/lackr.cpp | 16 +- .../lackr_model_constructor.cpp | 14 +- src/api/z3_replayer.cpp | 54 +- src/ast/arith_decl_plugin.cpp | 6 +- src/ast/array_decl_plugin.cpp | 4 +- src/ast/ast.cpp | 72 +- src/ast/ast_pp_dot.cpp | 2 +- src/ast/ast_smt2_pp.cpp | 14 +- src/ast/ast_translation.cpp | 6 +- src/ast/bv_decl_plugin.cpp | 4 +- src/ast/converters/equiv_proof_converter.cpp | 2 +- .../converters/generic_model_converter.cpp | 6 +- .../horn_subsume_model_converter.cpp | 10 +- .../converters/replace_proof_converter.cpp | 4 +- src/ast/datatype_decl_plugin.cpp | 50 +- src/ast/dl_decl_plugin.cpp | 4 +- src/ast/euf/euf_ac_plugin.cpp | 32 +- src/ast/euf/euf_bv_plugin.cpp | 18 +- src/ast/euf/euf_egraph.cpp | 50 +- src/ast/euf/euf_enode.cpp | 4 +- src/ast/euf/euf_etable.cpp | 2 +- src/ast/euf/euf_mam.cpp | 154 +- src/ast/euf/euf_plugin.cpp | 4 +- src/ast/expr2polynomial.cpp | 2 +- src/ast/expr2var.cpp | 2 +- src/ast/expr_abstract.cpp | 4 +- src/ast/for_each_ast.h | 2 +- src/ast/fpa/bv2fpa_converter.cpp | 18 +- src/ast/fpa/fpa2bv_converter.cpp | 98 +- src/ast/fpa/fpa2bv_rewriter.cpp | 22 +- src/ast/fpa_decl_plugin.cpp | 2 +- src/ast/macros/macro_finder.cpp | 26 +- src/ast/macros/macro_manager.cpp | 14 +- src/ast/macros/macro_util.cpp | 26 +- src/ast/macros/quasi_macros.cpp | 16 +- src/ast/normal_forms/defined_names.cpp | 12 +- src/ast/normal_forms/elim_term_ite.cpp | 2 +- src/ast/normal_forms/name_exprs.cpp | 8 +- src/ast/normal_forms/nnf.cpp | 16 +- src/ast/normal_forms/pull_quant.cpp | 6 +- src/ast/pattern/expr_pattern_match.cpp | 8 +- src/ast/pattern/pattern_inference.cpp | 34 +- src/ast/pp.cpp | 2 +- src/ast/proofs/proof_checker.cpp | 14 +- src/ast/proofs/proof_utils.cpp | 8 +- src/ast/proofs/proof_utils.h | 2 +- src/ast/recfun_decl_plugin.cpp | 2 +- src/ast/rewriter/arith_rewriter.cpp | 26 +- src/ast/rewriter/array_rewriter.cpp | 6 +- src/ast/rewriter/bit2int.cpp | 8 +- src/ast/rewriter/bit_blaster/bit_blaster.cpp | 8 +- .../bit_blaster/bit_blaster_rewriter.cpp | 4 +- .../bit_blaster/bit_blaster_tpl_def.h | 4 +- src/ast/rewriter/bool_rewriter.cpp | 4 +- src/ast/rewriter/bv2int_translator.cpp | 2 +- src/ast/rewriter/bv_bounds.cpp | 42 +- src/ast/rewriter/bv_bounds_base.h | 10 +- src/ast/rewriter/bv_rewriter.cpp | 24 +- src/ast/rewriter/cached_var_subst.cpp | 2 +- src/ast/rewriter/der.cpp | 14 +- src/ast/rewriter/distribute_forall.cpp | 2 +- src/ast/rewriter/dom_simplifier.cpp | 12 +- src/ast/rewriter/elim_bounds.cpp | 8 +- src/ast/rewriter/factor_equivs.cpp | 2 +- src/ast/rewriter/factor_rewriter.cpp | 18 +- src/ast/rewriter/fpa_rewriter.cpp | 26 +- src/ast/rewriter/inj_axiom.cpp | 4 +- src/ast/rewriter/maximize_ac_sharing.cpp | 10 +- src/ast/rewriter/pb2bv_rewriter.cpp | 20 +- src/ast/rewriter/pb_rewriter.cpp | 4 +- src/ast/rewriter/pb_rewriter_def.h | 10 +- src/ast/rewriter/poly_rewriter_def.h | 22 +- src/ast/rewriter/push_app_ite.cpp | 4 +- src/ast/rewriter/quant_hoist.cpp | 6 +- src/ast/rewriter/rewriter.cpp | 4 +- src/ast/rewriter/rewriter.h | 2 +- src/ast/rewriter/rewriter_def.h | 50 +- src/ast/rewriter/seq_axioms.cpp | 18 +- src/ast/rewriter/seq_rewriter.cpp | 114 +- src/ast/rewriter/th_rewriter.cpp | 12 +- src/ast/rewriter/value_sweep.cpp | 2 +- src/ast/rewriter/var_subst.cpp | 12 +- src/ast/seq_decl_plugin.cpp | 4 +- src/ast/simplifiers/bit_blaster.cpp | 2 +- src/ast/simplifiers/bound_manager.cpp | 6 +- src/ast/simplifiers/bound_propagator.cpp | 40 +- src/ast/simplifiers/bound_simplifier.cpp | 32 +- src/ast/simplifiers/card2bv.cpp | 2 +- .../simplifiers/demodulator_simplifier.cpp | 8 +- src/ast/simplifiers/dominator_simplifier.cpp | 12 +- src/ast/simplifiers/elim_unconstrained.cpp | 6 +- src/ast/simplifiers/eliminate_predicates.cpp | 8 +- src/ast/simplifiers/euf_completion.cpp | 4 +- src/ast/simplifiers/linear_equation.cpp | 10 +- .../model_reconstruction_trail.cpp | 20 +- .../simplifiers/reduce_args_simplifier.cpp | 4 +- src/ast/simplifiers/solve_context_eqs.cpp | 2 +- src/ast/simplifiers/solve_eqs.cpp | 4 +- src/ast/simplifiers/then_simplifier.h | 4 +- src/ast/sls/bvsls_opt_engine.cpp | 22 +- src/ast/sls/sls_arith_base.cpp | 32 +- src/ast/sls/sls_arith_clausal.cpp | 24 +- src/ast/sls/sls_arith_lookahead.cpp | 18 +- src/ast/sls/sls_bv_engine.cpp | 8 +- src/ast/sls/sls_bv_eval.cpp | 8 +- src/ast/sls/sls_bv_evaluator.h | 8 +- src/ast/sls/sls_bv_lookahead.cpp | 32 +- src/ast/sls/sls_bv_plugin.cpp | 4 +- src/ast/sls/sls_bv_tracker.h | 28 +- src/ast/sls/sls_context.cpp | 12 +- src/ast/sls/sls_datatype_plugin.cpp | 20 +- src/ast/sls/sls_euf_plugin.cpp | 8 +- src/ast/sls/sls_smt_plugin.cpp | 4 +- src/ast/sls/sls_smt_solver.cpp | 4 +- src/ast/static_features.cpp | 10 +- src/ast/substitution/demodulator_rewriter.cpp | 44 +- src/ast/substitution/substitution.cpp | 20 +- src/ast/substitution/substitution.h | 2 +- src/ast/substitution/substitution_tree.cpp | 22 +- src/ast/substitution/unifier.cpp | 4 +- src/ast/well_sorted.cpp | 4 +- src/cmd_context/cmd_context.cpp | 40 +- src/cmd_context/pdecl.cpp | 18 +- src/cmd_context/tactic_cmds.cpp | 2 +- src/math/automata/automaton.h | 10 +- src/math/automata/symbolic_automata_def.h | 4 +- src/math/dd/dd_bdd.cpp | 16 +- src/math/grobner/grobner.cpp | 26 +- src/math/grobner/pdd_simplifier.cpp | 22 +- src/math/grobner/pdd_solver.cpp | 14 +- src/math/hilbert/hilbert_basis.cpp | 22 +- src/math/interval/dep_intervals.h | 6 +- src/math/interval/interval_def.h | 88 +- src/math/lp/bound_analyzer_on_row.h | 2 +- src/math/lp/cross_nested.h | 66 +- src/math/lp/dioph_eq.cpp | 120 +- src/math/lp/emonics.cpp | 52 +- src/math/lp/emonics.h | 2 +- src/math/lp/gomory.cpp | 18 +- src/math/lp/hnf.h | 10 +- src/math/lp/hnf_cutter.cpp | 4 +- src/math/lp/horner.cpp | 10 +- src/math/lp/int_branch.cpp | 4 +- src/math/lp/int_cube.cpp | 10 +- src/math/lp/int_gcd_test.cpp | 16 +- src/math/lp/int_solver.cpp | 16 +- src/math/lp/lar_core_solver_def.h | 8 +- src/math/lp/lar_solver.cpp | 106 +- src/math/lp/lar_solver.h | 6 +- src/math/lp/lp_bound_propagator.h | 24 +- src/math/lp/lp_core_solver_base.h | 24 +- src/math/lp/lp_core_solver_base_def.h | 14 +- src/math/lp/lp_primal_core_solver.h | 4 +- src/math/lp/lp_primal_core_solver_def.h | 2 +- .../lp/lp_primal_core_solver_tableau_def.h | 6 +- src/math/lp/monomial_bounds.cpp | 12 +- src/math/lp/nex.h | 16 +- src/math/lp/nex_creator.cpp | 96 +- src/math/lp/nex_creator.h | 4 +- src/math/lp/nla_basics_lemmas.cpp | 52 +- src/math/lp/nla_common.cpp | 6 +- src/math/lp/nla_core.cpp | 92 +- src/math/lp/nla_grobner.cpp | 26 +- src/math/lp/nla_intervals.cpp | 52 +- src/math/lp/nla_order_lemmas.cpp | 30 +- src/math/lp/nla_powers.cpp | 2 +- src/math/lp/nla_tangent_lemmas.cpp | 14 +- src/math/lp/nra_solver.cpp | 6 +- src/math/lp/random_updater_def.h | 6 +- src/math/lp/var_eqs.h | 2 +- src/math/polynomial/algebraic_numbers.cpp | 162 +-- src/math/polynomial/linear_eq_solver.h | 4 +- src/math/polynomial/polynomial.cpp | 278 ++-- src/math/polynomial/upolynomial.cpp | 142 +- .../polynomial/upolynomial_factorization.cpp | 118 +- src/math/realclosure/mpz_matrix.cpp | 4 +- src/math/realclosure/realclosure.cpp | 76 +- src/math/simplex/model_based_opt.cpp | 42 +- src/math/simplex/network_flow_def.h | 22 +- src/math/simplex/simplex_def.h | 38 +- src/math/subpaving/subpaving_t_def.h | 90 +- .../subpaving/tactic/subpaving_tactic.cpp | 2 +- src/model/array_factory.cpp | 14 +- src/model/datatype_factory.cpp | 26 +- src/model/func_interp.cpp | 4 +- src/model/model.cpp | 12 +- src/model/model_core.cpp | 4 +- src/model/model_evaluator.cpp | 52 +- src/model/model_implicant.cpp | 52 +- src/model/model_implicant.h | 2 +- src/model/model_macro_solver.cpp | 20 +- src/model/model_smt2_pp.cpp | 2 +- src/muz/base/dl_context.cpp | 18 +- src/muz/base/dl_rule.cpp | 14 +- src/muz/base/dl_rule_set.cpp | 8 +- src/muz/base/dl_rule_transformer.cpp | 4 +- src/muz/base/dl_util.cpp | 8 +- src/muz/base/hnf.cpp | 6 +- src/muz/bmc/dl_bmc_engine.cpp | 20 +- src/muz/dataflow/dataflow.h | 2 +- src/muz/fp/horn_tactic.cpp | 4 +- src/muz/rel/check_relation.cpp | 4 +- src/muz/rel/dl_bound_relation.cpp | 12 +- src/muz/rel/dl_compiler.cpp | 20 +- src/muz/rel/dl_instruction.cpp | 32 +- src/muz/rel/dl_interval_relation.cpp | 8 +- src/muz/rel/dl_mk_explanations.cpp | 14 +- src/muz/rel/dl_mk_simple_joins.cpp | 32 +- src/muz/rel/dl_product_relation.cpp | 48 +- src/muz/rel/dl_relation_manager.cpp | 26 +- src/muz/rel/dl_sparse_table.cpp | 10 +- src/muz/rel/dl_table_relation.cpp | 14 +- src/muz/rel/dl_vector_relation.h | 12 +- src/muz/rel/doc.cpp | 6 +- src/muz/rel/karr_relation.cpp | 24 +- src/muz/rel/rel_context.cpp | 22 +- src/muz/rel/udoc_relation.cpp | 36 +- src/muz/spacer/spacer_arith_generalizers.cpp | 4 +- src/muz/spacer/spacer_arith_kernel.cpp | 4 +- src/muz/spacer/spacer_cluster.cpp | 22 +- src/muz/spacer/spacer_cluster_util.cpp | 4 +- src/muz/spacer/spacer_conjecture.cpp | 2 +- src/muz/spacer/spacer_context.cpp | 160 +-- src/muz/spacer/spacer_convex_closure.cpp | 12 +- src/muz/spacer/spacer_dl_interface.cpp | 6 +- .../spacer/spacer_expand_bnd_generalizer.cpp | 8 +- src/muz/spacer/spacer_farkas_learner.cpp | 10 +- src/muz/spacer/spacer_generalizers.cpp | 18 +- src/muz/spacer/spacer_global_generalizer.cpp | 32 +- .../spacer/spacer_ind_lemma_generalizer.cpp | 4 +- src/muz/spacer/spacer_iuc_solver.cpp | 4 +- src/muz/spacer/spacer_legacy_frames.cpp | 12 +- src/muz/spacer/spacer_legacy_mbp.cpp | 8 +- src/muz/spacer/spacer_legacy_mev.cpp | 42 +- src/muz/spacer/spacer_legacy_mev.h | 2 +- src/muz/spacer/spacer_manager.cpp | 2 +- src/muz/spacer/spacer_matrix.cpp | 4 +- src/muz/spacer/spacer_mbc.cpp | 2 +- src/muz/spacer/spacer_mev_array.cpp | 26 +- src/muz/spacer/spacer_pdr.cpp | 8 +- src/muz/spacer/spacer_proof_utils.cpp | 18 +- src/muz/spacer/spacer_prop_solver.cpp | 8 +- src/muz/spacer/spacer_qe_project.cpp | 108 +- src/muz/spacer/spacer_quant_generalizer.cpp | 28 +- src/muz/spacer/spacer_sat_answer.cpp | 10 +- src/muz/spacer/spacer_sym_mux.cpp | 2 +- src/muz/spacer/spacer_unsat_core_plugin.cpp | 8 +- src/muz/spacer/spacer_util.cpp | 40 +- src/muz/tab/tab_context.cpp | 2 +- src/muz/transforms/dl_mk_array_blast.cpp | 10 +- src/muz/transforms/dl_mk_backwards.cpp | 2 +- src/muz/transforms/dl_mk_bit_blast.cpp | 10 +- src/muz/transforms/dl_mk_coi_filter.cpp | 10 +- src/muz/transforms/dl_mk_elim_term_ite.cpp | 8 +- src/muz/transforms/dl_mk_filter_rules.cpp | 4 +- .../dl_mk_interp_tail_simplifier.cpp | 10 +- src/muz/transforms/dl_mk_karr_invariants.cpp | 4 +- src/muz/transforms/dl_mk_magic_sets.cpp | 2 +- src/muz/transforms/dl_mk_magic_symbolic.cpp | 2 +- .../dl_mk_quantifier_abstraction.cpp | 16 +- .../dl_mk_quantifier_instantiation.cpp | 6 +- src/muz/transforms/dl_mk_rule_inliner.cpp | 46 +- src/muz/transforms/dl_mk_scale.cpp | 6 +- src/muz/transforms/dl_mk_slice.cpp | 52 +- .../transforms/dl_mk_subsumption_checker.cpp | 2 +- .../transforms/dl_mk_unbound_compressor.cpp | 14 +- src/nlsat/nlsat_evaluator.cpp | 24 +- src/nlsat/nlsat_explain.cpp | 122 +- src/nlsat/nlsat_interval_set.cpp | 56 +- src/nlsat/nlsat_simple_checker.cpp | 64 +- src/nlsat/nlsat_simplify.cpp | 2 +- src/nlsat/nlsat_solver.cpp | 218 +-- .../nlsat_variable_ordering_strategy.cpp | 2 +- src/nlsat/tactic/goal2nlsat.cpp | 8 +- src/nlsat/tactic/nlsat_tactic.cpp | 10 +- src/opt/maxcore.cpp | 40 +- src/opt/maxlex.cpp | 2 +- src/opt/maxsmt.cpp | 8 +- src/opt/opt_context.cpp | 66 +- src/opt/opt_cores.cpp | 2 +- src/opt/opt_lns.cpp | 4 +- src/opt/opt_pareto.cpp | 4 +- src/opt/opt_preprocess.cpp | 2 +- src/opt/opt_sls_solver.h | 6 +- src/opt/opt_solver.cpp | 18 +- src/opt/optsmt.cpp | 28 +- src/opt/pb_sls.cpp | 4 +- src/opt/sortmax.cpp | 6 +- src/opt/wmax.cpp | 8 +- src/parsers/smt2/smt2parser.cpp | 74 +- src/parsers/smt2/smt2scanner.cpp | 6 +- src/parsers/util/scanner.cpp | 4 +- src/qe/lite/qe_lite_tactic.cpp | 82 +- src/qe/mbp/mbp_arith.cpp | 42 +- src/qe/mbp/mbp_arrays.cpp | 58 +- src/qe/mbp/mbp_arrays_tg.cpp | 14 +- src/qe/mbp/mbp_basic_tg.cpp | 4 +- src/qe/mbp/mbp_datatypes.cpp | 14 +- src/qe/mbp/mbp_dt_tg.cpp | 8 +- src/qe/mbp/mbp_euf.cpp | 2 +- src/qe/mbp/mbp_plugin.cpp | 10 +- src/qe/mbp/mbp_qel.cpp | 12 +- src/qe/mbp/mbp_solve_plugin.cpp | 2 +- src/qe/mbp/mbp_term_graph.cpp | 38 +- src/qe/nlarith_util.cpp | 38 +- src/qe/nlqsat.cpp | 38 +- src/qe/qe.cpp | 94 +- src/qe/qe_arith_plugin.cpp | 90 +- src/qe/qe_array_plugin.cpp | 8 +- src/qe/qe_bool_plugin.cpp | 4 +- src/qe/qe_datatype_plugin.cpp | 30 +- src/qe/qe_dl_plugin.cpp | 4 +- src/qe/qe_mbi.cpp | 36 +- src/qe/qe_mbp.cpp | 56 +- src/qe/qsat.cpp | 84 +- src/sat/sat_aig_cuts.cpp | 16 +- src/sat/sat_anf_simplifier.cpp | 20 +- src/sat/sat_asymm_branch.cpp | 8 +- src/sat/sat_bcd.cpp | 12 +- src/sat/sat_clause.cpp | 4 +- src/sat/sat_clause_use_list.h | 8 +- src/sat/sat_cleaner.cpp | 18 +- src/sat/sat_cut_simplifier.cpp | 6 +- src/sat/sat_drat.cpp | 14 +- src/sat/sat_elim_eqs.cpp | 26 +- src/sat/sat_gc.cpp | 14 +- src/sat/sat_integrity_checker.cpp | 16 +- src/sat/sat_local_search.cpp | 8 +- src/sat/sat_lookahead.cpp | 92 +- src/sat/sat_lookahead.h | 4 +- src/sat/sat_lut_finder.cpp | 2 +- src/sat/sat_model_converter.cpp | 14 +- src/sat/sat_mus.cpp | 10 +- src/sat/sat_probing.cpp | 10 +- src/sat/sat_proof_trim.cpp | 6 +- src/sat/sat_scc.cpp | 18 +- src/sat/sat_simplifier.cpp | 84 +- src/sat/sat_solver.cpp | 152 +- src/sat/sat_solver.h | 4 +- src/sat/sat_solver/inc_sat_solver.cpp | 44 +- src/sat/sat_solver/sat_smt_solver.cpp | 22 +- src/sat/sat_xor_finder.cpp | 10 +- src/sat/smt/arith_axioms.cpp | 14 +- src/sat/smt/arith_diagnostics.cpp | 4 +- src/sat/smt/arith_internalize.cpp | 26 +- src/sat/smt/arith_solver.cpp | 122 +- src/sat/smt/arith_value.cpp | 6 +- src/sat/smt/array_axioms.cpp | 24 +- src/sat/smt/array_internalize.cpp | 2 +- src/sat/smt/array_model.cpp | 10 +- src/sat/smt/array_solver.cpp | 6 +- src/sat/smt/bv_delay_internalize.cpp | 8 +- src/sat/smt/bv_internalize.cpp | 20 +- src/sat/smt/bv_solver.cpp | 40 +- src/sat/smt/dt_solver.cpp | 32 +- src/sat/smt/euf_ackerman.cpp | 10 +- src/sat/smt/euf_internalize.cpp | 6 +- src/sat/smt/euf_invariant.cpp | 2 +- src/sat/smt/euf_model.cpp | 24 +- src/sat/smt/euf_proof.cpp | 4 +- src/sat/smt/euf_relevancy.cpp | 18 +- src/sat/smt/euf_solver.cpp | 36 +- src/sat/smt/fpa_solver.cpp | 22 +- src/sat/smt/intblast_solver.cpp | 8 +- src/sat/smt/pb_card.cpp | 2 +- src/sat/smt/pb_internalize.cpp | 6 +- src/sat/smt/pb_pb.cpp | 4 +- src/sat/smt/pb_solver.cpp | 102 +- src/sat/smt/q_ematch.cpp | 18 +- src/sat/smt/q_eval.cpp | 6 +- src/sat/smt/q_mbi.cpp | 20 +- src/sat/smt/q_model_fixer.cpp | 10 +- src/sat/smt/q_queue.cpp | 10 +- src/sat/smt/q_solver.cpp | 2 +- src/sat/smt/recfun_solver.cpp | 4 +- src/sat/smt/sat_th.h | 2 +- src/sat/smt/specrel_solver.cpp | 6 +- src/sat/smt/user_solver.cpp | 2 +- src/sat/smt/xor_solver.d | 16 +- src/sat/tactic/goal2sat.cpp | 34 +- src/sat/tactic/sat2goal.cpp | 6 +- src/sat/tactic/sat_tactic.cpp | 18 +- src/shell/datalog_frontend.cpp | 6 +- src/smt/arith_eq_adapter.cpp | 38 +- src/smt/arith_eq_solver.cpp | 30 +- src/smt/diff_logic.h | 72 +- src/smt/dyn_ack.cpp | 40 +- src/smt/expr_context_simplifier.cpp | 8 +- src/smt/fingerprints.cpp | 8 +- src/smt/mam.cpp | 172 +-- src/smt/old_interval.cpp | 32 +- src/smt/params/smt_params.cpp | 2 +- src/smt/proto_model/proto_model.cpp | 20 +- src/smt/qi_queue.cpp | 56 +- src/smt/seq_eq_solver.cpp | 82 +- src/smt/seq_ne_solver.cpp | 22 +- src/smt/seq_offset_eq.cpp | 6 +- src/smt/seq_regex.cpp | 104 +- src/smt/smt_arith_value.cpp | 12 +- src/smt/smt_case_split_queue.cpp | 50 +- src/smt/smt_cg_table.cpp | 4 +- src/smt/smt_clause_proof.cpp | 8 +- src/smt/smt_conflict_resolution.cpp | 108 +- src/smt/smt_conflict_resolution.h | 2 +- src/smt/smt_consequences.cpp | 26 +- src/smt/smt_context.cpp | 319 ++--- src/smt/smt_context.h | 2 +- src/smt/smt_context_inv.cpp | 38 +- src/smt/smt_context_pp.cpp | 4 +- src/smt/smt_enode.cpp | 2 +- src/smt/smt_farkas_util.cpp | 4 +- src/smt/smt_for_each_relevant_expr.cpp | 22 +- src/smt/smt_implied_equalities.cpp | 14 +- src/smt/smt_induction.cpp.disabled | 2 +- src/smt/smt_internalizer.cpp | 120 +- src/smt/smt_justification.cpp | 8 +- src/smt/smt_kernel.cpp | 2 +- src/smt/smt_model_checker.cpp | 60 +- src/smt/smt_model_finder.cpp | 84 +- src/smt/smt_model_generator.cpp | 48 +- src/smt/smt_quantifier.cpp | 26 +- src/smt/smt_quick_checker.cpp | 20 +- src/smt/smt_relevancy.cpp | 26 +- src/smt/smt_setup.cpp | 62 +- src/smt/smt_solver.cpp | 2 +- src/smt/smt_theory.cpp | 2 +- src/smt/smt_theory.h | 8 +- src/smt/spanning_tree_def.h | 6 +- src/smt/tactic/ctx_solver_simplify_tactic.cpp | 10 +- src/smt/tactic/smt_tactic_core.cpp | 22 +- src/smt/tactic/unit_subsumption_tactic.cpp | 4 +- src/smt/theory_arith_aux.h | 90 +- src/smt/theory_arith_core.h | 238 ++-- src/smt/theory_arith_eq.h | 16 +- src/smt/theory_arith_int.h | 86 +- src/smt/theory_arith_inv.h | 20 +- src/smt/theory_arith_nl.h | 192 +-- src/smt/theory_array.cpp | 28 +- src/smt/theory_array_bapa.cpp | 8 +- src/smt/theory_array_base.cpp | 48 +- src/smt/theory_array_full.cpp | 44 +- src/smt/theory_bv.cpp | 92 +- src/smt/theory_char.cpp | 12 +- src/smt/theory_datatype.cpp | 46 +- src/smt/theory_dense_diff_logic_def.h | 72 +- src/smt/theory_diff_logic_def.h | 70 +- src/smt/theory_dl.cpp | 10 +- src/smt/theory_fpa.cpp | 56 +- src/smt/theory_lra.cpp | 204 +-- src/smt/theory_pb.cpp | 66 +- src/smt/theory_recfun.cpp | 4 +- src/smt/theory_seq.cpp | 158 +-- src/smt/theory_special_relations.cpp | 48 +- src/smt/theory_str.cpp | 696 ++++----- src/smt/theory_str.h | 8 +- src/smt/theory_str_mc.cpp | 150 +- src/smt/theory_str_regex.cpp | 94 +- src/smt/theory_user_propagator.cpp | 14 +- src/smt/theory_utvpi_def.h | 34 +- src/smt/theory_wmaxsat.cpp | 18 +- src/solver/assertions/asserted_formulas.cpp | 54 +- src/solver/assertions/asserted_formulas.h | 2 +- src/solver/check_logic.cpp | 2 +- src/solver/combined_solver.cpp | 6 +- src/solver/mus.cpp | 12 +- src/solver/simplifier_solver.cpp | 6 +- src/solver/solver2tactic.cpp | 4 +- src/solver/solver_na2as.cpp | 4 +- src/solver/solver_pool.cpp | 2 +- src/solver/tactic2solver.cpp | 14 +- src/tactic/aig/aig.cpp | 36 +- src/tactic/arith/add_bounds_tactic.cpp | 2 +- src/tactic/arith/arith_bounds_tactic.cpp | 4 +- src/tactic/arith/bv2int_rewriter.cpp | 6 +- src/tactic/arith/bv2real_rewriter.cpp | 10 +- src/tactic/arith/degree_shift_tactic.cpp | 4 +- src/tactic/arith/diff_neq_tactic.cpp | 8 +- src/tactic/arith/factor_tactic.cpp | 6 +- src/tactic/arith/fix_dl_var_tactic.cpp | 8 +- src/tactic/arith/fm_tactic.cpp | 56 +- src/tactic/arith/lia2card_tactic.cpp | 6 +- src/tactic/arith/lia2pb_tactic.cpp | 6 +- src/tactic/arith/nla2bv_tactic.cpp | 18 +- src/tactic/arith/normalize_bounds_tactic.cpp | 4 +- src/tactic/arith/pb2bv_model_converter.cpp | 2 +- src/tactic/arith/pb2bv_tactic.cpp | 46 +- src/tactic/arith/probe_arith.cpp | 10 +- src/tactic/arith/purify_arith_tactic.cpp | 10 +- src/tactic/arith/recover_01_tactic.cpp | 4 +- src/tactic/bv/bit_blaster_model_converter.cpp | 8 +- src/tactic/bv/bit_blaster_tactic.cpp | 6 +- src/tactic/bv/bv_bound_chk_tactic.cpp | 2 +- src/tactic/bv/bv_size_reduction_tactic.cpp | 30 +- src/tactic/bv/bvarray2uf_rewriter.cpp | 24 +- src/tactic/bv/elim_small_bv_tactic.cpp | 20 +- src/tactic/core/blast_term_ite_tactic.cpp | 2 +- src/tactic/core/cofactor_elim_term_ite.cpp | 28 +- src/tactic/core/ctx_simplify_tactic.cpp | 22 +- src/tactic/core/elim_uncnstr_tactic.cpp | 12 +- src/tactic/core/injectivity_tactic.cpp | 6 +- src/tactic/core/nnf_tactic.cpp | 6 +- src/tactic/core/pb_preprocess_tactic.cpp | 14 +- src/tactic/core/propagate_values_tactic.cpp | 12 +- src/tactic/core/reduce_args_tactic.cpp | 8 +- src/tactic/core/simplify_tactic.cpp | 4 +- src/tactic/core/special_relations_tactic.cpp | 6 +- src/tactic/core/split_clause_tactic.cpp | 2 +- src/tactic/core/symmetry_reduce_tactic.cpp | 12 +- src/tactic/core/tseitin_cnf_tactic.cpp | 4 +- .../fd_solver/bounded_int2bv_solver.cpp | 10 +- src/tactic/fd_solver/smtfd_solver.cpp | 56 +- src/tactic/fpa/fpa2bv_model_converter.cpp | 4 +- src/tactic/fpa/fpa2bv_tactic.cpp | 4 +- src/tactic/goal.cpp | 4 +- .../portfolio/solver_subsumption_tactic.cpp | 2 +- src/tactic/sls/sls_tactic.cpp | 8 +- src/tactic/smtlogics/qfufbv_tactic.cpp | 2 +- src/tactic/smtlogics/quant_tactics.cpp | 2 +- src/tactic/tactic.cpp | 8 +- src/tactic/tactical.cpp | 6 +- src/tactic/ufbv/macro_finder_tactic.cpp | 2 +- src/test/ast.cpp | 10 +- src/test/bit_blaster.cpp | 14 +- src/test/chashtable.cpp | 4 +- src/test/diff_logic.cpp | 6 +- src/test/doc.cpp | 10 +- src/test/euf_arith_plugin.cpp | 16 +- src/test/euf_bv_plugin.cpp | 20 +- src/test/heap.cpp | 12 +- src/test/inf_rational.cpp | 2 +- src/test/list.cpp | 6 +- src/test/lp/gomory_test.h | 22 +- src/test/lp/lp.cpp | 46 +- src/test/lp/nla_solver_test.cpp | 4 +- src/test/mpff.cpp | 4 +- src/test/mpz.cpp | 4 +- src/test/no_overflow.cpp | 12 +- src/test/object_allocator.cpp | 6 +- src/test/optional.cpp | 10 +- src/test/parray.cpp | 38 +- src/test/polynomial.cpp | 6 +- src/test/polynorm.cpp | 2 +- src/test/random.cpp | 2 +- src/test/rational.cpp | 32 +- src/test/simple_parser.cpp | 12 +- src/test/simplifier.cpp | 16 +- src/test/small_object_allocator.cpp | 8 +- src/test/sorting_network.cpp | 14 +- src/test/string_buffer.cpp | 2 +- src/test/substitution.cpp | 8 +- src/test/theory_pb.cpp | 6 +- src/test/trigo.cpp | 2 +- src/test/upolynomial.cpp | 6 +- src/test/var_subst.cpp | 2 +- src/util/bit_vector.cpp | 4 +- src/util/chashtable.h | 4 +- src/util/gparams.cpp | 8 +- src/util/hwf.cpp | 4 +- src/util/memory_manager.cpp | 4 +- src/util/min_cut.cpp | 2 +- src/util/mpbq.cpp | 6 +- src/util/mpf.cpp | 234 ++-- src/util/mpff.cpp | 72 +- src/util/mpfx.cpp | 40 +- src/util/mpn.cpp | 22 +- src/util/mpq.cpp | 22 +- src/util/mpq.h | 36 +- src/util/mpz.cpp | 80 +- src/util/mpzzp.h | 8 +- src/util/parray.h | 10 +- src/util/sorting_network.h | 34 +- src/util/state_graph.cpp | 34 +- src/util/tbv.cpp | 6 +- src/util/total_order.h | 4 +- src/util/trace.cpp | 18 +- src/util/trace.h | 18 +- src/util/trace_tags.def | 1248 +++++++++++++++++ src/util/trace_tags.h | 83 ++ src/util/union_find.h | 6 +- 583 files changed, 8698 insertions(+), 7299 deletions(-) create mode 100644 src/util/trace_tags.def create mode 100644 src/util/trace_tags.h diff --git a/doc/mk_api_doc.py b/doc/mk_api_doc.py index 6e2ef96e5..f5c4ff68c 100644 --- a/doc/mk_api_doc.py +++ b/doc/mk_api_doc.py @@ -184,11 +184,66 @@ def configure_file(template_file_path, output_file_path, substitutions): with open(output_file_path, 'w') as f: f.write(template_string) +def generate_trace_tag_docs(): + """Generate trace tag documentation from trace_tags.def file. + + This function reads the trace_tags.def file and generates a markdown table with the following format: + + # Z3 Trace Tags Documentation + + This document contains the trace tags and their descriptions used in Z3. + + | Tag | Class | Description | + |-----|-------|-------------| + | Global | Global | Unknown Class | + | add_bounds_tactic | arith_bounds_tactic | add bounds tactic | + | parser | parser | parser functionality | + + The def file format should be: + X(class, tag, "description") + + For example: + X(Global, Global, "Unknown Class") + X(add_bounds_tactic, arith_bounds_tactic, "add bounds tactic") + """ + print("Generating trace tag documentation...") + def_file = os.path.join(SCRIPT_DIR, "../src/util/trace_tags.def") + output_md = os.path.join(OUTPUT_DIRECTORY, "trace_tags.md") + + if not os.path.exists(def_file): + print(f"Warning: {def_file} not found. Skipping trace tag documentation generation.") + return + + with open(def_file, "r") as f: + lines = f.readlines() + + entries = [] + for line in lines: + match = re.match(r'X\(\s*(\w+)\s*,\s*(\w+)\s*,\s*"([^"]+)"\s*\)', line) + if match: + tag_class, tag, desc = match.groups() + entries.append((tag_class, tag, desc)) + + mk_dir(os.path.dirname(output_md)) + with open(output_md, "w", encoding='utf-8') as f: + f.write("# Z3 Trace Tags Documentation\n\n") + f.write("This document contains the trace tags and their descriptions used in Z3.\n\n") + f.write("| Tag | Class | Description |\n") + f.write("|-----|-------|-------------|\n") + for tag, class_name, desc in sorted(entries): + f.write(f"| {tag} | {class_name} | {desc} |\n") + + print(f"Trace tag documentation has been generated at {output_md}") + try: parse_options() print("Creating temporary directory \"{}\"".format(TEMP_DIR)) mk_dir(TEMP_DIR) + + # Generate trace tag documentation + generate_trace_tag_docs() + # Short-hand for path to temporary file def temp_path(path): return os.path.join(TEMP_DIR, path) diff --git a/src/ackermannization/ackermannize_bv_tactic.cpp b/src/ackermannization/ackermannize_bv_tactic.cpp index 5ef783c93..088133f8e 100644 --- a/src/ackermannization/ackermannize_bv_tactic.cpp +++ b/src/ackermannization/ackermannize_bv_tactic.cpp @@ -35,7 +35,7 @@ public: tactic_report report("ackermannize_bv", *g); fail_if_unsat_core_generation("ackermannize", g); fail_if_proof_generation("ackermannize", g); - TRACE("goal", g->display(tout << "in\n");); + TRACE(goal, g->display(tout << "in\n");); ptr_vector flas; const unsigned sz = g->size(); @@ -46,7 +46,7 @@ public: goal_ref resg(alloc(goal, *g, true)); const bool success = lackr.mk_ackermann(resg, m_lemma_limit); if (!success) { // Just pass on the input unchanged - TRACE("ackermannize", tout << "ackermannize not run due to limit" << std::endl;); + TRACE(ackermannize, tout << "ackermannize not run due to limit" << std::endl;); result.reset(); result.push_back(g.get()); return; @@ -58,7 +58,7 @@ public: } resg->inc_depth(); - TRACE("goal", resg->display(tout << "out\n");); + TRACE(goal, resg->display(tout << "out\n");); } diff --git a/src/ackermannization/ackr_bound_probe.cpp b/src/ackermannization/ackr_bound_probe.cpp index 48a54543f..5abb046c4 100644 --- a/src/ackermannization/ackr_bound_probe.cpp +++ b/src/ackermannization/ackr_bound_probe.cpp @@ -69,7 +69,7 @@ public: } p.prune_non_select(); double total = ackr_helper::calculate_lemma_bound(p.m_fun2terms, p.m_sel2terms); - TRACE("ackermannize", tout << "total=" << total << std::endl;); + TRACE(ackermannize, tout << "total=" << total << std::endl;); return result(total); } diff --git a/src/ackermannization/ackr_model_converter.cpp b/src/ackermannization/ackr_model_converter.cpp index a38455e03..a5d05fcb8 100644 --- a/src/ackermannization/ackr_model_converter.cpp +++ b/src/ackermannization/ackr_model_converter.cpp @@ -43,9 +43,9 @@ public: void get_units(obj_map& units) override { units.reset(); } void operator()(model_ref & md) override { - TRACE("ackermannize", tout << (fixed_model? "fixed" : "nonfixed") << "\n";); - CTRACE("ackermannize", md, tout << *md << "\n"); - CTRACE("ackermannize", fixed_model, tout << *abstr_model << "\n"); + TRACE(ackermannize, tout << (fixed_model? "fixed" : "nonfixed") << "\n";); + CTRACE(ackermannize, md, tout << *md << "\n"); + CTRACE(ackermannize, fixed_model, tout << *abstr_model << "\n"); model* new_model = alloc(model, m); @@ -96,7 +96,7 @@ void ackr_model_converter::convert(model * source, model * destination) { } void ackr_model_converter::convert_constants(model * source, model * destination) { - TRACE("ackermannize", tout << "converting constants\n";); + TRACE(ackermannize, tout << "converting constants\n";); obj_map interpretations; obj_map array_interpretations; model_evaluator evaluator(*source); @@ -107,7 +107,7 @@ void ackr_model_converter::convert_constants(model * source, model * destination func_decl * const c = source->get_constant(i); app * const term = info->find_term(c); expr * value = source->get_const_interp(c); - TRACE("ackermannize", tout << mk_ismt2_pp(c, m) << " " << mk_ismt2_pp(term, m) << "\n";); + TRACE(ackermannize, tout << mk_ismt2_pp(c, m) << " " << mk_ismt2_pp(term, m) << "\n";); if (!term) destination->register_decl(c, value); else if (autil.is_select(term)) @@ -160,7 +160,7 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator, void ackr_model_converter::add_entry(model_evaluator & evaluator, app* term, expr* value, obj_map& interpretations) { - TRACE("ackermannize", tout << "add_entry" + TRACE(ackermannize, tout << "add_entry" << mk_ismt2_pp(term, m, 2) << "->" << mk_ismt2_pp(value, m, 2) << "\n";); @@ -178,7 +178,7 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator, args.push_back(evaluator(info->abstract(arg))); } if (fi->get_entry(args.data()) == nullptr) { - TRACE("ackermannize", + TRACE(ackermannize, tout << mk_ismt2_pp(declaration, m) << " args: " << std::endl; for (expr* arg : args) { tout << mk_ismt2_pp(arg, m) << std::endl; @@ -187,7 +187,7 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator, fi->insert_new_entry(args.data(), value); } else { - TRACE("ackermannize", tout << "entry already present\n";); + TRACE(ackermannize, tout << "entry already present\n";); } } diff --git a/src/ackermannization/lackr.cpp b/src/ackermannization/lackr.cpp index b02ef8c44..b438302b6 100644 --- a/src/ackermannization/lackr.cpp +++ b/src/ackermannization/lackr.cpp @@ -65,7 +65,7 @@ lbool lackr::operator()() { if (rv == l_true) { m_solver->get_model(m_model); } - CTRACE("ackermannize", rv == l_true, model_smt2_pp(tout << "abstr_model(\n", m, *(m_model.get()), 2); tout << ")\n"; ); + CTRACE(ackermannize, rv == l_true, model_smt2_pp(tout << "abstr_model(\n", m, *(m_model.get()), 2); tout << ")\n"; ); return rv; } @@ -103,7 +103,7 @@ bool lackr::init() { // Introduce ackermann lemma for the two given terms. // bool lackr::ackr(app * const t1, app * const t2) { - TRACE("ackermannize", tout << "ackr " << mk_ismt2_pp(t1, m, 2) << " , " << mk_ismt2_pp(t2, m, 2) << "\n";); + TRACE(ackermannize, tout << "ackr " << mk_ismt2_pp(t1, m, 2) << " , " << mk_ismt2_pp(t2, m, 2) << "\n";); const unsigned sz = t1->get_num_args(); SASSERT(t2->get_num_args() == sz); expr_ref_vector eqs(m); @@ -112,7 +112,7 @@ bool lackr::ackr(app * const t1, app * const t2) { expr * const arg2 = t2->get_arg(i); if (m.are_equal(arg1, arg2)) continue; // quickly skip syntactically equal if (m.are_distinct(arg1, arg2)){ // quickly abort if there are two distinct (e.g. numerals) - TRACE("ackermannize", tout << "never eq\n";); + TRACE(ackermannize, tout << "never eq\n";); return false; } eqs.push_back(m.mk_eq(arg1, arg2)); @@ -125,7 +125,7 @@ bool lackr::ackr(app * const t1, app * const t2) { expr_ref cg(m.mk_implies(lhs, rhs), m); expr_ref cga = m_info->abstract(cg); // constraint needs abstraction due to nested applications m_simp(cga); - TRACE("ackermannize", + TRACE(ackermannize, tout << "abstr1 " << mk_ismt2_pp(a1, m, 2) << "\n"; tout << "abstr2 " << mk_ismt2_pp(a2, m, 2) << "\n"; tout << "ackr constr lhs" << mk_ismt2_pp(lhs, m, 2) << "\n"; @@ -144,7 +144,7 @@ bool lackr::ackr(app * const t1, app * const t2) { // Introduce the ackermann lemma for each pair of terms. // void lackr::eager_enc() { - TRACE("ackermannize", tout << "#funs: " << m_fun2terms.size() << " #sels: " << m_sel2terms.size() << std::endl;); + TRACE(ackermannize, tout << "#funs: " << m_fun2terms.size() << " #sels: " << m_sel2terms.size() << std::endl;); for (auto const& [k,v] : m_fun2terms) { checkpoint(); ackr(v); @@ -227,7 +227,7 @@ void lackr::push_abstraction() { lbool lackr::eager() { SASSERT(m_is_init); push_abstraction(); - TRACE("ackermannize", tout << "run sat 0\n"; ); + TRACE(ackermannize, tout << "run sat 0\n"; ); lbool rv0 = m_solver->check_sat(0, nullptr); if (rv0 == l_false) { return l_false; @@ -236,7 +236,7 @@ lbool lackr::eager() { expr_ref all = mk_and(m_ackrs); m_simp(all); m_solver->assert_expr(all); - TRACE("ackermannize", tout << "run sat all\n"; ); + TRACE(ackermannize, tout << "run sat all\n"; ); return m_solver->check_sat(0, nullptr); } @@ -248,7 +248,7 @@ lbool lackr::lazy() { while (true) { m_st.m_it++; checkpoint(); - TRACE("ackermannize", tout << "lazy check: " << m_st.m_it << "\n";); + TRACE(ackermannize, tout << "lazy check: " << m_st.m_it << "\n";); const lbool r = m_solver->check_sat(0, nullptr); if (r == l_undef) return l_undef; // give up if (r == l_false) return l_false; // abstraction unsat diff --git a/src/ackermannization/lackr_model_constructor.cpp b/src/ackermannization/lackr_model_constructor.cpp index ec4727152..0e2d21134 100644 --- a/src/ackermannization/lackr_model_constructor.cpp +++ b/src/ackermannization/lackr_model_constructor.cpp @@ -199,12 +199,12 @@ private: for (unsigned i = 0; i < num; ++i) { expr * val = nullptr; const bool b = eval_cached(to_app(args[i]), val); // TODO: OK conversion to_app? - CTRACE("model_constructor", m_conflicts.empty() && !b, tout << "fail arg val(\n" << mk_ismt2_pp(args[i], m, 2) << '\n'; ); + CTRACE(model_constructor, m_conflicts.empty() && !b, tout << "fail arg val(\n" << mk_ismt2_pp(args[i], m, 2) << '\n'; ); if (!b) { // bailing out because args eval failed previously return false; } - TRACE("model_constructor", tout << + TRACE(model_constructor, tout << "arg val " << i << "(\n" << mk_ismt2_pp(args[i], m, 2) << " : " << mk_ismt2_pp(val, m, 2) << '\n'; ); SASSERT(b); @@ -233,15 +233,15 @@ private: bool mk_value(app * a) { if (is_val(a)) return true; // skip numerals - TRACE("model_constructor", tout << "mk_value(\n" << mk_ismt2_pp(a, m, 2) << ")\n";); + TRACE(model_constructor, tout << "mk_value(\n" << mk_ismt2_pp(a, m, 2) << ")\n";); SASSERT(!m_app2val.contains(a)); expr_ref result(m); if (!evaluate(a, result)) return false; - TRACE("model_constructor", + TRACE(model_constructor, tout << "map term(\n" << mk_ismt2_pp(a, m, 2) << "\n->" << mk_ismt2_pp(result.get(), m, 2)<< ")\n"; ); - CTRACE("model_constructor", + CTRACE(model_constructor, !is_val(result.get()), tout << "eval didn't create a constant \n" << mk_ismt2_pp(a, m, 2) << " " << mk_ismt2_pp(result, m, 2) << "\n"; ); @@ -284,7 +284,7 @@ private: SASSERT(vi.source_term); const bool ok = vi.value == value; if (!ok) { - TRACE("model_constructor", + TRACE(model_constructor, tout << "already mapped by(\n" << mk_ismt2_pp(vi.source_term, m, 2) << "\n->" << mk_ismt2_pp(vi.value, m, 2) << ")\n"; ); m_conflicts.push_back(std::make_pair(a, vi.source_term)); @@ -315,7 +315,7 @@ private: expr_ref term(m); term = m.mk_app(a->get_decl(), num, values.data()); m_evaluator->operator() (term, result); - TRACE("model_constructor", + TRACE(model_constructor, tout << "eval(\n" << mk_ismt2_pp(term.get(), m, 2) << "\n->" << mk_ismt2_pp(result.get(), m, 2) << ")\n"; ); return; diff --git a/src/api/z3_replayer.cpp b/src/api/z3_replayer.cpp index eb6064a43..9272ca0fc 100644 --- a/src/api/z3_replayer.cpp +++ b/src/api/z3_replayer.cpp @@ -30,7 +30,7 @@ void register_z3_replayer_cmds(z3_replayer & in); void throw_invalid_reference() { - TRACE("z3_replayer", tout << "invalid argument reference\n";); + TRACE(z3_replayer, tout << "invalid argument reference\n";); throw z3_replayer_exception("invalid argument reference"); } @@ -72,14 +72,14 @@ struct z3_replayer::imp { void check_arg(unsigned pos, value_kind k) const { if (pos >= m_args.size()) { - TRACE("z3_replayer", tout << pos << " too few arguments " << m_args.size() << " expecting " << kind2string(k) << "\n";); + TRACE(z3_replayer, tout << pos << " too few arguments " << m_args.size() << " expecting " << kind2string(k) << "\n";); throw z3_replayer_exception("invalid argument reference"); } if (m_args[pos].m_kind != k) { std::stringstream strm; strm << "expecting " << kind2string(k) << " at position " << pos << " but got " << kind2string(m_args[pos].m_kind); - TRACE("z3_replayer", tout << strm.str() << "\n";); + TRACE(z3_replayer, tout << strm.str() << "\n";); throw z3_replayer_exception(std::move(strm).str()); } } @@ -196,7 +196,7 @@ struct z3_replayer::imp { throw z3_replayer_exception("invalid escaped character"); next(); } - TRACE("z3_replayer_escape", tout << "val: " << val << "\n";); + TRACE(z3_replayer_escape, tout << "val: " << val << "\n";); m_string.push_back(static_cast(val)); } else if (c == delimiter) { @@ -300,7 +300,7 @@ struct z3_replayer::imp { void read_ptr() { if (!(('0' <= curr() && curr() <= '9') || ('A' <= curr() && curr() <= 'F') || ('a' <= curr() && curr() <= 'f'))) { - TRACE("invalid_ptr", tout << "curr: " << curr() << "\n";); + TRACE(invalid_ptr, tout << "curr: " << curr() << "\n";); throw z3_replayer_exception("invalid ptr"); } unsigned pos = 0; @@ -380,7 +380,7 @@ struct z3_replayer::imp { } } else if (k == OBJECT) { - TRACE("z3_replayer_bug", + TRACE(z3_replayer_bug, tout << "args: "; display_args(tout); tout << "\n"; tout << "push_back, sz: " << sz << ", m_obj_arrays.size(): " << m_obj_arrays.size() << "\n"; for (unsigned i = asz - sz; i < asz; i++) { @@ -427,13 +427,13 @@ struct z3_replayer::imp { case 'R': // reset next(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "R\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "R\n";); reset(); break; case 'P': { // push pointer next(); skip_blank(); read_ptr(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "P " << m_ptr << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "P " << m_ptr << "\n";); if (m_ptr == 0) { m_args.push_back(nullptr); } @@ -442,14 +442,14 @@ struct z3_replayer::imp { if (!m_heap.find(m_ptr, obj)) throw z3_replayer_exception("invalid pointer"); m_args.push_back(value(obj)); - TRACE("z3_replayer_bug", tout << "args after 'P':\n"; display_args(tout); tout << "\n";); + TRACE(z3_replayer_bug, tout << "args after 'P':\n"; display_args(tout); tout << "\n";); } break; } case 'S': { // push string next(); skip_blank(); read_string(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "S " << m_string.begin() << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "S " << m_string.begin() << "\n";); symbol sym(m_string.begin()); // save string m_args.push_back(value(STRING, sym.bare_str())); break; @@ -457,20 +457,20 @@ struct z3_replayer::imp { case 'N': // push null symbol next(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "N\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "N\n";); m_args.push_back(value(SYMBOL, symbol::null)); break; case '$': { // push symbol next(); skip_blank(); read_quoted_symbol(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "$ " << m_id << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "$ " << m_id << "\n";); m_args.push_back(value(SYMBOL, m_id)); break; } case '#': { // push numeral symbol next(); skip_blank(); read_uint64(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "# " << m_uint64 << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "# " << m_uint64 << "\n";); symbol sym(static_cast(m_uint64)); m_args.push_back(value(SYMBOL, sym)); break; @@ -478,25 +478,25 @@ struct z3_replayer::imp { case 'I': // push integer; next(); skip_blank(); read_int64(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "I " << m_int64 << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "I " << m_int64 << "\n";); m_args.push_back(value(INT64, m_int64)); break; case 'U': // push unsigned; next(); skip_blank(); read_uint64(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "U " << m_uint64 << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "U " << m_uint64 << "\n";); m_args.push_back(value(UINT64, m_uint64)); break; case 'F': // push float next(); skip_blank(); read_float(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "F " << m_float << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "F " << m_float << "\n";); m_args.push_back(value(FLOAT, m_float)); break; case 'D': // push double next(); skip_blank(); read_double(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "D " << m_double << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "D " << m_double << "\n";); m_args.push_back(value(DOUBLE, m_double)); break; case 'p': @@ -505,7 +505,7 @@ struct z3_replayer::imp { case 'i': // push array next(); skip_blank(); read_uint64(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "A " << m_uint64 << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "A " << m_uint64 << "\n";); if (c == 'p') push_array(static_cast(m_uint64), OBJECT); else if (c == 's') @@ -518,12 +518,12 @@ struct z3_replayer::imp { case 'C': { // call procedure next(); skip_blank(); read_uint64(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "C " << m_uint64 << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "C " << m_uint64 << "\n";); unsigned idx = static_cast(m_uint64); if (idx >= m_cmds.size()) throw z3_replayer_exception("invalid command"); try { - TRACE("z3_replayer_cmd", tout << idx << ":" << m_cmds_names[idx] << "\n";); + TRACE(z3_replayer_cmd, tout << idx << ":" << m_cmds_names[idx] << "\n";); m_cmds[idx](m_owner); } catch (z3_error & ex) { @@ -541,7 +541,7 @@ struct z3_replayer::imp { // save result // = obj_id next(); skip_blank(); read_ptr(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "= " << m_ptr << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "= " << m_ptr << "\n";); m_heap.insert(m_ptr, m_result); break; case '*': { @@ -549,7 +549,7 @@ struct z3_replayer::imp { // @ obj_id pos next(); skip_blank(); read_ptr(); skip_blank(); read_uint64(); unsigned pos = static_cast(m_uint64); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "* " << m_ptr << " " << pos << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "* " << m_ptr << " " << pos << "\n";); check_arg(pos, OBJECT); m_heap.insert(m_ptr, m_args[pos].m_obj); break; @@ -564,19 +564,19 @@ struct z3_replayer::imp { ptr_vector & v = m_obj_arrays[aidx]; skip_blank(); read_uint64(); unsigned idx = static_cast(m_uint64); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "@ " << m_ptr << " " << pos << " " << idx << "\n";); - TRACE("z3_replayer_bug", tout << "v[idx]: " << v[idx] << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "@ " << m_ptr << " " << pos << " " << idx << "\n";); + TRACE(z3_replayer_bug, tout << "v[idx]: " << v[idx] << "\n";); m_heap.insert(m_ptr, v[idx]); break; } case 'M': // user message next(); skip_blank(); read_string(); - TRACE("z3_replayer", tout << "[" << m_line << "] " << "M " << m_string.begin() << "\n";); + TRACE(z3_replayer, tout << "[" << m_line << "] " << "M " << m_string.begin() << "\n";); std::cout << m_string.begin() << "\n"; std::cout.flush(); break; default: - TRACE("z3_replayer", tout << "unknown command " << c << "\n";); + TRACE(z3_replayer, tout << "unknown command " << c << "\n";); throw z3_replayer_exception("unknown log command"); break; } @@ -657,7 +657,7 @@ struct z3_replayer::imp { check_arg(pos, OBJECT_ARRAY); unsigned idx = static_cast(m_args[pos].m_uint); ptr_vector const & v = m_obj_arrays[idx]; - TRACE("z3_replayer_bug", tout << "pos: " << pos << ", idx: " << idx << " size(): " << v.size() << "\n"; + TRACE(z3_replayer_bug, tout << "pos: " << pos << ", idx: " << idx << " size(): " << v.size() << "\n"; for (unsigned i = 0; i < v.size(); i++) tout << v[i] << " "; tout << "\n";); return v.data(); } diff --git a/src/ast/arith_decl_plugin.cpp b/src/ast/arith_decl_plugin.cpp index 8e2cbef82..db927e431 100644 --- a/src/ast/arith_decl_plugin.cpp +++ b/src/ast/arith_decl_plugin.cpp @@ -39,14 +39,14 @@ struct arith_decl_plugin::algebraic_numbers_wrapper { unsigned idx = m_id_gen.mk(); m_nums.reserve(idx+1); m_amanager.set(m_nums[idx], val); - TRACE("algebraic2expr", tout << "mk_id -> " << idx << "\n"; m_amanager.display(tout, val); tout << "\n";); + TRACE(algebraic2expr, tout << "mk_id -> " << idx << "\n"; m_amanager.display(tout, val); tout << "\n";); return idx; } void recycle_id(unsigned idx) { SASSERT(idx < m_nums.size()); SASSERT(!m_amanager.is_zero(m_nums[idx])); - TRACE("algebraic2expr", tout << "recycling: " << idx << "\n";); + TRACE(algebraic2expr, tout << "recycling: " << idx << "\n";); m_id_gen.recycle(idx); m_amanager.del(m_nums[idx]); } @@ -667,7 +667,7 @@ bool arith_decl_plugin::are_equal(app * a, app * b) const { } bool arith_decl_plugin::are_distinct(app * a, app * b) const { - TRACE("are_distinct_bug", tout << mk_ismt2_pp(a, *m_manager) << "\n" << mk_ismt2_pp(b, *m_manager) << "\n";); + TRACE(are_distinct_bug, tout << mk_ismt2_pp(a, *m_manager) << "\n" << mk_ismt2_pp(b, *m_manager) << "\n";); if (decl_plugin::are_distinct(a,b)) { return true; } diff --git a/src/ast/array_decl_plugin.cpp b/src/ast/array_decl_plugin.cpp index c013036f4..22c2184c1 100644 --- a/src/ast/array_decl_plugin.cpp +++ b/src/ast/array_decl_plugin.cpp @@ -65,7 +65,7 @@ sort * array_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, paramete } } sort * range = to_sort(parameters[num_parameters - 1].get_ast()); - TRACE("array_decl_plugin_bug", tout << mk_pp(range, *m_manager) << "\n";); + TRACE(array_decl_plugin_bug, tout << mk_pp(range, *m_manager) << "\n";); if (!range->is_infinite() && !range->is_very_big() && (1 == range->get_num_elements().size())) { return m_manager->mk_sort(symbol(ARRAY_SORT_STR), sort_info(m_family_id, ARRAY_SORT, 1, num_parameters, parameters)); @@ -550,7 +550,7 @@ func_decl * array_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters !parameters[0].is_ast() || !is_func_decl(parameters[0].get_ast()) || to_func_decl(parameters[0].get_ast())->get_arity() == 0) { - TRACE("array_bug", + TRACE(array_bug, tout << "num_parameters: " << num_parameters << std::endl; tout << "parameter.kind: " << parameters[0].is_int() << " " << parameters[0].is_ast() << " " << parameters[0].is_symbol() << "\n"; tout << "as-array-bug: " << to_func_decl(parameters[0].get_ast())->get_name() << " " << to_func_decl(parameters[0].get_ast())->get_arity() << std::endl;); diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp index b7d401098..b5eddceb1 100644 --- a/src/ast/ast.cpp +++ b/src/ast/ast.cpp @@ -1506,7 +1506,7 @@ std::ostream& ast_manager::display(std::ostream& out, parameter const& p) { } void ast_manager::copy_families_plugins(ast_manager const & from) { - TRACE("copy_families_plugins", + TRACE(copy_families_plugins, tout << "target:\n"; for (family_id fid = 0; m_family_manager.has_family(fid); fid++) { tout << "fid: " << fid << " fidname: " << get_family_name(fid) << "\n"; @@ -1520,7 +1520,7 @@ void ast_manager::copy_families_plugins(ast_manager const & from) { if (!m_family_manager.has_family(fid)) { family_id new_fid = mk_family_id(fid_name); (void)new_fid; - TRACE("copy_families_plugins", tout << "new target fid created: " << new_fid << " fid_name: " << fid_name << "\n";); + TRACE(copy_families_plugins, tout << "new target fid created: " << new_fid << " fid_name: " << fid_name << "\n";); } } for (family_id fid = 0; from.m_family_manager.has_family(fid); fid++) { @@ -1528,10 +1528,10 @@ void ast_manager::copy_families_plugins(ast_manager const & from) { SASSERT(!from.is_builtin_family_id(fid) || m_family_manager.has_family(fid)); symbol fid_name = from.get_family_name(fid); (void)fid_name; - TRACE("copy_families_plugins", tout << "copying: " << fid_name << ", src fid: " << fid + TRACE(copy_families_plugins, tout << "copying: " << fid_name << ", src fid: " << fid << ", target has_family: " << m_family_manager.has_family(fid) << "\n"; if (m_family_manager.has_family(fid)) tout << get_family_id(fid_name) << "\n";); - TRACE("copy_families_plugins", tout << "target fid: " << get_family_id(fid_name) << "\n";); + TRACE(copy_families_plugins, tout << "target fid: " << get_family_id(fid_name) << "\n";); SASSERT(fid == get_family_id(fid_name)); if (from.has_plugin(fid) && !has_plugin(fid)) { decl_plugin * new_p = from.get_plugin(fid)->mk_fresh(); @@ -1630,7 +1630,7 @@ bool ast_manager::are_distinct(expr* a, expr* b) const { } void ast_manager::add_lambda_def(func_decl* f, quantifier* q) { - TRACE("model", tout << "add lambda def " << mk_pp(q, *this) << "\n"); + TRACE(model, tout << "add lambda def " << mk_pp(q, *this) << "\n"); m_lambda_defs.insert(f, q); f->get_info()->set_lambda(true); inc_ref(q); @@ -1658,7 +1658,7 @@ bool ast_manager::slow_not_contains(ast const * n) { unsigned num = 0; for (ast * curr : m_ast_table) { if (compare_nodes(curr, n)) { - TRACE("nondet_bug", + TRACE(nondet_bug, tout << "id1: " << curr->get_id() << ", id2: " << n->get_id() << "\n"; tout << "hash1: " << get_node_hash(curr) << ", hash2: " << get_node_hash(n) << "\n";); return false; @@ -1680,7 +1680,7 @@ static unsigned s_count = 0; static void track_id(ast_manager& m, ast* n, unsigned id) { if (n->get_id() != id) return; ++s_count; - TRACE("ast", tout << s_count << "\n";); + TRACE(ast, tout << s_count << "\n";); // SASSERT(s_count != 5); } #endif @@ -1717,8 +1717,8 @@ ast * ast_manager::register_node_core(ast * n) { // track_id(*this, n, 9213); -// TRACE("ast", tout << (s_count++) << " Object " << n->m_id << " was created.\n";); - TRACE("mk_var_bug", tout << "mk_ast: " << n->m_id << "\n";); +// TRACE(ast, tout << (s_count++) << " Object " << n->m_id << " was created.\n";); + TRACE(mk_var_bug, tout << "mk_ast: " << n->m_id << "\n";); // increment reference counters switch (n->get_kind()) { case AST_SORT: @@ -1804,16 +1804,16 @@ ast * ast_manager::register_node_core(ast * n) { void ast_manager::delete_node(ast * n) { - TRACE("delete_node_bug", tout << mk_ll_pp(n, *this) << "\n";); + TRACE(delete_node_bug, tout << mk_ll_pp(n, *this) << "\n";); SASSERT(m_ast_table.contains(n)); m_ast_table.push_erase(n); while ((n = m_ast_table.pop_erase())) { - CTRACE("del_quantifier", is_quantifier(n), tout << "deleting quantifier " << n->m_id << " " << n << "\n";); - TRACE("mk_var_bug", tout << "del_ast: " << " " << n->m_ref_count << "\n";); - TRACE("ast_delete_node", tout << mk_bounded_pp(n, *this) << "\n";); + CTRACE(del_quantifier, is_quantifier(n), tout << "deleting quantifier " << n->m_id << " " << n << "\n";); + TRACE(mk_var_bug, tout << "del_ast: " << " " << n->m_ref_count << "\n";); + TRACE(ast_delete_node, tout << mk_bounded_pp(n, *this) << "\n";); SASSERT(!m_debug_ref_count || !m_debug_free_indices.contains(n->m_id)); @@ -2251,7 +2251,7 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar } } else if (decl->is_chainable()) { - TRACE("chainable", tout << "chainable...\n";); + TRACE(chainable, tout << "chainable...\n";); ptr_buffer new_args; for (unsigned i = 1; i < num_args; i++) { new_args.push_back(mk_app_core(decl, args[i-1], args[i])); @@ -2263,7 +2263,7 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar r = mk_app_core(decl, num_args, args); } SASSERT(r != 0); - TRACE("app_ground", tout << "ground: " << r->is_ground() << " id: " << r->get_id() << "\n" << mk_ll_pp(r, *this) << "\n";); + TRACE(app_ground, tout << "ground: " << r->is_ground() << " id: " << r->get_id() << "\n" << mk_ll_pp(r, *this) << "\n";); return r; } @@ -2432,7 +2432,7 @@ quantifier * ast_manager::mk_quantifier(quantifier_kind k, unsigned num_decls, s throw ast_exception("simultaneous patterns and no-patterns not supported"); DEBUG_CODE({ for (unsigned i = 0; i < num_patterns; ++i) { - TRACE("ast", tout << i << " " << mk_pp(patterns[i], *this) << "\n";); + TRACE(ast, tout << i << " " << mk_pp(patterns[i], *this) << "\n";); SASSERT(is_pattern(patterns[i])); }}); unsigned sz = quantifier::get_obj_size(num_decls, num_patterns, num_no_patterns); @@ -2553,7 +2553,7 @@ quantifier * ast_manager::update_quantifier(quantifier * q, expr * body) { quantifier * ast_manager::update_quantifier_weight(quantifier * q, int w) { if (q->get_weight() == w) return q; - TRACE("update_quantifier_weight", tout << "#" << q->get_id() << " " << q->get_weight() << " -> " << w << "\n";); + TRACE(update_quantifier_weight, tout << "#" << q->get_id() << " " << q->get_weight() << " -> " << w << "\n";); return mk_quantifier(q->get_kind(), q->get_num_decls(), q->get_decl_sorts(), @@ -2620,7 +2620,7 @@ app * ast_manager::mk_distinct_expanded(unsigned num_args, expr * const * args) } } app * r = mk_and(new_args.size(), new_args.data()); - TRACE("distinct", tout << "expanded distinct:\n" << mk_pp(r, *this) << "\n";); + TRACE(distinct, tout << "expanded distinct:\n" << mk_pp(r, *this) << "\n";); return r; } @@ -2769,7 +2769,7 @@ proof * ast_manager::mk_true_proof() { } proof * ast_manager::mk_asserted(expr * f) { - CTRACE("mk_asserted_bug", !is_bool(f), tout << mk_ismt2_pp(f, *this) << "\nsort: " << mk_ismt2_pp(f->get_sort(), *this) << "\n";); + CTRACE(mk_asserted_bug, !is_bool(f), tout << mk_ismt2_pp(f, *this) << "\nsort: " << mk_ismt2_pp(f->get_sort(), *this) << "\n";); SASSERT(is_bool(f)); return mk_proof(basic_family_id, PR_ASSERTED, f); } @@ -2783,15 +2783,15 @@ proof * ast_manager::mk_modus_ponens(proof * p1, proof * p2) { if (!p2 || !p1) return p1; SASSERT(has_fact(p1)); SASSERT(has_fact(p2)); - CTRACE("mk_modus_ponens", !(is_implies(get_fact(p2)) || is_eq(get_fact(p2)) || is_oeq(get_fact(p2))), + CTRACE(mk_modus_ponens, !(is_implies(get_fact(p2)) || is_eq(get_fact(p2)) || is_oeq(get_fact(p2))), tout << mk_ll_pp(p1, *this) << "\n"; tout << mk_ll_pp(p2, *this) << "\n";); SASSERT(is_implies(get_fact(p2)) || is_eq(get_fact(p2)) || is_oeq(get_fact(p2))); - CTRACE("mk_modus_ponens", to_app(get_fact(p2))->get_arg(0) != get_fact(p1), + CTRACE(mk_modus_ponens, to_app(get_fact(p2))->get_arg(0) != get_fact(p1), tout << mk_pp(get_fact(p1), *this) << "\n" << mk_pp(get_fact(p2), *this) << "\n";); SASSERT(!proofs_enabled() || to_app(get_fact(p2))->get_arg(0) == get_fact(p1)); - CTRACE("mk_modus_ponens", !is_ground(p2) && !has_quantifiers(p2), tout << "Non-ground: " << mk_pp(p2, *this) << "\n";); - CTRACE("mk_modus_ponens", !is_ground(p1) && !has_quantifiers(p1), tout << "Non-ground: " << mk_pp(p1, *this) << "\n";); + CTRACE(mk_modus_ponens, !is_ground(p2) && !has_quantifiers(p2), tout << "Non-ground: " << mk_pp(p2, *this) << "\n";); + CTRACE(mk_modus_ponens, !is_ground(p1) && !has_quantifiers(p1), tout << "Non-ground: " << mk_pp(p1, *this) << "\n";); if (is_reflexivity(p2)) return p1; expr * f = to_app(get_fact(p2))->get_arg(1); @@ -2863,14 +2863,14 @@ proof * ast_manager::mk_transitivity(proof * p1, proof * p2) { app* fact2 = to_app(get_fact(p2)); SASSERT(fact1->get_num_args() == 2); SASSERT(fact2->get_num_args() == 2); - CTRACE("mk_transitivity", fact1->get_decl() != fact2->get_decl(), + CTRACE(mk_transitivity, fact1->get_decl() != fact2->get_decl(), tout << mk_pp(fact1, *this) << "\n\n" << mk_pp(fact2, *this) << "\n"; tout << mk_pp(fact1->get_decl(), *this) << "\n"; tout << mk_pp(fact2->get_decl(), *this) << "\n";); SASSERT(fact1->get_decl() == fact2->get_decl() || ( (is_eq(fact1) || is_oeq(fact1)) && (is_eq(fact2) || is_oeq(fact2)))); - CTRACE("mk_transitivity", fact1->get_arg(1) != fact2->get_arg(0), + CTRACE(mk_transitivity, fact1->get_arg(1) != fact2->get_arg(0), tout << mk_pp(fact1, *this) << "\n\n" << mk_pp(fact2, *this) << "\n"; tout << p1->get_id() << ": " << mk_bounded_pp(p1, *this, 5) << "\n\n"; tout << p2->get_id() << ": " << mk_bounded_pp(p2, *this, 5) << "\n\n"; @@ -3086,7 +3086,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro if (!found_complement) { args.append(num_proofs, (expr**)proofs); - CTRACE("mk_unit_resolution_bug", !is_or(f1), tout << mk_ll_pp(f1, *this) << "\n"; + CTRACE(mk_unit_resolution_bug, !is_or(f1), tout << mk_ll_pp(f1, *this) << "\n"; for (unsigned i = 1; i < num_proofs; ++i) tout << mk_pp(proofs[i], *this) << "\n"; tout << "facts\n"; @@ -3121,7 +3121,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro } DEBUG_CODE({ for (unsigned i = 1; proofs_enabled() && i < num_proofs; i++) { - CTRACE("mk_unit_resolution_bug", !found.get(i, false), + CTRACE(mk_unit_resolution_bug, !found.get(i, false), for (unsigned j = 0; j < num_proofs; j++) { if (j == i) tout << "Index " << i << " was not found:\n"; tout << mk_ll_pp(get_fact(proofs[j]), *this); @@ -3144,12 +3144,12 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro } proof * pr = mk_app(basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.data()); - TRACE("unit_resolution", tout << "unit_resolution generating fact\n" << mk_ll_pp(pr, *this);); + TRACE(unit_resolution, tout << "unit_resolution generating fact\n" << mk_ll_pp(pr, *this);); return pr; } proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * proofs, expr * new_fact) { - TRACE("unit_bug", + TRACE(unit_bug, for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n"; tout << "===>\n"; tout << mk_pp(new_fact, *this) << "\n";); @@ -3167,7 +3167,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro SASSERT(is_or(f1)); app * cls = to_app(f1); unsigned cls_sz = cls->get_num_args(); - CTRACE("unit_bug", !(num_proofs == cls_sz || (num_proofs == cls_sz + 1 && is_false(new_fact))), + CTRACE(unit_bug, !(num_proofs == cls_sz || (num_proofs == cls_sz + 1 && is_false(new_fact))), for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n"; tout << "===>\n"; tout << mk_pp(new_fact, *this) << "\n";); @@ -3186,7 +3186,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro } } if (j == num_proofs) { - CTRACE("unit_bug", new_fact != lit, tout << mk_pp(f1, *this) << "\n" << mk_ll_pp(new_fact, *this) << "\n" << mk_ll_pp(lit, *this) << "\n";); + CTRACE(unit_bug, new_fact != lit, tout << mk_pp(f1, *this) << "\n" << mk_ll_pp(new_fact, *this) << "\n" << mk_ll_pp(lit, *this) << "\n";); SASSERT(new_fact == lit); ++num_occ; } @@ -3196,7 +3196,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro } #endif proof * pr = mk_app(basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.data()); - TRACE("unit_resolution", tout << "unit_resolution using fact\n" << mk_ll_pp(pr, *this);); + TRACE(unit_resolution, tout << "unit_resolution using fact\n" << mk_ll_pp(pr, *this);); return pr; } @@ -3207,7 +3207,7 @@ proof * ast_manager::mk_hypothesis(expr * h) { proof * ast_manager::mk_lemma(proof * p, expr * lemma) { if (!p) return p; SASSERT(has_fact(p)); - CTRACE("mk_lemma", !is_false(get_fact(p)), tout << mk_ll_pp(p, *this) << "\n";); + CTRACE(mk_lemma, !is_false(get_fact(p)), tout << mk_ll_pp(p, *this) << "\n";); SASSERT(is_false(get_fact(p))); return mk_app(basic_family_id, PR_LEMMA, p, lemma); } @@ -3283,7 +3283,7 @@ proof * ast_manager::mk_and_elim(proof * p, unsigned i) { return nullptr; SASSERT(has_fact(p)); SASSERT(is_and(get_fact(p))); - CTRACE("mk_and_elim", i >= to_app(get_fact(p))->get_num_args(), tout << "i: " << i << "\n" << mk_pp(get_fact(p), *this) << "\n";); + CTRACE(mk_and_elim, i >= to_app(get_fact(p))->get_num_args(), tout << "i: " << i << "\n" << mk_pp(get_fact(p), *this) << "\n";); SASSERT(i < to_app(get_fact(p))->get_num_args()); expr * f = to_app(get_fact(p))->get_arg(i); return mk_app(basic_family_id, PR_AND_ELIM, p, f); @@ -3365,7 +3365,7 @@ proof* ast_manager::mk_hyper_resolve(unsigned num_premises, proof* const* premis ptr_vector fmls; SASSERT(positions.size() + 1 == substs.size()); for (unsigned i = 0; i < num_premises; ++i) { - TRACE("hyper_res", tout << mk_pp(premises[i], *this) << "\n";); + TRACE(hyper_res, tout << mk_pp(premises[i], *this) << "\n";); fmls.push_back(get_fact(premises[i])); } SASSERT(is_bool(concl)); @@ -3380,7 +3380,7 @@ proof* ast_manager::mk_hyper_resolve(unsigned num_premises, proof* const* premis params.push_back(parameter(positions[i].second)); } } - TRACE("hyper_res", + TRACE(hyper_res, for (unsigned i = 0; i < params.size(); ++i) { params[i].display(tout); tout << "\n"; }); diff --git a/src/ast/ast_pp_dot.cpp b/src/ast/ast_pp_dot.cpp index 1298239a2..3dae0492c 100644 --- a/src/ast/ast_pp_dot.cpp +++ b/src/ast/ast_pp_dot.cpp @@ -81,7 +81,7 @@ private: } void pp_step(const proof * p) { - TRACE("pp_ast_dot_step", tout << " :kind " << p->get_kind() << " :num-args " << p->get_num_args() << "\n";); + TRACE(pp_ast_dot_step, tout << " :kind " << p->get_kind() << " :num-args " << p->get_num_args() << "\n";); if (m().has_fact(p)) { // print result expr* p_res = m().get_fact(p); // result of proof step diff --git a/src/ast/ast_smt2_pp.cpp b/src/ast/ast_smt2_pp.cpp index bfa262410..72382e366 100644 --- a/src/ast/ast_smt2_pp.cpp +++ b/src/ast/ast_smt2_pp.cpp @@ -702,7 +702,7 @@ class smt2_printer { ((f_info.m_depth >= m_pp_max_depth) || ((f_info.m_weight >= m_pp_min_alias_size || is_quantifier(t)) && m_soccs.is_shared(t)))) { symbol a = next_alias(); - TRACE("smt2_pp", tout << "a: " << a << " depth: " << f_info.m_depth << ", weight: " << f_info.m_weight + TRACE(smt2_pp, tout << "a: " << a << " depth: " << f_info.m_depth << ", weight: " << f_info.m_weight << ", lvl: " << f_info.m_lvl << " t: #" << t->get_id() << "\n" << mk_ll_pp(t, m()) << ", is-shared: " << m_soccs.is_shared(t) << "\n";); register_alias(t, f, f_info.m_lvl, a); @@ -800,7 +800,7 @@ class smt2_printer { unsigned sz = m_aliased_exprs.size(); SASSERT(old_sz <= sz); num_lets = sz - old_sz; - TRACE("pp_let", tout << "old_sz: " << old_sz << ", sz: " << sz << "\n";); + TRACE(pp_let, tout << "old_sz: " << old_sz << ", sz: " << sz << "\n";); if (old_sz == sz) return f; vector > decls; @@ -812,7 +812,7 @@ class smt2_printer { ptr_vector & lvl_decls = decls[lvl]; lvl_decls.push_back(mk_seq1(m(), f_def, f_def+1, f2f(), f_name.str())); } - TRACE("pp_let", tout << "decls.size(): " << decls.size() << "\n";); + TRACE(pp_let, tout << "decls.size(): " << decls.size() << "\n";); ptr_buffer buf; unsigned num_op = 0; for (ptr_vector & lvl_decls : decls) { @@ -824,7 +824,7 @@ class smt2_printer { buf.push_back(mk_string(m(), "(let ")); buf.push_back(mk_indent(m(), 5, mk_seq5(m(), lvl_decls.begin(), lvl_decls.end(), f2f()))); } - TRACE("pp_let", tout << "num_op: " << num_op << "\n";); + TRACE(pp_let, tout << "num_op: " << num_op << "\n";); if (num_op == 0) return f; buf.push_back(mk_indent(m(), SMALL_INDENT, mk_compose(m(), mk_line_break(m()), f))); @@ -841,7 +841,7 @@ class smt2_printer { void begin_scope() { SASSERT(m_aliased_exprs.size() == m_aliased_pps.size()); SASSERT(m_aliased_exprs.size() == m_aliased_lvls_names.size()); - TRACE("pp_scope", tout << "[begin-scope] sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";); + TRACE(pp_scope, tout << "[begin-scope] sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";); m_scopes.push_back(scope(m_aliased_exprs.size(), m_next_alias_idx, m_root)); unsigned lvl = m_scopes.size(); while (lvl >= m_expr2alias_stack.size()) @@ -851,7 +851,7 @@ class smt2_printer { } void end_scope() { - TRACE("pp_scope", tout << "[end-scope] before sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";); + TRACE(pp_scope, tout << "[end-scope] before sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";); m_expr2alias->reset(); scope & s = m_scopes.back(); unsigned old_sz = s.m_aliased_exprs_lim; @@ -864,7 +864,7 @@ class smt2_printer { m_aliased_exprs.shrink(old_sz); m_aliased_pps.shrink(old_sz); m_aliased_lvls_names.shrink(old_sz); - TRACE("pp_scope", tout << "[end-scope] after sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";); + TRACE(pp_scope, tout << "[end-scope] after sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";); } void register_var_names(quantifier * q) { diff --git a/src/ast/ast_translation.cpp b/src/ast/ast_translation.cpp index e2369a35a..12184cb03 100644 --- a/src/ast/ast_translation.cpp +++ b/src/ast/ast_translation.cpp @@ -196,7 +196,7 @@ void ast_translation::mk_func_decl(func_decl * f, frame & fr) { to().add_lambda_def(new_f, new_q); } } - TRACE("ast_translation", + TRACE(ast_translation, tout << f->get_name() << " "; if (fi) tout << *fi; tout << "\n"; tout << "---->\n"; tout << new_f->get_name() << " "; if (new_f->get_info()) tout << *(new_f->get_info()); tout << "\n";); @@ -226,14 +226,14 @@ ast * ast_translation::process(ast const * _n) { frame & fr = m_frame_stack.back(); ast * n = fr.m_n; ast * r; - TRACE("ast_translation", tout << mk_ll_pp(n, m_from_manager, false) << "\n";); + TRACE(ast_translation, tout << mk_ll_pp(n, m_from_manager, false) << "\n";); if (fr.m_idx == 0 && n->get_ref_count() > 1) { if (m_cache.find(n, r)) { SASSERT(m_result_stack.size() == fr.m_rpos); m_result_stack.push_back(r); m_extra_children_stack.shrink(fr.m_cpos); m_frame_stack.pop_back(); - TRACE("ast_translation", tout << "hit\n";); + TRACE(ast_translation, tout << "hit\n";); m_hit_count++; continue; } diff --git a/src/ast/bv_decl_plugin.cpp b/src/ast/bv_decl_plugin.cpp index ef15935e9..83c0e2772 100644 --- a/src/ast/bv_decl_plugin.cpp +++ b/src/ast/bv_decl_plugin.cpp @@ -714,7 +714,7 @@ bool bv_decl_plugin::are_distinct(app * a, app * b) const { expr * b_term; get_offset_term(a, a_term, a_offset); get_offset_term(b, b_term, b_offset); - TRACE("bv_are_distinct", + TRACE(bv_are_distinct, tout << mk_ismt2_pp(a, *m_manager) << "\n" << mk_ismt2_pp(b, *m_manager) << "\n"; tout << "---->\n"; tout << "a: " << a_offset << " + " << mk_ismt2_pp(a_term, *m_manager) << "\n"; @@ -865,7 +865,7 @@ bool bv_recognizers::is_allone(expr const * e) const { return false; } bool result = (r == rational::power_of_two(bv_size) - rational(1)); - TRACE("is_allone", tout << r << " " << result << "\n";); + TRACE(is_allone, tout << r << " " << result << "\n";); return result; } diff --git a/src/ast/converters/equiv_proof_converter.cpp b/src/ast/converters/equiv_proof_converter.cpp index d0ed94d8b..db9f64512 100644 --- a/src/ast/converters/equiv_proof_converter.cpp +++ b/src/ast/converters/equiv_proof_converter.cpp @@ -28,7 +28,7 @@ void equiv_proof_converter::insert(expr* fml1, expr* fml2) { p1 = m.mk_asserted(fml1); p2 = m.mk_rewrite(fml1, fml2); p3 = m.mk_modus_ponens(p1, p2); - TRACE("proof_converter", tout << mk_pp(p3.get(), m) << "\n";); + TRACE(proof_converter, tout << mk_pp(p3.get(), m) << "\n";); SASSERT(m.has_fact(p3)); m_replace.insert(p3); } diff --git a/src/ast/converters/generic_model_converter.cpp b/src/ast/converters/generic_model_converter.cpp index 03624c9de..ed73106b2 100644 --- a/src/ast/converters/generic_model_converter.cpp +++ b/src/ast/converters/generic_model_converter.cpp @@ -36,7 +36,7 @@ void generic_model_converter::add(func_decl * d, expr* e) { } void generic_model_converter::operator()(model_ref & md) { - TRACE("model_converter", tout << "before generic_model_converter\n"; model_v2_pp(tout, *md); display(tout);); + TRACE(model_converter, tout << "before generic_model_converter\n"; model_v2_pp(tout, *md); display(tout);); model_evaluator ev(*(md.get())); ev.set_model_completion(m_completion); @@ -53,7 +53,7 @@ void generic_model_converter::operator()(model_ref & md) { break; case instruction::ADD: ev(e.m_def, val); - TRACE("model_converter", tout << e.m_f->get_name() << " ->\n" << e.m_def << "\n==>\n" << val << "\n";); + TRACE(model_converter, tout << e.m_f->get_name() << " ->\n" << e.m_def << "\n==>\n" << val << "\n";); arity = e.m_f->get_arity(); reset_ev = false; if (arity == 0) { @@ -96,7 +96,7 @@ void generic_model_converter::operator()(model_ref & md) { for (auto const& [s, u] : uninterpreted) { md->register_usort(s, u.size(), u.data()); } - TRACE("model_converter", tout << "after generic_model_converter\n"; model_v2_pp(tout, *md);); + TRACE(model_converter, tout << "after generic_model_converter\n"; model_v2_pp(tout, *md);); } void generic_model_converter::display(std::ostream & out) { diff --git a/src/ast/converters/horn_subsume_model_converter.cpp b/src/ast/converters/horn_subsume_model_converter.cpp index a0c8b341e..b27ff344e 100644 --- a/src/ast/converters/horn_subsume_model_converter.cpp +++ b/src/ast/converters/horn_subsume_model_converter.cpp @@ -108,7 +108,7 @@ bool horn_subsume_model_converter::mk_horn( m_rewrite(body_res); } - TRACE("mc", + TRACE(mc, tout << mk_pp(head, m) << " :- " << mk_pp(body, m) << "\n"; tout << pred->get_name() << " :- " << mk_pp(body_res.get(), m) << "\n";); @@ -151,7 +151,7 @@ void horn_subsume_model_converter::add_default_proc::operator()(app* n) { if (m.is_bool(n) && !m_md->has_interpretation(n->get_decl()) && (n->get_family_id() == null_family_id)) { - TRACE("mc", tout << "adding: " << n->get_decl()->get_name() << "\n";); + TRACE(mc, tout << "adding: " << n->get_decl()->get_name() << "\n";); if (n->get_decl()->get_arity() == 0) { m_md->register_decl(n->get_decl(), m.mk_false()); } @@ -180,7 +180,7 @@ void horn_subsume_model_converter::operator()(model_ref& mr) { m_delay_head.reset(); m_delay_body.reset(); - TRACE("mc", tout << m_funcs.size() << "\n"; model_smt2_pp(tout, m, *mr, 0);); + TRACE(mc, tout << m_funcs.size() << "\n"; model_smt2_pp(tout, m, *mr, 0);); for (unsigned i = m_funcs.size(); i-- > 0; ) { func_decl* h = m_funcs.get(i); expr_ref body(m_bodies.get(i), m); @@ -188,10 +188,10 @@ void horn_subsume_model_converter::operator()(model_ref& mr) { add_default_false_interpretation(body, mr); SASSERT(m.is_bool(body)); - TRACE("mc", tout << "eval: " << h->get_name() << "\n" << body << "\n";); + TRACE(mc, tout << "eval: " << h->get_name() << "\n" << body << "\n";); body = (*mr)(body); - TRACE("mc", tout << "to:\n" << body << "\n";); + TRACE(mc, tout << "to:\n" << body << "\n";); if (arity == 0) { expr* e = mr->get_const_interp(h); diff --git a/src/ast/converters/replace_proof_converter.cpp b/src/ast/converters/replace_proof_converter.cpp index 81fe251a3..12341a640 100644 --- a/src/ast/converters/replace_proof_converter.cpp +++ b/src/ast/converters/replace_proof_converter.cpp @@ -66,11 +66,11 @@ proof_ref replace_proof_converter::operator()(ast_manager & m, unsigned num_sour replace.apply(e); f = m.mk_asserted(m.get_fact(p)); replace.insert(f, e); - TRACE("proof_converter", tout << f->get_id() << " " << mk_pp(f, m) << + TRACE(proof_converter, tout << f->get_id() << " " << mk_pp(f, m) << "\n|-> " << mk_pp(e, m) << "\n";); } replace.apply(tmp); - TRACE("proof_converter", tout << mk_pp(source[0], m) << "\n"; + TRACE(proof_converter, tout << mk_pp(source[0], m) << "\n"; tout << mk_pp(tmp.get(), m) << "\n";); return proof_ref(to_app(tmp), m); } diff --git a/src/ast/datatype_decl_plugin.cpp b/src/ast/datatype_decl_plugin.cpp index be030b378..4667d872a 100644 --- a/src/ast/datatype_decl_plugin.cpp +++ b/src/ast/datatype_decl_plugin.cpp @@ -90,7 +90,7 @@ namespace datatype { sort_ref def::instantiate(sort_ref_vector const& sorts) const { sort_ref s(m); - TRACE("datatype", tout << "instantiate " << m_name << "\n";); + TRACE(datatype, tout << "instantiate " << m_name << "\n";); if (!m_sort) { vector ps; ps.push_back(parameter(m_name)); @@ -282,22 +282,22 @@ namespace datatype { sort * plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) { try { if (k != DATATYPE_SORT) { - TRACE("datatype", tout << "invalid kind parameter to datatype\n";); + TRACE(datatype, tout << "invalid kind parameter to datatype\n";); throw invalid_datatype(); } if (num_parameters < 1) { - TRACE("datatype", tout << "at least one parameter expected to datatype declaration\n";); + TRACE(datatype, tout << "at least one parameter expected to datatype declaration\n";); throw invalid_datatype(); } parameter const & name = parameters[0]; if (!name.is_symbol()) { - TRACE("datatype", tout << "expected symbol parameter at position " << 0 << " got: " << name << "\n";); + TRACE(datatype, tout << "expected symbol parameter at position " << 0 << " got: " << name << "\n";); throw invalid_datatype(); } for (unsigned i = 1; i < num_parameters; ++i) { parameter const& s = parameters[i]; if (!s.is_ast() || !is_sort(s.get_ast())) { - TRACE("datatype", tout << "expected sort parameter at position " << i << " got: " << s << "\n";); + TRACE(datatype, tout << "expected sort parameter at position " << i << " got: " << s << "\n";); throw invalid_datatype(); } } @@ -309,15 +309,15 @@ namespace datatype { obj_map S; for (unsigned i = 0; i + 1 < num_parameters; ++i) { sort* r = to_sort(parameters[i + 1].get_ast()); - TRACE("datatype", tout << "inserting " << mk_ismt2_pp(r, *m_manager) << " " << r->get_num_elements() << "\n";); + TRACE(datatype, tout << "inserting " << mk_ismt2_pp(r, *m_manager) << " " << r->get_num_elements() << "\n";); S.insert(d->params()[i], r->get_num_elements()); } sort_size ts = d->sort_size()->eval(S); - TRACE("datatype", tout << name << " has size " << ts << "\n";); + TRACE(datatype, tout << name << " has size " << ts << "\n";); s->set_num_elements(ts); } else { - TRACE("datatype", tout << "not setting size for " << name << "\n";); + TRACE(datatype, tout << "not setting size for " << name << "\n";); } return s; } @@ -564,9 +564,9 @@ namespace datatype { begin_def_block(); for (unsigned i = 0; i < num_datatypes; ++i) { def* d = nullptr; - TRACE("datatype", tout << "declaring " << datatypes[i]->name() << "\n";); + TRACE(datatype, tout << "declaring " << datatypes[i]->name() << "\n";); if (m_defs.find(datatypes[i]->name(), d)) { - TRACE("datatype", tout << "delete previous version for " << datatypes[i]->name() << "\n";); + TRACE(datatype, tout << "delete previous version for " << datatypes[i]->name() << "\n";); u().reset(); dealloc(d); } @@ -616,7 +616,7 @@ namespace datatype { } bool plugin::is_value_aux(bool unique, app * e) const { - TRACE("dt_is_value", tout << "checking\n" << mk_ismt2_pp(e, *m_manager) << "\n";); + TRACE(dt_is_value, tout << "checking\n" << mk_ismt2_pp(e, *m_manager) << "\n";); if (!u().is_constructor(e)) return false; if (e->get_num_args() == 0) @@ -627,7 +627,7 @@ namespace datatype { // potentially expensive check for common sub-expressions. for (expr* arg : *e) { if (!is_value_visit(unique, arg, todo)) { - TRACE("dt_is_value", tout << "not-value:\n" << mk_ismt2_pp(arg, *m_manager) << "\n";); + TRACE(dt_is_value, tout << "not-value:\n" << mk_ismt2_pp(arg, *m_manager) << "\n";); return false; } } @@ -637,7 +637,7 @@ namespace datatype { todo.pop_back(); for (expr* arg : *curr) { if (!is_value_visit(unique, arg, todo)) { - TRACE("dt_is_value", tout << "not-value:\n" << mk_ismt2_pp(arg, *m_manager) << "\n";); + TRACE(dt_is_value, tout << "not-value:\n" << mk_ismt2_pp(arg, *m_manager) << "\n";); return false; } } @@ -858,12 +858,12 @@ namespace datatype { map already_found; map szs; - TRACE("datatype", for (auto const& s : names) tout << s << " "; tout << "\n";); + TRACE(datatype, for (auto const& s : names) tout << s << " "; tout << "\n";); svector todo(names); status st; while (!todo.empty()) { symbol s = todo.back(); - TRACE("datatype", tout << "Sort size for " << s << "\n";); + TRACE(datatype, tout << "Sort size for " << s << "\n";); if (already_found.find(s, st) && st == BLACK) { todo.pop_back(); @@ -897,7 +897,7 @@ namespace datatype { todo.pop_back(); already_found.insert(s, BLACK); if (is_infinite) { - TRACE("datatype", tout << "infinite " << s << "\n";); + TRACE(datatype, tout << "infinite " << s << "\n";); d.set_sort_size(param_size::size::mk_offset(sort_size::mk_infinite())); continue; } @@ -911,7 +911,7 @@ namespace datatype { } s_add.push_back(param_size::size::mk_times(s_mul)); } - TRACE("datatype", tout << "set sort size " << s << "\n";); + TRACE(datatype, tout << "set sort size " << s << "\n";); d.set_sort_size(param_size::size::mk_plus(s_add)); plugin().m_refs.reset(); } @@ -1208,7 +1208,7 @@ namespace datatype { return cd.first; ptr_vector forbidden_set; forbidden_set.push_back(ty); - TRACE("util_bug", tout << "invoke get-non-rec: " << sort_ref(ty, m) << "\n";); + TRACE(util_bug, tout << "invoke get-non-rec: " << sort_ref(ty, m) << "\n";); cd = get_non_rec_constructor_core(ty, forbidden_set); SASSERT(forbidden_set.back() == ty); if (!cd.first) // datatypes are not completed on parse errors @@ -1232,7 +1232,7 @@ namespace datatype { cnstr_depth result(nullptr, 0); if (plugin().m_datatype2nonrec_constructor.find(ty, result)) return result; - TRACE("util_bug", tout << "get-non-rec constructor: " << sort_ref(ty, m) << "\n"; + TRACE(util_bug, tout << "get-non-rec constructor: " << sort_ref(ty, m) << "\n"; tout << "forbidden: "; for (sort* s : forbidden_set) tout << sort_ref(s, m) << " "; tout << "\n"; @@ -1245,7 +1245,7 @@ namespace datatype { for (unsigned cj = 0; cj < constructors.size(); ++cj) { func_decl* c = constructors[(start + cj) % constructors.size()]; if (all_of(*c, [&](sort* s) { return !is_datatype(s); })) { - TRACE("util_bug", tout << "non_rec_constructor c: " << func_decl_ref(c, m) << "\n";); + TRACE(util_bug, tout << "non_rec_constructor c: " << func_decl_ref(c, m) << "\n";); result.first = c; result.second = 1; plugin().add_ast(result.first); @@ -1257,7 +1257,7 @@ namespace datatype { for (unsigned cj = 0; cj < constructors.size(); ++cj) { func_decl* c = constructors[(start + cj) % constructors.size()]; - TRACE("util_bug", tout << "non_rec_constructor c: " << func_decl_ref(c, m) << "\n";); + TRACE(util_bug, tout << "non_rec_constructor c: " << func_decl_ref(c, m) << "\n";); unsigned num_args = c->get_arity(); unsigned j = 0; unsigned max_depth = 0; @@ -1265,13 +1265,13 @@ namespace datatype { for (; j < num_args; j++) { unsigned i = (start2 + j) % num_args; sort * T_i = autil.get_array_range_rec(c->get_domain(i)); - TRACE("util_bug", tout << "c: " << i << " " << sort_ref(T_i, m) << "\n";); + TRACE(util_bug, tout << "c: " << i << " " << sort_ref(T_i, m) << "\n";); if (!is_datatype(T_i)) { - TRACE("util_bug", tout << sort_ref(T_i, m) << " is not a datatype\n";); + TRACE(util_bug, tout << sort_ref(T_i, m) << " is not a datatype\n";); continue; } if (std::find(forbidden_set.begin(), forbidden_set.end(), T_i) != forbidden_set.end()) { - TRACE("util_bug", tout << sort_ref(T_i, m) << " is in forbidden_set\n";); + TRACE(util_bug, tout << sort_ref(T_i, m) << " is in forbidden_set\n";); break; } forbidden_set.push_back(T_i); @@ -1280,7 +1280,7 @@ namespace datatype { forbidden_set.pop_back(); if (nested_c.first == nullptr) break; - TRACE("util_bug", tout << "nested_c: " << nested_c.first->get_name() << "\n";); + TRACE(util_bug, tout << "nested_c: " << nested_c.first->get_name() << "\n";); max_depth = std::max(nested_c.second + 1, max_depth); } if (j == num_args && max_depth < min_depth) { diff --git a/src/ast/dl_decl_plugin.cpp b/src/ast/dl_decl_plugin.cpp index 608940da4..a63d13f59 100644 --- a/src/ast/dl_decl_plugin.cpp +++ b/src/ast/dl_decl_plugin.cpp @@ -211,7 +211,7 @@ namespace datalog { ast_manager& m = *m_manager; ptr_vector sorts; vector ps; - TRACE("dl_decl_plugin", + TRACE(dl_decl_plugin, tout << mk_pp(r, m) << " "; for (unsigned i = 0; i < num_params; ++i) { tout << params[i] << " "; @@ -624,7 +624,7 @@ namespace datalog { return nullptr; } - TRACE("dl_decl_plugin", tout << mk_pp(result, *m_manager) << "\n";); + TRACE(dl_decl_plugin, tout << mk_pp(result, *m_manager) << "\n";); return result; } diff --git a/src/ast/euf/euf_ac_plugin.cpp b/src/ast/euf/euf_ac_plugin.cpp index 0c890a26f..99c9a2fd8 100644 --- a/src/ast/euf/euf_ac_plugin.cpp +++ b/src/ast/euf/euf_ac_plugin.cpp @@ -437,10 +437,10 @@ namespace euf { if (eq_id == UINT_MAX) break; - TRACE("plugin", tout << "propagate " << eq_id << ": " << eq_pp(*this, m_eqs[eq_id]) << "\n"); + TRACE(plugin, tout << "propagate " << eq_id << ": " << eq_pp(*this, m_eqs[eq_id]) << "\n"); // simplify eq using processed - TRACE("plugin", + TRACE(plugin, for (auto other_eq : backward_iterator(eq_id)) tout << "backward iterator " << eq_id << " vs " << other_eq << " " << is_processed(other_eq) << "\n"); for (auto other_eq : backward_iterator(eq_id)) @@ -466,7 +466,7 @@ namespace euf { } propagate_shared(); - CTRACE("plugin", !m_shared.empty() || !m_eqs.empty(), display(tout)); + CTRACE(plugin, !m_shared.empty() || !m_eqs.empty(), display(tout)); } unsigned ac_plugin::pick_next_eq() { @@ -637,11 +637,11 @@ namespace euf { auto& src = m_eqs[src_eq]; // src_r_counts, src_l_counts are initialized auto& dst = m_eqs[dst_eq]; - TRACE("plugin", tout << "forward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << "\n"); + TRACE(plugin, tout << "forward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << "\n"); if (forward_subsumes(src_eq, dst_eq)) { - TRACE("plugin", tout << "forward subsumed\n"); + TRACE(plugin, tout << "forward subsumed\n"); set_status(dst_eq, eq_status::is_dead); return; } @@ -691,7 +691,7 @@ namespace euf { push_undo(is_update_eq); m_src_r.reset(); m_src_r.append(monomial(src.r).m_nodes); - TRACE("plugin", tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n"); + TRACE(plugin, tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n"); } bool ac_plugin::backward_simplify(unsigned dst_eq, unsigned src_eq) { @@ -703,10 +703,10 @@ namespace euf { // // dst_ids, dst_count contain rhs of dst_eq // - TRACE("plugin", tout << "backward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << " can-be-subset: " << can_be_subset(monomial(src.l), monomial(dst.r)) << "\n"); + TRACE(plugin, tout << "backward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << " can-be-subset: " << can_be_subset(monomial(src.l), monomial(dst.r)) << "\n"); if (backward_subsumes(src_eq, dst_eq)) { - TRACE("plugin", tout << "backward subsumed\n"); + TRACE(plugin, tout << "backward subsumed\n"); set_status(dst_eq, eq_status::is_dead); return true; } @@ -714,7 +714,7 @@ namespace euf { if (!can_be_subset(monomial(src.l), monomial(dst.r))) return false; if (!is_subset(m_dst_r_counts, m_src_l_counts, monomial(src.l))) { - TRACE("plugin", tout << "not subset\n"); + TRACE(plugin, tout << "not subset\n"); return false; } @@ -731,7 +731,7 @@ namespace euf { m_update_eq_trail.push_back({ dst_eq, m_eqs[dst_eq] }); m_eqs[dst_eq].r = new_r; m_eqs[dst_eq].j = j; - TRACE("plugin", tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n"); + TRACE(plugin, tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n"); push_undo(is_update_eq); return true; } @@ -850,7 +850,7 @@ namespace euf { continue; if (!is_subset(m_m_counts, m_eq_counts, monomial(src.l))) continue; - TRACE("plugin", display_equation(tout << "reduce ", src) << "\n"); + TRACE(plugin, display_equation(tout << "reduce ", src) << "\n"); SASSERT(is_correct_ref_count(monomial(src.l), m_eq_counts)); rewrite1(m_eq_counts, monomial(src.r), m_m_counts, m); j = join(j, eq); @@ -900,7 +900,7 @@ namespace euf { auto& src = m_eqs[src_eq]; auto& dst = m_eqs[dst_eq]; - TRACE("plugin", tout << "superpose: "; display_equation(tout, src); tout << " "; display_equation(tout, dst); tout << "\n";); + TRACE(plugin, tout << "superpose: "; display_equation(tout, src); tout << " "; display_equation(tout, dst); tout << "\n";); // AB -> C, AD -> E => BE ~ CD // m_src_ids, m_src_counts contains information about src (call it AD -> E) m_dst_l_counts.reset(); @@ -941,7 +941,7 @@ namespace euf { return; } - TRACE("plugin", tout << m_pp(*this, m_src_r) << "== " << m_pp(*this, m_dst_r) << "\n";); + TRACE(plugin, tout << m_pp(*this, m_src_r) << "== " << m_pp(*this, m_dst_r) << "\n";); justification j = justify_rewrite(src_eq, dst_eq); reduce(m_dst_r, j); @@ -994,11 +994,11 @@ namespace euf { m_monomial_table.reset(); for (auto const& s1 : m_shared) { shared s2; - TRACE("plugin", tout << "shared " << m_pp(*this, monomial(s1.m)) << "\n"); + TRACE(plugin, tout << "shared " << m_pp(*this, monomial(s1.m)) << "\n"); if (!m_monomial_table.find(s1.m, s2)) m_monomial_table.insert(s1.m, s1); else if (s2.n->get_root() != s1.n->get_root()) { - TRACE("plugin", tout << m_pp(*this, monomial(s1.m)) << " == " << m_pp(*this, monomial(s2.m)) << "\n"); + TRACE(plugin, tout << m_pp(*this, monomial(s1.m)) << " == " << m_pp(*this, monomial(s2.m)) << "\n"); push_merge(s1.n, s2.n, justification::dependent(m_dep_manager.mk_join(m_dep_manager.mk_leaf(s1.j), m_dep_manager.mk_leaf(s2.j)))); } } @@ -1008,7 +1008,7 @@ namespace euf { auto j = s.j; auto old_m = s.m; ptr_vector m1(monomial(old_m).m_nodes); - TRACE("plugin", tout << "simplify " << m_pp(*this, monomial(old_m)) << "\n"); + TRACE(plugin, tout << "simplify " << m_pp(*this, monomial(old_m)) << "\n"); if (!reduce(m1, j)) return; diff --git a/src/ast/euf/euf_bv_plugin.cpp b/src/ast/euf/euf_bv_plugin.cpp index 4b0cd6cfc..6b90bfd3a 100644 --- a/src/ast/euf/euf_bv_plugin.cpp +++ b/src/ast/euf/euf_bv_plugin.cpp @@ -107,7 +107,7 @@ namespace euf { if (!bv.is_bv(x->get_expr())) return; - TRACE("bv", tout << "merge_eh " << g.bpp(x) << " == " << g.bpp(y) << "\n"); + TRACE(bv, tout << "merge_eh " << g.bpp(x) << " == " << g.bpp(y) << "\n"); SASSERT(!m_internal); flet _internal(m_internal, true); @@ -208,7 +208,7 @@ namespace euf { m_ensure_concat.reset(); auto ensure_concat = [&](unsigned lo, unsigned mid, unsigned hi) { // verbose_stream() << lo << " " << mid << " " << hi << "\n"; - TRACE("bv", tout << "ensure-concat " << lo << " " << mid << " " << hi << "\n"); + TRACE(bv, tout << "ensure-concat " << lo << " " << mid << " " << hi << "\n"); unsigned lo_, hi_; for (enode* p1 : enode_parents(n)) if (is_extract(p1, lo_, hi_) && lo_ == lo && hi_ == hi && p1->get_arg(0)->get_root() == arg_r) @@ -218,14 +218,14 @@ namespace euf { }; auto propagate_above = [&](enode* b) { - TRACE("bv", tout << "propagate-above " << g.bpp(b) << "\n"); + TRACE(bv, tout << "propagate-above " << g.bpp(b) << "\n"); for (enode* sib : enode_class(b)) if (is_extract(sib, lo2, hi2) && sib->get_arg(0)->get_root() == arg_r && hi1 + 1 == lo2) m_ensure_concat.push_back({lo1, hi1, hi2}); }; auto propagate_below = [&](enode* a) { - TRACE("bv", tout << "propagate-below " << g.bpp(a) << "\n"); + TRACE(bv, tout << "propagate-below " << g.bpp(a) << "\n"); for (enode* sib : enode_class(a)) if (is_extract(sib, lo2, hi2) && sib->get_arg(0)->get_root() == arg_r && hi2 + 1 == lo1) m_ensure_concat.push_back({lo2, hi2, hi1}); @@ -271,7 +271,7 @@ namespace euf { void bv_plugin::propagate_register_node(enode* n) { - TRACE("bv", tout << "register " << g.bpp(n) << "\n"); + TRACE(bv, tout << "register " << g.bpp(n) << "\n"); enode* a, * b; unsigned lo, hi; if (is_concat(n, a, b)) { @@ -296,7 +296,7 @@ namespace euf { push_merge(mk_extract(arg, 0, w - 1), arg); ensure_slice(arg, lo, hi); } - TRACE("bv", tout << "done register " << g.bpp(n) << "\n"); + TRACE(bv, tout << "done register " << g.bpp(n) << "\n"); } // @@ -306,7 +306,7 @@ namespace euf { enode* r = n; unsigned lb = 0, ub = width(n) - 1; while (true) { - TRACE("bv", tout << "ensure slice " << g.bpp(n) << " " << lb << " [" << lo << ", " << hi << "] " << ub << "\n"); + TRACE(bv, tout << "ensure slice " << g.bpp(n) << " " << lb << " [" << lo << ", " << hi << "] " << ub << "\n"); SASSERT(lb <= lo && hi <= ub); SASSERT(ub - lb + 1 == width(r)); if (lb == lo && ub == hi) @@ -370,7 +370,7 @@ namespace euf { SASSERT(!ys.empty()); auto x = xs.back(); auto y = ys.back(); - TRACE("bv", tout << "merge " << g.bpp(x) << " " << g.bpp(y) << "\n"); + TRACE(bv, tout << "merge " << g.bpp(x) << " " << g.bpp(y) << "\n"); if (unfold_sub(x, xs)) continue; else if (unfold_sub(y, ys)) @@ -407,7 +407,7 @@ namespace euf { } void bv_plugin::split(enode* n, unsigned cut) { - TRACE("bv", tout << "split: " << g.bpp(n) << " " << cut << "\n"); + TRACE(bv, tout << "split: " << g.bpp(n) << " " << cut << "\n"); unsigned w = width(n); SASSERT(!info(n).hi); SASSERT(0 < cut && cut < w); diff --git a/src/ast/euf/euf_egraph.cpp b/src/ast/euf/euf_egraph.cpp index a2bd2df4f..a3f07e9cb 100644 --- a/src/ast/euf/euf_egraph.cpp +++ b/src/ast/euf/euf_egraph.cpp @@ -69,7 +69,7 @@ namespace euf { } enode_bool_pair egraph::insert_table(enode* p) { - TRACE("euf_verbose", tout << "insert_table " << bpp(p) << "\n"); + TRACE(euf_verbose, tout << "insert_table " << bpp(p) << "\n"); //SASSERT(!m_table.contains_ptr(p)); auto rc = m_table.insert(p); p->m_cg = rc.first; @@ -163,7 +163,7 @@ namespace euf { } void egraph::add_th_eq(theory_id id, theory_var v1, theory_var v2, enode* c, enode* r) { - TRACE("euf", tout << "eq: " << v1 << " == " << v2 << " - " << bpp(c) << " == " << bpp(r) << "\n";); + TRACE(euf, tout << "eq: " << v1 << " == " << v2 << " - " << bpp(c) << " == " << bpp(r) << "\n";); m_new_th_eqs.push_back(th_eq(id, v1, v2, c, r)); m_updates.push_back(update_record(update_record::new_th_eq())); ++m_stats.m_num_th_eqs; @@ -175,7 +175,7 @@ namespace euf { void egraph::add_th_diseq(theory_id id, theory_var v1, theory_var v2, enode* eq) { if (!th_propagates_diseqs(id)) return; - TRACE("euf_verbose", tout << "eq: " << v1 << " != " << v2 << "\n";); + TRACE(euf_verbose, tout << "eq: " << v1 << " != " << v2 << "\n";); m_new_th_eqs.push_back(th_eq(id, v1, v2, eq->get_expr())); m_updates.push_back(update_record(update_record::new_th_eq())); auto* p = get_plugin(id); @@ -185,7 +185,7 @@ namespace euf { } void egraph::add_literal(enode* n, enode* ante) { - TRACE("euf", tout << "propagate " << bpp(n) << " " << bpp(ante) << "\n"); + TRACE(euf, tout << "propagate " << bpp(n) << " " << bpp(ante) << "\n"); if (!m_on_propagate_literal) return; if (!ante) ++m_stats.m_num_eqs; else ++m_stats.m_num_lits; @@ -222,7 +222,7 @@ namespace euf { enode* arg1 = n->get_arg(0), * arg2 = n->get_arg(1); enode* r1 = arg1->get_root(); enode* r2 = arg2->get_root(); - TRACE("euf", tout << "new-diseq: " << bpp(r1) << " " << bpp(r2) << ": " << r1->has_th_vars() << " " << r2->has_th_vars() << "\n";); + TRACE(euf, tout << "new-diseq: " << bpp(r1) << " " << bpp(r2) << ": " << r1->has_th_vars() << " " << r2->has_th_vars() << "\n";); if (r1 == r2) { add_literal(n, nullptr); return; @@ -323,7 +323,7 @@ namespace euf { if (!m.is_bool(n->get_sort())) return; if (enable_merge_tf != n->merge_tf()) { - TRACE("euf", tout << "set tf " << enable_merge_tf << " " << bpp(n) << "\n"); + TRACE(euf, tout << "set tf " << enable_merge_tf << " " << bpp(n) << "\n"); n->set_merge_tf(enable_merge_tf); m_updates.push_back(update_record(n, update_record::toggle_merge_tf())); } @@ -361,7 +361,7 @@ namespace euf { void egraph::set_value(enode* n, lbool value, justification j) { if (n->value() == l_undef) { force_push(); - TRACE("euf", tout << bpp(n) << " := " << value << "\n";); + TRACE(euf, tout << bpp(n) << " := " << value << "\n";); n->set_value(value); n->m_lit_justification = j; m_updates.push_back(update_record(n, update_record::value_assignment())); @@ -459,7 +459,7 @@ namespace euf { break; case update_record::tag_t::is_update_children: for (unsigned i = 0; i < p.r1->num_args(); ++i) { - CTRACE("euf", (p.r1->m_args[i]->get_root()->m_parents.back() != p.r1), + CTRACE(euf, (p.r1->m_args[i]->get_root()->m_parents.back() != p.r1), display(tout << bpp(p.r1->m_args[i]) << " " << bpp(p.r1->m_args[i]->get_root()) << " ");); SASSERT(p.r1->m_args[i]->get_root()->m_parents.back() == p.r1); p.r1->m_args[i]->get_root()->m_parents.pop_back(); @@ -494,7 +494,7 @@ namespace euf { if (r1 == r2) return; - TRACE("euf", j.display(tout << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n" << bpp(r1) << " " << bpp(r2) << "\n";); + TRACE(euf, j.display(tout << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n" << bpp(r1) << " " << bpp(r2) << "\n";); IF_VERBOSE(20, j.display(verbose_stream() << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n";); force_push(); SASSERT(m_num_scopes == 0); @@ -537,7 +537,7 @@ namespace euf { } void egraph::remove_parents(enode* r) { - TRACE("euf_verbose", tout << bpp(r) << "\n"); + TRACE(euf_verbose, tout << bpp(r) << "\n"); SASSERT(all_of(enode_parents(r), [&](enode* p) { return !p->is_marked1(); })); for (enode* p : enode_parents(r)) { if (p->is_marked1()) @@ -548,7 +548,7 @@ namespace euf { SASSERT(m_table.contains_ptr(p)); p->mark1(); erase_from_table(p); - CTRACE("euf_verbose", m_table.contains_ptr(p), tout << bpp(p) << "\n"; display(tout)); + CTRACE(euf_verbose, m_table.contains_ptr(p), tout << bpp(p) << "\n"; display(tout)); SASSERT(!m_table.contains_ptr(p)); } else if (p->is_equality()) @@ -561,11 +561,11 @@ namespace euf { if (!p->is_marked1()) continue; p->unmark1(); - TRACE("euf_verbose", tout << "reinsert " << bpp(r1) << " " << bpp(r2) << " " << bpp(p) << " " << p->cgc_enabled() << "\n";); + TRACE(euf_verbose, tout << "reinsert " << bpp(r1) << " " << bpp(r2) << " " << bpp(p) << " " << p->cgc_enabled() << "\n";); if (p->cgc_enabled()) { auto [p_other, comm] = insert_table(p); SASSERT(m_table.contains_ptr(p) == (p_other == p)); - CTRACE("euf_verbose", p_other != p, tout << "reinsert " << bpp(p) << " == " << bpp(p_other) << " " << p->value() << " " << p_other->value() << "\n"); + CTRACE(euf_verbose, p_other != p, tout << "reinsert " << bpp(p) << " == " << bpp(p_other) << " " << p->value() << " " << p_other->value() << "\n"); if (p_other != p) m_to_merge.push_back(to_merge(p_other, p, comm)); else @@ -599,14 +599,14 @@ namespace euf { void egraph::undo_eq(enode* r1, enode* n1, unsigned r2_num_parents) { enode* r2 = r1->get_root(); - TRACE("euf_verbose", tout << "undo-eq old-root: " << bpp(r1) << " current-root " << bpp(r2) << " node: " << bpp(n1) << "\n";); + TRACE(euf_verbose, tout << "undo-eq old-root: " << bpp(r1) << " current-root " << bpp(r2) << " node: " << bpp(n1) << "\n";); r2->dec_class_size(r1->class_size()); r2->set_is_shared(l_undef); std::swap(r1->m_next, r2->m_next); auto begin = r2->begin_parents() + r2_num_parents, end = r2->end_parents(); for (auto it = begin; it != end; ++it) { enode* p = *it; - TRACE("euf_verbose", tout << "erase " << bpp(p) << "\n";); + TRACE(euf_verbose, tout << "erase " << bpp(p) << "\n";); SASSERT(!p->cgc_enabled() || m_table.contains_ptr(p)); SASSERT(!p->cgc_enabled() || p->is_cgr()); if (p->cgc_enabled()) @@ -661,7 +661,7 @@ namespace euf { m_updates.push_back(update_record(false, update_record::inconsistent())); m_n1 = n1; m_n2 = n2; - TRACE("euf", tout << "conflict " << bpp(n1) << " " << bpp(n2) << " " << j << " " << n1->get_root()->value() << " " << n2->get_root()->value() << "\n"); + TRACE(euf, tout << "conflict " << bpp(n1) << " " << bpp(n2) << " " << j << " " << n1->get_root()->value() << " " << n2->get_root()->value() << "\n"); m_justification = j; } @@ -678,11 +678,11 @@ namespace euf { SASSERT(n2->acyclic()); SASSERT(n1->get_root()->reaches(n1)); SASSERT(!n2->get_root()->m_target); - TRACE("euf_verbose", tout << "merge " << n1->get_expr_id() << " " << n2->get_expr_id() << " updates: " << m_updates.size() << "\n";); + TRACE(euf_verbose, tout << "merge " << n1->get_expr_id() << " " << n2->get_expr_id() << " updates: " << m_updates.size() << "\n";); } void egraph::unmerge_justification(enode* n1) { - TRACE("euf_verbose", tout << "unmerge " << n1->get_expr_id() << " " << n1->m_target->get_expr_id() << "\n";); + TRACE(euf_verbose, tout << "unmerge " << n1->get_expr_id() << " " << n1->m_target->get_expr_id() << "\n";); // r1 -> .. -> n1 -> n2 -> ... -> r2 // where n2 = n1->m_target SASSERT(n1->get_root()->reaches(n1)); @@ -749,7 +749,7 @@ namespace euf { push_lca(n1->get_arg(1), n2->get_arg(0)); return; } - TRACE("euf_verbose", tout << bpp(n1) << " " << bpp(n2) << "\n"); + TRACE(euf_verbose, tout << bpp(n1) << " " << bpp(n2) << "\n"); for (unsigned i = 0; i < n1->num_args(); ++i) push_lca(n1->get_arg(i), n2->get_arg(i)); @@ -808,7 +808,7 @@ namespace euf { template void egraph::explain_eq(ptr_vector& justifications, cc_justification* cc, enode* a, enode* b, justification const& j) { - TRACE("euf_verbose", tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " jst: " << j << "\n";); + TRACE(euf_verbose, tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " jst: " << j << "\n";); if (j.is_external()) justifications.push_back(j.ext()); else if (j.is_congruence()) @@ -833,7 +833,7 @@ namespace euf { SASSERT(a->get_root() == b->get_root()); enode* lca = find_lca(a, b); - TRACE("euf_verbose", tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " lca: " << bpp(lca) << "\n";); + TRACE(euf_verbose, tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " lca: " << bpp(lca) << "\n";); push_to_lca(a, lca); push_to_lca(b, lca); if (m_used_eq) @@ -865,7 +865,7 @@ namespace euf { continue; if (n->m_target) { n->mark1(); - CTRACE("euf_verbose", m_display_justification, n->m_justification.display(tout << n->get_expr_id() << " = " << n->m_target->get_expr_id() << " ", m_display_justification) << "\n";); + CTRACE(euf_verbose, m_display_justification, n->m_justification.display(tout << n->get_expr_id() << " = " << n->m_target->get_expr_id() << " ", m_display_justification) << "\n";); explain_eq(justifications, cc, n, n->m_target, n->m_justification); } else if (!n->is_marked1() && n->value() != l_undef) { @@ -884,9 +884,9 @@ namespace euf { n->invariant(*this); for (enode* n : m_nodes) if (n->cgc_enabled() && n->num_args() > 0 && (!m_table.find(n) || n->get_root() != m_table.find(n)->get_root())) { - CTRACE("euf", !m_table.find(n), tout << "node is not in table\n";); - CTRACE("euf", m_table.find(n), tout << "root " << bpp(n->get_root()) << " table root " << bpp(m_table.find(n)->get_root()) << "\n";); - TRACE("euf", display(tout << bpp(n) << " is not closed under congruence\n");); + CTRACE(euf, !m_table.find(n), tout << "node is not in table\n";); + CTRACE(euf, m_table.find(n), tout << "root " << bpp(n->get_root()) << " table root " << bpp(m_table.find(n)->get_root()) << "\n";); + TRACE(euf, display(tout << bpp(n) << " is not closed under congruence\n");); UNREACHABLE(); } } diff --git a/src/ast/euf/euf_enode.cpp b/src/ast/euf/euf_enode.cpp index 2149059b4..42dd59ebc 100644 --- a/src/ast/euf/euf_enode.cpp +++ b/src/ast/euf/euf_enode.cpp @@ -42,7 +42,7 @@ namespace euf { for (enode* arg : enode_args(p)) { found |= arg->get_root() == this; } - CTRACE("euf", !found, tout << g.bpp(p) << " does not have a child with root: " << g.bpp(this) << "\n";); + CTRACE(euf, !found, tout << g.bpp(p) << " does not have a child with root: " << g.bpp(this) << "\n";); VERIFY(found); } for (enode* c : enode_class(this)) { @@ -55,7 +55,7 @@ namespace euf { for (enode* q : enode_parents(this)) { found |= p->congruent(q); } - CTRACE("euf", !found, tout << "parent " << g.bpp(p) << " of " << g.bpp(c) << " is not congruent to a parent of " << g.bpp(this) << "\n";); + CTRACE(euf, !found, tout << "parent " << g.bpp(p) << " of " << g.bpp(c) << " is not congruent to a parent of " << g.bpp(this) << "\n";); VERIFY(found); } } diff --git a/src/ast/euf/euf_etable.cpp b/src/ast/euf/euf_etable.cpp index 1fc8aa0e0..49e5d1bdf 100644 --- a/src/ast/euf/euf_etable.cpp +++ b/src/ast/euf/euf_etable.cpp @@ -237,7 +237,7 @@ namespace euf { UNTAG(table*, t)->erase(n); break; } - CTRACE("euf", contains_ptr(n), display(tout)); + CTRACE(euf, contains_ptr(n), display(tout)); SASSERT(!contains_ptr(n)); } diff --git a/src/ast/euf/euf_mam.cpp b/src/ast/euf/euf_mam.cpp index c4cb2d28c..d9e9a8378 100644 --- a/src/ast/euf/euf_mam.cpp +++ b/src/ast/euf/euf_mam.cpp @@ -951,7 +951,7 @@ namespace euf { for (unsigned reg : m_todo) { expr * p = m_registers[reg]; SASSERT(!is_quantifier(p)); - TRACE("mam", tout << "lin: " << reg << " " << get_check_mark(reg) << " " << is_var(p) << "\n";); + TRACE(mam, tout << "lin: " << reg << " " << get_check_mark(reg) << " " << is_var(p) << "\n";); if (is_var(p)) { unsigned var_id = to_var(p)->get_idx(); if (m_vars[var_id] != -1) @@ -1298,7 +1298,7 @@ namespace euf { return nullptr; // it is unlikely we will find a compatible node } if (curr_compatibility > max_compatibility) { - TRACE("mam", tout << "better child " << best_child << " -> " << curr_child << "\n";); + TRACE(mam, tout << "better child " << best_child << " -> " << curr_child << "\n";); best_child = curr_child; max_compatibility = curr_compatibility; } @@ -1507,16 +1507,16 @@ namespace euf { for (;;) { m_compatible.reset(); m_incompatible.reset(); - TRACE("mam_compiler_detail", tout << "processing head: " << *head << "\n";); + TRACE(mam_compiler_detail, tout << "processing head: " << *head << "\n";); instruction * curr = head->m_next; instruction * last = head; while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) { - TRACE("mam_compiler_detail", tout << "processing instr: " << *curr << "\n";); + TRACE(mam_compiler_detail, tout << "processing instr: " << *curr << "\n";); switch (curr->m_opcode) { case BIND1: case BIND2: case BIND3: case BIND4: case BIND5: case BIND6: case BINDN: { bind* bnd = static_cast(curr); if (is_compatible(bnd)) { - TRACE("mam_compiler_detail", tout << "compatible\n";); + TRACE(mam_compiler_detail, tout << "compatible\n";); unsigned ireg = bnd->m_ireg; SASSERT(m_todo.contains(ireg)); m_todo.erase(ireg); @@ -1531,7 +1531,7 @@ namespace euf { } } else { - TRACE("mam_compiler_detail", tout << "incompatible\n";); + TRACE(mam_compiler_detail, tout << "incompatible\n";); m_incompatible.push_back(curr); } break; @@ -1539,7 +1539,7 @@ namespace euf { case CHECK: { check* chk = static_cast(curr); if (is_compatible(chk)) { - TRACE("mam_compiler_detail", tout << "compatible\n";); + TRACE(mam_compiler_detail, tout << "compatible\n";); unsigned reg = chk->m_reg; SASSERT(m_todo.contains(reg)); m_todo.erase(reg); @@ -1547,7 +1547,7 @@ namespace euf { m_compatible.push_back(curr); } else if (m_use_filters && is_semi_compatible(chk)) { - TRACE("mam_compiler_detail", tout << "semi compatible\n";); + TRACE(mam_compiler_detail, tout << "semi compatible\n";); unsigned reg = chk->m_reg; enode * n1 = chk->m_enode; // n1->has_lbl_hash may be false, even @@ -1575,14 +1575,14 @@ namespace euf { m_incompatible.push_back(curr); } else { - TRACE("mam_compiler_detail", tout << "incompatible " << chk->m_reg << "\n";); + TRACE(mam_compiler_detail, tout << "incompatible " << chk->m_reg << "\n";); m_incompatible.push_back(curr); } break; } case COMPARE: if (is_compatible(static_cast(curr))) { - TRACE("mam_compiler_detail", tout << "compatible\n";); + TRACE(mam_compiler_detail, tout << "compatible\n";); unsigned reg1 = static_cast(curr)->m_reg1; unsigned reg2 = static_cast(curr)->m_reg2; SASSERT(m_todo.contains(reg2)); @@ -1598,7 +1598,7 @@ namespace euf { m_compatible.push_back(curr); } else { - TRACE("mam_compiler_detail", tout << "incompatible\n";); + TRACE(mam_compiler_detail, tout << "incompatible\n";); m_incompatible.push_back(curr); } break; @@ -1619,8 +1619,8 @@ namespace euf { SASSERT(m_use_filters); if (is_compatible(flt)) { unsigned reg = flt->m_reg; - TRACE("mam_compiler_detail", tout << "compatible " << reg << "\n";); - CTRACE("mam_compiler_bug", !m_todo.contains(reg), { + TRACE(mam_compiler_detail, tout << "compatible " << reg << "\n";); + CTRACE(mam_compiler_bug, !m_todo.contains(reg), { for (unsigned t : m_todo) { tout << t << " "; } tout << "\nregisters:\n"; unsigned i = 0; @@ -1637,8 +1637,8 @@ namespace euf { } else if (is_semi_compatible(flt)) { unsigned reg = flt->m_reg; - TRACE("mam_compiler_detail", tout << "semi compatible " << reg << "\n";); - CTRACE("mam_compiler_bug", !m_todo.contains(reg), { + TRACE(mam_compiler_detail, tout << "semi compatible " << reg << "\n";); + CTRACE(mam_compiler_bug, !m_todo.contains(reg), { for (unsigned t : m_todo) { tout << t << " "; } tout << "\nregisters:\n"; unsigned i = 0; @@ -1648,7 +1648,7 @@ namespace euf { }); SASSERT(m_todo.contains(reg)); unsigned h = get_pat_lbl_hash(reg); - TRACE("mam_lbl_bug", + TRACE(mam_lbl_bug, tout << "curr_set: " << flt->m_lbl_set << "\n"; tout << "new hash: " << h << "\n";); set_check_mark(reg, CHECK_SET); @@ -1667,13 +1667,13 @@ namespace euf { } } else { - TRACE("mam_compiler_detail", tout << "incompatible\n";); + TRACE(mam_compiler_detail, tout << "incompatible\n";); m_incompatible.push_back(curr); } break; } default: - TRACE("mam_compiler_detail", tout << "incompatible\n";); + TRACE(mam_compiler_detail, tout << "incompatible\n";); m_incompatible.push_back(curr); break; } @@ -1681,7 +1681,7 @@ namespace euf { curr = curr->m_next; } - TRACE("mam_compiler", tout << *head << " " << head << "\n"; + TRACE(mam_compiler, tout << *head << " " << head << "\n"; tout << "m_compatible.size(): " << m_compatible.size() << "\n"; tout << "m_incompatible.size(): " << m_incompatible.size() << "\n";); @@ -1691,7 +1691,7 @@ namespace euf { SASSERT(curr->m_opcode == CHOOSE); choose * first_child = static_cast(curr); choose * best_child = find_best_child(first_child); - TRACE("mam", tout << "best child " << best_child << "\n";); + TRACE(mam, tout << "best child " << best_child << "\n";); if (best_child == nullptr) { // There is no compatible child // Suppose the sequence is: @@ -1776,7 +1776,7 @@ namespace euf { init(r, qa, mp, first_idx); linearise(r->m_root, first_idx); r->m_num_choices = m_num_choices; - TRACE("mam_compiler", tout << "new tree for:\n" << mk_pp(mp, m) << "\n" << *r;); + TRACE(mam_compiler, tout << "new tree for:\n" << mk_pp(mp, m) << "\n" << *r;); return r; } @@ -1794,21 +1794,21 @@ namespace euf { return; } m_is_tmp_tree = is_tmp_tree; - TRACE("mam_compiler", tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";); - TRACE("mam_bug", tout << "before insertion\n" << *tree << "\n";); + TRACE(mam_compiler, tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";); + TRACE(mam_bug, tout << "before insertion\n" << *tree << "\n";); if (!is_tmp_tree) m_ct_manager.save_num_regs(tree); init(tree, qa, mp, first_idx); m_num_choices = tree->m_num_choices; insert(tree->m_root, first_idx); - TRACE("mam_bug", + TRACE(mam_bug, tout << "m_num_choices: " << m_num_choices << "\n";); if (m_num_choices > tree->m_num_choices) { if (!is_tmp_tree) m_ct_manager.save_num_choices(tree); tree->m_num_choices = m_num_choices; } - TRACE("mam_bug", + TRACE(mam_bug, tout << "m_num_choices: " << m_num_choices << "\n"; tout << "new tree:\n" << *tree; tout << "todo "; @@ -1999,7 +1999,7 @@ namespace euf { } void init(code_tree * t) { - TRACE("mam_bug", tout << "preparing to match tree:\n" << *t << "\n";); + TRACE(mam_bug, tout << "preparing to match tree:\n" << *t << "\n";); m_registers.reserve(t->get_num_regs(), nullptr); m_bindings.reserve(t->get_num_regs(), nullptr); if (m_backtrack_stack.size() < t->get_num_choices()) @@ -2010,14 +2010,14 @@ namespace euf { void execute(code_tree * t) { if (!t->has_candidates()) return; - TRACE("trigger_bug", tout << "execute for code tree:\n"; t->display(tout);); + TRACE(trigger_bug, tout << "execute for code tree:\n"; t->display(tout);); init(t); t->save_qhead(ctx); enode* app; if (t->filter_candidates()) { code_tree::scoped_unmark _unmark(t); while ((app = t->next_candidate()) && !ctx.resource_limits_exceeded()) { - TRACE("trigger_bug", tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";); + TRACE(trigger_bug, tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";); if (!app->is_marked3() && app->is_cgr()) { execute_core(t, app); app->mark3(); @@ -2026,7 +2026,7 @@ namespace euf { } else { while ((app = t->next_candidate()) && !ctx.resource_limits_exceeded()) { - TRACE("trigger_bug", tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";); + TRACE(trigger_bug, tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";); if (app->is_cgr()) execute_core(t, app); } @@ -2175,7 +2175,7 @@ namespace euf { bp.m_instr = c; bp.m_old_max_generation = m_max_generation; if (best_v == nullptr) { - TRACE("mam_bug", tout << "m_top: " << m_top << ", m_backtrack_stack.size(): " << m_backtrack_stack.size() << "\n"; + TRACE(mam_bug, tout << "m_top: " << m_top << ", m_backtrack_stack.size(): " << m_backtrack_stack.size() << "\n"; tout << *c << "\n";); bp.m_to_recycle = nullptr; bp.m_it = ctx.get_egraph().enodes_of(lbl).begin(); @@ -2255,7 +2255,7 @@ namespace euf { } bool interpreter::execute_core(code_tree * t, enode * n) { - TRACE("trigger_bug", tout << "interpreter::execute_core\n"; t->display(tout); tout << "\nenode\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";); + TRACE(trigger_bug, tout << "interpreter::execute_core\n"; t->display(tout); tout << "\nenode\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";); unsigned since_last_check = 0; #ifdef _PROFILE_MAM @@ -2269,7 +2269,7 @@ namespace euf { t->inc_counter(); #endif // It doesn't make sense to process an irrelevant enode. - TRACE("mam_execute_core", tout << "EXEC " << t->get_root_lbl()->get_name() << "\n";); + TRACE(mam_execute_core, tout << "EXEC " << t->get_root_lbl()->get_name() << "\n";); if (!ctx.is_relevant(n)) return false; SASSERT(ctx.is_relevant(n)); @@ -2286,7 +2286,7 @@ namespace euf { main_loop: - TRACE("mam_int", display_pc_info(tout);); + TRACE(mam_int, display_pc_info(tout);); #ifdef _PROFILE_MAM const_cast(m_pc)->m_counter++; #endif @@ -2425,7 +2425,7 @@ namespace euf { m_app = get_first_f_app(static_cast(m_pc)->m_label, static_cast(m_pc)->m_num_args, m_n1); \ if (!m_app) \ goto backtrack; \ - TRACE("mam_int", tout << "bind candidate: " << mk_pp(m_app->get_expr(), m) << "\n";); \ + TRACE(mam_int, tout << "bind candidate: " << mk_pp(m_app->get_expr(), m) << "\n";); \ m_backtrack_stack[m_top].m_instr = m_pc; \ m_backtrack_stack[m_top].m_old_max_generation = m_curr_max_generation; \ m_backtrack_stack[m_top].m_curr = m_app; \ @@ -2624,7 +2624,7 @@ namespace euf { if (m_app == nullptr) goto backtrack; m_pattern_instances.push_back(m_app); - TRACE("mam_int", tout << "continue candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); + TRACE(mam_int, tout << "continue candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); for (unsigned i = 0; i < m_num_args; i++) m_registers[m_oreg+i] = m_app->get_arg(i); m_pc = m_pc->m_next; @@ -2643,9 +2643,9 @@ namespace euf { goto main_loop; backtrack: - TRACE("mam_int", tout << "backtracking.\n";); + TRACE(mam_int, tout << "backtracking.\n";); if (m_top == 0) { - TRACE("mam_int", tout << "no more alternatives.\n";); + TRACE(mam_int, tout << "no more alternatives.\n";); #ifdef _PROFILE_MAM t->get_watch().stop(); #endif @@ -2655,7 +2655,7 @@ namespace euf { m_max_generation = bp.m_old_max_generation; - TRACE("mam_int", tout << "backtrack top: " << bp.m_instr << " " << *(bp.m_instr) << "\n";); + TRACE(mam_int, tout << "backtrack top: " << bp.m_instr << " " << *(bp.m_instr) << "\n";); #ifdef _PROFILE_MAM if (bp.m_instr->m_opcode != CHOOSE) // CHOOSE has a different status. It is a control flow backtracking. const_cast(bp.m_instr)->m_counter++; @@ -2682,7 +2682,7 @@ namespace euf { switch (bp.m_instr->m_opcode) { case CHOOSE: m_pc = static_cast(bp.m_instr)->m_alt; - TRACE("mam_int", tout << "alt: " << m_pc << "\n";); + TRACE(mam_int, tout << "alt: " << m_pc << "\n";); SASSERT(m_pc != 0); m_top--; goto main_loop; @@ -2695,7 +2695,7 @@ namespace euf { goto backtrack; \ } \ bp.m_curr = m_app; \ - TRACE("mam_int", tout << "bind next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); \ + TRACE(mam_int, tout << "bind next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); \ m_oreg = m_b->m_oreg BBIND_COMMON(); @@ -2775,7 +2775,7 @@ namespace euf { m_pattern_instances.push_back(m_app); // continue succeeded update_max_generation(m_app, nullptr); // null indicates a top-level match - TRACE("mam_int", tout << "continue next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); + TRACE(mam_int, tout << "continue next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); m_num_args = c->m_num_args; m_oreg = c->m_oreg; for (unsigned i = 0; i < m_num_args; i++) @@ -2884,7 +2884,7 @@ namespace euf { m_trees[lbl_id]->get_patterns().push_back(std::make_pair(qa, mp)); ctx.get_trail().push(push_back_trail, false>(m_trees[lbl_id]->get_patterns())); }); - TRACE("trigger_bug", tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout);); + TRACE(trigger_bug, tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout);); } void reset() { @@ -3093,7 +3093,7 @@ namespace euf { void add_candidate(code_tree * t, enode * app) { if (!t) return; - TRACE("q", tout << "candidate " << ctx.get_egraph().bpp(app) << "\n";); + TRACE(q, tout << "candidate " << ctx.get_egraph().bpp(app) << "\n";); if (!t->has_candidates()) { ctx.get_trail().push(push_back_trail(m_to_match)); m_to_match.push_back(t); @@ -3126,8 +3126,8 @@ namespace euf { void update_clbls(func_decl * lbl) { unsigned lbl_id = lbl->get_small_id(); m_is_clbl.reserve(lbl_id+1, false); - TRACE("trigger_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";); - TRACE("mam_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";); + TRACE(trigger_bug, tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";); + TRACE(mam_bug, tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";); if (m_is_clbl[lbl_id]) return; ctx.get_trail().push(set_bitvector_trail(m_is_clbl, lbl_id)); @@ -3136,7 +3136,7 @@ namespace euf { for (enode* app : m_egraph.enodes_of(lbl)) { if (ctx.is_relevant(app)) { update_lbls(app, h); - TRACE("mam_bug", tout << "updating labels of: #" << app->get_expr_id() << "\n"; + TRACE(mam_bug, tout << "updating labels of: #" << app->get_expr_id() << "\n"; tout << "new_elem: " << h << "\n"; tout << "lbls: " << app->get_lbls() << "\n"; tout << "r.lbls: " << app->get_root()->get_lbls() << "\n";); @@ -3152,10 +3152,10 @@ namespace euf { if (!r_plbls.may_contain(elem)) { ctx.get_trail().push(mam_value_trail(r_plbls)); r_plbls.insert(elem); - TRACE("trigger_bug", tout << "updating plabels of:\n" << mk_ismt2_pp(c->get_root()->get_expr(), m) << "\n"; + TRACE(trigger_bug, tout << "updating plabels of:\n" << mk_ismt2_pp(c->get_root()->get_expr(), m) << "\n"; tout << "new_elem: " << static_cast(elem) << "\n"; tout << "plbls: " << c->get_root()->get_plbls() << "\n";); - TRACE("mam_bug", tout << "updating plabels of: #" << c->get_root()->get_expr_id() << "\n"; + TRACE(mam_bug, tout << "updating plabels of: #" << c->get_root()->get_expr_id() << "\n"; tout << "new_elem: " << static_cast(elem) << "\n"; tout << "plbls: " << c->get_root()->get_plbls() << "\n";); @@ -3166,9 +3166,9 @@ namespace euf { void update_plbls(func_decl * lbl) { unsigned lbl_id = lbl->get_small_id(); m_is_plbl.reserve(lbl_id+1, false); - TRACE("trigger_bug", tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << ", lbl_id: " << lbl_id << "\n"; + TRACE(trigger_bug, tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << ", lbl_id: " << lbl_id << "\n"; tout << "mam: " << this << "\n";); - TRACE("mam_bug", tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << "\n";); + TRACE(mam_bug, tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << "\n";); if (m_is_plbl[lbl_id]) return; ctx.get_trail().push(set_bitvector_trail(m_is_plbl, lbl_id)); @@ -3282,7 +3282,7 @@ namespace euf { ctx.get_trail().push(set_ptr_trail(m_pc[h1][h2])); m_pc[h1][h2] = mk_path_tree(p, qa, mp); } - TRACE("mam_path_tree_updt", + TRACE(mam_path_tree_updt, tout << "updated path tree:\n"; m_pc[h1][h2]->display(tout, 2);); } @@ -3320,7 +3320,7 @@ namespace euf { m_pp[h1][h2].second = mk_path_tree(p2, qa, mp); } } - TRACE("mam_path_tree_updt", + TRACE(mam_path_tree_updt, tout << "updated path tree:\n"; SASSERT(h1 <= h2); m_pp[h1][h2].first->display(tout, 2); @@ -3386,7 +3386,7 @@ namespace euf { update_plbls(plbl); if (!n->has_lbl_hash()) m_egraph.set_lbl_hash(n); - TRACE("mam_bug", + TRACE(mam_bug, tout << "updating pc labels " << plbl->get_name() << " " << static_cast(n->get_lbl_hash()) << "\n"; tout << "#" << n->get_expr_id() << " " << n->get_root()->get_lbls() << "\n"; @@ -3396,7 +3396,7 @@ namespace euf { } func_decl * clbl = to_app(child)->get_decl(); - TRACE("mam_bug", tout << "updating pc labels " << plbl->get_name() << " " << clbl->get_name() << "\n";); + TRACE(mam_bug, tout << "updating pc labels " << plbl->get_name() << " " << clbl->get_name() << "\n";); update_plbls(plbl); update_clbls(clbl); update_pc(m_lbl_hasher(plbl), m_lbl_hasher(clbl), new_path, qa, mp); @@ -3408,7 +3408,7 @@ namespace euf { \brief Update inverted path index. */ void update_filters(quantifier * qa, app * mp) { - TRACE("mam_bug", tout << "updating filters using:\n" << mk_pp(mp, m) << "\n";); + TRACE(mam_bug, tout << "updating filters using:\n" << mk_pp(mp, m) << "\n";); unsigned num_vars = qa->get_num_decls(); if (num_vars >= m_var_paths.size()) m_var_paths.resize(num_vars+1); @@ -3460,7 +3460,7 @@ namespace euf { \brief Collect new E-matching candidates using the inverted path index t. */ void collect_parents(enode * r, path_tree * t) { - TRACE("mam", tout << ctx.get_egraph().bpp(r) << " " << t << "\n";); + TRACE(mam, tout << ctx.get_egraph().bpp(r) << " " << t << "\n";); if (t == nullptr) return; #ifdef _PROFILE_PATH_TREE @@ -3481,7 +3481,7 @@ namespace euf { #ifdef _PROFILE_PATH_TREE t->m_counter++; #endif - TRACE("mam_path_tree", + TRACE(mam_path_tree, tout << "processing:\n"; t->display(tout, 2);); enode_vector * v = t->m_todo; @@ -3526,7 +3526,7 @@ namespace euf { std::cout << "Avg2. " << static_cast(total_sz2)/static_cast(counter2) << ", Max2. " << max_sz2 << "\n"; #endif - TRACE("mam_path_tree", tout << "processing: #" << curr_child->get_expr_id() << "\n";); + TRACE(mam_path_tree, tout << "processing: #" << curr_child->get_expr_id() << "\n";); for (enode* curr_parent : euf::enode_parents(curr_child)) { #ifdef _PROFILE_PATH_TREE if (curr_parent->is_equality()) @@ -3541,8 +3541,8 @@ namespace euf { bool is_flat_assoc = lbl->is_flat_associative(); enode * curr_parent_root = curr_parent->get_root(); enode * curr_parent_cg = curr_parent->get_cg(); - TRACE("mam_path_tree", tout << "processing parent:\n" << mk_pp(curr_parent->get_expr(), m) << "\n";); - TRACE("mam_path_tree", tout << "parent is marked: " << curr_parent->is_marked1() << "\n";); + TRACE(mam_path_tree, tout << "processing parent:\n" << mk_pp(curr_parent->get_expr(), m) << "\n";); + TRACE(mam_path_tree, tout << "parent is marked: " << curr_parent->is_marked1() << "\n";); if (filter.may_contain(m_lbl_hasher(lbl)) && !curr_parent->is_marked1() && (curr_parent_cg == curr_parent || !is_eq(curr_parent_cg, curr_parent_root)) && @@ -3572,7 +3572,7 @@ namespace euf { is_eq(curr_tree->m_ground_arg, curr_parent->get_arg(curr_tree->m_ground_arg_idx)) )) { if (curr_tree->m_code) { - TRACE("mam_path_tree", tout << "found candidate " << expr_ref(curr_parent->get_expr(), m) << "\n";); + TRACE(mam_path_tree, tout << "found candidate " << expr_ref(curr_parent->get_expr(), m) << "\n";); add_candidate(curr_tree->m_code, curr_parent); } if (curr_tree->m_first_child) { @@ -3621,8 +3621,8 @@ namespace euf { void process_pp(enode * r1, enode * r2) { approx_set & plbls1 = r1->get_plbls(); approx_set & plbls2 = r2->get_plbls(); - TRACE("incremental_matcher", tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";); - TRACE("mam_info", tout << "pp: " << plbls1.size() * plbls2.size() << "\n";); + TRACE(incremental_matcher, tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";); + TRACE(mam_info, tout << "pp: " << plbls1.size() * plbls2.size() << "\n";); if (!plbls1.empty() && !plbls2.empty()) { for (unsigned plbl1 : plbls1) { if (!m.inc()) { @@ -3682,7 +3682,7 @@ namespace euf { return; ctx.get_trail().push(value_trail(m_new_patterns_qhead)); - TRACE("mam_new_pat", tout << "matching new patterns:\n";); + TRACE(mam_new_pat, tout << "matching new patterns:\n";); m_tmp_trees_to_delete.reset(); for (; m_new_patterns_qhead < m_new_patterns.size(); ++m_new_patterns_qhead) { if (!m.inc()) @@ -3741,8 +3741,8 @@ namespace euf { void add_pattern(quantifier * qa, app * mp) override { SASSERT(m.is_pattern(mp)); - TRACE("trigger_bug", tout << "adding pattern\n" << mk_ismt2_pp(qa, m) << "\n" << mk_ismt2_pp(mp, m) << "\n";); - TRACE("mam_bug", tout << "adding pattern\n" << mk_pp(qa, m) << "\n" << mk_pp(mp, m) << "\n";); + TRACE(trigger_bug, tout << "adding pattern\n" << mk_ismt2_pp(qa, m) << "\n" << mk_ismt2_pp(mp, m) << "\n";); + TRACE(mam_bug, tout << "adding pattern\n" << mk_pp(qa, m) << "\n" << mk_pp(mp, m) << "\n";); // Z3 checks if a pattern is ground or not before solving. // Ground patterns are discarded. // However, the simplifier may turn a non-ground pattern into a ground one. @@ -3786,7 +3786,7 @@ namespace euf { } void propagate() override { - TRACE("trigger_bug", tout << "match\n"; display(tout);); + TRACE(trigger_bug, tout << "match\n"; display(tout);); propagate_to_match(); propagate_new_patterns(); } @@ -3805,14 +3805,14 @@ namespace euf { } bool check_missing_instances() override { - TRACE("missing_instance", tout << "checking for missing instances...\n";); + TRACE(missing_instance, tout << "checking for missing instances...\n";); flet l(m_check_missing_instances, true); rematch(false); return true; } void on_match(quantifier * qa, app * pat, unsigned num_bindings, enode * const * bindings, unsigned max_generation) override { - TRACE("trigger_bug", tout << "found match " << mk_pp(qa, m) << "\n";); + TRACE(trigger_bug, tout << "found match " << mk_pp(qa, m) << "\n";); unsigned min_gen = 0, max_gen = 0; m_interpreter.get_min_max_top_generation(min_gen, max_gen); m_ematch.on_binding(qa, pat, bindings, max_generation, min_gen, max_gen); @@ -3822,23 +3822,23 @@ namespace euf { // If lazy == true, then n is not added to the list of // candidate enodes for matching. That is, the method just updates the lbls. void add_node(enode * n, bool lazy) override { - TRACE("trigger_bug", tout << "relevant_eh:\n" << mk_ismt2_pp(n->get_expr(), m) << "\n"; + TRACE(trigger_bug, tout << "relevant_eh:\n" << mk_ismt2_pp(n->get_expr(), m) << "\n"; tout << "mam: " << this << "\n";); - TRACE("mam", tout << "relevant_eh: #" << n->get_expr_id() << "\n";); + TRACE(mam, tout << "relevant_eh: #" << n->get_expr_id() << "\n";); if (n->has_lbl_hash()) update_lbls(n, n->get_lbl_hash()); if (n->num_args() > 0) { func_decl * lbl = n->get_decl(); unsigned h = m_lbl_hasher(lbl); - TRACE("trigger_bug", tout << "lbl: " << lbl->get_name() << " is_clbl(lbl): " << is_clbl(lbl) + TRACE(trigger_bug, tout << "lbl: " << lbl->get_name() << " is_clbl(lbl): " << is_clbl(lbl) << ", is_plbl(lbl): " << is_plbl(lbl) << ", h: " << h << "\n"; tout << "lbl_id: " << lbl->get_small_id() << "\n";); if (is_clbl(lbl)) update_lbls(n, h); if (is_plbl(lbl)) update_children_plbls(n, h); - TRACE("mam_bug", tout << "adding relevant candidate:\n" << mk_ll_pp(n->get_expr(), m) << "\n";); + TRACE(mam_bug, tout << "adding relevant candidate:\n" << mk_ll_pp(n->get_expr(), m) << "\n";); if (!lazy) add_candidate(n); } @@ -3852,9 +3852,9 @@ namespace euf { flet l1(m_other, other); flet l2(m_root, root); - TRACE("mam", tout << "on_merge: #" << other->get_expr_id() << " #" << root->get_expr_id() << "\n";); - TRACE("mam_inc_bug_detail", m_egraph.display(tout);); - TRACE("mam_inc_bug", + TRACE(mam, tout << "on_merge: #" << other->get_expr_id() << " #" << root->get_expr_id() << "\n";); + TRACE(mam_inc_bug_detail, m_egraph.display(tout);); + TRACE(mam_inc_bug, tout << "before:\n#" << other->get_expr_id() << " #" << root->get_expr_id() << "\n"; tout << "other.lbls: " << other->get_lbls() << "\n"; tout << "root.lbls: " << root->get_lbls() << "\n"; @@ -3874,7 +3874,7 @@ namespace euf { ctx.get_trail().push(mam_value_trail(root_plbls)); root_lbls |= other_lbls; root_plbls |= other_plbls; - TRACE("mam_inc_bug", + TRACE(mam_inc_bug, tout << "after:\n"; tout << "other.lbls: " << other->get_lbls() << "\n"; tout << "root.lbls: " << root->get_lbls() << "\n"; diff --git a/src/ast/euf/euf_plugin.cpp b/src/ast/euf/euf_plugin.cpp index f95107bc3..198bc86d8 100644 --- a/src/ast/euf/euf_plugin.cpp +++ b/src/ast/euf/euf_plugin.cpp @@ -26,12 +26,12 @@ namespace euf { } void plugin::push_merge(enode* a, enode* b, justification j) { - TRACE("euf", tout << "push-merge " << g.bpp(a) << " == " << g.bpp(b) << " " << j << "\n"); + TRACE(euf, tout << "push-merge " << g.bpp(a) << " == " << g.bpp(b) << " " << j << "\n"); g.push_merge(a, b, j); } void plugin::push_merge(enode* a, enode* b) { - TRACE("plugin", tout << g.bpp(a) << " == " << g.bpp(b) << "\n"); + TRACE(plugin, tout << g.bpp(a) << " == " << g.bpp(b) << "\n"); g.push_merge(a, b, justification::axiom(get_id())); } diff --git a/src/ast/expr2polynomial.cpp b/src/ast/expr2polynomial.cpp index 3bcd7367a..8f300d0cb 100644 --- a/src/ast/expr2polynomial.cpp +++ b/src/ast/expr2polynomial.cpp @@ -368,7 +368,7 @@ struct expr2polynomial::imp { checkpoint(); frame & fr = m_frame_stack.back(); app * a = fr.m_curr; - TRACE("expr2polynomial", tout << "processing: " << fr.m_idx << "\n" << mk_ismt2_pp(a, m()) << "\n";); + TRACE(expr2polynomial, tout << "processing: " << fr.m_idx << "\n" << mk_ismt2_pp(a, m()) << "\n";); unsigned num_args = a->get_num_args(); while (fr.m_idx < num_args) { expr * arg = a->get_arg(fr.m_idx); diff --git a/src/ast/expr2var.cpp b/src/ast/expr2var.cpp index 61adcfc3a..afd2794c8 100644 --- a/src/ast/expr2var.cpp +++ b/src/ast/expr2var.cpp @@ -26,7 +26,7 @@ Notes: void expr2var::insert(expr * n, var v) { if (!is_uninterp_const(n)) { - TRACE("expr2var", tout << "interpreted:\n" << mk_ismt2_pp(n, m()) << "\n";); + TRACE(expr2var, tout << "interpreted:\n" << mk_ismt2_pp(n, m()) << "\n";); m_interpreted_vars = true; } unsigned idx = m_id2map.get(n->get_id(), UINT_MAX); diff --git a/src/ast/expr_abstract.cpp b/src/ast/expr_abstract.cpp index d6593a2a3..65086c6ca 100644 --- a/src/ast/expr_abstract.cpp +++ b/src/ast/expr_abstract.cpp @@ -111,7 +111,7 @@ void expr_abstractor::operator()(unsigned base, unsigned num_bound, expr* const* void expr_abstract(ast_manager& m, unsigned base, unsigned num_bound, expr* const* bound, expr* n, expr_ref& result) { expr_abstractor abs(m); abs(base, num_bound, bound, n, result); - TRACE("expr_abstract", + TRACE(expr_abstract, tout << expr_ref(n, m) << "\n"; tout << result << "\n";); } @@ -128,7 +128,7 @@ static expr_ref mk_quantifier(quantifier_kind k, ast_manager& m, unsigned num_bo } result = m.mk_quantifier(k, num_bound, sorts.data(), names.data(), result); } - TRACE("expr_abstract", + TRACE(expr_abstract, tout << expr_ref(n, m) << "\n"; for (unsigned i = 0; i < num_bound; ++i) tout << expr_ref(bound[i], m) << " "; tout << "\n"; diff --git a/src/ast/for_each_ast.h b/src/ast/for_each_ast.h index b01829548..fbc26775b 100644 --- a/src/ast/for_each_ast.h +++ b/src/ast/for_each_ast.h @@ -46,7 +46,7 @@ void for_each_ast(ForEachProc & proc, ast_mark & visited, ast * n, bool visit_pa while (!stack.empty()) { curr = stack.back(); - TRACE("for_each_ast", tout << "visiting node: " << curr->get_id() << ", kind: " << get_ast_kind_name(curr->get_kind()) + TRACE(for_each_ast, tout << "visiting node: " << curr->get_id() << ", kind: " << get_ast_kind_name(curr->get_kind()) << ", stack size: " << stack.size() << "\n";); if (visited.is_marked(curr)) { diff --git a/src/ast/fpa/bv2fpa_converter.cpp b/src/ast/fpa/bv2fpa_converter.cpp index a3008851b..fa801be14 100644 --- a/src/ast/fpa/bv2fpa_converter.cpp +++ b/src/ast/fpa/bv2fpa_converter.cpp @@ -111,7 +111,7 @@ expr_ref bv2fpa_converter::convert_bv2fp(sort * s, expr * sgn, expr * exp, expr res = m_fpa_util.mk_value(fp_val); - TRACE("bv2fpa", tout << "[" << mk_ismt2_pp(sgn, m) << + TRACE(bv2fpa, tout << "[" << mk_ismt2_pp(sgn, m) << " " << mk_ismt2_pp(exp, m) << " " << mk_ismt2_pp(sig, m) << "] == " << mk_ismt2_pp(res, m) << std::endl;); @@ -189,7 +189,7 @@ expr_ref bv2fpa_converter::convert_bv2rm(model_core * mc, expr * val) { expr_ref bv2fpa_converter::rebuild_floats(model_core * mc, sort * s, expr * e) { expr_ref result(m); - TRACE("bv2fpa_rebuild", tout << "rebuild floats in " << mk_ismt2_pp(s, m) << " for "; + TRACE(bv2fpa_rebuild, tout << "rebuild floats in " << mk_ismt2_pp(s, m) << " for "; if (e) tout << mk_ismt2_pp(e, m); else tout << "nil"; tout << std::endl; ); @@ -240,7 +240,7 @@ bv2fpa_converter::array_model bv2fpa_converter::convert_array_func_interp(model_ expr_ref as_arr_mdl(m); as_arr_mdl = mc->get_const_interp(bv_f); if (as_arr_mdl == 0) return am; - TRACE("bv2fpa", tout << "arity=0 func_interp for " << mk_ismt2_pp(f, m) << " := " << mk_ismt2_pp(as_arr_mdl, m) << std::endl;); + TRACE(bv2fpa, tout << "arity=0 func_interp for " << mk_ismt2_pp(f, m) << " := " << mk_ismt2_pp(as_arr_mdl, m) << std::endl;); SASSERT(arr_util.is_as_array(as_arr_mdl)); for (unsigned i = 0; i < arity; i++) array_domain.push_back(to_sort(f->get_range()->get_parameter(i).get_ast())); @@ -285,7 +285,7 @@ func_interp * bv2fpa_converter::convert_func_interp(model_core * mc, func_decl * bv_fres = bv_fe->get_result(); expr_ref ft_fres = rebuild_floats(mc, rng, to_app(bv_fres)); m_th_rw(ft_fres); - TRACE("bv2fpa", + TRACE(bv2fpa, tout << "func_interp entry #" << i << ":" << std::endl; tout << "(" << bv_f->get_name(); for (unsigned i = 0; i < bv_f->get_arity(); i++) @@ -338,7 +338,7 @@ func_interp * bv2fpa_converter::convert_func_interp(model_core * mc, func_decl * else if (bv_fi->get_else()) { expr_ref ft_els = rebuild_floats(mc, rng, bv_fi->get_else()); m_th_rw(ft_els); - TRACE("bv2fpa", tout << "else=" << mk_ismt2_pp(ft_els, m) << std::endl;); + TRACE(bv2fpa, tout << "else=" << mk_ismt2_pp(ft_els, m) << std::endl;); result->set_else(ft_els); } } @@ -410,7 +410,7 @@ void bv2fpa_converter::convert_consts(model_core * mc, model_core * target_model expr_ref cv = convert_bv2fp(var->get_range(), sgn, exp, sig); target_model->register_decl(var, cv); - TRACE("bv2fpa", tout << var->get_name() << " == " << mk_ismt2_pp(cv, m) << std::endl;); + TRACE(bv2fpa, tout << var->get_name() << " == " << mk_ismt2_pp(cv, m) << std::endl;); } } @@ -422,7 +422,7 @@ void bv2fpa_converter::convert_rm_consts(model_core * mc, model_core * target_mo SASSERT(m_fpa_util.is_bv2rm(val)); expr * bvval = to_app(val)->get_arg(0); expr_ref fv = convert_bv2rm(mc, to_app(bvval)); - TRACE("bv2fpa", tout << var->get_name() << " == " << mk_ismt2_pp(fv, m) << std::endl;); + TRACE(bv2fpa, tout << var->get_name() << " == " << mk_ismt2_pp(fv, m) << std::endl;); target_model->register_decl(var, fv); seen.insert(to_app(bvval)->get_decl()); } @@ -463,7 +463,7 @@ void bv2fpa_converter::convert_min_max_specials(model_core * mc, model_core * ta flt_fi->set_else(else_value); target_model->register_decl(f, flt_fi); - TRACE("bv2fpa", tout << "fp.min/fp.max special: " << std::endl << + TRACE(bv2fpa, tout << "fp.min/fp.max special: " << std::endl << mk_ismt2_pp(f, m) << " == " << mk_ismt2_pp(flt_fi->get_interp(), m) << std::endl;); } } @@ -508,7 +508,7 @@ void bv2fpa_converter::convert_uf2bvuf(model_core * mc, model_core * target_mode } } - TRACE("bv2fpa", tout << "Target model: " << *target_model << std::endl; ); + TRACE(bv2fpa, tout << "Target model: " << *target_model << std::endl; ); } void bv2fpa_converter::display(std::ostream & out) { diff --git a/src/ast/fpa/fpa2bv_converter.cpp b/src/ast/fpa/fpa2bv_converter.cpp index cad3a7c01..af4a330f3 100644 --- a/src/ast/fpa/fpa2bv_converter.cpp +++ b/src/ast/fpa/fpa2bv_converter.cpp @@ -52,7 +52,7 @@ fpa2bv_converter::~fpa2bv_converter() { void fpa2bv_converter::mk_eq(expr * a, expr * b, expr_ref & result) { if (is_float(a) && is_float(b)) { - TRACE("fpa2bv", tout << "mk_eq a=" << mk_ismt2_pp(a, m) << std::endl; + TRACE(fpa2bv, tout << "mk_eq a=" << mk_ismt2_pp(a, m) << std::endl; tout << "mk_eq b=" << mk_ismt2_pp(b, m) << std::endl;); SASSERT(m_util.is_fp(a) && m_util.is_fp(b)); @@ -84,7 +84,7 @@ void fpa2bv_converter::mk_eq(expr * a, expr * b, expr_ref & result) { else if (is_rm(a) && is_rm(b)) { SASSERT(m_util.is_bv2rm(b) && m_util.is_bv2rm(a)); - TRACE("fpa2bv", tout << "mk_eq_rm a=" << mk_ismt2_pp(a, m) << std::endl; + TRACE(fpa2bv, tout << "mk_eq_rm a=" << mk_ismt2_pp(a, m) << std::endl; tout << "mk_eq_rm b=" << mk_ismt2_pp(b, m) << std::endl;); m_simp.mk_eq(to_app(a)->get_arg(0), to_app(b)->get_arg(0), result); @@ -119,7 +119,7 @@ void fpa2bv_converter::mk_ite(expr * c, expr * t, expr * f, expr_ref & result) { else if (m_util.is_rm(t) && m_util.is_rm(f)) { SASSERT(m_util.is_bv2rm(t) && m_util.is_bv2rm(f)); - TRACE("fpa2bv", tout << "ite rm: t=" << mk_ismt2_pp(t, m) << " f=" << mk_ismt2_pp(f, m) << std::endl; ); + TRACE(fpa2bv, tout << "ite rm: t=" << mk_ismt2_pp(t, m) << " f=" << mk_ismt2_pp(f, m) << std::endl; ); m_simp.mk_ite(c, to_app(t)->get_arg(0), to_app(f)->get_arg(0), result); result = m_util.mk_bv2rm(result); } @@ -179,7 +179,7 @@ void fpa2bv_converter::mk_numeral(sort * s, mpf const & v, expr_ref & result) { mk_bias(e, biased_exp); result = m_util.mk_fp(bv_sgn, biased_exp, bv_sig); - TRACE("fpa2bv_dbg", tout << "value of [" << sign << " " << m_mpz_manager.to_string(sig) << " " << exp << "] is " + TRACE(fpa2bv_dbg, tout << "value of [" << sign << " " << m_mpz_manager.to_string(sig) << " " << exp << "] is " << mk_ismt2_pp(result, m) << std::endl;); } } @@ -265,7 +265,7 @@ expr_ref fpa2bv_converter::extra_quantify(expr * e) for (unsigned i = 0; i < nv; i++) { if (uv.contains(i)) { - TRACE("fpa2bv", tout << "uv[" << i << "] = " << mk_ismt2_pp(uv.get(i), m) << std::endl; ); + TRACE(fpa2bv, tout << "uv[" << i << "] = " << mk_ismt2_pp(uv.get(i), m) << std::endl; ); sort * s = uv.get(i); var * v = m.mk_var(i, s); new_decl_sorts.push_back(s); @@ -277,14 +277,14 @@ expr_ref fpa2bv_converter::extra_quantify(expr * e) expr_ref res(m); var_subst vsubst(m); res = vsubst.operator()(e, nv, subst_map.data()); - TRACE("fpa2bv", tout << "subst'd = " << mk_ismt2_pp(res, m) << std::endl; ); + TRACE(fpa2bv, tout << "subst'd = " << mk_ismt2_pp(res, m) << std::endl; ); res = m.mk_forall(nv, new_decl_sorts.data(), new_decl_names.data(), res); return res; } void fpa2bv_converter::mk_uf(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { - TRACE("fpa2bv", tout << "UF: " << mk_ismt2_pp(f, m) << std::endl; ); + TRACE(fpa2bv, tout << "UF: " << mk_ismt2_pp(f, m) << std::endl; ); expr_ref fapp(m); sort_ref rng(m); @@ -321,7 +321,7 @@ void fpa2bv_converter::mk_uf(func_decl * f, unsigned num, expr * const * args, e else result = fapp; - TRACE("fpa2bv", tout << "UF result: " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(fpa2bv, tout << "UF result: " << mk_ismt2_pp(result, m) << std::endl; ); SASSERT(is_well_sorted(m, result)); } @@ -500,7 +500,7 @@ void fpa2bv_converter::add_core(unsigned sbits, unsigned ebits, m_simp.mk_eq(c_sgn, d_sgn, eq_sgn); dbg_decouple("fpa2bv_add_eq_sgn", eq_sgn); - TRACE("fpa2bv_add_core", tout << "EQ_SGN = " << mk_ismt2_pp(eq_sgn, m) << std::endl; ); + TRACE(fpa2bv_add_core, tout << "EQ_SGN = " << mk_ismt2_pp(eq_sgn, m) << std::endl; ); // two extra bits for catching the overflow. c_sig = m_bv_util.mk_zero_extend(2, c_sig); @@ -693,7 +693,7 @@ void fpa2bv_converter::mk_add(sort * s, expr_ref & rm, expr_ref & x, expr_ref & SASSERT(is_well_sorted(m, result)); - TRACE("fpa2bv_add", tout << "ADD = " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(fpa2bv_add, tout << "ADD = " << mk_ismt2_pp(result, m) << std::endl; ); } void fpa2bv_converter::mk_sub(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { @@ -875,7 +875,7 @@ void fpa2bv_converter::mk_mul(sort * s, expr_ref & rm, expr_ref & x, expr_ref & SASSERT(is_well_sorted(m, result)); - TRACE("fpa2bv_mul", tout << "MUL = " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(fpa2bv_mul, tout << "MUL = " << mk_ismt2_pp(result, m) << std::endl; ); } void fpa2bv_converter::mk_div(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { @@ -1044,7 +1044,7 @@ void fpa2bv_converter::mk_div(sort * s, expr_ref & rm, expr_ref & x, expr_ref & SASSERT(is_well_sorted(m, result)); - TRACE("fpa2bv_div", tout << "DIV = " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(fpa2bv_div, tout << "DIV = " << mk_ismt2_pp(result, m) << std::endl; ); } void fpa2bv_converter::mk_rem(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { @@ -1056,7 +1056,7 @@ void fpa2bv_converter::mk_rem(func_decl * f, unsigned num, expr * const * args, } void fpa2bv_converter::mk_rem(sort * s, expr_ref & x, expr_ref & y, expr_ref & result) { - TRACE("fpa2bv_rem", tout << "X = " << mk_ismt2_pp(x, m) << std::endl; + TRACE(fpa2bv_rem, tout << "X = " << mk_ismt2_pp(x, m) << std::endl; tout << "Y = " << mk_ismt2_pp(y, m) << std::endl;); expr_ref nan(m), nzero(m), pzero(m), ninf(m), pinf(m); @@ -1276,7 +1276,7 @@ void fpa2bv_converter::mk_rem(sort * s, expr_ref & x, expr_ref & y, expr_ref & r SASSERT(is_well_sorted(m, result)); - TRACE("fpa2bv_rem", tout << "REM = " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(fpa2bv_rem, tout << "REM = " << mk_ismt2_pp(result, m) << std::endl; ); } void fpa2bv_converter::mk_abs(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { @@ -1811,7 +1811,7 @@ void fpa2bv_converter::mk_fma(func_decl * f, unsigned num, expr * const * args, SASSERT(is_well_sorted(m, result)); - TRACE("fpa2bv_fma_", tout << "FMA = " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(fpa2bv_fma_, tout << "FMA = " << mk_ismt2_pp(result, m) << std::endl; ); } void fpa2bv_converter::mk_sqrt(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { @@ -2225,7 +2225,7 @@ void fpa2bv_converter::mk_round_to_integral(sort * s, expr_ref & rm, expr_ref & SASSERT(is_well_sorted(m, result)); - TRACE("fpa2bv_round_to_integral", tout << "ROUND2INTEGRAL = " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(fpa2bv_round_to_integral, tout << "ROUND2INTEGRAL = " << mk_ismt2_pp(result, m) << std::endl; ); } void fpa2bv_converter::mk_float_eq(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { @@ -2237,7 +2237,7 @@ void fpa2bv_converter::mk_float_eq(func_decl * f, unsigned num, expr * const * a } void fpa2bv_converter::mk_float_eq(sort * s, expr_ref & x, expr_ref & y, expr_ref & result) { - TRACE("fpa2bv_float_eq", tout << "X = " << mk_ismt2_pp(x, m) << std::endl; + TRACE(fpa2bv_float_eq, tout << "X = " << mk_ismt2_pp(x, m) << std::endl; tout << "Y = " << mk_ismt2_pp(y, m) << std::endl;); expr_ref c1(m), c2(m), x_is_nan(m), y_is_nan(m), x_is_zero(m), y_is_zero(m); @@ -2267,7 +2267,7 @@ void fpa2bv_converter::mk_float_eq(sort * s, expr_ref & x, expr_ref & y, expr_re m_simp.mk_ite(c2, m.mk_true(), c3t4, c2else); m_simp.mk_ite(c1, m.mk_false(), c2else, result); - TRACE("fpa2bv_float_eq", tout << "FLOAT_EQ = " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(fpa2bv_float_eq, tout << "FLOAT_EQ = " << mk_ismt2_pp(result, m) << std::endl; ); } void fpa2bv_converter::mk_float_lt(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { @@ -2424,7 +2424,7 @@ void fpa2bv_converter::mk_is_negative(func_decl * f, unsigned num, expr * const mk_is_neg(args[0], t2); nt1 = m.mk_not(t1); result = m.mk_and(nt1, t2); - TRACE("fpa2bv_is_negative", tout << "result = " << mk_ismt2_pp(result, m) << std::endl;); + TRACE(fpa2bv_is_negative, tout << "result = " << mk_ismt2_pp(result, m) << std::endl;); } void fpa2bv_converter::mk_is_positive(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { @@ -2437,7 +2437,7 @@ void fpa2bv_converter::mk_is_positive(func_decl * f, unsigned num, expr * const } void fpa2bv_converter::mk_to_fp(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { - TRACE("fpa2bv_to_fp", for (unsigned i=0; i < num; i++) + TRACE(fpa2bv_to_fp, for (unsigned i=0; i < num; i++) tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl; ); if (num == 1 && @@ -2675,7 +2675,7 @@ void fpa2bv_converter::mk_to_fp_float(sort * to_srt, expr * rm, expr * x, expr_r } void fpa2bv_converter::mk_to_fp_real(func_decl * f, sort * s, expr * rm, expr * x, expr_ref & result) { - TRACE("fpa2bv_to_fp_real", tout << "rm: " << mk_ismt2_pp(rm, m) << std::endl << + TRACE(fpa2bv_to_fp_real, tout << "rm: " << mk_ismt2_pp(rm, m) << std::endl << "x: " << mk_ismt2_pp(x, m) << std::endl;); SASSERT(m_util.is_float(s)); SASSERT(au().is_real(x) || au().is_int(x)); @@ -2815,7 +2815,7 @@ void fpa2bv_converter::mk_to_fp_real(func_decl * f, sort * s, expr * rm, expr * unsigned max_exp = m_mpz_manager.get_uint(max_exp_z); rational max_sig = m_mpf_manager.m_powers2.m1(sbits) / m_mpf_manager.m_powers2(sbits-1); max_real = max_sig * rational(m_mpf_manager.m_powers2(max_exp)); - TRACE("fpa2bv_to_real", tout << "max exp: " << max_exp << " max real: " << max_real << std::endl;); + TRACE(fpa2bv_to_real, tout << "max exp: " << max_exp << " max real: " << max_real << std::endl;); expr_ref r_is_pinf(m), r_is_ninf(m); mk_is_pinf(result, r_is_pinf); @@ -2909,7 +2909,7 @@ void fpa2bv_converter::mk_to_fp_real_int(func_decl * f, unsigned num, expr * con } void fpa2bv_converter::mk_to_real(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { - TRACE("fpa2bv_to_real", for (unsigned i = 0; i < num; i++) + TRACE(fpa2bv_to_real, for (unsigned i = 0; i < num; i++) tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;); SASSERT(num == 1); SASSERT(f->get_num_parameters() == 0); @@ -2989,7 +2989,7 @@ void fpa2bv_converter::mk_to_real(func_decl * f, unsigned num, expr * const * ar res = m.mk_ite(sgn_is_1, minus_res, res); dbg_decouple("fpa2bv_to_real_sig_times_exp2", res); - TRACE("fpa2bv_to_real", tout << "rsig = " << mk_ismt2_pp(rsig, m) << std::endl; + TRACE(fpa2bv_to_real, tout << "rsig = " << mk_ismt2_pp(rsig, m) << std::endl; tout << "exp2 = " << mk_ismt2_pp(exp2, m) << std::endl;); expr_ref unspec(m); @@ -3002,7 +3002,7 @@ void fpa2bv_converter::mk_to_real(func_decl * f, unsigned num, expr * const * ar } void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { - TRACE("fpa2bv_to_fp_signed", for (unsigned i = 0; i < num; i++) + TRACE(fpa2bv_to_fp_signed, for (unsigned i = 0; i < num; i++) tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;); // This is a conversion from signed bitvector to float: @@ -3107,7 +3107,7 @@ void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const // exp < bv_sz (+sign bit which is [0]) unsigned exp_worst_case_sz = (unsigned)((log((double)bv_sz) / log((double)2)) + 1.0); - TRACE("fpa2bv_to_fp_signed", tout << "exp worst case sz: " << exp_worst_case_sz << std::endl;); + TRACE(fpa2bv_to_fp_signed, tout << "exp worst case sz: " << exp_worst_case_sz << std::endl;); if (exp_sz <= exp_worst_case_sz) { // exp_sz < exp_worst_case_sz and exp >= 0. @@ -3145,7 +3145,7 @@ void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const } void fpa2bv_converter::mk_to_fp_unsigned(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { - TRACE("fpa2bv_to_fp_unsigned", for (unsigned i = 0; i < num; i++) + TRACE(fpa2bv_to_fp_unsigned, for (unsigned i = 0; i < num; i++) tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;); // This is a conversion from unsigned bitvector to float: @@ -3289,7 +3289,7 @@ void fpa2bv_converter::mk_to_ieee_bv(func_decl * f, unsigned num, expr * const * join_fp(x, sgn_e_s); m_simp.mk_ite(x_is_nan, unspec, sgn_e_s, result); - TRACE("fpa2bv_to_ieee_bv", tout << "result=" << mk_ismt2_pp(result, m) << std::endl;); + TRACE(fpa2bv_to_ieee_bv, tout << "result=" << mk_ismt2_pp(result, m) << std::endl;); SASSERT(is_well_sorted(m, result)); } @@ -3321,7 +3321,7 @@ void fpa2bv_converter::mk_to_ieee_bv_unspecified(func_decl * f, unsigned num, ex m_extra_assertions.push_back(std::move(sig_is_non_zero)); } - TRACE("fpa2bv_to_ieee_bv_unspecified", tout << "result=" << mk_ismt2_pp(result, m) << std::endl;); + TRACE(fpa2bv_to_ieee_bv_unspecified, tout << "result=" << mk_ismt2_pp(result, m) << std::endl;); SASSERT(is_well_sorted(m, result)); } @@ -3332,7 +3332,7 @@ void fpa2bv_converter::mk_to_ieee_bv_i(func_decl * f, unsigned num, expr * const } void fpa2bv_converter::mk_to_bv(func_decl * f, unsigned num, expr * const * args, bool is_signed, expr_ref & result) { - TRACE("fpa2bv_to_bv", for (unsigned i = 0; i < num; i++) + TRACE(fpa2bv_to_bv, for (unsigned i = 0; i < num; i++) tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;); SASSERT(num == 2); @@ -3502,13 +3502,13 @@ void fpa2bv_converter::mk_to_bv(func_decl * f, unsigned num, expr * const * args } void fpa2bv_converter::mk_to_ubv(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { - TRACE("fpa2bv_to_ubv", for (unsigned i = 0; i < num; i++) + TRACE(fpa2bv_to_ubv, for (unsigned i = 0; i < num; i++) tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;); mk_to_bv(f, num, args, false, result); } void fpa2bv_converter::mk_to_sbv(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { - TRACE("fpa2bv_to_sbv", for (unsigned i = 0; i < num; i++) + TRACE(fpa2bv_to_sbv, for (unsigned i = 0; i < num; i++) tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;); mk_to_bv(f, num, args, true, result); } @@ -3549,7 +3549,7 @@ void fpa2bv_converter::mk_to_bv_unspecified(func_decl * f, unsigned num, expr * result = m.mk_app(f_bv, rm_bv, nw); } - TRACE("fpa2bv_to_bv_unspecified", tout << "result=" << mk_ismt2_pp(result, m) << std::endl;); + TRACE(fpa2bv_to_bv_unspecified, tout << "result=" << mk_ismt2_pp(result, m) << std::endl;); SASSERT(is_well_sorted(m, result)); } @@ -3578,7 +3578,7 @@ void fpa2bv_converter::mk_fp(func_decl * f, unsigned num, expr * const * args, e SASSERT(m_util.get_sbits(f->get_range()) == m_bv_util.get_bv_size(args[2]) + 1); SASSERT(m_util.get_ebits(f->get_range()) == m_bv_util.get_bv_size(args[1])); result = m_util.mk_fp(args[0], args[1], args[2]); - TRACE("fpa2bv_mk_fp", tout << "mk_fp result = " << mk_ismt2_pp(result, m) << std::endl;); + TRACE(fpa2bv_mk_fp, tout << "mk_fp result = " << mk_ismt2_pp(result, m) << std::endl;); } void fpa2bv_converter::split_fp(expr * e, expr_ref & sgn, expr_ref & exp, expr_ref & sig) const { @@ -3906,9 +3906,9 @@ void fpa2bv_converter::unpack(expr * e, expr_ref & sgn, expr_ref & sig, expr_ref SASSERT(m_bv_util.get_bv_size(sig) == sbits); SASSERT(m_bv_util.get_bv_size(exp) == ebits); - TRACE("fpa2bv_unpack", tout << "UNPACK SGN = " << mk_ismt2_pp(sgn, m) << std::endl; ); - TRACE("fpa2bv_unpack", tout << "UNPACK SIG = " << mk_ismt2_pp(sig, m) << std::endl; ); - TRACE("fpa2bv_unpack", tout << "UNPACK EXP = " << mk_ismt2_pp(exp, m) << std::endl; ); + TRACE(fpa2bv_unpack, tout << "UNPACK SGN = " << mk_ismt2_pp(sgn, m) << std::endl; ); + TRACE(fpa2bv_unpack, tout << "UNPACK SIG = " << mk_ismt2_pp(sig, m) << std::endl; ); + TRACE(fpa2bv_unpack, tout << "UNPACK EXP = " << mk_ismt2_pp(exp, m) << std::endl; ); } void fpa2bv_converter::mk_rounding_mode(decl_kind k, expr_ref & result) @@ -4025,7 +4025,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref & SASSERT(is_well_sorted(m, sig)); SASSERT(is_well_sorted(m, exp)); - TRACE("fpa2bv_dbg", tout << "RND: " << std::endl << + TRACE(fpa2bv_dbg, tout << "RND: " << std::endl << "ebits = " << ebits << std::endl << "sbits = " << sbits << std::endl << "sgn = " << mk_ismt2_pp(sgn, m) << std::endl << @@ -4048,7 +4048,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref & mk_min_exp(ebits, e_min); mk_max_exp(ebits, e_max); - TRACE("fpa2bv_dbg", tout << "e_min = " << mk_ismt2_pp(e_min, m) << std::endl; + TRACE(fpa2bv_dbg, tout << "e_min = " << mk_ismt2_pp(e_min, m) << std::endl; tout << "e_max = " << mk_ismt2_pp(e_max, m) << std::endl;); expr_ref OVF1(m), e_top_three(m), sigm1(m), e_eq_emax_and_sigm1(m), e_eq_emax(m); @@ -4074,7 +4074,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref & dbg_decouple("fpa2bv_rnd_OVF1", OVF1); - TRACE("fpa2bv_dbg", tout << "OVF1 = " << mk_ismt2_pp(OVF1, m) << std::endl;); + TRACE(fpa2bv_dbg, tout << "OVF1 = " << mk_ismt2_pp(OVF1, m) << std::endl;); SASSERT(is_well_sorted(m, OVF1)); expr_ref lz(m); @@ -4082,7 +4082,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref & dbg_decouple("fpa2bv_rnd_lz", lz); - TRACE("fpa2bv_dbg", tout << "LZ = " << mk_ismt2_pp(lz, m) << std::endl;); + TRACE(fpa2bv_dbg, tout << "LZ = " << mk_ismt2_pp(lz, m) << std::endl;); expr_ref t(m); t = m_bv_util.mk_bv_add(exp, m_bv_util.mk_numeral(1, ebits+2)); @@ -4092,13 +4092,13 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref & expr_ref TINY(m); TINY = m_bv_util.mk_sle(t, m_bv_util.mk_numeral(rational(-1), ebits+2)); dbg_decouple("fpa2bv_rnd_TINY", TINY); - TRACE("fpa2bv_dbg", tout << "TINY = " << mk_ismt2_pp(TINY, m) << std::endl;); + TRACE(fpa2bv_dbg, tout << "TINY = " << mk_ismt2_pp(TINY, m) << std::endl;); SASSERT(is_well_sorted(m, TINY)); expr_ref beta(m); beta = m_bv_util.mk_bv_add(m_bv_util.mk_bv_sub(exp, lz), m_bv_util.mk_numeral(1, ebits+2)); - TRACE("fpa2bv_dbg", tout << "beta = " << mk_ismt2_pp(beta, m) << std::endl; ); + TRACE(fpa2bv_dbg, tout << "beta = " << mk_ismt2_pp(beta, m) << std::endl; ); SASSERT(is_well_sorted(m, beta)); dbg_decouple("fpa2bv_rnd_beta", beta); @@ -4112,7 +4112,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref & dbg_decouple("fpa2bv_rnd_sigma", sigma); - TRACE("fpa2bv_dbg", tout << "Shift distance: " << mk_ismt2_pp(sigma, m) << std::endl;); + TRACE(fpa2bv_dbg, tout << "Shift distance: " << mk_ismt2_pp(sigma, m) << std::endl;); SASSERT(is_well_sorted(m, sigma)); // Normalization shift @@ -4173,7 +4173,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref & round = m_bv_util.mk_extract(1, 1, sig); last = m_bv_util.mk_extract(2, 2, sig); - TRACE("fpa2bv_dbg", tout << "sticky = " << mk_ismt2_pp(sticky, m) << std::endl;); + TRACE(fpa2bv_dbg, tout << "sticky = " << mk_ismt2_pp(sticky, m) << std::endl;); dbg_decouple("fpa2bv_rnd_sticky", sticky); dbg_decouple("fpa2bv_rnd_round", round); @@ -4320,7 +4320,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref & result = m_util.mk_fp(res_sgn, res_exp, res_sig); - TRACE("fpa2bv_round", tout << "ROUND = " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(fpa2bv_round, tout << "ROUND = " << mk_ismt2_pp(result, m) << std::endl; ); } void fpa2bv_converter::reset() { @@ -4347,7 +4347,7 @@ func_decl * fpa2bv_converter::mk_bv_uf(func_decl * f, sort * const * domain, sor m.inc_ref(f); m.inc_ref(res); m_uf2bvuf.insert(f, res); - TRACE("fpa2bv", tout << "New UF func_decl: " << res->get_id() << std::endl << mk_ismt2_pp(res, m) << std::endl;); + TRACE(fpa2bv, tout << "New UF func_decl: " << res->get_id() << std::endl << mk_ismt2_pp(res, m) << std::endl;); } return res; } @@ -4472,7 +4472,7 @@ expr* fpa2bv_converter_wrapped::bv2rm_value(expr* b) { default: result = m_util.mk_round_toward_zero(); } - TRACE("t_fpa", tout << "result: " << mk_ismt2_pp(result, m) << std::endl;); + TRACE(t_fpa, tout << "result: " << mk_ismt2_pp(result, m) << std::endl;); return result; } @@ -4539,7 +4539,7 @@ expr* fpa2bv_converter_wrapped::bv2fpa_value(sort* s, expr* a, expr* b, expr* c) mpfm.set(f, ebits, sbits, mpzm.is_one(sgn_z), mpzm.get_int64(exp_u), sig_z); result = m_util.mk_value(f); - TRACE("t_fpa", tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << " result: [" << + TRACE(t_fpa, tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << " result: [" << mpzm.to_string(sgn_z) << "," << mpzm.to_string(exp_z) << "," << mpzm.to_string(sig_z) << "] --> " << diff --git a/src/ast/fpa/fpa2bv_rewriter.cpp b/src/ast/fpa/fpa2bv_rewriter.cpp index 88fde8b67..bba7adb60 100644 --- a/src/ast/fpa/fpa2bv_rewriter.cpp +++ b/src/ast/fpa/fpa2bv_rewriter.cpp @@ -54,7 +54,7 @@ bool fpa2bv_rewriter_cfg::max_steps_exceeded(unsigned num_steps) const { br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) { - TRACE("fpa2bv_rw", tout << "func: " << f->get_name() << std::endl; + TRACE(fpa2bv_rw, tout << "func: " << f->get_name() << std::endl; tout << "args: " << std::endl; for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << std::endl;); @@ -71,7 +71,7 @@ br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * co if (m().is_eq(f)) { SASSERT(num == 2); - TRACE("fpa2bv_rw", tout << "(= " << mk_ismt2_pp(args[0], m()) << " " << + TRACE(fpa2bv_rw, tout << "(= " << mk_ismt2_pp(args[0], m()) << " " << mk_ismt2_pp(args[1], m()) << ")" << std::endl;); SASSERT(args[0]->get_sort() == args[1]->get_sort()); sort * ds = f->get_domain()[0]; @@ -158,7 +158,7 @@ br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * co return BR_FAILED; default: - TRACE("fpa2bv", tout << "unsupported operator: " << f->get_name() << "\n"; + TRACE(fpa2bv, tout << "unsupported operator: " << f->get_name() << "\n"; for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << std::endl;); NOT_IMPLEMENTED_YET(); } @@ -177,11 +177,11 @@ br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * co bool fpa2bv_rewriter_cfg::pre_visit(expr * t) { - TRACE("fpa2bv", tout << "pre_visit: " << mk_ismt2_pp(t, m()) << std::endl;); + TRACE(fpa2bv, tout << "pre_visit: " << mk_ismt2_pp(t, m()) << std::endl;); if (is_quantifier(t)) { quantifier * q = to_quantifier(t); - TRACE("fpa2bv", tout << "pre_visit quantifier [" << q->get_id() << "]: " << mk_ismt2_pp(q->get_expr(), m()) << std::endl;); + TRACE(fpa2bv, tout << "pre_visit quantifier [" << q->get_id() << "]: " << mk_ismt2_pp(q->get_expr(), m()) << std::endl;); sort_ref_vector new_bindings(m_manager); for (unsigned i = 0 ; i < q->get_num_decls(); i++) new_bindings.push_back(q->get_decl_sort(i)); @@ -239,7 +239,7 @@ bool fpa2bv_rewriter_cfg::reduce_quantifier( result_pr = m().mk_rewrite(old_q, result); } m_bindings.shrink(old_sz); - TRACE("fpa2bv", tout << "reduce_quantifier[" << old_q->get_depth() << "]: " << + TRACE(fpa2bv, tout << "reduce_quantifier[" << old_q->get_depth() << "]: " << mk_ismt2_pp(old_q->get_expr(), m()) << std::endl << " new body: " << mk_ismt2_pp(new_body, m()) << std::endl; tout << "result = " << mk_ismt2_pp(result, m()) << std::endl;); @@ -272,14 +272,14 @@ bool fpa2bv_rewriter_cfg::reduce_var(var * t, expr_ref & result, proof_ref & res result = new_exp; result_pr = nullptr; - TRACE("fpa2bv", tout << "reduce_var: " << mk_ismt2_pp(t, m()) << " -> " << mk_ismt2_pp(result, m()) << std::endl;); + TRACE(fpa2bv, tout << "reduce_var: " << mk_ismt2_pp(t, m()) << " -> " << mk_ismt2_pp(result, m()) << std::endl;); return true; } template class rewriter_tpl; expr_ref fpa2bv_rewriter::convert_atom(th_rewriter& rw, expr * e) { - TRACE("t_fpa_detail", tout << "converting atom: " << mk_ismt2_pp(e, m_cfg.m()) << std::endl;); + TRACE(t_fpa_detail, tout << "converting atom: " << mk_ismt2_pp(e, m_cfg.m()) << std::endl;); expr_ref res(m_cfg.m()); proof_ref pr(m_cfg.m()); (*this)(e, res); @@ -298,7 +298,7 @@ expr_ref fpa2bv_rewriter::convert_term(th_rewriter& rw, expr * e) { (*this)(e, e_conv); - TRACE("t_fpa_detail", tout << "term: " << mk_ismt2_pp(e, m) << std::endl; + TRACE(t_fpa_detail, tout << "term: " << mk_ismt2_pp(e, m) << std::endl; tout << "converted term: " << mk_ismt2_pp(e_conv, m) << std::endl;); if (fu().is_rm(e)) { @@ -334,7 +334,7 @@ expr_ref fpa2bv_rewriter::convert_conversion_term(th_rewriter& rw, expr * e) { expr_ref fpa2bv_rewriter::convert(th_rewriter& rw, expr * e) { ast_manager& m = m_cfg.m(); expr_ref res(m); - TRACE("t_fpa", tout << "converting " << mk_ismt2_pp(e, m) << std::endl;); + TRACE(t_fpa, tout << "converting " << mk_ismt2_pp(e, m) << std::endl;); if (fu().is_fp(e)) res = e; @@ -345,7 +345,7 @@ expr_ref fpa2bv_rewriter::convert(th_rewriter& rw, expr * e) { else res = convert_conversion_term(rw, e); - TRACE("t_fpa_detail", tout << "converted; caching:" << std::endl; + TRACE(t_fpa_detail, tout << "converted; caching:" << std::endl; tout << mk_ismt2_pp(e, m) << std::endl << " -> " << std::endl << mk_ismt2_pp(res, m) << std::endl;); diff --git a/src/ast/fpa_decl_plugin.cpp b/src/ast/fpa_decl_plugin.cpp index 3bdc19d5e..ac6e79f63 100644 --- a/src/ast/fpa_decl_plugin.cpp +++ b/src/ast/fpa_decl_plugin.cpp @@ -1065,7 +1065,7 @@ bool fpa_util::contains_floats(ast * a) { } bool fpa_util::is_considered_uninterpreted(func_decl * f, unsigned n, expr* const* args) { - TRACE("fpa_util", expr_ref t(m().mk_app(f, n, args), m()); tout << mk_ismt2_pp(t, m()) << std::endl; ); + TRACE(fpa_util, expr_ref t(m().mk_app(f, n, args), m()); tout << mk_ismt2_pp(t, m()) << std::endl; ); family_id ffid = plugin().get_family_id(); if (f->get_family_id() != ffid) diff --git a/src/ast/macros/macro_finder.cpp b/src/ast/macros/macro_finder.cpp index a715d1241..9bf1d91ea 100644 --- a/src/ast/macros/macro_finder.cpp +++ b/src/ast/macros/macro_finder.cpp @@ -25,7 +25,7 @@ Revision History: bool macro_finder::is_macro(expr * n, app_ref & head, expr_ref & def) { if (!is_forall(n)) return false; - TRACE("macro_finder", tout << "processing: " << mk_pp(n, m) << "\n";); + TRACE(macro_finder, tout << "processing: " << mk_pp(n, m) << "\n";); expr * body = to_quantifier(n)->get_expr(); unsigned num_decls = to_quantifier(n)->get_num_decls(); return m_util.is_simple_macro(body, num_decls, head, def); @@ -89,7 +89,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, bool deps_valid, expr_de } // is ge or le // - TRACE("macro_finder", tout << "is_arith_macro: is_ge or is_le " << f->get_name() << "\n";); + TRACE(macro_finder, tout << "is_arith_macro: is_ge or is_le " << f->get_name() << "\n";); func_decl * k = m.mk_fresh_func_decl(f->get_name(), symbol::null, f->get_arity(), f->get_domain(), f->get_range()); app * k_app = m.mk_app(k, head->get_num_args(), head->get_args()); expr_ref_buffer new_rhs_args(m); @@ -161,7 +161,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, vector& } // is ge or le // - TRACE("macro_finder", tout << "is_arith_macro: is_ge or is_le\n";); + TRACE(macro_finder, tout << "is_arith_macro: is_ge or is_le\n";); func_decl * k = m.mk_fresh_func_decl(f->get_name(), symbol::null, f->get_arity(), f->get_domain(), f->get_range()); app * k_app = m.mk_app(k, head->get_num_args(), head->get_args()); expr_ref_buffer new_rhs_args(m); @@ -270,7 +270,7 @@ macro_finder::macro_finder(ast_manager & m, macro_manager & mm): } bool macro_finder::expand_macros(expr_ref_vector const& exprs, proof_ref_vector const& prs, expr_dependency_ref_vector const& deps, expr_ref_vector & new_exprs, proof_ref_vector & new_prs, expr_dependency_ref_vector & new_deps) { - TRACE("macro_finder", tout << "starting expand_macros:\n"; + TRACE(macro_finder, tout << "starting expand_macros:\n"; m_macro_manager.display(tout);); bool found_new_macro = false; unsigned num = exprs.size(); @@ -286,15 +286,15 @@ bool macro_finder::expand_macros(expr_ref_vector const& exprs, proof_ref_vector m_macro_manager.expand_macros(n, pr, dep, new_n, new_pr, new_dep); app_ref head(m), t(m); if (is_macro(new_n, head, def) && m_macro_manager.insert(head->get_decl(), to_quantifier(new_n.get()), new_pr, new_dep)) { - TRACE("macro_finder", tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";); + TRACE(macro_finder, tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";); found_new_macro = true; } else if (is_arith_macro(new_n, new_pr, deps_valid, new_dep, new_exprs, new_prs, new_deps)) { - TRACE("macro_finder", tout << "found new arith macro:\n" << new_n << "\n";); + TRACE(macro_finder, tout << "found new arith macro:\n" << new_n << "\n";); found_new_macro = true; } else if (m_util.is_pseudo_predicate_macro(new_n, head, t, def)) { - TRACE("macro_finder", tout << "found new pseudo macro:\n" << head->get_decl()->get_name() << "\n" << t << "\n" << def << "\n";); + TRACE(macro_finder, tout << "found new pseudo macro:\n" << head->get_decl()->get_name() << "\n" << t << "\n" << def << "\n";); pseudo_predicate_macro2macro(m, head, t, def, to_quantifier(new_n), new_pr, deps_valid, new_dep, new_exprs, new_prs, new_deps); found_new_macro = true; } @@ -313,7 +313,7 @@ bool macro_finder::expand_macros(expr_ref_vector const& exprs, proof_ref_vector } void macro_finder::operator()(expr_ref_vector const& exprs, proof_ref_vector const & prs, expr_dependency_ref_vector const & deps, expr_ref_vector & new_exprs, proof_ref_vector & new_prs, expr_dependency_ref_vector & new_deps) { - TRACE("macro_finder", tout << "processing macros...\n";); + TRACE(macro_finder, tout << "processing macros...\n";); expr_ref_vector _new_exprs(m); proof_ref_vector _new_prs(m); expr_dependency_ref_vector _new_deps(m); @@ -342,7 +342,7 @@ void macro_finder::operator()(expr_ref_vector const& exprs, proof_ref_vector con bool macro_finder::expand_macros(unsigned num, justified_expr const * fmls, vector& new_fmls) { - TRACE("macro_finder", tout << "starting expand_macros:\n"; + TRACE(macro_finder, tout << "starting expand_macros:\n"; m_macro_manager.display(tout);); bool found_new_macro = false; for (unsigned i = 0; i < num; i++) { @@ -354,15 +354,15 @@ bool macro_finder::expand_macros(unsigned num, justified_expr const * fmls, vect m_macro_manager.expand_macros(n, pr, nullptr, new_n, new_pr, new_dep); app_ref head(m), t(m); if (is_macro(new_n, head, def) && m_macro_manager.insert(head->get_decl(), to_quantifier(new_n.get()), new_pr)) { - TRACE("macro_finder", tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";); + TRACE(macro_finder, tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";); found_new_macro = true; } else if (is_arith_macro(new_n, new_pr, new_fmls)) { - TRACE("macro_finder", tout << "found new arith macro:\n" << new_n << "\n";); + TRACE(macro_finder, tout << "found new arith macro:\n" << new_n << "\n";); found_new_macro = true; } else if (m_util.is_pseudo_predicate_macro(new_n, head, t, def)) { - TRACE("macro_finder", tout << "found new pseudo macro:\n" << head << "\n" << t << "\n" << def << "\n";); + TRACE(macro_finder, tout << "found new pseudo macro:\n" << head << "\n" << t << "\n" << def << "\n";); pseudo_predicate_macro2macro(m, head, t, def, to_quantifier(new_n), new_pr, new_fmls); found_new_macro = true; } @@ -384,7 +384,7 @@ void macro_finder::revert_unsafe_macros(vector& new_fmls) { void macro_finder::operator()(unsigned n, justified_expr const* fmls, vector& new_fmls) { m_macro_manager.unsafe_macros().reset(); - TRACE("macro_finder", tout << "processing macros...\n";); + TRACE(macro_finder, tout << "processing macros...\n";); vector _new_fmls; if (expand_macros(n, fmls, _new_fmls)) { while (true) { diff --git a/src/ast/macros/macro_manager.cpp b/src/ast/macros/macro_manager.cpp index d47072ebb..4c6d60275 100644 --- a/src/ast/macros/macro_manager.cpp +++ b/src/ast/macros/macro_manager.cpp @@ -114,11 +114,11 @@ void macro_manager::copy_to(macro_manager& dst) { } bool macro_manager::insert(func_decl * f, quantifier * q, proof * pr, expr_dependency* dep) { - TRACE("macro_insert", tout << "trying to create macro: " << f->get_name() << "\n" << mk_pp(q, m) << "\n";); + TRACE(macro_insert, tout << "trying to create macro: " << f->get_name() << "\n" << mk_pp(q, m) << "\n";); // if we already have a macro for f then return false; if (m_decls.contains(f)) { - TRACE("macro_insert", tout << "we already have a macro for: " << f->get_name() << "\n";); + TRACE(macro_insert, tout << "we already have a macro for: " << f->get_name() << "\n";); return false; } @@ -145,7 +145,7 @@ bool macro_manager::insert(func_decl * f, quantifier * q, proof * pr, expr_depen m_macro_deps.push_back(dep); m_decl2macro_dep.insert(f, dep); - TRACE("macro_insert", tout << "A macro was successfully created for: " << f->get_name() << "\n";); + TRACE(macro_insert, tout << "A macro was successfully created for: " << f->get_name() << "\n";); // Nothing's forbidden anymore; if something's bad, we detected it earlier. // mark_forbidden(m->get_expr()); @@ -223,7 +223,7 @@ func_decl * macro_manager::get_macro_interpretation(unsigned i, expr_ref & inter expr_ref def(m); bool r; get_head_def(q, f, head, def, r); - TRACE("macro_bug", + TRACE(macro_bug, tout << f->get_name() << "\n" << mk_pp(head, m) << "\n" << mk_pp(q, m) << "\n";); m_util.mk_macro_interpretation(head, q->get_num_decls(), def, interp); return f; @@ -290,7 +290,7 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg { app * n = to_app(_n); quantifier * q = nullptr; func_decl * d = n->get_decl(), *d2 = nullptr; - TRACE("macro_manager", tout << "trying to expand:\n" << mk_pp(n, m) << "\nd:\n" << d->get_name() << "\n";); + TRACE(macro_manager, tout << "trying to expand:\n" << mk_pp(n, m) << "\nd:\n" << d->get_name() << "\n";); if (mm.m_decl2macro.find(d, q)) { app * head = nullptr; expr_ref def(m); @@ -298,7 +298,7 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg { mm.get_head_def(q, d, head, def, revert); unsigned num = n->get_num_args(); SASSERT(head && def); - TRACE("macro_manager", tout << "expanding: " << mk_pp(n, m) << "\n" << mk_pp(head, m) << " " << mk_pp(def, m) << "\n";); + TRACE(macro_manager, tout << "expanding: " << mk_pp(n, m) << "\n" << mk_pp(head, m) << " " << mk_pp(def, m) << "\n";); ptr_buffer subst_args; subst_args.resize(num, 0); for (unsigned i = 0; i < num; i++) { @@ -377,7 +377,7 @@ void macro_manager::expand_macros(expr * n, proof * pr, expr_dependency * dep, e macro_expander_rw proc(m, *this); proof_ref n_eq_r_pr(m); SASSERT(!old_pr || m.get_fact(old_pr) == old_n); - TRACE("macro_manager_bug", tout << "expand_macros:\n" << mk_pp(n, m) << "\n";); + TRACE(macro_manager_bug, tout << "expand_macros:\n" << mk_pp(n, m) << "\n";); proc(old_n, r, n_eq_r_pr); new_pr = m.mk_modus_ponens(old_pr, n_eq_r_pr); new_dep = m.mk_join(old_dep, proc.m_cfg.m_used_macro_dependencies); diff --git a/src/ast/macros/macro_util.cpp b/src/ast/macros/macro_util.cpp index f7377061b..cf4ac6dcf 100644 --- a/src/ast/macros/macro_util.cpp +++ b/src/ast/macros/macro_util.cpp @@ -312,7 +312,7 @@ bool macro_util::is_arith_macro(expr * n, unsigned num_decls, app_ref & head, ex mk_sub(tmp, rhs, def); else mk_sub(rhs, tmp, def); - TRACE("macro_util", tout << def << "\n";); + TRACE(macro_util, tout << def << "\n";); return true; } @@ -351,7 +351,7 @@ bool macro_util::is_pseudo_head(expr * n, unsigned num_decls, app_ref & head, ap bool macro_util::is_pseudo_predicate_macro(expr * n, app_ref & head, app_ref & t, expr_ref & def) { if (!is_forall(n)) return false; - TRACE("macro_util", tout << "processing: " << mk_pp(n, m) << "\n";); + TRACE(macro_util, tout << "processing: " << mk_pp(n, m) << "\n";); expr * body = to_quantifier(n)->get_expr(); unsigned num_decls = to_quantifier(n)->get_num_decls(); expr * lhs, *rhs; @@ -483,7 +483,7 @@ void macro_util::quasi_macro_head_to_macro_head(app * qhead, unsigned & num_decl See normalize_expr */ void macro_util::mk_macro_interpretation(app * head, unsigned num_decls, expr * def, expr_ref & interp) const { - TRACE("macro_util", tout << mk_pp(head, m) << "\n" << mk_pp(def, m) << "\n";); + TRACE(macro_util, tout << mk_pp(head, m) << "\n" << mk_pp(def, m) << "\n";); SASSERT(is_macro_head(head, head->get_num_args()) || is_quasi_macro_ok(head, head->get_num_args(), def)); SASSERT(!occurs(head->get_decl(), def)); @@ -505,7 +505,7 @@ void macro_util::normalize_expr(app * head, unsigned num_decls, expr * t, expr_r var_mapping.resize(num_decls); bool changed = false; unsigned num_args = head->get_num_args(); - TRACE("macro_util", + TRACE(macro_util, tout << "head: " << mk_pp(head, m) << "\n"; tout << "applying substitution to:\n" << mk_bounded_pp(t, m) << "\n";); for (unsigned i = 0; i < num_args; i++) { @@ -524,7 +524,7 @@ void macro_util::normalize_expr(app * head, unsigned num_decls, expr * t, expr_r if (changed) { // REMARK: t may have nested quantifiers... So, I must use the std order for variable substitution. var_subst subst(m, true); - TRACE("macro_util", + TRACE(macro_util, tout << "head: " << mk_pp(head, m) << "\n"; tout << "applying substitution to:\n" << mk_ll_pp(t, m) << "\nsubstitution:\n"; for (unsigned i = 0; i < var_mapping.size(); i++) { @@ -633,12 +633,12 @@ void hint_to_macro_head(ast_manager & m, app * head, unsigned & num_decls, app_r is_hint_head(head, vars) must also return true */ bool macro_util::is_poly_hint(expr * n, app * head, expr * exception) { - TRACE("macro_util", tout << "is_poly_hint n:\n" << mk_pp(n, m) << "\nhead:\n" << mk_pp(head, m) << "\nexception:\n"; + TRACE(macro_util, tout << "is_poly_hint n:\n" << mk_pp(n, m) << "\nhead:\n" << mk_pp(head, m) << "\nexception:\n"; if (exception) tout << mk_pp(exception, m); else tout << ""; tout << "\n";); ptr_buffer vars; if (!is_hint_head(head, vars)) { - TRACE("macro_util", tout << "failed because head is not hint head\n";); + TRACE(macro_util, tout << "failed because head is not hint head\n";); return false; } func_decl * f = head->get_decl(); @@ -655,11 +655,11 @@ bool macro_util::is_poly_hint(expr * n, app * head, expr * exception) { for (unsigned i = 0; i < num_args; i++) { expr * arg = args[i]; if (arg != exception && (occurs(f, arg) || !vars_of_is_subset(arg, vars))) { - TRACE("macro_util", tout << "failed because of:\n" << mk_pp(arg, m) << "\n";); + TRACE(macro_util, tout << "failed because of:\n" << mk_pp(arg, m) << "\n";); return false; } } - TRACE("macro_util", tout << "succeeded\n";); + TRACE(macro_util, tout << "succeeded\n";); return true; } @@ -714,7 +714,7 @@ void macro_util::insert_macro(app * head, unsigned num_decls, expr * def, expr * void macro_util::insert_quasi_macro(app * head, unsigned num_decls, expr * def, expr * cond, bool ineq, bool satisfy_atom, bool hint, macro_candidates & r) { - TRACE("macro_util", tout << expr_ref(head, m) << "\n";); + TRACE(macro_util, tout << expr_ref(head, m) << "\n";); if (!is_macro_head(head, head->get_num_args())) { app_ref new_head(m); expr_ref extra_cond(m); @@ -728,7 +728,7 @@ void macro_util::insert_quasi_macro(app * head, unsigned num_decls, expr * def, } else { hint_to_macro_head(m, head, num_decls, new_head); - TRACE("macro_util", + TRACE(macro_util, tout << "hint macro head: " << mk_ismt2_pp(new_head, m) << std::endl; tout << "hint macro def: " << mk_ismt2_pp(def, m) << std::endl; ); } @@ -863,7 +863,7 @@ void macro_util::collect_arith_macro_candidates(expr * lhs, expr * rhs, expr * a } void macro_util::collect_arith_macro_candidates(expr * atom, unsigned num_decls, macro_candidates & r) { - TRACE("macro_util", tout << "collect_arith_macro_candidates:\n" << mk_pp(atom, m) << "\n";); + TRACE(macro_util, tout << "collect_arith_macro_candidates:\n" << mk_pp(atom, m) << "\n";); if (!m.is_eq(atom) && !is_le_ge(atom)) return; expr * lhs = to_app(atom)->get_arg(0); @@ -912,7 +912,7 @@ void macro_util::collect_arith_macro_candidates(expr * atom, unsigned num_decls, void macro_util::collect_macro_candidates_core(expr * atom, unsigned num_decls, macro_candidates & r) { expr* lhs, *rhs; - TRACE("macro_util", tout << "Candidate check for: " << mk_ismt2_pp(atom, m) << std::endl;); + TRACE(macro_util, tout << "Candidate check for: " << mk_ismt2_pp(atom, m) << std::endl;); auto insert_quasi = [&](expr* lhs, expr* rhs) { if (is_quasi_macro_head(lhs, num_decls) && diff --git a/src/ast/macros/quasi_macros.cpp b/src/ast/macros/quasi_macros.cpp index 254baa8b8..8a3d9a76a 100644 --- a/src/ast/macros/quasi_macros.cpp +++ b/src/ast/macros/quasi_macros.cpp @@ -157,7 +157,7 @@ bool quasi_macros::is_quasi_macro(expr * e, app_ref & a, expr_ref & t) const { // Our definition of a quasi-macro: // Forall X. f[X] = T[X], where f[X] is a term starting with symbol f, f is uninterpreted, // f[X] contains all universally quantified variables, and f does not occur in T[X]. - TRACE("quasi_macros", tout << "Checking for quasi macro: " << mk_pp(e, m) << std::endl;); + TRACE(quasi_macros, tout << "Checking for quasi macro: " << mk_pp(e, m) << std::endl;); if (is_forall(e)) { quantifier * q = to_quantifier(e); @@ -273,7 +273,7 @@ bool quasi_macros::quasi_macro_to_macro(quantifier * q, app * a, expr * t, quant } bool quasi_macros::find_macros(unsigned n, expr * const * exprs) { - TRACE("quasi_macros", tout << "Finding quasi-macros in: " << std::endl; + TRACE(quasi_macros, tout << "Finding quasi-macros in: " << std::endl; for (unsigned i = 0 ; i < n ; i++) tout << i << ": " << mk_pp(exprs[i], m) << std::endl; ); bool res = false; @@ -284,7 +284,7 @@ bool quasi_macros::find_macros(unsigned n, expr * const * exprs) { for (unsigned i = 0 ; i < n ; i++) find_occurrences(exprs[i]); - TRACE("quasi_macros", + TRACE(quasi_macros, tout << "Occurrences: " << std::endl; for (auto & kd : m_occurrences) tout << kd.m_key->get_name() << ": " << kd.m_value << std::endl; ); @@ -296,7 +296,7 @@ bool quasi_macros::find_macros(unsigned n, expr * const * exprs) { quantifier_ref macro(m); if (is_quasi_macro(exprs[i], a, t) && quasi_macro_to_macro(to_quantifier(exprs[i]), a, t, macro)) { - TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i], m) << std::endl; + TRACE(quasi_macros, tout << "Found quasi macro: " << mk_pp(exprs[i], m) << std::endl; tout << "Macro: " << mk_pp(macro, m) << std::endl; ); proof * pr = nullptr; if (m.proofs_enabled()) @@ -311,7 +311,7 @@ bool quasi_macros::find_macros(unsigned n, expr * const * exprs) { } bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) { - TRACE("quasi_macros", tout << "Finding quasi-macros in: " << std::endl; + TRACE(quasi_macros, tout << "Finding quasi-macros in: " << std::endl; for (unsigned i = 0; i < n; i++) tout << i << ": " << mk_pp(exprs[i].fml(), m) << std::endl; ); bool res = false; @@ -322,7 +322,7 @@ bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) { for (unsigned i = 0 ; i < n ; i++) find_occurrences(exprs[i].fml()); - TRACE("quasi_macros", tout << "Occurrences: " << std::endl; + TRACE(quasi_macros, tout << "Occurrences: " << std::endl; for (auto kv : m_occurrences) tout << kv.m_key->get_name() << ": " << kv.m_value << std::endl; ); @@ -333,7 +333,7 @@ bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) { quantifier_ref macro(m); if (is_quasi_macro(exprs[i].fml(), a, t) && quasi_macro_to_macro(to_quantifier(exprs[i].fml()), a, t, macro)) { - TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i].fml(), m) << std::endl; + TRACE(quasi_macros, tout << "Found quasi macro: " << mk_pp(exprs[i].fml(), m) << std::endl; tout << "Macro: " << mk_pp(macro, m) << std::endl; ); proof * pr = nullptr; if (m.proofs_enabled()) @@ -387,7 +387,7 @@ void quasi_macros::apply_macros(unsigned n, justified_expr const* fmls, vector& new_fmls) { - TRACE("quasi_macros", m_macro_manager.display(tout);); + TRACE(quasi_macros, m_macro_manager.display(tout);); if (find_macros(n, fmls)) { apply_macros(n, fmls, new_fmls); return true; diff --git a/src/ast/normal_forms/defined_names.cpp b/src/ast/normal_forms/defined_names.cpp index 4e9ee6263..43902e491 100644 --- a/src/ast/normal_forms/defined_names.cpp +++ b/src/ast/normal_forms/defined_names.cpp @@ -163,9 +163,9 @@ void defined_names::impl::bound_vars(sort_ref_buffer const & sorts, buffer\n" << r << "\n";); + TRACE(name_exprs, tout << mk_ismt2_pp(n, m_rw.m()) << "\n---->\n" << r << "\n";); } @@ -124,7 +124,7 @@ class name_nested_formulas : public name_exprs_core { pred(ast_manager & m):m(m), m_root(nullptr) {} bool operator()(expr * t) override { - TRACE("name_exprs", tout << "name_nested_formulas::pred:\n" << mk_ismt2_pp(t, m) << "\n";); + TRACE(name_exprs, tout << "name_nested_formulas::pred:\n" << mk_ismt2_pp(t, m) << "\n";); if (is_app(t)) return to_app(t)->get_family_id() == m.get_basic_family_id() && to_app(t)->get_num_args() > 0 && t != m_root; return m.is_label(t) || is_quantifier(t); @@ -141,7 +141,7 @@ public: void operator()(expr * n, expr_ref_vector & new_defs, proof_ref_vector & new_def_proofs, expr_ref & r, proof_ref & p) override { m_pred.m_root = n; - TRACE("name_exprs", tout << "operator()\n";); + TRACE(name_exprs, tout << "operator()\n";); name_exprs_core::operator()(n, new_defs, new_def_proofs, r, p); } }; diff --git a/src/ast/normal_forms/nnf.cpp b/src/ast/normal_forms/nnf.cpp index 9b4ea1346..3ca15ded8 100644 --- a/src/ast/normal_forms/nnf.cpp +++ b/src/ast/normal_forms/nnf.cpp @@ -80,7 +80,7 @@ class skolemizer { void process(quantifier * q, expr_ref & r, proof_ref & p) { if (q->get_kind() == lambda_k) { - TRACE("nnf", tout << expr_ref(q, m) << "\n";); + TRACE(nnf, tout << expr_ref(q, m) << "\n";); r = q; p = nullptr; return; @@ -99,7 +99,7 @@ class skolemizer { } } - TRACE("skolemizer", tout << "skid: " << q->get_skid() << "\n";); + TRACE(skolemizer, tout << "skid: " << q->get_skid() << "\n";); expr_ref_vector substitution(m); unsigned num_decls = q->get_num_decls(); @@ -301,7 +301,7 @@ struct nnf::imp { else throw nnf_params_exception("invalid NNF mode"); - TRACE("nnf", tout << "nnf-mode: " << m_mode << " " << mode_sym << "\n" << _p << "\n";); + TRACE(nnf, tout << "nnf-mode: " << m_mode << " " << mode_sym << "\n" << _p << "\n";); m_ignore_labels = p.ignore_labels(); m_max_memory = megabytes_to_bytes(p.max_memory()); @@ -706,7 +706,7 @@ struct nnf::imp { } bool process_app(app * t, frame & fr) { - TRACE("nnf", tout << mk_ismt2_pp(t, m) << "\n";); + TRACE(nnf, tout << mk_ismt2_pp(t, m) << "\n";); SASSERT(m.is_bool(t)); if (t->get_family_id() == m.get_basic_family_id()) { switch (static_cast(t->get_decl_kind())) { @@ -740,7 +740,7 @@ struct nnf::imp { } bool process_quantifier(quantifier * q, frame & fr) { - TRACE("nnf", tout << expr_ref(q, m) << "\n";); + TRACE(nnf, tout << expr_ref(q, m) << "\n";); expr_ref r(m); proof_ref pr(m); if (fr.m_i == 0) { @@ -843,7 +843,7 @@ struct nnf::imp { } void process(expr * t, expr_ref & result, proof_ref & result_pr) { - TRACE("nnf", tout << "processing:\n" << mk_ismt2_pp(t, m) << "\n";); + TRACE(nnf, tout << "processing:\n" << mk_ismt2_pp(t, m) << "\n";); SASSERT(m.is_bool(t)); if (visit(t, true /* positive polarity */, false /* not nested in quantifier */)) { @@ -909,7 +909,7 @@ struct nnf::imp { nnf::nnf(ast_manager & m, defined_names & n, params_ref const & p) { - TRACE("nnf", tout << "nnf constructor: " << p << "\n";); + TRACE(nnf, tout << "nnf constructor: " << p << "\n";); m_imp = alloc(imp, m, n, p); } @@ -919,7 +919,7 @@ nnf::~nnf() { void nnf::operator()(expr * n, expr_ref_vector & new_defs, proof_ref_vector & new_def_proofs, expr_ref & r, proof_ref & p) { m_imp->operator()(n, new_defs, new_def_proofs, r, p); - TRACE("nnf_result", tout << expr_ref(n, r.get_manager()) << "\nNNF result:\n" << new_defs << "\n" << r << "\n";); + TRACE(nnf_result, tout << expr_ref(n, r.get_manager()) << "\nNNF result:\n" << new_defs << "\n" << r << "\n";); } void nnf::updt_params(params_ref const & p) { diff --git a/src/ast/normal_forms/pull_quant.cpp b/src/ast/normal_forms/pull_quant.cpp index 486f4e949..9f57f826a 100644 --- a/src/ast/normal_forms/pull_quant.cpp +++ b/src/ast/normal_forms/pull_quant.cpp @@ -98,14 +98,14 @@ struct pull_quant::imp { expr_ref adjusted_child(m); unsigned num_decls = var_sorts.size(); unsigned shift_amount = 0; - TRACE("pull_quant", tout << "Result num decls:" << num_decls << "\n";); + TRACE(pull_quant, tout << "Result num decls:" << num_decls << "\n";); for (unsigned i = 0; i < num_children; i++) { expr * child = children[i]; if (!is_quantifier(child)) { // increment the free variables in child by num_decls because // child will be in the scope of num_decls bound variables. m_shift(child, num_decls, adjusted_child); - TRACE("pull_quant", tout << "shifted by: " << num_decls << "\n" << + TRACE(pull_quant, tout << "shifted by: " << num_decls << "\n" << mk_pp(child, m) << "\n---->\n" << mk_pp(adjusted_child, m) << "\n";); } else { @@ -127,7 +127,7 @@ struct pull_quant::imp { num_decls - nested_q->get_num_decls(), // shift1 (shift by this amount if var idx >= bound) shift_amount, // shift2 (shift by this amount if var idx < bound) adjusted_child); - TRACE("pull_quant", tout << "shifted bound: " << nested_q->get_num_decls() << " shift1: " << shift_amount << + TRACE(pull_quant, tout << "shifted bound: " << nested_q->get_num_decls() << " shift1: " << shift_amount << " shift2: " << (num_decls - nested_q->get_num_decls()) << "\n" << mk_pp(nested_q->get_expr(), m) << "\n---->\n" << mk_pp(adjusted_child, m) << "\n";); shift_amount += nested_q->get_num_decls(); diff --git a/src/ast/pattern/expr_pattern_match.cpp b/src/ast/pattern/expr_pattern_match.cpp index 2fbd99bdf..b4ca2fe03 100644 --- a/src/ast/pattern/expr_pattern_match.cpp +++ b/src/ast/pattern/expr_pattern_match.cpp @@ -99,7 +99,7 @@ expr_pattern_match::instantiate(expr* a, unsigned num_bound, subst& s, expr_ref& for (unsigned i = 0; i < num_bound; ++i) { b.insert(m_bound_dom[i], m_bound_rng[i]); } - TRACE("expr_pattern_match", tout << mk_pp(a, m_manager) << " " << num_bound << "\n";); + TRACE(expr_pattern_match, tout << mk_pp(a, m_manager) << " " << num_bound << "\n";); inst_proc proc(m_manager, s, b, m_regs); for_each_ast(proc, a); expr* v = nullptr; @@ -270,13 +270,13 @@ expr_pattern_match::match(expr* a, unsigned init, subst& s) break; } case CHECK_BOUND: - TRACE("expr_pattern_match", tout << "check bound " << pc.m_num_bound << " " << pc.m_reg << "\n";); + TRACE(expr_pattern_match, tout << "check bound " << pc.m_num_bound << " " << pc.m_reg << "\n";); ok = m_bound_rng[pc.m_num_bound] == m_regs[pc.m_reg]; break; case BIND: case BIND_AC: case BIND_C: { - TRACE("expr_pattern_match", display(tout, pc); + TRACE(expr_pattern_match, display(tout, pc); tout << mk_pp(m_regs[pc.m_reg],m_manager) << "\n";); app* app1 = to_app(pc.m_pat); a = m_regs[pc.m_reg]; @@ -352,7 +352,7 @@ expr_pattern_match::match(expr* a, unsigned init, subst& s) pc = m_instrs[pc.m_next]; } else { - TRACE("expr_pattern_match", tout << "backtrack\n";); + TRACE(expr_pattern_match, tout << "backtrack\n";); pc = m_instrs[0]; } } diff --git a/src/ast/pattern/pattern_inference.cpp b/src/ast/pattern/pattern_inference.cpp index 7c7576c84..0b658b0ad 100644 --- a/src/ast/pattern/pattern_inference.cpp +++ b/src/ast/pattern/pattern_inference.cpp @@ -31,7 +31,7 @@ Revision History: void smaller_pattern::save(expr * p1, expr * p2) { expr_pair e(p1, p2); if (!m_cache.contains(e)) { - TRACE("smaller_pattern_proc", tout << "saving: " << p1->get_id() << " " << p2->get_id() << "\n";); + TRACE(smaller_pattern_proc, tout << "saving: " << p1->get_id() << " " << p2->get_id() << "\n";); m_cache.insert(e); m_todo.push_back(e); } @@ -129,8 +129,8 @@ void pattern_inference_cfg::collect::operator()(expr * n, unsigned num_bindings) entry & e = m_todo.back(); n = e.m_node; unsigned delta = e.m_delta; - TRACE("collect", tout << "processing: " << n->get_id() << " " << delta << " kind: " << n->get_kind() << "\n";); - TRACE("collect_info", tout << mk_pp(n, m) << "\n";); + TRACE(collect, tout << "processing: " << n->get_id() << " " << delta << " kind: " << n->get_kind() << "\n";); + TRACE(collect_info, tout << mk_pp(n, m) << "\n";); if (visit_children(n, delta)) { m_todo.pop_back(); save_candidate(n, delta); @@ -249,7 +249,7 @@ void pattern_inference_cfg::collect::save_candidate(expr * n, unsigned delta) { decl_kind k = c->get_decl_kind(); if (!free_vars.empty() && (fid != m_afid || (fid == m_afid && !m_owner.m_nested_arith_only && (k == OP_DIV || k == OP_IDIV || k == OP_MOD || k == OP_REM || k == OP_MUL)))) { - TRACE("pattern_inference", tout << "potential candidate: \n" << mk_pp(new_node, m) << "\n";); + TRACE(pattern_inference, tout << "potential candidate: \n" << mk_pp(new_node, m) << "\n";); m_owner.add_candidate(new_node, free_vars, size); } return; @@ -352,7 +352,7 @@ bool pattern_inference_cfg::contains_subpattern::operator()(expr * n) { uint_set const & s2 = e->get_data().m_value.m_free_vars; SASSERT(s2.subset_of(s1)); if (s1 == s2) { - TRACE("pattern_inference", tout << mk_pp(n, m_owner.m) << "\nis bigger than\n" << mk_pp(to_app(curr), m_owner.m) << "\n";); + TRACE(pattern_inference, tout << mk_pp(n, m_owner.m) << "\nis bigger than\n" << mk_pp(to_app(curr), m_owner.m) << "\n";); return true; } } @@ -513,7 +513,7 @@ void pattern_inference_cfg::candidates2multi_patterns(unsigned max_num_patterns, m_pre_patterns.push_back(curr); } } - TRACE("pattern_inference", tout << "m_pre_patterns.size(): " << m_pre_patterns.size() << + TRACE(pattern_inference, tout << "m_pre_patterns.size(): " << m_pre_patterns.size() << "\nnum_splits: " << num_splits << "\n";); } } @@ -532,7 +532,7 @@ bool pattern_inference_cfg::is_forbidden(app * n) const { // occur outside of the quantifier. That is, Z3 will never match this kind of // pattern. if (m_params.m_pi_avoid_skolems && decl->is_skolem()) { - CTRACE("pattern_inference_skolem", decl->is_skolem(), tout << "ignoring: " << mk_pp(n, m) << "\n";); + CTRACE(pattern_inference_skolem, decl->is_skolem(), tout << "ignoring: " << mk_pp(n, m) << "\n";); return true; } if (is_forbidden(decl)) @@ -549,7 +549,7 @@ bool pattern_inference_cfg::has_preferred_patterns(ptr_vector & candidate_p expr2info::obj_map_entry * e = m_candidates_info.find_core(candidate); info const & i = e->get_data().m_value; if (i.m_free_vars.num_elems() == m_num_bindings) { - TRACE("pattern_inference", tout << "found preferred pattern:\n" << mk_pp(candidate, m) << "\n";); + TRACE(pattern_inference, tout << "found preferred pattern:\n" << mk_pp(candidate, m) << "\n";); app * p = m.mk_pattern(candidate); result.push_back(p); found = true; @@ -570,7 +570,7 @@ void pattern_inference_cfg::mk_patterns(unsigned num_bindings, m_collect(n, num_bindings); - TRACE("pattern_inference", + TRACE(pattern_inference, tout << mk_pp(n, m); tout << "\ncandidates:\n"; unsigned num = m_candidates.size(); @@ -581,7 +581,7 @@ void pattern_inference_cfg::mk_patterns(unsigned num_bindings, if (!m_candidates.empty()) { m_tmp1.reset(); filter_looping_patterns(m_tmp1); - TRACE("pattern_inference", + TRACE(pattern_inference, tout << "candidates after removing looping-patterns:\n"; dump_app_vector(tout, m_tmp1, m);); SASSERT(!m_tmp1.empty()); @@ -590,7 +590,7 @@ void pattern_inference_cfg::mk_patterns(unsigned num_bindings, m_tmp2.reset(); filter_bigger_patterns(m_tmp1, m_tmp2); SASSERT(!m_tmp2.empty()); - TRACE("pattern_inference", + TRACE(pattern_inference, tout << "candidates after removing bigger patterns:\n"; dump_app_vector(tout, m_tmp2, m);); m_tmp1.reset(); @@ -601,7 +601,7 @@ void pattern_inference_cfg::mk_patterns(unsigned num_bindings, if (num_extra_multi_patterns > 0 && !m_tmp1.empty()) { // m_pattern_weight_lt is not a total order std::stable_sort(m_tmp1.begin(), m_tmp1.end(), m_pattern_weight_lt); - TRACE("pattern_inference", + TRACE(pattern_inference, tout << "candidates after sorting:\n"; dump_app_vector(tout, m_tmp1, m);); candidates2multi_patterns(num_extra_multi_patterns, m_tmp1, result); @@ -623,7 +623,7 @@ bool pattern_inference_cfg::reduce_quantifier( expr_ref & result, proof_ref & result_pr) { - TRACE("pattern_inference", tout << "processing:\n" << mk_pp(q, m) << "\n";); + TRACE(pattern_inference, tout << "processing:\n" << mk_pp(q, m) << "\n";); if (!m_params.m_pi_enabled) return false; @@ -640,14 +640,14 @@ bool pattern_inference_cfg::reduce_quantifier( DEBUG_CODE(for (unsigned i = 0; i < new_patterns.size(); i++) { SASSERT(is_well_sorted(m, new_patterns.get(i))); }); if (q->get_num_patterns() > 0) { // just update the weight... - TRACE("pattern_inference", tout << "updating weight to: " << new_weight << "\n" << mk_pp(q, m) << "\n";); + TRACE(pattern_inference, tout << "updating weight to: " << new_weight << "\n" << mk_pp(q, m) << "\n";); result = m.update_quantifier_weight(q, new_weight); } else { quantifier_ref tmp(m); tmp = m.update_quantifier(q, new_patterns.size(), (expr**) new_patterns.data(), q->get_expr()); result = m.update_quantifier_weight(tmp, new_weight); - TRACE("pattern_inference", tout << "found patterns in database, weight: " << new_weight << "\n" << mk_pp(result, m) << "\n";); + TRACE(pattern_inference, tout << "found patterns in database, weight: " << new_weight << "\n" << mk_pp(result, m) << "\n";); } if (m.proofs_enabled()) result_pr = m.mk_rewrite(q, result); @@ -739,7 +739,7 @@ bool pattern_inference_cfg::reduce_quantifier( if (m.proofs_enabled()) { result_pr = m.mk_transitivity(new_pr, m.mk_quant_intro(result2, new_q, m.mk_bind_proof(new_q, m.mk_reflexivity(new_q->get_expr())))); } - TRACE("pattern_inference", tout << "pulled quantifier:\n" << mk_pp(new_q, m) << "\n";); + TRACE(pattern_inference, tout << "pulled quantifier:\n" << mk_pp(new_q, m) << "\n";); } } } @@ -749,7 +749,7 @@ bool pattern_inference_cfg::reduce_quantifier( auto str = q->get_qid().str(); warning_msg("failed to find a pattern for quantifier (quantifier id: %s)", str.c_str()); } - TRACE("pi_failed", tout << mk_pp(q, m) << "\n";); + TRACE(pi_failed, tout << mk_pp(q, m) << "\n";); } if (new_patterns.empty() && new_body == q->get_expr()) { diff --git a/src/ast/pp.cpp b/src/ast/pp.cpp index 091b50c97..4d08b4286 100644 --- a/src/ast/pp.cpp +++ b/src/ast/pp.cpp @@ -52,7 +52,7 @@ static std::pair space_upto_line_break(ast_manager & m, format * inline bool fits(ast_manager & m, format * f, unsigned space_left) { unsigned s = space_upto_line_break(m, f).first; - TRACE("fits", tout << "s: " << s << " space_left " << space_left << "\n";); + TRACE(fits, tout << "s: " << s << " space_left " << space_left << "\n";); return s <= space_left; } diff --git a/src/ast/proofs/proof_checker.cpp b/src/ast/proofs/proof_checker.cpp index dd7cdc851..cc29defbb 100644 --- a/src/ast/proofs/proof_checker.cpp +++ b/src/ast/proofs/proof_checker.cpp @@ -301,7 +301,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { return false; } case PR_MONOTONICITY: { - TRACE("proof_checker", tout << mk_bounded_pp(p, m, 3) << "\n";); + TRACE(proof_checker, tout << mk_bounded_pp(p, m, 3) << "\n";); if (match_fact(p, fact) && match_binary(fact, d1, t1, t2) && match_app(t1, f1, terms1) && @@ -530,7 +530,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { found = match_negated(ors[j].get(), hypotheses[i].get()); } if (!found) { - TRACE("pr_lemma_bug", + TRACE(pr_lemma_bug, tout << "i: " << i << "\n"; tout << "ORs:\n" << ors << "\n"; tout << "HYPOTHESIS:\n" << hypotheses << "\n"; @@ -538,7 +538,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { UNREACHABLE(); return false; } - TRACE("proof_checker", tout << "Matched:\n"; + TRACE(proof_checker, tout << "Matched:\n"; ast_ll_pp(tout, m, hypotheses[i].get()); ast_ll_pp(tout, m, ors[j-1].get());); } @@ -575,7 +575,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { } } if (!found) { - TRACE("pr_unit_bug", + TRACE(pr_unit_bug, tout << "Parents:\n"; for (unsigned i = 0; i < proofs.size(); i++) { expr* p = nullptr; @@ -791,7 +791,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { premise = vs(premise, sub.size(), sub.data()); } fmls.push_back(premise.get()); - TRACE("proof_checker", + TRACE(proof_checker, tout << mk_pp(premise.get(), m) << "\n"; for (unsigned j = 0; j < sub.size(); ++j) { tout << mk_pp(sub[j], m) << " "; @@ -1151,7 +1151,7 @@ void proof_checker::get_hypotheses(proof* p, expr_ref_vector& ante) { SASSERT(match_nil(h)); } } - TRACE("proof_checker", + TRACE(proof_checker, { ast_ll_pp(tout << "Getting hypotheses from: ", m, p); tout << "Found hypotheses:\n"; @@ -1396,7 +1396,7 @@ bool proof_checker::check_arith_proof(proof* p) { return false; } } - TRACE("proof_checker", + TRACE(proof_checker, for (unsigned i = 0; i < num_parents; i++) tout << coeffs[i] << " * " << mk_bounded_pp(m.get_fact(m.get_parent(p, i)), m) << "\n"; tout << "fact:" << mk_bounded_pp(fact, m) << "\n";); diff --git a/src/ast/proofs/proof_utils.cpp b/src/ast/proofs/proof_utils.cpp index a3508969b..93dfbdf5e 100644 --- a/src/ast/proofs/proof_utils.cpp +++ b/src/ast/proofs/proof_utils.cpp @@ -469,7 +469,7 @@ public: tmp = pr; elim(pr); reset(); - CTRACE("proof_utils", contains_hypothesis(pr), + CTRACE(proof_utils, contains_hypothesis(pr), tout << "Contains hypothesis:\n"; tout << mk_ismt2_pp(tmp, m) << "\n====>\n"; tout << mk_ismt2_pp(pr, m) << "\n";); @@ -569,7 +569,7 @@ public: m_hypmap.insert(result, new_hyps); // might push 0 into m_hyprefs. No reason for that m_hyprefs.push_back(new_hyps); - TRACE("proof_utils", + TRACE(proof_utils, tout << "New lemma: " << mk_pp(m.get_fact(p), m) << "\n==>\n" << mk_pp(m.get_fact(result), m) << "\n"; @@ -743,7 +743,7 @@ void proof_utils::reduce_hypotheses(proof_ref& pr) { ast_manager& m = pr.get_manager(); class reduce_hypotheses0 reduce(m); reduce(pr); - CTRACE("proof_utils", !is_closed(m, pr), tout << mk_pp(pr, m) << "\n";); + CTRACE(proof_utils, !is_closed(m, pr), tout << mk_pp(pr, m) << "\n";); } class proof_is_closed { @@ -985,7 +985,7 @@ private: } quantifier* q = to_quantifier(fml); if (q->get_num_decls() != sub.size()) { - TRACE("proof_utils", tout << "quantifier has different number of variables than substitution"; + TRACE(proof_utils, tout << "quantifier has different number of variables than substitution"; tout << mk_pp(q, m) << "\n"; tout << sub.size() << "\n";); return; diff --git a/src/ast/proofs/proof_utils.h b/src/ast/proofs/proof_utils.h index dbb9dfac0..ccd516752 100644 --- a/src/ast/proofs/proof_utils.h +++ b/src/ast/proofs/proof_utils.h @@ -221,7 +221,7 @@ public: } cache.insert(p, newp); todo.pop_back(); - CTRACE("virtual", + CTRACE(proof_virtual, p->get_decl_kind() == PR_TH_LEMMA && p->get_decl()->get_parameter(0).get_symbol() == "arith" && p->get_decl()->get_num_parameters() > 1 && diff --git a/src/ast/recfun_decl_plugin.cpp b/src/ast/recfun_decl_plugin.cpp index 79c6fa066..9da36b27a 100644 --- a/src/ast/recfun_decl_plugin.cpp +++ b/src/ast/recfun_decl_plugin.cpp @@ -26,7 +26,7 @@ Revision History: #include "ast/for_each_expr.h" #include "util/scoped_ptr_vector.h" -#define TRACEFN(x) TRACE("recfun", tout << x << '\n';) +#define TRACEFN(x) TRACE(recfun, tout << x << '\n';) #define VALIDATE_PARAM(m, _pred_) if (!(_pred_)) m.raise_exception("invalid parameter to recfun " #_pred_); namespace recfun { diff --git a/src/ast/rewriter/arith_rewriter.cpp b/src/ast/rewriter/arith_rewriter.cpp index b67e873c0..702030c49 100644 --- a/src/ast/rewriter/arith_rewriter.cpp +++ b/src/ast/rewriter/arith_rewriter.cpp @@ -97,7 +97,7 @@ br_status arith_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * c case OP_ARITH_LSHR: SASSERT(num_args == 2); st = mk_lshr_core(f->get_parameter(0).get_int(), args[0], args[1], result); break; default: st = BR_FAILED; break; } - CTRACE("arith_rewriter", st != BR_FAILED, tout << st << ": " << mk_pp(f, m); + CTRACE(arith_rewriter, st != BR_FAILED, tout << st << ": " << mk_pp(f, m); for (unsigned i = 0; i < num_args; ++i) tout << mk_pp(args[i], m) << " "; tout << "\n==>\n" << mk_pp(result.get(), m) << "\n"; if (is_app(result)) tout << "args: " << to_app(result)->get_num_args() << "\n"; @@ -646,7 +646,7 @@ br_status arith_rewriter::mk_le_ge_eq_core(expr * arg1, expr * arg2, op_kind kin (is_zero(arg2) && is_reduce_power_target(arg1, kind == EQ))) return reduce_power(arg1, arg2, kind, result); br_status st = cancel_monomials(arg1, arg2, m_arith_ineq_lhs || m_arith_lhs, new_arg1, new_arg2); - TRACE("mk_le_bug", tout << "st: " << st << " " << new_arg1 << " " << new_arg2 << "\n";); + TRACE(mk_le_bug, tout << "st: " << st << " " << new_arg1 << " " << new_arg2 << "\n";); if (st != BR_FAILED) { arg1 = new_arg1; arg2 = new_arg2; @@ -656,7 +656,7 @@ br_status arith_rewriter::mk_le_ge_eq_core(expr * arg1, expr * arg2, op_kind kin if (m_elim_to_real && elim_to_real(arg1, arg2, new_new_arg1, new_new_arg2)) { arg1 = new_new_arg1; arg2 = new_new_arg2; - CTRACE("elim_to_real", m_elim_to_real, tout << "after_elim_to_real\n" << mk_ismt2_pp(arg1, m) << "\n" << mk_ismt2_pp(arg2, m) << "\n";); + CTRACE(elim_to_real, m_elim_to_real, tout << "after_elim_to_real\n" << mk_ismt2_pp(arg1, m) << "\n" << mk_ismt2_pp(arg2, m) << "\n";); if (st == BR_FAILED) st = BR_DONE; } @@ -697,10 +697,10 @@ br_status arith_rewriter::mk_le_ge_eq_core(expr * arg1, expr * arg2, op_kind kin numeral g; unsigned num_consts = 0; get_coeffs_gcd(arg1, g, first, num_consts); - TRACE("arith_rewriter_gcd", tout << "[step1] g: " << g << ", num_consts: " << num_consts << "\n";); + TRACE(arith_rewriter_gcd, tout << "[step1] g: " << g << ", num_consts: " << num_consts << "\n";); if ((first || !g.is_one()) && num_consts <= 1) get_coeffs_gcd(arg2, g, first, num_consts); - TRACE("arith_rewriter_gcd", tout << "[step2] g: " << g << ", num_consts: " << num_consts << "\n";); + TRACE(arith_rewriter_gcd, tout << "[step2] g: " << g << ", num_consts: " << num_consts << "\n";); g = abs(g); if (!first && !g.is_one() && num_consts <= 1) { bool is_sat = div_polynomial(arg1, g, (kind == LE ? CT_CEIL : (kind == GE ? CT_FLOOR : CT_FALSE)), new_arg1); @@ -1174,7 +1174,7 @@ br_status arith_rewriter::mk_div_core(expr * arg1, expr * arg2, expr_ref & resul v2 = rational(1); d = arg2; } - TRACE("div_bug", tout << "v1: " << v1 << ", v2: " << v2 << "\n";); + TRACE(div_bug, tout << "v1: " << v1 << ", v2: " << v2 << "\n";); if (!v1.is_one() || !v2.is_one()) { v1 /= v2; result = m_util.mk_mul(m_util.mk_numeral(v1, false), @@ -1238,7 +1238,7 @@ br_status arith_rewriter::mk_idiv_core(expr * arg1, expr * arg2, expr_ref & resu if (change) { result = m_util.mk_idiv(m.mk_app(to_app(arg1)->get_decl(), args.size(), args.data()), arg2); result = m_util.mk_add(m_util.mk_numeral(add, true), result); - TRACE("div_bug", tout << "mk_div result: " << result << "\n";); + TRACE(div_bug, tout << "mk_div result: " << result << "\n";); return BR_REWRITE3; } } @@ -1385,7 +1385,7 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul // propagate mod inside only if there is something to reduce. if (is_num2 && is_int && v2.is_pos() && (is_add(arg1) || is_mul(arg1))) { - TRACE("mod_bug", tout << "mk_mod:\n" << mk_ismt2_pp(arg1, m) << "\n" << mk_ismt2_pp(arg2, m) << "\n";); + TRACE(mod_bug, tout << "mk_mod:\n" << mk_ismt2_pp(arg1, m) << "\n" << mk_ismt2_pp(arg2, m) << "\n";); expr_ref_buffer args(m); bool change = false; for (expr* arg : *to_app(arg1)) { @@ -1408,7 +1408,7 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul } if (change) { result = m_util.mk_mod(m.mk_app(to_app(arg1)->get_decl(), args.size(), args.data()), arg2); - TRACE("mod_bug", tout << "mk_mod result: " << mk_ismt2_pp(result, m) << "\n";); + TRACE(mod_bug, tout << "mk_mod result: " << mk_ismt2_pp(result, m) << "\n";); return BR_REWRITE3; } } @@ -1482,7 +1482,7 @@ br_status arith_rewriter::mk_rem_core(expr * arg1, expr * arg2, expr_ref & resul result = m.mk_ite(m_util.mk_ge(arg2, m_util.mk_numeral(rational(0), true)), mod, m_util.mk_uminus(mod)); - TRACE("elim_rem", tout << "result: " << mk_ismt2_pp(result, m) << "\n";); + TRACE(elim_rem, tout << "result: " << mk_ismt2_pp(result, m) << "\n";); return BR_REWRITE3; } return BR_FAILED; @@ -1639,7 +1639,7 @@ br_status arith_rewriter::mk_power_core(expr * arg1, expr * arg2, expr_ref & res bool is_num_y = m_util.is_numeral(arg2, y); auto ensure_real = [&](expr* e) { return m_util.is_int(e) ? m_util.mk_to_real(e) : e; }; - TRACE("arith", tout << mk_bounded_pp(arg1, m) << " " << mk_bounded_pp(arg2, m) << "\n";); + TRACE(arith, tout << mk_bounded_pp(arg1, m) << " " << mk_bounded_pp(arg2, m) << "\n";); if (is_num_x && x.is_one()) { result = m_util.mk_numeral(x, false); return BR_DONE; @@ -1991,7 +1991,7 @@ bool arith_rewriter::is_pi_integer(expr * t) { a = c; b = d; } - TRACE("tan", tout << "is_pi_integer " << mk_ismt2_pp(t, m) << "\n"; + TRACE(tan, tout << "is_pi_integer " << mk_ismt2_pp(t, m) << "\n"; tout << "a: " << mk_ismt2_pp(a, m) << "\n"; tout << "b: " << mk_ismt2_pp(b, m) << "\n";); return @@ -2022,7 +2022,7 @@ app * arith_rewriter::mk_sqrt(rational const & k) { // Return 0 if failed. expr * arith_rewriter::mk_sin_value(rational const & k) { rational k_prime = mod(floor(k), rational(2)) + k - floor(k); - TRACE("sine", tout << "k: " << k << ", k_prime: " << k_prime << "\n";); + TRACE(sine, tout << "k: " << k << ", k_prime: " << k_prime << "\n";); SASSERT(k_prime >= rational(0) && k_prime < rational(2)); bool neg = false; if (k_prime >= rational(1)) { diff --git a/src/ast/rewriter/array_rewriter.cpp b/src/ast/rewriter/array_rewriter.cpp index 7d75ce72d..c6197fdd2 100644 --- a/src/ast/rewriter/array_rewriter.cpp +++ b/src/ast/rewriter/array_rewriter.cpp @@ -115,7 +115,7 @@ br_status array_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * c st = BR_FAILED; break; } - CTRACE("array_rewriter", st != BR_FAILED, + CTRACE(array_rewriter, st != BR_FAILED, tout << mk_pp(f, m()) << "\n"; for (unsigned i = 0; i < num_args; ++i) { tout << mk_bounded_pp(args[i], m(), 2) << "\n"; @@ -459,7 +459,7 @@ br_status array_rewriter::mk_map_core(func_decl * f, unsigned num_args, expr * c sort_ref s = get_map_array_sort(f, num_args, args); result = m_util.mk_const_array(s, value); } - TRACE("array", tout << result << "\n";); + TRACE(array, tout << result << "\n";); return BR_REWRITE2; } @@ -819,7 +819,7 @@ expr_ref array_rewriter::expand_store(expr* s) { } br_status array_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) { - TRACE("array_rewriter", tout << mk_bounded_pp(lhs, m(), 2) << " " << mk_bounded_pp(rhs, m(), 2) << "\n";); + TRACE(array_rewriter, tout << mk_bounded_pp(lhs, m(), 2) << " " << mk_bounded_pp(rhs, m(), 2) << "\n";); expr* v = nullptr, *w = nullptr; if (m_util.is_const(rhs) && is_lambda(lhs)) { std::swap(lhs, rhs); diff --git a/src/ast/rewriter/bit2int.cpp b/src/ast/rewriter/bit2int.cpp index d2c37dbbf..5037776d0 100644 --- a/src/ast/rewriter/bit2int.cpp +++ b/src/ast/rewriter/bit2int.cpp @@ -38,7 +38,7 @@ void bit2int::operator()(expr * n, expr_ref & result, proof_ref& p) { // TBD: rough p = m.mk_rewrite(n, result); } - TRACE("bit2int", + TRACE(bit2int, tout << mk_pp(n, m) << "======>\n" << result << "\n";); } @@ -221,7 +221,7 @@ bool bit2int::is_bv_poly(expr* n, expr_ref& pos, expr_ref& neg) { VERIFY(mk_add(arg1, neg, neg)); } else { - TRACE("bit2int", tout << "Not a poly: " << mk_pp(n, m) << "\n";); + TRACE(bit2int, tout << "Not a poly: " << mk_pp(n, m) << "\n";); return false; } } @@ -407,12 +407,12 @@ expr * bit2int::get_cached(expr * n) const { expr* r = nullptr; proof* p = nullptr; const_cast(this)->m_cache.get(n, r, p); - CTRACE("bit2int", !r, tout << mk_pp(n, m) << "\n";); + CTRACE(bit2int, !r, tout << mk_pp(n, m) << "\n";); return r; } void bit2int::cache_result(expr * n, expr * r) { - TRACE("bit2int_verbose", tout << "caching:\n" << mk_pp(n, m) << + TRACE(bit2int_verbose, tout << "caching:\n" << mk_pp(n, m) << "======>\n" << mk_ll_pp(r, m) << "\n";); m_cache.insert(n, r, nullptr); } diff --git a/src/ast/rewriter/bit_blaster/bit_blaster.cpp b/src/ast/rewriter/bit_blaster/bit_blaster.cpp index 8f5fc2a53..835af6b00 100644 --- a/src/ast/rewriter/bit_blaster/bit_blaster.cpp +++ b/src/ast/rewriter/bit_blaster/bit_blaster.cpp @@ -38,9 +38,9 @@ static void sort_args(expr * & l1, expr * & l2, expr * & l3) { void bit_blaster_cfg::mk_xor3(expr * l1, expr * l2, expr * l3, expr_ref & r) { - TRACE("xor3", tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id();); + TRACE(xor3, tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id();); sort_args(l1, l2, l3); - TRACE("xor3_sorted", tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id();); + TRACE(xor3_sorted, tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id();); if (m_params.m_bb_ext_gates) { if (l1 == l2) r = l3; @@ -77,9 +77,9 @@ void bit_blaster_cfg::mk_xor3(expr * l1, expr * l2, expr * l3, expr_ref & r) { } void bit_blaster_cfg::mk_carry(expr * l1, expr * l2, expr * l3, expr_ref & r) { - TRACE("carry", tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id();); + TRACE(carry, tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id();); sort_args(l1, l2, l3); - TRACE("carry_sorted", tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id();); + TRACE(carry_sorted, tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id();); if (m_params.m_bb_ext_gates) { if ((m().is_false(l1) && m().is_false(l2)) || (m().is_false(l1) && m().is_false(l3)) || diff --git a/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp b/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp index a3e797a80..0392c25f3 100644 --- a/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp +++ b/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp @@ -379,7 +379,7 @@ MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend); br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) { result_pr = nullptr; - TRACE("bit_blaster", tout << f->get_name() << " "; + TRACE(bit_blaster, tout << f->get_name() << " "; for (unsigned i = 0; i < num; ++i) tout << mk_pp(args[i], m()) << " "; tout << "\n";); if (num == 0 && f->get_family_id() == null_family_id && butil().is_bv_sort(f->get_range())) { @@ -552,7 +552,7 @@ MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend); case OP_SBV2INT: return BR_FAILED; default: - TRACE("bit_blaster", tout << "non-supported operator: " << f->get_name() << "\n"; + TRACE(bit_blaster, tout << "non-supported operator: " << f->get_name() << "\n"; for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << std::endl;); { expr_ref r(m().mk_app(f, num, args), m()); diff --git a/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h b/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h index 7a3ee0ea6..b03b7357a 100644 --- a/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h +++ b/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h @@ -425,7 +425,7 @@ void bit_blaster_tpl::mk_udiv_urem(unsigned sz, expr * const * a_bits, expr for (unsigned i = 0; i < sz; i++) { SASSERT(q_bits.get(i) != 0); }}); - TRACE("bit_blaster", + TRACE(bit_blaster, tout << "a: "; for (unsigned i = 0; i < sz; ++i) tout << mk_pp(a_bits[i], m()) << " "; tout << "\nb: "; @@ -777,7 +777,7 @@ void bit_blaster_tpl::mk_eq(unsigned sz, expr * const * a_bits, expr * cons template void bit_blaster_tpl::mk_rotate_left(unsigned sz, expr * const * a_bits, unsigned n, expr_ref_vector & out_bits) { - TRACE("bit_blaster", tout << n << ": " << sz << " "; + TRACE(bit_blaster, tout << n << ": " << sz << " "; for (unsigned i = 0; i < sz; ++i) { tout << mk_pp(a_bits[i], m()) << " "; } diff --git a/src/ast/rewriter/bool_rewriter.cpp b/src/ast/rewriter/bool_rewriter.cpp index c90777c30..b3c8b888d 100644 --- a/src/ast/rewriter/bool_rewriter.cpp +++ b/src/ast/rewriter/bool_rewriter.cpp @@ -769,12 +769,12 @@ br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) { expr* c2, * t2, * e2; if (m().is_ite(lhs) && m().is_value(rhs)) { r = try_ite_value(to_app(lhs), to_app(rhs), result); - CTRACE("try_ite_value", r != BR_FAILED, + CTRACE(try_ite_value, r != BR_FAILED, tout << mk_bounded_pp(lhs, m()) << "\n" << mk_bounded_pp(rhs, m()) << "\n--->\n" << mk_bounded_pp(result, m()) << "\n";); } else if (m().is_ite(rhs) && m().is_value(lhs)) { r = try_ite_value(to_app(rhs), to_app(lhs), result); - CTRACE("try_ite_value", r != BR_FAILED, + CTRACE(try_ite_value, r != BR_FAILED, tout << mk_bounded_pp(lhs, m()) << "\n" << mk_bounded_pp(rhs, m()) << "\n--->\n" << mk_bounded_pp(result, m()) << "\n";); } else if (m().is_ite(lhs, c1, t1, e1) && m().is_ite(rhs, c2, t2, e2) && diff --git a/src/ast/rewriter/bv2int_translator.cpp b/src/ast/rewriter/bv2int_translator.cpp index 4387413bd..da15bde2b 100644 --- a/src/ast/rewriter/bv2int_translator.cpp +++ b/src/ast/rewriter/bv2int_translator.cpp @@ -687,7 +687,7 @@ void bv2int_translator::translate_eq(expr* e) { set_translated(e, m.mk_eq(umod(x, 0), a.mk_int(0))); } m_preds.push_back(e); - TRACE("bv", tout << mk_pp(e, m) << " " << mk_pp(translated(e), m) << "\n"); + TRACE(bv, tout << mk_pp(e, m) << " " << mk_pp(translated(e), m) << "\n"); ctx.push(push_back_vector(m_preds)); } diff --git a/src/ast/rewriter/bv_bounds.cpp b/src/ast/rewriter/bv_bounds.cpp index c2ee35f71..7123666e7 100644 --- a/src/ast/rewriter/bv_bounds.cpp +++ b/src/ast/rewriter/bv_bounds.cpp @@ -22,7 +22,7 @@ bv_bounds::~bv_bounds() { } bv_bounds::conv_res bv_bounds::record(app * v, numeral lo, numeral hi, bool negated, vector& nis) { - TRACE("bv_bounds", tout << "record0 " << mk_ismt2_pp(v, m_m) << ":" << (negated ? "~[" : "[") << lo << ";" << hi << "]" << std::endl;); + TRACE(bv_bounds, tout << "record0 " << mk_ismt2_pp(v, m_m) << ":" << (negated ? "~[" : "[") << lo << ";" << hi << "]" << std::endl;); const unsigned bv_sz = m_bv_util.get_bv_size(v); const numeral& one = numeral::one(); SASSERT(numeral::zero() <= lo); @@ -54,7 +54,7 @@ bv_bounds::conv_res bv_bounds::record(app * v, numeral lo, numeral hi, bool nega } if (lo_min) lo = vmin; if (hi_max) hi = vmax; - TRACE("bv_bounds", tout << "record1 " << mk_ismt2_pp(v, m_m) << ":" << (negated ? "~[" : "[") << lo << ";" << hi << "]" << std::endl;); + TRACE(bv_bounds, tout << "record1 " << mk_ismt2_pp(v, m_m) << ":" << (negated ? "~[" : "[") << lo << ";" << hi << "]" << std::endl;); if (lo > hi) return negated ? CONVERTED : UNSAT; if (lo_min && hi_max) return negated ? UNSAT : CONVERTED; nis.resize(nis.size() + 1); @@ -100,7 +100,7 @@ bool bv_bounds::is_uleq(expr * e, expr * & v, numeral & c) { } bv_bounds::conv_res bv_bounds::convert(expr * e, vector& nis, bool negated) { - TRACE("bv_bounds", tout << "new constraint: " << (negated ? "~" : "" ) << mk_ismt2_pp(e, m_m) << std::endl;); + TRACE(bv_bounds, tout << "new constraint: " << (negated ? "~" : "" ) << mk_ismt2_pp(e, m_m) << std::endl;); if (m_m.is_not(e)) { negated = !negated; @@ -281,9 +281,9 @@ br_status bv_bounds::rewrite(unsigned limit, func_decl * f, unsigned num, expr * expr_ref_vector nargs(m_m); bool has_singls = false; for (unsigned i = 0; i < num && m_okay; ++i) { - TRACE("bv_bounds", tout << "check red: " << mk_ismt2_pp(args[i], m_m) << std::endl;); + TRACE(bv_bounds, tout << "check red: " << mk_ismt2_pp(args[i], m_m) << std::endl;); if (ignore[i]) { - TRACE("bv_bounds", tout << "unprocessed" << std::endl;); + TRACE(bv_bounds, tout << "unprocessed" << std::endl;); nargs.push_back(args[i]); continue; } @@ -299,13 +299,13 @@ br_status bv_bounds::rewrite(unsigned limit, func_decl * f, unsigned num, expr * const numeral& one = numeral::one(); if (!has_lower) tl = numeral::zero(); if (!has_upper) th = (numeral::power_of_two(bv_sz) - one); - TRACE("bv_bounds", tout << "bounds: " << mk_ismt2_pp(v, m_m) << "[" << tl << "-" << th << "]" << std::endl;); + TRACE(bv_bounds, tout << "bounds: " << mk_ismt2_pp(v, m_m) << "[" << tl << "-" << th << "]" << std::endl;); is_singl = tl == th; nis_head = lengths[count]; } if (!redundant && !is_singl) nargs.push_back(args[i]); has_singls |= is_singl; - CTRACE("bv_bounds", redundant, tout << "redundant: " << mk_ismt2_pp(args[i], m_m) << std::endl;); + CTRACE(bv_bounds, redundant, tout << "redundant: " << mk_ismt2_pp(args[i], m_m) << std::endl;); ++count; } @@ -330,7 +330,7 @@ br_status bv_bounds::rewrite(unsigned limit, func_decl * f, unsigned num, expr * } bool bv_bounds::add_constraint(expr* e) { - TRACE("bv_bounds", tout << "new constraint" << mk_ismt2_pp(e, m_m) << std::endl;); + TRACE(bv_bounds, tout << "new constraint" << mk_ismt2_pp(e, m_m) << std::endl;); if (!m_okay) return false; bool negated = false; @@ -450,7 +450,7 @@ bool bv_bounds::add_constraint(expr* e) { } bool bv_bounds::add_bound_unsigned(app * v, const numeral& a, const numeral& b, bool negate) { - TRACE("bv_bounds", tout << "bound_unsigned " << mk_ismt2_pp(v, m_m) << ": " << (negate ? "~[" : "[") << a << ";" << b << "]" << std::endl;); + TRACE(bv_bounds, tout << "bound_unsigned " << mk_ismt2_pp(v, m_m) << ": " << (negate ? "~[" : "[") << a << ";" << b << "]" << std::endl;); const unsigned bv_sz = m_bv_util.get_bv_size(v); const numeral& zero = numeral::zero(); const numeral& one = numeral::one(); @@ -473,7 +473,7 @@ bool bv_bounds::add_bound_unsigned(app * v, const numeral& a, const numeral& b, } bv_bounds::conv_res bv_bounds::convert_signed(app * v, const numeral& a, const numeral& b, bool negate, vector& nis) { - TRACE("bv_bounds", tout << "convert_signed " << mk_ismt2_pp(v, m_m) << ":" << (negate ? "~[" : "[") << a << ";" << b << "]" << std::endl;); + TRACE(bv_bounds, tout << "convert_signed " << mk_ismt2_pp(v, m_m) << ":" << (negate ? "~[" : "[") << a << ";" << b << "]" << std::endl;); const unsigned bv_sz = m_bv_util.get_bv_size(v); SASSERT(a <= b); const numeral& zero = numeral::zero(); @@ -497,7 +497,7 @@ bv_bounds::conv_res bv_bounds::convert_signed(app * v, const numeral& a, const n } bool bv_bounds::add_bound_signed(app * v, const numeral& a, const numeral& b, bool negate) { - TRACE("bv_bounds", tout << "bound_signed " << mk_ismt2_pp(v, m_m) << ":" << (negate ? "~" : " ") << a << ";" << b << std::endl;); + TRACE(bv_bounds, tout << "bound_signed " << mk_ismt2_pp(v, m_m) << ":" << (negate ? "~" : " ") << a << ";" << b << std::endl;); const unsigned bv_sz = m_bv_util.get_bv_size(v); SASSERT(a <= b); const numeral& zero = numeral::zero(); @@ -521,7 +521,7 @@ bool bv_bounds::add_bound_signed(app * v, const numeral& a, const numeral& b, bo bool bv_bounds::bound_lo(app * v, const numeral& l) { SASSERT(in_range(v, l)); - TRACE("bv_bounds", tout << "lower " << mk_ismt2_pp(v, m_m) << ":" << l << std::endl;); + TRACE(bv_bounds, tout << "lower " << mk_ismt2_pp(v, m_m) << ":" << l << std::endl;); // l <= v auto& value = m_unsigned_lowers.insert_if_not_there(v, l); if (!(value < l)) return m_okay; @@ -532,7 +532,7 @@ bool bv_bounds::bound_lo(app * v, const numeral& l) { bool bv_bounds::bound_up(app * v, const numeral& u) { SASSERT(in_range(v, u)); - TRACE("bv_bounds", tout << "upper " << mk_ismt2_pp(v, m_m) << ":" << u << std::endl;); + TRACE(bv_bounds, tout << "upper " << mk_ismt2_pp(v, m_m) << ":" << u << std::endl;); // v <= u auto& value = m_unsigned_uppers.insert_if_not_there(v, u); if (!(u < value)) return m_okay; @@ -542,7 +542,7 @@ bool bv_bounds::bound_up(app * v, const numeral& u) { } bool bv_bounds::add_neg_bound(app * v, const numeral& a, const numeral& b) { - TRACE("bv_bounds", tout << "negative bound " << mk_ismt2_pp(v, m_m) << ":" << a << ";" << b << std::endl;); + TRACE(bv_bounds, tout << "negative bound " << mk_ismt2_pp(v, m_m) << ":" << a << ";" << b << std::endl;); bv_bounds::interval negative_interval(a, b); SASSERT(m_bv_util.is_bv(v)); SASSERT(a >= numeral::zero()); @@ -597,15 +597,15 @@ struct interval_comp_t { void bv_bounds::record_singleton(app * v, numeral& singleton_value) { - TRACE("bv_bounds", tout << "singleton:" << mk_ismt2_pp(v, m_m) << ":" << singleton_value << std::endl;); + TRACE(bv_bounds, tout << "singleton:" << mk_ismt2_pp(v, m_m) << ":" << singleton_value << std::endl;); SASSERT(!m_singletons.find(v, singleton_value)); m_singletons.insert(v, singleton_value); } bool bv_bounds::is_sat(app * v) { - TRACE("bv_bounds", tout << "is_sat " << mk_ismt2_pp(v, m_m) << std::endl;); + TRACE(bv_bounds, tout << "is_sat " << mk_ismt2_pp(v, m_m) << std::endl;); const bool rv = is_sat_core(v); - TRACE("bv_bounds", tout << "is_sat " << mk_ismt2_pp(v, m_m) << "\nres: " << rv << std::endl;); + TRACE(bv_bounds, tout << "is_sat " << mk_ismt2_pp(v, m_m) << "\nres: " << rv << std::endl;); return rv; } @@ -620,7 +620,7 @@ bool bv_bounds::is_sat_core(app * v) { const numeral& one = numeral::one(); if (!has_lower) lower = numeral::zero(); if (!has_upper) upper = (numeral::power_of_two(bv_sz) - one); - TRACE("bv_bounds", tout << "is_sat bound:" << lower << "-" << upper << std::endl;); + TRACE(bv_bounds, tout << "is_sat bound:" << lower << "-" << upper << std::endl;); intervals * negative_intervals(nullptr); const bool has_neg_intervals = m_negative_intervals.find(v, negative_intervals); bool is_sat(false); @@ -641,9 +641,9 @@ bool bv_bounds::is_sat_core(app * v) { if (new_hi > upper) new_hi = upper; is_sat = true; } - TRACE("bv_bounds", tout << "is_sat new_lo, new_hi:" << new_lo << "-" << new_hi << std::endl;); + TRACE(bv_bounds, tout << "is_sat new_lo, new_hi:" << new_lo << "-" << new_hi << std::endl;); ptr = negative_upper + one; - TRACE("bv_bounds", tout << "is_sat ptr, new_hi:" << ptr << "-" << new_hi << std::endl;); + TRACE(bv_bounds, tout << "is_sat ptr, new_hi:" << ptr << "-" << new_hi << std::endl;); if (ptr > upper) break; } } @@ -655,7 +655,7 @@ bool bv_bounds::is_sat_core(app * v) { } if (new_hi < upper) bound_up(v, new_hi); if (new_lo > lower) bound_lo(v, new_lo); - TRACE("bv_bounds", tout << "is_sat new_lo, new_hi:" << new_lo << "-" << new_hi << std::endl;); + TRACE(bv_bounds, tout << "is_sat new_lo, new_hi:" << new_lo << "-" << new_hi << std::endl;); const bool is_singleton = is_sat && new_hi == new_lo; if (is_singleton) record_singleton(v, new_lo); diff --git a/src/ast/rewriter/bv_bounds_base.h b/src/ast/rewriter/bv_bounds_base.h index 8542e5921..489e94e90 100644 --- a/src/ast/rewriter/bv_bounds_base.h +++ b/src/ast/rewriter/bv_bounds_base.h @@ -125,7 +125,7 @@ namespace bv { if (sign && !b.negate(b)) return false; - TRACE("bv", tout << (sign?"(not ":"") << mk_pp(t, m) << (sign ? ")" : "") << ": " << mk_pp(t1, m) << " in " << b << "\n";); + TRACE(bv, tout << (sign?"(not ":"") << mk_pp(t, m) << (sign ? ")" : "") << ": " << mk_pp(t1, m) << " in " << b << "\n";); map::obj_map_entry* e = m_bound.find_core(t1); if (e) { interval& old = e->get_data().m_value; @@ -202,7 +202,7 @@ namespace bv { if (simplified) { result = m.mk_app(to_app(t)->get_decl(), m_args); - TRACE("bv", tout << mk_pp(t, m) << " -> " << result << "\n"); + TRACE(bv, tout << mk_pp(t, m) << " -> " << result << "\n"); return true; } @@ -255,10 +255,10 @@ namespace bv { else if (false && intr != b) result = mk_bound(t1, intr.lo(), intr.hi()); else { - TRACE("bv", tout << mk_pp(t, m) << " b: " << b << " ctx: " << ctx << " intr " << intr << "\n"); + TRACE(bv, tout << mk_pp(t, m) << " b: " << b << " ctx: " << ctx << " intr " << intr << "\n"); } - CTRACE("bv", result, tout << mk_pp(t, m) << " " << b << " (ctx: " << ctx << ") (intr: " << intr << "): " << result << "\n";); + CTRACE(bv, result, tout << mk_pp(t, m) << " " << b << " (ctx: " << ctx << ") (intr: " << intr << "): " << result << "\n";); if (sign && result) result = m.mk_not(result); return result != nullptr; @@ -325,7 +325,7 @@ namespace bv { } void pop_core(unsigned num_scopes) { - TRACE("bv", tout << "pop: " << num_scopes << "\n";); + TRACE(bv, tout << "pop: " << num_scopes << "\n";); if (m_scopes.empty()) return; unsigned target = m_scopes.size() - num_scopes; diff --git a/src/ast/rewriter/bv_rewriter.cpp b/src/ast/rewriter/bv_rewriter.cpp index 5dd7c211f..57124c67d 100644 --- a/src/ast/rewriter/bv_rewriter.cpp +++ b/src/ast/rewriter/bv_rewriter.cpp @@ -244,7 +244,7 @@ br_status bv_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * cons return BR_FAILED; } - CTRACE("bv_verbose", st != BR_FAILED, tout << mk_pp(f, m) << "\n"; + CTRACE(bv_verbose, st != BR_FAILED, tout << mk_pp(f, m) << "\n"; for (unsigned i = 0; i < num_args; ++i) tout << " " << mk_bounded_pp(args[i], m) << "\n"; tout << mk_bounded_pp(result, m, 3) << "\n"); @@ -570,7 +570,7 @@ br_status bv_rewriter::mk_leq_core(bool is_signed, expr * a, expr * b, expr_ref if (m_le_extra) { const br_status cst = rw_leq_concats(is_signed, a, b, result); if (cst != BR_FAILED) { - TRACE("le_extra", tout << (is_signed ? "bv_sle\n" : "bv_ule\n") + TRACE(le_extra, tout << (is_signed ? "bv_sle\n" : "bv_ule\n") << mk_pp(a, m, 2) << "\n" << mk_pp(b, m, 2) << "\n--->\n"<< mk_pp(result, m, 2) << "\n";); return cst; } @@ -579,7 +579,7 @@ br_status bv_rewriter::mk_leq_core(bool is_signed, expr * a, expr * b, expr_ref if (m_le_extra) { const br_status cst = rw_leq_overflow(is_signed, a, b, result); if (cst != BR_FAILED) { - TRACE("le_extra", tout << (is_signed ? "bv_sle\n" : "bv_ule\n") + TRACE(le_extra, tout << (is_signed ? "bv_sle\n" : "bv_ule\n") << mk_pp(a, m, 2) << "\n" << mk_pp(b, m, 2) << "\n--->\n"<< mk_pp(result, m, 2) << "\n";); return cst; } @@ -857,7 +857,7 @@ br_status bv_rewriter::mk_extract(unsigned high, unsigned low, expr * arg, expr_ const unsigned ep_rm = propagate_extract(high, arg, ep_res); if (ep_rm != 0) { result = m_mk_extract(high, low, ep_res); - TRACE("extract_prop", tout << mk_pp(arg, m) << "\n[" << high <<"," << low << "]\n" << ep_rm << "---->\n" + TRACE(extract_prop, tout << mk_pp(arg, m) << "\n[" << high <<"," << low << "]\n" << ep_rm << "---->\n" << mk_pp(result.get(), m) << "\n";); return BR_REWRITE2; } @@ -1158,7 +1158,7 @@ br_status bv_rewriter::mk_bv_udiv_core(expr * arg1, expr * arg2, bool hi_div0, e numeral r1, r2; unsigned bv_size; - TRACE("bv_udiv", tout << "hi_div0: " << hi_div0 << "\n";); + TRACE(bv_udiv, tout << "hi_div0: " << hi_div0 << "\n";); if (is_numeral(arg2, r2, bv_size)) { r2 = m_util.norm(r2, bv_size); @@ -1207,7 +1207,7 @@ br_status bv_rewriter::mk_bv_udiv_core(expr * arg1, expr * arg2, bool hi_div0, e m_util.mk_bv_udiv0(arg1), m_util.mk_bv_udiv_i(arg1, arg2)); - TRACE("bv_udiv", tout << mk_pp(arg1, m) << "\n" << mk_pp(arg2, m) << "\n---->\n" << mk_pp(result, m) << "\n";); + TRACE(bv_udiv, tout << mk_pp(arg1, m) << "\n" << mk_pp(arg2, m) << "\n---->\n" << mk_pp(result, m) << "\n";); return BR_REWRITE2; } @@ -1903,7 +1903,7 @@ br_status bv_rewriter::mk_bv_or(unsigned num, expr * const * args, expr_ref & re } std::reverse(exs.begin(), exs.end()); result = m_util.mk_concat(exs.size(), exs.data()); - TRACE("mask_bug", + TRACE(mask_bug, tout << "(assert (distinct (bvor (_ bv" << old_v1 << " " << sz << ")\n" << mk_pp(t, m) << ")\n"; tout << mk_pp(result, m) << "))\n";); return BR_REWRITE2; @@ -2317,7 +2317,7 @@ br_status bv_rewriter::mk_bv_comp(expr * arg1, expr * arg2, expr_ref & result) { br_status bv_rewriter::mk_bv_add(unsigned num_args, expr * const * args, expr_ref & result) { br_status st = mk_add_core(num_args, args, result); if (st != BR_FAILED && st != BR_DONE) { - TRACE("bv", tout << result << "\n";); + TRACE(bv, tout << result << "\n";); return st; } #if 0 @@ -2575,7 +2575,7 @@ br_status bv_rewriter::mk_blast_eq_value(expr * lhs, expr * rhs, expr_ref & resu unsigned sz = get_bv_size(lhs); if (sz == 1) return BR_FAILED; - TRACE("blast_eq_value", tout << "sz: " << sz << "\n" << mk_pp(lhs, m) << "\n";); + TRACE(blast_eq_value, tout << "sz: " << sz << "\n" << mk_pp(lhs, m) << "\n";); if (is_numeral(lhs)) std::swap(lhs, rhs); @@ -2869,13 +2869,13 @@ br_status bv_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) { st = mk_mul_eq(lhs, rhs, result); if (st != BR_FAILED) { - TRACE("mk_mul_eq", tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";); + TRACE(mk_mul_eq, tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";); return st; } st = mk_mul_eq(rhs, lhs, result); if (st != BR_FAILED) { - TRACE("mk_mul_eq", tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";); + TRACE(mk_mul_eq, tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";); return st; } @@ -2992,7 +2992,7 @@ bool bv_rewriter::is_eq_bit(expr * t, expr * & x, unsigned & val) { br_status bv_rewriter::mk_ite_core(expr * c, expr * t, expr * e, expr_ref & result) { - TRACE("bv_ite", tout << "mk_ite_core:\n" << mk_pp(c, m) << "?\n" + TRACE(bv_ite, tout << "mk_ite_core:\n" << mk_pp(c, m) << "?\n" << mk_pp(t, m) << "\n:" << mk_pp(e, m) << "\n";); if (m.are_equal(t, e)) { result = e; diff --git a/src/ast/rewriter/cached_var_subst.cpp b/src/ast/rewriter/cached_var_subst.cpp index 61f9ceee7..0f731706d 100644 --- a/src/ast/rewriter/cached_var_subst.cpp +++ b/src/ast/rewriter/cached_var_subst.cpp @@ -65,7 +65,7 @@ expr_ref cached_var_subst::operator()() { // entry was already there m_new_keys[num_bindings] = m_key; // recycle key result = entry->get_data().m_value; - SCTRACE("bindings", is_trace_enabled("coming_from_quant"), tout << "(cache)\n"; + SCTRACE(bindings, is_trace_enabled(TraceTag::coming_from_quant), tout << "(cache)\n"; for (unsigned i = 0; i < num_bindings; i++) if (m_key->m_bindings[i]) tout << i << ": " << mk_ismt2_pp(m_key->m_bindings[i], result.m()) << ";\n"; diff --git a/src/ast/rewriter/der.cpp b/src/ast/rewriter/der.cpp index 1e2a19d72..25fc295d7 100644 --- a/src/ast/rewriter/der.cpp +++ b/src/ast/rewriter/der.cpp @@ -48,7 +48,7 @@ bool der::is_var_diseq(expr * e, unsigned num_decls, var * & v, expr_ref & t) { auto set_result = [&](var *w, expr* s) { v = w; t = s; - TRACE("der", tout << mk_pp(e, m) << "\n";); + TRACE(der, tout << mk_pp(e, m) << "\n";); return true; }; @@ -97,7 +97,7 @@ bool der::is_var_eq(expr* e, unsigned num_decls, var*& v, expr_ref& t) { auto set_result = [&](var* w, expr* s) { v = w; t = s; - TRACE("der", tout << mk_pp(e, m) << "\n";); + TRACE(der, tout << mk_pp(e, m) << "\n";); return true; }; @@ -137,7 +137,7 @@ void der::operator()(quantifier * q, expr_ref & r, proof_ref & pr) { pr = nullptr; r = q; - TRACE("der", tout << mk_pp(q, m) << "\n";); + TRACE(der, tout << mk_pp(q, m) << "\n";); auto k = q->get_kind(); // Keep applying it until r doesn't change anymore @@ -226,7 +226,7 @@ void der::reduce1(quantifier * q, expr_ref & r, proof_ref & pr) { } } else { - TRACE("der_bug", tout << "Did not find any diseq\n" << mk_pp(q, m) << "\n";); + TRACE(der_bug, tout << "Did not find any diseq\n" << mk_pp(q, m) << "\n";); r = q; } } @@ -282,7 +282,7 @@ static void der_sort_vars(ptr_vector & vars, expr_ref_vector & definitions, case AST_VAR: vidx = to_var(t)->get_idx(); if (fr.second == 0) { - CTRACE("der_bug", vidx >= definitions.size(), tout << "vidx: " << vidx << "\n";); + CTRACE(der_bug, vidx >= definitions.size(), tout << "vidx: " << vidx << "\n";); // Remark: The size of definitions may be smaller than the number of variables occurring in the quantified formula. if (definitions.get(vidx, nullptr) != nullptr) { if (visiting.is_marked(t)) { @@ -341,7 +341,7 @@ static void der_sort_vars(ptr_vector & vars, expr_ref_vector & definitions, void der::get_elimination_order() { m_order.reset(); - TRACE("top_sort", + TRACE(top_sort, tout << "DEFINITIONS: " << std::endl; unsigned i = 0; for (expr* e : m_map) { @@ -353,7 +353,7 @@ void der::get_elimination_order() { // der::top_sort ts(m); der_sort_vars(m_inx2var, m_map, m_order); - TRACE("der", + TRACE(der, tout << "Elimination m_order:" << "\n"; tout << m_order << "\n";); } diff --git a/src/ast/rewriter/distribute_forall.cpp b/src/ast/rewriter/distribute_forall.cpp index 6a6056227..b65b3f543 100644 --- a/src/ast/rewriter/distribute_forall.cpp +++ b/src/ast/rewriter/distribute_forall.cpp @@ -155,7 +155,7 @@ void distribute_forall::operator()(expr * f, expr_ref & result) { result = get_cached(f); SASSERT(result!=0); - TRACE("distribute_forall", tout << mk_ll_pp(f, m_manager) << "======>\n" + TRACE(distribute_forall, tout << mk_ll_pp(f, m_manager) << "======>\n" << mk_ll_pp(result, m_manager);); } diff --git a/src/ast/rewriter/dom_simplifier.cpp b/src/ast/rewriter/dom_simplifier.cpp index 205c81dbb..13d87290d 100644 --- a/src/ast/rewriter/dom_simplifier.cpp +++ b/src/ast/rewriter/dom_simplifier.cpp @@ -90,7 +90,7 @@ bool expr_dominators::compute_dominators() { unsigned iterations = 1; while (change) { change = false; - TRACE("simplify", + TRACE(simplify, for (auto & kv : m_doms) { tout << mk_bounded_pp(kv.m_key, m) << " |-> " << mk_bounded_pp(kv.m_value, m) << "\n"; }); @@ -135,7 +135,7 @@ bool expr_dominators::compile(expr * e) { compute_post_order(); if (!compute_dominators()) return false; extract_tree(); - TRACE("simplify", display(tout);); + TRACE(simplify, display(tout);); return true; } @@ -263,7 +263,7 @@ public: if (m.is_true(t)) return !sign; - TRACE("simplify", tout << t->get_id() << ": " << mk_bounded_pp(t, m) << " " << (sign?" - neg":" - pos") << "\n";); + TRACE(simplify, tout << t->get_id() << ": " << mk_bounded_pp(t, m) << " " << (sign?" - neg":" - pos") << "\n";); m_scoped_substitution.push(); if (!sign) { @@ -284,16 +284,16 @@ public: m_trail.push_back(lhs); m_trail.push_back(rhs); if (is_gt(lhs, rhs)) { - TRACE("propagate_values", tout << "insert " << mk_pp(lhs, m) << " -> " << mk_pp(rhs, m) << "\n";); + TRACE(propagate_values, tout << "insert " << mk_pp(lhs, m) << " -> " << mk_pp(rhs, m) << "\n";); m_scoped_substitution.insert(lhs, rhs, pr); return; } if (is_gt(rhs, lhs)) { - TRACE("propagate_values", tout << "insert " << mk_pp(rhs, m) << " -> " << mk_pp(lhs, m) << "\n";); + TRACE(propagate_values, tout << "insert " << mk_pp(rhs, m) << " -> " << mk_pp(lhs, m) << "\n";); m_scoped_substitution.insert(rhs, lhs, m.mk_symmetry(pr)); return; } - TRACE("propagate_values", tout << "incompatible " << mk_pp(n, m) << "\n";); + TRACE(propagate_values, tout << "incompatible " << mk_pp(n, m) << "\n";); } if (m.is_not(n, n1)) { m_scoped_substitution.insert(n1, m.mk_false(), m.mk_iff_false(pr)); diff --git a/src/ast/rewriter/elim_bounds.cpp b/src/ast/rewriter/elim_bounds.cpp index b6b98e0cb..00c974700 100644 --- a/src/ast/rewriter/elim_bounds.cpp +++ b/src/ast/rewriter/elim_bounds.cpp @@ -151,14 +151,14 @@ bool elim_bounds_cfg::reduce_quantifier(quantifier * q, } } } - TRACE("elim_bounds", tout << "candidates:\n"; for (unsigned i = 0; i < candidates.size(); i++) tout << mk_pp(candidates[i], m) << "\n";); + TRACE(elim_bounds, tout << "candidates:\n"; for (unsigned i = 0; i < candidates.size(); i++) tout << mk_pp(candidates[i], m) << "\n";); // remove candidates that have lower and upper bounds for (var * v : candidates) { if (lowers.contains(v) && uppers.contains(v)) candidate_set.erase(v); } - TRACE("elim_bounds", tout << "candidates after filter:\n"; for (unsigned i = 0; i < candidates.size(); i++) tout << mk_pp(candidates[i], m) << "\n";); + TRACE(elim_bounds, tout << "candidates after filter:\n"; for (unsigned i = 0; i < candidates.size(); i++) tout << mk_pp(candidates[i], m) << "\n";); if (candidate_set.empty()) { return false; } @@ -182,7 +182,7 @@ bool elim_bounds_cfg::reduce_quantifier(quantifier * q, case 0: result = m.mk_false(); result_pr = m.mk_rewrite(q, result); - TRACE("elim_bounds", tout << mk_pp(q, m) << "\n" << result << "\n";); + TRACE(elim_bounds, tout << mk_pp(q, m) << "\n" << result << "\n";); return true; case 1: new_body = atoms[0]; @@ -195,7 +195,7 @@ bool elim_bounds_cfg::reduce_quantifier(quantifier * q, new_q = m.update_quantifier(q, new_body); result = elim_unused_vars(m, new_q, params_ref()); result_pr = m.mk_rewrite(q, result); - TRACE("elim_bounds", tout << mk_pp(q, m) << "\n" << result << "\n";); + TRACE(elim_bounds, tout << mk_pp(q, m) << "\n" << result << "\n";); return true; } diff --git a/src/ast/rewriter/factor_equivs.cpp b/src/ast/rewriter/factor_equivs.cpp index e06c9479c..574ab6e23 100644 --- a/src/ast/rewriter/factor_equivs.cpp +++ b/src/ast/rewriter/factor_equivs.cpp @@ -86,7 +86,7 @@ expr *choose_rep(expr_equiv_class::eq_class &clazz, ast_manager &m) { } } } - TRACE("equiv", + TRACE(equiv, tout << "Rep: " << mk_pp(rep, m) << "\n"; for (expr *el : clazz) tout << mk_pp(el, m) << "\n"; diff --git a/src/ast/rewriter/factor_rewriter.cpp b/src/ast/rewriter/factor_rewriter.cpp index 8fbce55f6..2220d8613 100644 --- a/src/ast/rewriter/factor_rewriter.cpp +++ b/src/ast/rewriter/factor_rewriter.cpp @@ -53,7 +53,7 @@ br_status factor_rewriter::mk_eq(expr * arg1, expr * arg2, expr_ref & result) { return BR_DONE; } if (!extract_factors()) { - TRACE("factor_rewriter", tout << mk_pp(arg1, m()) << " = " << mk_pp(arg2, m()) << "\n";); + TRACE(factor_rewriter, tout << mk_pp(arg1, m()) << " = " << mk_pp(arg2, m()) << "\n";); return BR_FAILED; } powers_t::iterator it = m_powers.begin(), end = m_powers.end(); @@ -74,7 +74,7 @@ br_status factor_rewriter::mk_le(expr * arg1, expr * arg2, expr_ref & result) { return BR_DONE; } if (!extract_factors()) { - TRACE("factor_rewriter", tout << mk_pp(arg1, m()) << " <= " << mk_pp(arg2, m()) << "\n";); + TRACE(factor_rewriter, tout << mk_pp(arg1, m()) << " <= " << mk_pp(arg2, m()) << "\n";); return BR_FAILED; } @@ -87,7 +87,7 @@ br_status factor_rewriter::mk_le(expr * arg1, expr * arg2, expr_ref & result) { mk_is_negative(neg, eqs); eqs.push_back(neg); result = m().mk_or(eqs.size(), eqs.data()); - TRACE("factor_rewriter", + TRACE(factor_rewriter, tout << mk_pp(arg1, m()) << " <= " << mk_pp(arg2, m()) << "\n"; tout << mk_pp(result.get(), m()) << "\n";); return BR_DONE; @@ -101,7 +101,7 @@ br_status factor_rewriter::mk_lt(expr * arg1, expr * arg2, expr_ref & result) { return BR_DONE; } if (!extract_factors()) { - TRACE("factor_rewriter", tout << mk_pp(arg1, m()) << " < " << mk_pp(arg2, m()) << "\n";); + TRACE(factor_rewriter, tout << mk_pp(arg1, m()) << " < " << mk_pp(arg2, m()) << "\n";); return BR_FAILED; } // a^2 * b^3 * c < 0 -> @@ -116,7 +116,7 @@ br_status factor_rewriter::mk_lt(expr * arg1, expr * arg2, expr_ref & result) { } eqs.push_back(neg); result = m().mk_and(eqs.size(), eqs.data()); - TRACE("factor_rewriter", tout << mk_pp(result.get(), m()) << "\n";); + TRACE(factor_rewriter, tout << mk_pp(result.get(), m()) << "\n";); return BR_DONE; } @@ -163,7 +163,7 @@ void factor_rewriter::mk_adds(expr* arg1, expr* arg2) { bool sign = m_adds[i].second; expr* _e = m_adds[i].first; - TRACE("factor_rewriter", tout << i << " " << mk_pp(_e, m_manager) << "\n";); + TRACE(factor_rewriter, tout << i << " " << mk_pp(_e, m_manager) << "\n";); if (!is_app(_e)) { ++i; @@ -195,7 +195,7 @@ void factor_rewriter::mk_adds(expr* arg1, expr* arg2) { ++i; } } - TRACE("factor_rewriter", + TRACE(factor_rewriter, for (unsigned i = 0; i < m_adds.size(); ++i) { if (!m_adds[i].second) tout << "-"; else tout << "+"; tout << mk_pp(m_adds[i].first, m()) << " "; @@ -216,7 +216,7 @@ void factor_rewriter::mk_muls() { --i; } } - TRACE("factor_rewriter", + TRACE(factor_rewriter, for (unsigned i = 0; i < m_muls.size(); ++i) { for (unsigned j = 0; j < m_muls[i].size(); ++j) { tout << mk_pp(m_muls[i][j], m()) << " "; @@ -329,7 +329,7 @@ bool factor_rewriter::extract_factors() { m_factors.push_back(a().mk_add(trail.size(), trail.data())); break; } - TRACE("factor_rewriter", + TRACE(factor_rewriter, for (unsigned i = 0; i < m_factors.size(); ++i) { tout << mk_pp(m_factors[i].get(), m()) << " "; } diff --git a/src/ast/rewriter/fpa_rewriter.cpp b/src/ast/rewriter/fpa_rewriter.cpp index b7ba20ab7..474d1c958 100644 --- a/src/ast/rewriter/fpa_rewriter.cpp +++ b/src/ast/rewriter/fpa_rewriter.cpp @@ -143,7 +143,7 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const mpf_exp = m_fm.unbias_exp(ebits, mpf_exp); m_fm.set(v, ebits, sbits, !mpzm.is_zero(z), mpf_exp, sig); - TRACE("fp_rewriter", + TRACE(fp_rewriter, tout << "sgn: " << !mpzm.is_zero(z) << std::endl; tout << "sig: " << mpzm.to_string(sig) << std::endl; tout << "exp: " << mpf_exp << std::endl; @@ -159,27 +159,27 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const if (m_util.au().is_numeral(args[1], r1)) { // rm + real -> float - TRACE("fp_rewriter", tout << "r: " << r1 << std::endl;); + TRACE(fp_rewriter, tout << "r: " << r1 << std::endl;); scoped_mpf v(m_fm); m_fm.set(v, ebits, sbits, rmv, r1.to_mpq()); result = m_util.mk_value(v); - // TRACE("fp_rewriter", tout << "result: " << result << std::endl; ); + // TRACE(fp_rewriter, tout << "result: " << result << std::endl; ); return BR_DONE; } else if (m_util.is_numeral(args[1], v)) { // rm + float -> float - TRACE("fp_rewriter", tout << "v: " << m_fm.to_string(v) << std::endl; ); + TRACE(fp_rewriter, tout << "v: " << m_fm.to_string(v) << std::endl; ); scoped_mpf vf(m_fm); m_fm.set(vf, ebits, sbits, rmv, v); result = m_util.mk_value(vf); - // TRACE("fp_rewriter", tout << "result: " << result << std::endl; ); + // TRACE(fp_rewriter, tout << "result: " << result << std::endl; ); return BR_DONE; } else if (m_util.bu().is_numeral(args[1], r1, bvs1)) { // rm + signed bv -> float - TRACE("fp_rewriter", tout << "r1: " << r1 << std::endl;); + TRACE(fp_rewriter, tout << "r1: " << r1 << std::endl;); r1 = m_util.bu().norm(r1, bvs1, true); - TRACE("fp_rewriter", tout << "r1 norm: " << r1 << std::endl;); + TRACE(fp_rewriter, tout << "r1 norm: " << r1 << std::endl;); m_fm.set(v, ebits, sbits, rmv, r1.to_mpq()); result = m_util.mk_value(v); return BR_DONE; @@ -195,7 +195,7 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const !m_util.au().is_numeral(args[2], r2)) return BR_FAILED; - TRACE("fp_rewriter", tout << "r1: " << r1 << ", r2: " << r2 << "\n";); + TRACE(fp_rewriter, tout << "r1: " << r1 << ", r2: " << r2 << "\n";); m_fm.set(v, ebits, sbits, rmv, r2.to_mpq().numerator(), r1.to_mpq()); result = m_util.mk_value(v); return BR_DONE; @@ -209,7 +209,7 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const !m_util.au().is_numeral(args[2], r2)) return BR_FAILED; - TRACE("fp_rewriter", tout << "r1: " << r1 << ", r2: " << r2 << "\n";); + TRACE(fp_rewriter, tout << "r1: " << r1 << ", r2: " << r2 << "\n";); m_fm.set(v, ebits, sbits, rmv, r1.to_mpq().numerator(), r2.to_mpq()); result = m_util.mk_value(v); return BR_DONE; @@ -226,7 +226,7 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const r1.is_one(), m_fm.unbias_exp(bvs2, biased_exp), r3.to_mpq().numerator()); - TRACE("fp_rewriter", tout << "v = " << m_fm.to_string(v) << std::endl;); + TRACE(fp_rewriter, tout << "v = " << m_fm.to_string(v) << std::endl;); result = m_util.mk_value(v); return BR_DONE; } @@ -700,7 +700,7 @@ br_status fpa_rewriter::mk_fp(expr * sgn, expr * exp, expr * sig, expr_ref & res rsgn.is_one(), m_fm.unbias_exp(bvsz_exp, biased_exp), rsig.to_mpq().numerator()); - TRACE("fp_rewriter", tout << "simplified (fp ...) to " << m_fm.to_string(v) << std::endl;); + TRACE(fp_rewriter, tout << "simplified (fp ...) to " << m_fm.to_string(v) << std::endl;); result = m_util.mk_value(v); return BR_DONE; } @@ -765,11 +765,11 @@ br_status fpa_rewriter::mk_to_sbv(func_decl * f, expr * arg1, expr * arg2, expr_ } br_status fpa_rewriter::mk_to_ieee_bv(func_decl * f, expr * arg, expr_ref & result) { - TRACE("fp_rewriter", tout << "to_ieee_bv of " << mk_ismt2_pp(arg, m()) << std::endl;); + TRACE(fp_rewriter, tout << "to_ieee_bv of " << mk_ismt2_pp(arg, m()) << std::endl;); scoped_mpf v(m_fm); if (m_util.is_numeral(arg, v)) { - TRACE("fp_rewriter", tout << "to_ieee_bv numeral: " << m_fm.to_string(v) << std::endl;); + TRACE(fp_rewriter, tout << "to_ieee_bv numeral: " << m_fm.to_string(v) << std::endl;); bv_util bu(m()); const mpf & x = v.get(); diff --git a/src/ast/rewriter/inj_axiom.cpp b/src/ast/rewriter/inj_axiom.cpp index a46e60e5c..a1fdef2f9 100644 --- a/src/ast/rewriter/inj_axiom.cpp +++ b/src/ast/rewriter/inj_axiom.cpp @@ -75,7 +75,7 @@ bool simplify_inj_axiom(ast_manager & m, quantifier * q, expr_ref & result) { } if (found_vars && !has_free_vars(q)) { (void)num_vars; - TRACE("inj_axiom", + TRACE(inj_axiom, tout << "Cadidate for simplification:\n" << mk_ll_pp(q, m) << mk_pp(app1, m) << "\n" << mk_pp(app2, m) << "\n" << mk_pp(var1, m) << "\n" << mk_pp(var2, m) << "\nnum_vars: " << num_vars << "\n";); // Building new (optimized) axiom @@ -128,7 +128,7 @@ bool simplify_inj_axiom(ast_manager & m, quantifier * q, expr_ref & result) { result = m.mk_forall(decls.size(), decls.data(), names.data(), eq, 0, symbol(), symbol(), 1, &p); - TRACE("inj_axiom", tout << "new axiom:\n" << mk_pp(result, m) << "\n";); + TRACE(inj_axiom, tout << "new axiom:\n" << mk_pp(result, m) << "\n";); SASSERT(is_well_sorted(m, result)); return true; } diff --git a/src/ast/rewriter/maximize_ac_sharing.cpp b/src/ast/rewriter/maximize_ac_sharing.cpp index b5ebb9f1c..6749f1c21 100644 --- a/src/ast/rewriter/maximize_ac_sharing.cpp +++ b/src/ast/rewriter/maximize_ac_sharing.cpp @@ -46,18 +46,18 @@ br_status maximize_ac_sharing::reduce_app(func_decl * f, unsigned num_args, expr _args.append(num_args, args); } - TRACE("ac_sharing_detail", tout << "before-reuse: num_args: " << num_args << "\n";); + TRACE(ac_sharing_detail, tout << "before-reuse: num_args: " << num_args << "\n";); #define MAX_NUM_ARGS_FOR_OPT 128 // Try to reuse already created circuits. - TRACE("ac_sharing_detail", tout << "args: "; for (unsigned i = 0; i < num_args; i++) tout << mk_pp(_args[i], m) << "\n";); + TRACE(ac_sharing_detail, tout << "args: "; for (unsigned i = 0; i < num_args; i++) tout << mk_pp(_args[i], m) << "\n";); try_to_reuse: if (num_args > 1 && num_args < MAX_NUM_ARGS_FOR_OPT) { for (unsigned i = 0; i + 1 < num_args; i++) { for (unsigned j = i + 1; j < num_args; j++) { if (contains(f, _args[i], _args[j])) { - TRACE("ac_sharing_detail", tout << "reusing args: " << i << " " << j << "\n";); + TRACE(ac_sharing_detail, tout << "reusing args: " << i << " " << j << "\n";); _args[i] = m.mk_app(f, _args[i], _args[j]); SASSERT(num_args > 1); for (unsigned w = j; w + 1 < num_args; w++) { @@ -73,7 +73,7 @@ br_status maximize_ac_sharing::reduce_app(func_decl * f, unsigned num_args, expr // Create "tree-like circuit" while (true) { - TRACE("ac_sharing_detail", tout << "tree-loop: num_args: " << num_args << "\n";); + TRACE(ac_sharing_detail, tout << "tree-loop: num_args: " << num_args << "\n";); unsigned j = 0; for (unsigned i = 0; i < num_args; i += 2, j++) { if (i == num_args - 1) { @@ -92,7 +92,7 @@ br_status maximize_ac_sharing::reduce_app(func_decl * f, unsigned num_args, expr else { result = m.mk_app(f, numeral, _args[0]); } - TRACE("ac_sharing_detail", tout << "result: " << result << "\n";); + TRACE(ac_sharing_detail, tout << "result: " << result << "\n";); return BR_DONE; } } diff --git a/src/ast/rewriter/pb2bv_rewriter.cpp b/src/ast/rewriter/pb2bv_rewriter.cpp index 98c7a4c5e..62bb53611 100644 --- a/src/ast/rewriter/pb2bv_rewriter.cpp +++ b/src/ast/rewriter/pb2bv_rewriter.cpp @@ -157,7 +157,7 @@ struct pb2bv_rewriter::imp { gcd_reduce(m_coeffs, k); unsigned sz = m_args.size(); expr * const* args = m_args.data(); - TRACE("pb", + TRACE(pb, for (unsigned i = 0; i < sz; ++i) { tout << m_coeffs[i] << "*" << mk_pp(args[i], m) << " "; if (i + 1 < sz && !m_coeffs[i+1].is_neg()) tout << "+ "; @@ -283,7 +283,7 @@ struct pb2bv_rewriter::imp { return false; } result = m.mk_not(bounded_addition(sz, args, k + 1)); - TRACE("pb", tout << result << "\n";); + TRACE(pb, tout << result << "\n";); return true; } @@ -301,7 +301,7 @@ struct pb2bv_rewriter::imp { return false; } result = bounded_addition(sz, args, k); - TRACE("pb", tout << result << "\n";); + TRACE(pb, tout << result << "\n";); return true; } @@ -449,7 +449,7 @@ struct pb2bv_rewriter::imp { rational cost(0); create_basis(m_coeffs, rational::zero(), cost); m_base = m_min_base; - TRACE("pb", + TRACE(pb, tout << "Base: "; for (unsigned i = 0; i < m_base.size(); ++i) { tout << m_base[i] << " "; @@ -465,7 +465,7 @@ struct pb2bv_rewriter::imp { \brief Check if 'out mod n >= lim'. */ expr_ref mod_ge(ptr_vector const& out, unsigned n, unsigned lim) { - TRACE("pb", for (unsigned i = 0; i < out.size(); ++i) tout << mk_pp(out[i], m) << " "; tout << "\n"; + TRACE(pb, for (unsigned i = 0; i < out.size(); ++i) tout << mk_pp(out[i], m) << " "; tout << "\n"; tout << "n:" << n << " lim: " << lim << "\n";); if (lim == n) { return expr_ref(m.mk_false(), m); @@ -514,7 +514,7 @@ struct pb2bv_rewriter::imp { } coeffs[j] = div(coeffs[j], b_i); } - TRACE("pb", tout << "Carry: " << carry << "\n"; + TRACE(pb, tout << "Carry: " << carry << "\n"; for (auto c : coeffs) tout << c << " "; tout << "\n"; ); @@ -525,7 +525,7 @@ struct pb2bv_rewriter::imp { expr_ref ge = mod_ge(out, B, d_i); result = mk_and(ge, result); result = mk_or(gt, result); - TRACE("pb", tout << "b: " << b_i << " d: " << d_i << " gt: " << gt << " ge: " << ge << " " << result << "\n";); + TRACE(pb, tout << "b: " << b_i << " d: " << d_i << " gt: " << gt << " ge: " << ge << " " << result << "\n";); new_carry.reset(); for (unsigned j = B - 1; j < out.size(); j += B) { @@ -534,7 +534,7 @@ struct pb2bv_rewriter::imp { carry.reset(); carry.append(new_carry); } - TRACE("pb", tout << "bound: " << bound << " Carry: " << carry << " result: " << result << "\n";); + TRACE(pb, tout << "bound: " << bound << " Carry: " << carry << " result: " << result << "\n";); return true; } @@ -685,7 +685,7 @@ struct pb2bv_rewriter::imp { m_coeffs.push_back(pb.get_coeff(f, i)); m_args.push_back(args[i]); } - CTRACE("pb", k.is_neg(), tout << expr_ref(m.mk_app(f, sz, args), m) << "\n";); + CTRACE(pb, k.is_neg(), tout << expr_ref(m.mk_app(f, sz, args), m) << "\n";); SASSERT(!k.is_neg()); switch (kind) { case OP_PB_GE: @@ -923,7 +923,7 @@ struct pb2bv_rewriter::imp { else { result = mk_bv(f, sz, args); } - TRACE("pb", tout << "full: " << full << " " << expr_ref(m.mk_app(f, sz, args), m) << " " << result << "\n"; + TRACE(pb, tout << "full: " << full << " " << expr_ref(m.mk_app(f, sz, args), m) << " " << result << "\n"; ); return true; } diff --git a/src/ast/rewriter/pb_rewriter.cpp b/src/ast/rewriter/pb_rewriter.cpp index 4f1fe3fd1..7752f08d6 100644 --- a/src/ast/rewriter/pb_rewriter.cpp +++ b/src/ast/rewriter/pb_rewriter.cpp @@ -319,14 +319,14 @@ br_status pb_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * cons break; } } - TRACE("pb_verbose", + TRACE(pb_verbose, expr_ref tmp(m); tmp = m.mk_app(f, num_args, args); tout << tmp << "\n"; tout << result << "\n"; ); - TRACE("pb_validate", + TRACE(pb_validate, validate_rewrite(f, num_args, args, result);); return st; diff --git a/src/ast/rewriter/pb_rewriter_def.h b/src/ast/rewriter/pb_rewriter_def.h index 4c93a8b76..cd5f7d99a 100644 --- a/src/ast/rewriter/pb_rewriter_def.h +++ b/src/ast/rewriter/pb_rewriter_def.h @@ -35,7 +35,7 @@ void pb_rewriter_util::display(std::ostream& out, typename PBU::args_t& arg template void pb_rewriter_util::unique(typename PBU::args_t& args, typename PBU::numeral& k, bool is_eq) { - TRACE("pb_verbose", display(tout << "pre-unique:", args, k, is_eq);); + TRACE(pb_verbose, display(tout << "pre-unique:", args, k, is_eq);); for (unsigned i = 0; i < args.size(); ++i) { if (m_util.is_negated(args[i].first)) { args[i].first = m_util.negate(args[i].first); @@ -84,12 +84,12 @@ void pb_rewriter_util::unique(typename PBU::args_t& args, typename PBU::num } } args.resize(i); - TRACE("pb_verbose", display(tout << "post-unique:", args, k, is_eq);); + TRACE(pb_verbose, display(tout << "post-unique:", args, k, is_eq);); } template lbool pb_rewriter_util::normalize(typename PBU::args_t& args, typename PBU::numeral& k, bool is_eq) { - TRACE("pb_verbose", display(tout << "pre-normalize:", args, k, is_eq);); + TRACE(pb_verbose, display(tout << "pre-normalize:", args, k, is_eq);); DEBUG_CODE( bool found = false; @@ -167,7 +167,7 @@ lbool pb_rewriter_util::normalize(typename PBU::args_t& args, typename PBU: return l_false; } if (is_eq) { - TRACE("pb_verbose", display(tout << "post-normalize:", args, k, is_eq);); + TRACE(pb_verbose, display(tout << "post-normalize:", args, k, is_eq);); return l_undef; } @@ -265,7 +265,7 @@ lbool pb_rewriter_util::normalize(typename PBU::args_t& args, typename PBU: k = n1 + PBU::numeral::one(); } } - TRACE("pb_verbose", display(tout << "post-normalize:", args, k, is_eq);); + TRACE(pb_verbose, display(tout << "post-normalize:", args, k, is_eq);); return l_undef; } diff --git a/src/ast/rewriter/poly_rewriter_def.h b/src/ast/rewriter/poly_rewriter_def.h index f739579e6..f0f564816 100644 --- a/src/ast/rewriter/poly_rewriter_def.h +++ b/src/ast/rewriter/poly_rewriter_def.h @@ -187,7 +187,7 @@ br_status poly_rewriter::mk_flat_mul_core(unsigned num_args, expr * cons } } br_status st = mk_nflat_mul_core(flat_args.size(), flat_args.data(), result); - TRACE("poly_rewriter", + TRACE(poly_rewriter, tout << "flat mul:\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_bounded_pp(args[i], M()) << "\n"; tout << "---->\n"; @@ -292,7 +292,7 @@ br_status poly_rewriter::mk_nflat_mul_core(unsigned num_args, expr * con new_add_args.push_back(mk_mul_app(c, to_app(var)->get_arg(i))); } result = mk_add_app(new_add_args.size(), new_add_args.data()); - TRACE("mul_bug", tout << "result: " << mk_bounded_pp(result, M(), 5) << "\n";); + TRACE(mul_bug, tout << "result: " << mk_bounded_pp(result, M(), 5) << "\n";); return BR_REWRITE2; } } @@ -324,7 +324,7 @@ br_status poly_rewriter::mk_nflat_mul_core(unsigned num_args, expr * con new_args.push_back(curr); prev = curr; } - TRACE("poly_rewriter", + TRACE(poly_rewriter, for (unsigned i = 0; i < new_args.size(); i++) { if (i > 0) tout << (lt(new_args[i-1], new_args[i]) ? " < " : " !< "); @@ -335,7 +335,7 @@ br_status poly_rewriter::mk_nflat_mul_core(unsigned num_args, expr * con return BR_FAILED; if (!ordered) { std::sort(new_args.begin(), new_args.end(), lt); - TRACE("poly_rewriter", + TRACE(poly_rewriter, tout << "after sorting:\n"; for (unsigned i = 0; i < new_args.size(); i++) { if (i > 0) @@ -347,7 +347,7 @@ br_status poly_rewriter::mk_nflat_mul_core(unsigned num_args, expr * con SASSERT(new_args.size() >= 2); result = mk_mul_app(new_args.size(), new_args.data()); result = mk_mul_app(c, result); - TRACE("poly_rewriter", + TRACE(poly_rewriter, for (unsigned i = 0; i < num_args; ++i) tout << mk_ismt2_pp(args[i], M()) << " "; tout << "\nmk_nflat_mul_core result:\n" << mk_ismt2_pp(result, M()) << "\n";); @@ -375,9 +375,9 @@ br_status poly_rewriter::mk_nflat_mul_core(unsigned num_args, expr * con unsigned orig_size = sums.size(); expr_ref_buffer sum(M()); // must be ref_buffer because we may throw an exception ptr_buffer m_args; - TRACE("som", tout << "starting soM()...\n";); + TRACE(som, tout << "starting soM()...\n";); do { - TRACE("som", for (unsigned i = 0; i < it.size(); i++) tout << it[i] << " "; + TRACE(som, for (unsigned i = 0; i < it.size(); i++) tout << it[i] << " "; tout << "\n";); if (sum.size() > m_som_blowup * orig_size) { return BR_FAILED; @@ -564,7 +564,7 @@ br_status poly_rewriter::mk_nflat_add_core(unsigned num_args, expr * con } normalize(c); SASSERT(m_sort_sums || ordered); - TRACE("rewriter", + TRACE(rewriter, tout << "ordered: " << ordered << " sort sums: " << m_sort_sums << "\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], M()) << "\n";); @@ -615,14 +615,14 @@ br_status poly_rewriter::mk_nflat_add_core(unsigned num_args, expr * con } } if (m_sort_sums) { - TRACE("rewriter_bug", tout << "new_args.size(): " << new_args.size() << "\n";); + TRACE(rewriter_bug, tout << "new_args.size(): " << new_args.size() << "\n";); if (c.is_zero()) std::sort(new_args.data(), new_args.data() + new_args.size(), mon_lt(*this)); else std::sort(new_args.data() + 1, new_args.data() + new_args.size(), mon_lt(*this)); } result = mk_add_app(new_args.size(), new_args.data()); - TRACE("rewriter", tout << result << "\n";); + TRACE(rewriter, tout << result << "\n";); if (hoist_multiplication(result)) { return BR_REWRITE_FULL; } @@ -881,7 +881,7 @@ br_status poly_rewriter::cancel_monomials(expr * lhs, expr * rhs, bool m new_lhs_monomials[0] = insert_c_lhs ? mk_numeral(c) : nullptr; lhs_result = mk_add_app(new_lhs_monomials.size() - lhs_offset, new_lhs_monomials.data() + lhs_offset); rhs_result = mk_add_app(new_rhs_monomials.size() - rhs_offset, new_rhs_monomials.data() + rhs_offset); - TRACE("le_bug", tout << lhs_result << " " << rhs_result << "\n";); + TRACE(le_bug, tout << lhs_result << " " << rhs_result << "\n";); return BR_DONE; } diff --git a/src/ast/rewriter/push_app_ite.cpp b/src/ast/rewriter/push_app_ite.cpp index b993c29a5..32e111614 100644 --- a/src/ast/rewriter/push_app_ite.cpp +++ b/src/ast/rewriter/push_app_ite.cpp @@ -48,7 +48,7 @@ bool push_app_ite_cfg::is_target(func_decl * decl, unsigned num_args, expr * con } } } - CTRACE("push_app_ite", found_ite, tout << "found target for push app ite:\n"; + CTRACE(push_app_ite, found_ite, tout << "found target for push app ite:\n"; tout << "conservative " << m_conservative << "\n"; tout << decl->get_name(); for (unsigned i = 0; i < num_args; i++) tout << " " << mk_pp(args[i], m); @@ -75,7 +75,7 @@ br_status push_app_ite_cfg::reduce_app(func_decl * f, unsigned num, expr * const expr_ref e_new(m.mk_app(f, num, args_prime), m); args_prime[ite_arg_idx] = old; result = m.mk_ite(c, t_new, e_new); - TRACE("push_app_ite", tout << result << "\n";); + TRACE(push_app_ite, tout << result << "\n";); if (m.proofs_enabled()) { result_pr = m.mk_rewrite(m.mk_app(f, num, args), result); } diff --git a/src/ast/rewriter/quant_hoist.cpp b/src/ast/rewriter/quant_hoist.cpp index 64427aecd..d649737f5 100644 --- a/src/ast/rewriter/quant_hoist.cpp +++ b/src/ast/rewriter/quant_hoist.cpp @@ -44,7 +44,7 @@ public: void operator()(expr* fml, app_ref_vector& vars, bool& is_fa, expr_ref& result, bool use_fresh, bool rewrite_ok) { quantifier_type qt = Q_none_pos; pull_quantifier(fml, qt, vars, result, use_fresh, rewrite_ok); - TRACE("qe_verbose", + TRACE(qe_verbose, tout << mk_pp(fml, m) << "\n"; tout << mk_pp(result, m) << "\n";); SASSERT(is_positive(qt)); @@ -54,7 +54,7 @@ public: void pull_exists(expr* fml, app_ref_vector& vars, expr_ref& result, bool use_fresh, bool rewrite_ok) { quantifier_type qt = Q_exists_pos; pull_quantifier(fml, qt, vars, result, use_fresh, rewrite_ok); - TRACE("qe_verbose", + TRACE(qe_verbose, tout << mk_pp(fml, m) << "\n"; tout << mk_pp(result, m) << "\n";); } @@ -63,7 +63,7 @@ public: quantifier_type qt = is_forall?Q_forall_pos:Q_exists_pos; expr_ref result(m); pull_quantifier(fml, qt, vars, result, use_fresh, rewrite_ok); - TRACE("qe_verbose", + TRACE(qe_verbose, tout << mk_pp(fml, m) << "\n"; tout << mk_pp(result, m) << "\n";); fml = std::move(result); diff --git a/src/ast/rewriter/rewriter.cpp b/src/ast/rewriter/rewriter.cpp index 51c4764df..6c96d6411 100644 --- a/src/ast/rewriter/rewriter.cpp +++ b/src/ast/rewriter/rewriter.cpp @@ -50,7 +50,7 @@ bool rewriter_core::rewrites_from(expr* t, proof* p) { } bool rewriter_core::rewrites_to(expr* t, proof* p) { - CTRACE("rewriter", p && !m().proofs_disabled() && to_app(m().get_fact(p))->get_arg(1) != t, + CTRACE(rewriter, p && !m().proofs_disabled() && to_app(m().get_fact(p))->get_arg(1) != t, tout << mk_pp(p, m()) << "\n"; tout << mk_pp(t, m()) << "\n";); return !p || m().proofs_disabled() || (to_app(m().get_fact(p))->get_arg(1) == t); @@ -65,7 +65,7 @@ void rewriter_core::cache_shifted_result(expr * k, unsigned offset, expr * v) { #endif SASSERT(!m_proof_gen); - TRACE("rewriter_cache_result", tout << mk_ismt2_pp(k, m()) << "\n--->\n" << mk_ismt2_pp(v, m()) << "\n";); + TRACE(rewriter_cache_result, tout << mk_ismt2_pp(k, m()) << "\n--->\n" << mk_ismt2_pp(v, m()) << "\n";); SASSERT(k->get_sort() == v->get_sort()); diff --git a/src/ast/rewriter/rewriter.h b/src/ast/rewriter/rewriter.h index c7228d4f9..3886df129 100644 --- a/src/ast/rewriter/rewriter.h +++ b/src/ast/rewriter/rewriter.h @@ -106,7 +106,7 @@ protected: void end_scope(); bool is_child_of_top_frame(expr * t) const; void set_new_child_flag(expr * old_t) { - CTRACE("rewriter_bug", !is_child_of_top_frame(old_t), display_stack(tout, 3);); + CTRACE(rewriter_bug, !is_child_of_top_frame(old_t), display_stack(tout, 3);); SASSERT(is_child_of_top_frame(old_t)); if (!m_frame_stack.empty()) m_frame_stack.back().m_new_child = true; diff --git a/src/ast/rewriter/rewriter_def.h b/src/ast/rewriter/rewriter_def.h index 70824c5e4..7a0a1f61a 100644 --- a/src/ast/rewriter/rewriter_def.h +++ b/src/ast/rewriter/rewriter_def.h @@ -34,7 +34,7 @@ void rewriter_tpl::process_var(var * v) { m_pr = nullptr; } set_new_child_flag(v); - TRACE("rewriter", tout << mk_ismt2_pp(v, m()) << " -> " << m_r << "\n";); + TRACE(rewriter, tout << mk_ismt2_pp(v, m()) << " -> " << m_r << "\n";); m_r = nullptr; return; } @@ -45,7 +45,7 @@ void rewriter_tpl::process_var(var * v) { unsigned index = 0; expr * r; if (idx < m_bindings.size() && (index = m_bindings.size() - idx - 1, r = m_bindings[index])) { - CTRACE("rewriter", v->get_sort() != r->get_sort(), + CTRACE(rewriter, v->get_sort() != r->get_sort(), tout << expr_ref(v, m()) << ":" << sort_ref(v->get_sort(), m()) << " != " << expr_ref(r, m()) << ":" << sort_ref(r->get_sort(), m()); tout << "index " << index << " bindings " << m_bindings.size() << "\n"; display_bindings(tout);); @@ -60,13 +60,13 @@ void rewriter_tpl::process_var(var * v) { expr_ref tmp(m()); m_shifter(r, shift_amount, tmp); result_stack().push_back(tmp); - TRACE("rewriter", display_bindings(tout << "shift: " << shift_amount << " idx: " << idx << " --> " << tmp << "\n");); + TRACE(rewriter, display_bindings(tout << "shift: " << shift_amount << " idx: " << idx << " --> " << tmp << "\n");); cache_shifted_result(r, shift_amount, tmp); } } else { result_stack().push_back(r); - TRACE("rewriter", tout << idx << " " << mk_ismt2_pp(r, m()) << "\n";); + TRACE(rewriter, tout << idx << " " << mk_ismt2_pp(r, m()) << "\n";); } set_new_child_flag(v); } @@ -83,7 +83,7 @@ bool rewriter_tpl::process_const(app * t0) { retry: SASSERT(t->get_num_args() == 0); br_status st = m_cfg.reduce_app(t->get_decl(), 0, nullptr, m_r, m_pr); - TRACE("reduce_app", + TRACE(reduce_app, tout << "t0:" << mk_bounded_pp(t0, m()) << "\n"; if (t != t0) tout << "t: " << mk_bounded_pp(t, m()) << "\n"; tout << "st: " << st; @@ -91,7 +91,7 @@ bool rewriter_tpl::process_const(app * t0) { tout << "\n"; if (m_pr) tout << mk_bounded_pp(m_pr, m()) << "\n"; ); - CTRACE("reduce_app", + CTRACE(reduce_app, st != BR_FAILED && m_r->get_sort() != t->get_sort(), tout << mk_pp(t->get_sort(), m()) << ": " << mk_pp(t, m()) << "\n"; tout << m_r->get_id() << " " << mk_pp(m_r->get_sort(), m()) << ": " << m_r << "\n";); @@ -141,11 +141,11 @@ bool rewriter_tpl::process_const(app * t0) { template template bool rewriter_tpl::visit(expr * t, unsigned max_depth) { - TRACE("rewriter_visit", tout << "visiting\n" << mk_ismt2_pp(t, m()) << "\n";); + TRACE(rewriter_visit, tout << "visiting\n" << mk_ismt2_pp(t, m()) << "\n";); expr * new_t = nullptr; proof * new_t_pr = nullptr; if (m_cfg.get_subst(t, new_t, new_t_pr)) { - TRACE("rewriter_subst", tout << "subst\n" << mk_ismt2_pp(t, m()) << "\n---->\n" << mk_ismt2_pp(new_t, m()) << "\n";); + TRACE(rewriter_subst, tout << "subst\n" << mk_ismt2_pp(t, m()) << "\n---->\n" << mk_ismt2_pp(new_t, m()) << "\n";); SASSERT(t->get_sort() == new_t->get_sort()); result_stack().push_back(new_t); set_new_child_flag(t, new_t); @@ -196,7 +196,7 @@ bool rewriter_tpl::visit(expr * t, unsigned max_depth) { if (to_app(t)->get_num_args() == 0) { if (process_const(to_app(t))) return true; - TRACE("rewriter_const", tout << "process const: " << mk_bounded_pp(t, m()) << " -> " << mk_bounded_pp(m_r, m()) << "\n";); + TRACE(rewriter_const, tout << "process const: " << mk_bounded_pp(t, m()) << " -> " << mk_bounded_pp(m_r, m()) << "\n";); if (!is_blocked(t)) { rewriter_tpl rw(m(), false, m_cfg); for (auto* s : m_blocked) @@ -243,14 +243,14 @@ bool rewriter_tpl::constant_fold(app * t, frame & fr) { result_stack().shrink(fr.m_spos); result_stack().push_back(arg); fr.m_state = REWRITE_BUILTIN; - TRACE("rewriter_step", tout << "step\n" << mk_ismt2_pp(t, m()) << "\n";); + TRACE(rewriter_step, tout << "step\n" << mk_ismt2_pp(t, m()) << "\n";); if (visit(arg, fr.m_max_depth)) { m_r = result_stack().back(); result_stack().pop_back(); result_stack().pop_back(); result_stack().push_back(m_r); cache_result(t, m_r, m_pr, fr.m_cache_result); - TRACE("rewriter_step", tout << "step 1\n" << mk_ismt2_pp(m_r, m()) << "\n";); + TRACE(rewriter_step, tout << "step 1\n" << mk_ismt2_pp(m_r, m()) << "\n";); frame_stack().pop_back(); set_new_child_flag(t); } @@ -315,7 +315,7 @@ void rewriter_tpl::process_app(app * t, frame & fr) { } br_status st = m_cfg.reduce_app(f, new_num_args, new_args, m_r, m_pr2); - CTRACE("reduce_app", true || st != BR_FAILED || new_t, + CTRACE(reduce_app, true || st != BR_FAILED || new_t, tout << mk_bounded_pp(t, m()) << "\n"; tout << "st: " << st; if (m_r) tout << " --->\n" << mk_bounded_pp(m_r, m()); @@ -425,7 +425,7 @@ void rewriter_tpl::process_app(app * t, frame & fr) { } else { fr.m_state = EXPAND_DEF; - TRACE("get_macro", tout << "f: " << f->get_name() << ", def: \n" << mk_ismt2_pp(def, m()) << "\n"; + TRACE(get_macro, tout << "f: " << f->get_name() << ", def: \n" << mk_ismt2_pp(def, m()) << "\n"; tout << "Args num: " << num_args << "\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(new_args[i], m()) << "\n";); unsigned sz = m_bindings.size(); @@ -436,7 +436,7 @@ void rewriter_tpl::process_app(app * t, frame & fr) { m_shifts.push_back(sz); } result_stack().push_back(def); - TRACE("get_macro", display_bindings(tout);); + TRACE(get_macro, display_bindings(tout);); begin_scope(); m_num_qvars += num_args; m_root = def; @@ -453,7 +453,7 @@ void rewriter_tpl::process_app(app * t, frame & fr) { } } else { - TRACE("rewriter_reuse", tout << "reusing:\n" << mk_ismt2_pp(t, m()) << "\n";); + TRACE(rewriter_reuse, tout << "reusing:\n" << mk_ismt2_pp(t, m()) << "\n";); m_r = t; } } @@ -557,7 +557,7 @@ void rewriter_tpl::process_quantifier(quantifier * q, frame & fr) { expr_ref_vector new_pats(m_manager, num_pats, q->get_patterns()); expr_ref_vector new_no_pats(m_manager, num_no_pats, q->get_no_patterns()); if (rewrite_patterns()) { - TRACE("reduce_quantifier_bug", tout << "rewrite patterns\n";); + TRACE(reduce_quantifier_bug, tout << "rewrite patterns\n";); expr * const * np = it + 1; expr * const * nnp = np + num_pats; unsigned j = 0; @@ -591,18 +591,18 @@ void rewriter_tpl::process_quantifier(quantifier * q, frame & fr) { if (m_cfg.reduce_quantifier(new_q, new_body, new_pats.data(), new_no_pats.data(), m_r, pr2)) { m_pr = m().mk_transitivity(m_pr, pr2); } - TRACE("reduce_quantifier_bug",if (m_pr) tout << mk_ismt2_pp(m_pr, m()) << "\n"; else tout << "m_pr is_null\n";); + TRACE(reduce_quantifier_bug,if (m_pr) tout << mk_ismt2_pp(m_pr, m()) << "\n"; else tout << "m_pr is_null\n";); result_pr_stack().shrink(fr.m_spos); result_pr_stack().push_back(m_pr); } else { - TRACE("reduce_quantifier_bug", tout << mk_ismt2_pp(q, m()) << " " << mk_ismt2_pp(new_body, m()) << "\n";); + TRACE(reduce_quantifier_bug, tout << mk_ismt2_pp(q, m()) << " " << mk_ismt2_pp(new_body, m()) << "\n";); if (!m_cfg.reduce_quantifier(q, new_body, new_pats.data(), new_no_pats.data(), m_r, m_pr)) { if (fr.m_new_child) { m_r = m().update_quantifier(q, num_pats, new_pats.data(), num_no_pats, new_no_pats.data(), new_body); } else { - TRACE("rewriter_reuse", tout << "reusing:\n" << mk_ismt2_pp(q, m()) << "\n";); + TRACE(rewriter_reuse, tout << "reusing:\n" << mk_ismt2_pp(q, m()) << "\n";); m_r = q; } } @@ -680,8 +680,8 @@ void rewriter_tpl::set_bindings(unsigned num_bindings, expr * const * bi m_bindings.push_back(bindings[i]); m_shifts.push_back(num_bindings); } - TRACE("rewriter", display_bindings(tout);); - SCTRACE("bindings", is_trace_enabled("coming_from_quant"), display_bindings(tout);); + TRACE(rewriter, display_bindings(tout);); + SCTRACE(bindings, is_trace_enabled(TraceTag::coming_from_quant), display_bindings(tout);); } template @@ -694,8 +694,8 @@ void rewriter_tpl::set_inv_bindings(unsigned num_bindings, expr * const m_bindings.push_back(bindings[i]); m_shifts.push_back(num_bindings); } - TRACE("rewriter", display_bindings(tout);); - SCTRACE("bindings", is_trace_enabled("coming_from_quant"), display_bindings(tout);); + TRACE(rewriter, display_bindings(tout);); + SCTRACE(bindings, is_trace_enabled(TraceTag::coming_from_quant), display_bindings(tout);); } template @@ -741,7 +741,7 @@ void rewriter_tpl::main_loop(expr * t, expr_ref & result, proof_ref & re else { resume_core(result, result_pr); } - TRACE("rewriter", tout << mk_ismt2_pp(t, m()) << "\n=>\n" << result << "\n";;); + TRACE(rewriter, tout << mk_ismt2_pp(t, m()) << "\n=>\n" << result << "\n";;); } /** @@ -761,7 +761,7 @@ void rewriter_tpl::resume_core(expr_ref & result, proof_ref & result_pr) SASSERT(!ProofGen || result_stack().size() == result_pr_stack().size()); frame & fr = frame_stack().back(); expr * t = fr.m_curr; - TRACE("rewriter_step", tout << "step\n" << mk_ismt2_pp(t, m()) << "\n";); + TRACE(rewriter_step, tout << "step\n" << mk_ismt2_pp(t, m()) << "\n";); m_num_steps++; check_max_steps(); if (first_visit(fr) && fr.m_cache_result) { diff --git a/src/ast/rewriter/seq_axioms.cpp b/src/ast/rewriter/seq_axioms.cpp index b0d3add0b..d9faaf4a6 100644 --- a/src/ast/rewriter/seq_axioms.cpp +++ b/src/ast/rewriter/seq_axioms.cpp @@ -191,7 +191,7 @@ namespace seq { */ void axioms::extract_axiom(expr* e) { - TRACE("seq", tout << mk_pp(e, m) << "\n";); + TRACE(seq, tout << mk_pp(e, m) << "\n";); expr* _s = nullptr, *_i = nullptr, *_l = nullptr; VERIFY(seq.str.is_extract(e, _s, _i, _l)); auto s = purify(_s); @@ -218,7 +218,7 @@ namespace seq { extract_suffix_axiom(e, s, i); return; } - TRACE("seq", tout << s << " " << i << " " << l << "\n";); + TRACE(seq, tout << s << " " << i << " " << l << "\n";); expr_ref x = m_sk.mk_pre(s, i); expr_ref ls = mk_len(_s); expr_ref lx = mk_len(x); @@ -262,14 +262,14 @@ namespace seq { void axioms::tail_axiom(expr* e, expr* s) { expr_ref head(m), tail(m); m_sk.decompose(s, head, tail); - TRACE("seq", tout << "tail " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";); + TRACE(seq, tout << "tail " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";); expr_ref emp = mk_eq_empty(s); add_clause(emp, mk_seq_eq(s, mk_concat(head, e))); add_clause(~emp, mk_eq_empty(e)); } void axioms::drop_last_axiom(expr* e, expr* s) { - TRACE("seq", tout << "drop last " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";); + TRACE(seq, tout << "drop last " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";); expr_ref emp = mk_eq_empty(s); add_clause(emp, mk_seq_eq(s, mk_concat(e, seq.str.mk_unit(m_sk.mk_last(s))))); add_clause(~emp, mk_eq_empty(e)); @@ -331,7 +331,7 @@ namespace seq { len(s) < l => e = s */ void axioms::extract_prefix_axiom(expr* e, expr* s, expr* l) { - TRACE("seq", tout << "prefix " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << " " << mk_bounded_pp(l, m, 2) << "\n";); + TRACE(seq, tout << "prefix " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << " " << mk_bounded_pp(l, m, 2) << "\n";); expr_ref le = mk_len(e); expr_ref ls = mk_len(s); expr_ref ls_minus_l(mk_sub(ls, l), m); @@ -351,7 +351,7 @@ namespace seq { i > len(s) => e = empty */ void axioms::extract_suffix_axiom(expr* e, expr* s, expr* i) { - TRACE("seq", tout << "suffix " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";); + TRACE(seq, tout << "suffix " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";); expr_ref x = m_sk.mk_pre(s, i); expr_ref lx = mk_len(x); expr_ref ls = mk_len(s); @@ -594,7 +594,7 @@ namespace seq { */ void axioms::at_axiom(expr* e) { - TRACE("seq", tout << "at-axiom: " << mk_bounded_pp(e, m) << "\n";); + TRACE(seq, tout << "at-axiom: " << mk_bounded_pp(e, m) << "\n";); expr* _s = nullptr, *_i = nullptr; VERIFY(seq.str.is_at(e, _s, _i)); auto s = purify(_s); @@ -667,7 +667,7 @@ namespace seq { void axioms::itos_axiom(expr* e) { expr* n = nullptr; - TRACE("seq", tout << mk_pp(e, m) << "\n";); + TRACE(seq, tout << mk_pp(e, m) << "\n";); VERIFY(seq.str.is_itos(e, n)); // itos(n) = "" <=> n < 0 @@ -704,7 +704,7 @@ namespace seq { stoi(s) >= 0 => len(s) >= 1 */ void axioms::stoi_axiom(expr* e) { - TRACE("seq", tout << mk_pp(e, m) << "\n";); + TRACE(seq, tout << mk_pp(e, m) << "\n";); expr_ref ge0 = mk_ge(e, 0); expr* s = nullptr; VERIFY (seq.str.is_stoi(e, s)); diff --git a/src/ast/rewriter/seq_rewriter.cpp b/src/ast/rewriter/seq_rewriter.cpp index 73ebca7d7..cd7b56865 100644 --- a/src/ast/rewriter/seq_rewriter.cpp +++ b/src/ast/rewriter/seq_rewriter.cpp @@ -251,7 +251,7 @@ eautomaton* re2automaton::operator()(expr* e) { if (r) { r->compress(); bool_rewriter br(m); - TRACE("seq", display_expr1 disp(m); r->display(tout << mk_pp(e, m) << " -->\n", disp);); + TRACE(seq, display_expr1 disp(m); r->display(tout << mk_pp(e, m) << " -->\n", disp);); } return r; } @@ -302,7 +302,7 @@ eautomaton* re2automaton::re2aut(expr* e) { expr_ref _start(m), _stop(m); if (is_unit_char(e1, _start) && is_unit_char(e2, _stop)) { - TRACE("seq", tout << "Range: " << _start << " " << _stop << "\n";); + TRACE(seq, tout << "Range: " << _start << " " << _stop << "\n";); a = alloc(eautomaton, sm, sym_expr::mk_range(_start, _stop)); return a.detach(); } @@ -360,11 +360,11 @@ eautomaton* re2automaton::re2aut(expr* e) { } else if (u.re.is_intersection(e, e1, e2) && m_sa && (a = re2aut(e1)) && (b = re2aut(e2))) { eautomaton* r = m_sa->mk_product(*a, *b); - TRACE("seq", display_expr1 disp(m); a->display(tout << "a:", disp); b->display(tout << "b:", disp); r->display(tout << "intersection:", disp);); + TRACE(seq, display_expr1 disp(m); a->display(tout << "a:", disp); b->display(tout << "b:", disp); r->display(tout << "intersection:", disp);); return r; } else { - TRACE("seq", tout << "not handled " << mk_pp(e, m) << "\n";); + TRACE(seq, tout << "not handled " << mk_pp(e, m) << "\n";); } return nullptr; @@ -763,7 +763,7 @@ br_status seq_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * con if (st == BR_FAILED) { st = lift_ites_throttled(f, num_args, args, result); } - CTRACE("seq_verbose", st != BR_FAILED, tout << expr_ref(m().mk_app(f, num_args, args), m()) << " -> " << result << "\n";); + CTRACE(seq_verbose, st != BR_FAILED, tout << expr_ref(m().mk_app(f, num_args, args), m()) << " -> " << result << "\n";); SASSERT(st == BR_FAILED || result->get_sort() == f->get_range()); return st; } @@ -777,7 +777,7 @@ br_status seq_rewriter::mk_seq_unit(expr* e, expr_ref& result) { if (m_util.is_const_char(e, ch) && m_coalesce_chars) { // convert to string constant zstring s(ch); - TRACE("seq_verbose", tout << "rewrite seq.unit of 8-bit value " << ch << " to string constant \"" << s<< "\"" << std::endl;); + TRACE(seq_verbose, tout << "rewrite seq.unit of 8-bit value " << ch << " to string constant \"" << s<< "\"" << std::endl;); result = str().mk_string(s); return BR_DONE; } @@ -994,7 +994,7 @@ br_status seq_rewriter::lift_ites_throttled(func_decl* f, unsigned n, expr* cons new_args[i] = e; expr_ref arg2(m().mk_app(f, new_args), m()); result = m().mk_ite(c, arg1, arg2); - TRACE("seq_verbose", tout << "lifting ite: " << mk_pp(result, m()) << std::endl;); + TRACE(seq_verbose, tout << "lifting ite: " << mk_pp(result, m()) << std::endl;); return BR_REWRITE2; } return BR_FAILED; @@ -1137,7 +1137,7 @@ bool seq_rewriter::extract_push_offset(expr_ref_vector const& as, expr* b, expr* t1 = str().mk_concat(as.size() - i, as.data() + i, as[0]->get_sort()); expr_ref t2 = mk_len(pos1, lens); result = str().mk_substr(t1, t2, c); - TRACE("seq", tout << result << "\n";); + TRACE(seq, tout << result << "\n";); return true; } } @@ -1174,7 +1174,7 @@ bool seq_rewriter::extract_push_length(expr_ref_vector& as, expr* b, expr* c, ex result = str().mk_substr(t1, b, t2); as[i] = result; result = str().mk_concat(i + 1, as.data(), as[0]->get_sort()); - TRACE("seq", tout << result << "\n";); + TRACE(seq, tout << result << "\n";); return true; } } @@ -1186,7 +1186,7 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu zstring s; rational pos, len; - TRACE("seq_verbose", tout << mk_pp(a, m()) << " " << mk_pp(b, m()) << " " << mk_pp(c, m()) << "\n";); + TRACE(seq_verbose, tout << mk_pp(a, m()) << " " << mk_pp(b, m()) << " " << mk_pp(c, m()) << "\n";); bool constantBase = str().is_string(a, s); bool constantPos = m_autil.is_numeral(b, pos); bool constantLen = m_autil.is_numeral(c, len); @@ -1453,7 +1453,7 @@ br_status seq_rewriter::mk_seq_contains(expr* a, expr* b, expr_ref& result) { str().get_concat_units(a, as); str().get_concat_units(b, bs); - TRACE("seq", tout << mk_pp(a, m()) << " contains " << mk_pp(b, m()) << "\n";); + TRACE(seq, tout << mk_pp(a, m()) << " contains " << mk_pp(b, m()) << "\n";); if (bs.empty()) { result = m().mk_true(); @@ -2253,14 +2253,14 @@ br_status seq_rewriter::mk_seq_replace_re(expr* a, expr* b, expr* c, expr_ref& r } br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { - TRACE("seq", tout << mk_pp(a, m()) << " " << mk_pp(b, m()) << "\n";); + TRACE(seq, tout << mk_pp(a, m()) << " " << mk_pp(b, m()) << "\n";); zstring s1, s2; bool isc1 = str().is_string(a, s1); bool isc2 = str().is_string(b, s2); sort* sort_a = a->get_sort(); if (isc1 && isc2) { result = m().mk_bool_val(s1.prefixof(s2)); - TRACE("seq", tout << result << "\n";); + TRACE(seq, tout << result << "\n";); return BR_DONE; } if (str().is_empty(a)) { @@ -2278,7 +2278,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { if (s1.prefixof(s2)) { if (a == a1) { result = m().mk_true(); - TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";); + TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";); return BR_DONE; } str().get_concat(a, as); @@ -2288,12 +2288,12 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { bs[0] = str().mk_string(s2); result = str().mk_prefix(str().mk_concat(as.size()-1, as.data()+1, sort_a), str().mk_concat(bs.size(), bs.data(), sort_a)); - TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";); + TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";); return BR_REWRITE_FULL; } else { result = m().mk_false(); - TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";); + TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";); return BR_DONE; } } @@ -2301,7 +2301,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { if (s2.prefixof(s1)) { if (b == b1) { result = m().mk_false(); - TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";); + TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";); return BR_DONE; } str().get_concat(a, as); @@ -2311,12 +2311,12 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { as[0] = str().mk_string(s1); result = str().mk_prefix(str().mk_concat(as.size(), as.data(), sort_a), str().mk_concat(bs.size()-1, bs.data()+1, sort_a)); - TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";); + TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";); return BR_REWRITE_FULL; } else { result = m().mk_false(); - TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";); + TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";); return BR_DONE; } } @@ -2342,7 +2342,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { } if (i == as.size()) { result = mk_and(eqs); - TRACE("seq", tout << result << "\n";); + TRACE(seq, tout << result << "\n";); return BR_REWRITE3; } SASSERT(i < as.size()); @@ -2351,7 +2351,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { eqs.push_back(str().mk_is_empty(as.get(j))); } result = mk_and(eqs); - TRACE("seq", tout << result << "\n";); + TRACE(seq, tout << result << "\n";); return BR_REWRITE3; } if (i > 0) { @@ -2360,7 +2360,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { b = str().mk_concat(bs.size() - i, bs.data() + i, sort_a); eqs.push_back(str().mk_prefix(a, b)); result = mk_and(eqs); - TRACE("seq", tout << result << "\n";); + TRACE(seq, tout << result << "\n";); return BR_REWRITE3; } @@ -2420,7 +2420,7 @@ br_status seq_rewriter::mk_seq_suffix(expr* a, expr* b, expr_ref& result) { } if (i > sza) { result = mk_and(eqs); - TRACE("seq", tout << result << "\n";); + TRACE(seq, tout << result << "\n";); return BR_REWRITE3; } if (i > szb) { @@ -2429,7 +2429,7 @@ br_status seq_rewriter::mk_seq_suffix(expr* a, expr* b, expr_ref& result) { eqs.push_back(str().mk_is_empty(aj)); } result = mk_and(eqs); - TRACE("seq", tout << result << "\n";); + TRACE(seq, tout << result << "\n";); return BR_REWRITE3; } @@ -2439,7 +2439,7 @@ br_status seq_rewriter::mk_seq_suffix(expr* a, expr* b, expr_ref& result) { b = str().mk_concat(szb - i + 1, bs.data(), sort_a); eqs.push_back(str().mk_suffix(a, b)); result = mk_and(eqs); - TRACE("seq", tout << result << "\n";); + TRACE(seq, tout << result << "\n";); return BR_REWRITE3; } @@ -2889,14 +2889,14 @@ expr_ref seq_rewriter::re_predicate(expr* cond, sort* seq_sort) { } expr_ref seq_rewriter::is_nullable(expr* r) { - STRACE("seq_verbose", tout << "is_nullable: " + STRACE(seq_verbose, tout << "is_nullable: " << mk_pp(r, m()) << std::endl;); expr_ref result(m_op_cache.find(_OP_RE_IS_NULLABLE, r, nullptr, nullptr), m()); if (!result) { result = is_nullable_rec(r); m_op_cache.insert(_OP_RE_IS_NULLABLE, r, nullptr, nullptr, result); } - STRACE("seq_verbose", tout << "is_nullable result: " + STRACE(seq_verbose, tout << "is_nullable result: " << result << std::endl;); return result; } @@ -3144,12 +3144,12 @@ br_status seq_rewriter::mk_re_derivative(expr* ele, expr* r, expr_ref& result) { */ bool seq_rewriter::check_deriv_normal_form(expr* r, int level) { if (level == 3) { // top level - STRACE("seq_verbose", tout + STRACE(seq_verbose, tout << "Checking derivative normal form invariant...";); } expr *r1 = nullptr, *r2 = nullptr, *p = nullptr, *s = nullptr; unsigned lo = 0, hi = 0; - STRACE("seq_verbose", tout << " (level " << level << ")";); + STRACE(seq_verbose, tout << " (level " << level << ")";); int new_level = 0; if (re().is_antimirov_union(r)) { SASSERT(level >= 2); @@ -3193,7 +3193,7 @@ bool seq_rewriter::check_deriv_normal_form(expr* r, int level) { SASSERT(false); } if (level == 3) { - STRACE("seq_verbose", tout << " passed!" << std::endl;); + STRACE(seq_verbose, tout << " passed!" << std::endl;); } return true; } @@ -3218,8 +3218,8 @@ expr_ref seq_rewriter::mk_antimirov_deriv(expr* e, expr* r, expr* path) { if (!result) { mk_antimirov_deriv_rec(e, r, path, result); m_op_cache.insert(OP_RE_DERIVATIVE, e, r, path, result); - STRACE("seq_regex", tout << "D(" << mk_pp(e, m()) << "," << mk_pp(r, m()) << "," << mk_pp(path, m()) << ")" << std::endl;); - STRACE("seq_regex", tout << "= " << mk_pp(result, m()) << std::endl;); + STRACE(seq_regex, tout << "D(" << mk_pp(e, m()) << "," << mk_pp(r, m()) << "," << mk_pp(path, m()) << ")" << std::endl;); + STRACE(seq_regex, tout << "= " << mk_pp(result, m()) << std::endl;); } return result; } @@ -3851,7 +3851,7 @@ bool seq_rewriter::le_char(expr* ch1, expr* ch2) { - a and b are char <= constraints, or negations of char <= constraints */ bool seq_rewriter::pred_implies(expr* a, expr* b) { - STRACE("seq_verbose", tout << "pred_implies: " + STRACE(seq_verbose, tout << "pred_implies: " << "," << mk_pp(a, m()) << "," << mk_pp(b, m()) << std::endl;); expr *cha1 = nullptr, *cha2 = nullptr, *nota = nullptr, @@ -3912,7 +3912,7 @@ bool seq_rewriter::ite_bdds_compatible(expr* a, expr* b) { - result is in normal form (check_deriv_normal_form) */ expr_ref seq_rewriter::mk_der_op_rec(decl_kind k, expr* a, expr* b) { - STRACE("seq_verbose", tout << "mk_der_op_rec: " << k + STRACE(seq_verbose, tout << "mk_der_op_rec: " << k << "," << mk_pp(a, m()) << "," << mk_pp(b, m()) << std::endl;); expr* ca = nullptr, *a1 = nullptr, *a2 = nullptr; @@ -4076,7 +4076,7 @@ expr_ref seq_rewriter::mk_der_op(decl_kind k, expr* a, expr* b) { } expr_ref seq_rewriter::mk_der_compl(expr* r) { - STRACE("seq_verbose", tout << "mk_der_compl: " << mk_pp(r, m()) + STRACE(seq_verbose, tout << "mk_der_compl: " << mk_pp(r, m()) << std::endl;); expr_ref result(m_op_cache.find(OP_RE_COMPLEMENT, r, nullptr, nullptr), m()); if (!result) { @@ -4115,7 +4115,7 @@ expr_ref seq_rewriter::mk_der_compl(expr* r) { Postcondition: result is in BDD form */ expr_ref seq_rewriter::mk_der_cond(expr* cond, expr* ele, sort* seq_sort) { - STRACE("seq_verbose", tout << "mk_der_cond: " + STRACE(seq_verbose, tout << "mk_der_cond: " << mk_pp(cond, m()) << ", " << mk_pp(ele, m()) << std::endl;); sort *ele_sort = nullptr; VERIFY(u().is_seq(seq_sort, ele_sort)); @@ -4160,7 +4160,7 @@ expr_ref seq_rewriter::mk_der_cond(expr* cond, expr* ele, sort* seq_sort) { else { result = re_predicate(cond, seq_sort); } - STRACE("seq_verbose", tout << "mk_der_cond result: " + STRACE(seq_verbose, tout << "mk_der_cond result: " << mk_pp(result, m()) << std::endl;); CASSERT("seq_regex", check_deriv_normal_form(result)); return result; @@ -4264,7 +4264,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) { if (get_head_tail(r1, hd, tl)) { // head must be equal; if so, derivative is tail // Use mk_der_cond to normalize - STRACE("seq_verbose", tout << "deriv to_re" << std::endl;); + STRACE(seq_verbose, tout << "deriv to_re" << std::endl;); result = m().mk_eq(ele, hd); result = mk_der_cond(result, ele, seq_sort); expr_ref r1(re().mk_to_re(tl), m()); @@ -4305,7 +4305,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) { expr_ref hd(m()), tl(m()); if (get_head_tail_reversed(r2, hd, tl)) { // Use mk_der_cond to normalize - STRACE("seq_verbose", tout << "deriv reverse to_re" << std::endl;); + STRACE(seq_verbose, tout << "deriv reverse to_re" << std::endl;); result = m().mk_eq(ele, tl); result = mk_der_cond(result, ele, seq_sort); result = mk_der_concat(result, re().mk_reverse(re().mk_to_re(hd))); @@ -4334,7 +4334,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) { expr_ref ch1(m_util.mk_char(s1[0]), m()); expr_ref ch2(m_util.mk_char(s2[0]), m()); // Use mk_der_cond to normalize - STRACE("seq_verbose", tout << "deriv range zstring" << std::endl;); + STRACE(seq_verbose, tout << "deriv range zstring" << std::endl;); expr_ref p1(u().mk_le(ch1, ele), m()); p1 = mk_der_cond(p1, ele, seq_sort); expr_ref p2(u().mk_le(ele, ch2), m()); @@ -4350,7 +4350,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) { if (str().is_unit(r1, e1) && str().is_unit(r2, e2)) { SASSERT(u().is_char(e1)); // Use mk_der_cond to normalize - STRACE("seq_verbose", tout << "deriv range str" << std::endl;); + STRACE(seq_verbose, tout << "deriv range str" << std::endl;); expr_ref p1(u().mk_le(e1, ele), m()); p1 = mk_der_cond(p1, ele, seq_sort); expr_ref p2(u().mk_le(ele, e2), m()); @@ -4367,7 +4367,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) { expr* args[2] = { p, ele }; result = array.mk_select(2, args); // Use mk_der_cond to normalize - STRACE("seq_verbose", tout << "deriv of_pred" << std::endl;); + STRACE(seq_verbose, tout << "deriv of_pred" << std::endl;); return mk_der_cond(result, ele, seq_sort); } // stuck cases: re.derivative, re variable, @@ -4547,7 +4547,7 @@ This will help propagate cases like "abc"X in opt(to_re(X)) to equalities. */ br_status seq_rewriter::mk_str_in_regexp(expr* a, expr* b, expr_ref& result) { - STRACE("seq_verbose", tout << "mk_str_in_regexp: " << mk_pp(a, m()) + STRACE(seq_verbose, tout << "mk_str_in_regexp: " << mk_pp(a, m()) << ", " << mk_pp(b, m()) << std::endl;); if (re().is_empty(b)) { @@ -5423,7 +5423,7 @@ br_status seq_rewriter::mk_le_core(expr * l, expr * r, expr_ref & result) { } br_status seq_rewriter::mk_eq_core(expr * l, expr * r, expr_ref & result) { - TRACE("seq", tout << mk_pp(l, m()) << " == " << mk_pp(r, m()) << "\n"); + TRACE(seq, tout << mk_pp(l, m()) << " == " << mk_pp(r, m()) << "\n"); expr_ref_vector res(m()); expr_ref_pair_vector new_eqs(m()); if (m_util.is_re(l)) { @@ -5436,20 +5436,20 @@ br_status seq_rewriter::mk_eq_core(expr * l, expr * r, expr_ref & result) { #if 0 if (reduce_arith_eq(l, r, res) || reduce_arith_eq(r, l, res)) { result = mk_and(res); - TRACE("seq_verbose", tout << result << "\n";); + TRACE(seq_verbose, tout << result << "\n";); return BR_REWRITE3; } if (reduce_extract(l, r, res)) { result = mk_and(res); - TRACE("seq_verbose", tout << result << "\n";); + TRACE(seq_verbose, tout << result << "\n";); return BR_REWRITE3; } #endif if (!reduce_eq(l, r, new_eqs, changed)) { result = m().mk_false(); - TRACE("seq_verbose", tout << result << "\n";); + TRACE(seq_verbose, tout << result << "\n";); return BR_DONE; } if (!changed) { @@ -5459,7 +5459,7 @@ br_status seq_rewriter::mk_eq_core(expr * l, expr * r, expr_ref & result) { res.push_back(m().mk_eq(p.first, p.second)); } result = mk_and(res); - TRACE("seq_verbose", tout << result << "\n";); + TRACE(seq_verbose, tout << result << "\n";); return BR_REWRITE3; } @@ -5600,11 +5600,11 @@ bool seq_rewriter::reduce_front(expr_ref_vector& ls, expr_ref_vector& rs, expr_r } else if (str().is_string(l, s1) && str().is_string(r, s2)) { - TRACE("seq", tout << s1 << " - " << s2 << " " << s1.length() << " " << s2.length() << "\n";); + TRACE(seq, tout << s1 << " - " << s2 << " " << s1.length() << " " << s2.length() << "\n";); unsigned min_l = std::min(s1.length(), s2.length()); for (unsigned i = 0; i < min_l; ++i) { if (s1[i] != s2[i]) { - TRACE("seq", tout << "different at position " << i << " " << s1[i] << " " << s2[i] << "\n";); + TRACE(seq, tout << "different at position " << i << " " << s1[i] << " " << s2[i] << "\n";); return false; } } @@ -5638,7 +5638,7 @@ bool seq_rewriter::reduce_front(expr_ref_vector& ls, expr_ref_vector& rs, expr_r - sets change to true if some simplification occurred */ bool seq_rewriter::reduce_eq(expr_ref_vector& ls, expr_ref_vector& rs, expr_ref_pair_vector& eqs, bool& change) { - TRACE("seq_verbose", tout << ls << "\n"; tout << rs << "\n";); + TRACE(seq_verbose, tout << ls << "\n"; tout << rs << "\n";); unsigned hash_l = ls.hash(); unsigned hash_r = rs.hash(); unsigned sz_eqs = eqs.size(); @@ -5675,7 +5675,7 @@ bool seq_rewriter::reduce_eq(expr* l, expr* r, expr_ref_pair_vector& new_eqs, bo return true; } else { - TRACE("seq", tout << mk_bounded_pp(l, m()) << " != " << mk_bounded_pp(r, m()) << "\n";); + TRACE(seq, tout << mk_bounded_pp(l, m()) << " != " << mk_bounded_pp(r, m()) << "\n";); return false; } } @@ -5703,7 +5703,7 @@ void seq_rewriter::add_seqs(expr_ref_vector const& ls, expr_ref_vector const& rs bool seq_rewriter::reduce_contains(expr* a, expr* b, expr_ref_vector& disj) { m_lhs.reset(); str().get_concat(a, m_lhs); - TRACE("seq", tout << expr_ref(a, m()) << " " << expr_ref(b, m()) << "\n";); + TRACE(seq, tout << expr_ref(a, m()) << " " << expr_ref(b, m()) << "\n";); sort* sort_a = a->get_sort(); zstring s; for (unsigned i = 0; i < m_lhs.size(); ++i) { @@ -6201,7 +6201,7 @@ bool seq_rewriter::reduce_subsequence(expr_ref_vector& ls, expr_ref_vector& rs, str().mk_concat(rs, srt)); ls.reset(); rs.reset(); - TRACE("seq", tout << "subsequence " << eqs << "\n";); + TRACE(seq, tout << "subsequence " << eqs << "\n";); } return true; } @@ -6230,9 +6230,9 @@ void seq_rewriter::op_cache::cleanup() { if (m_table.size() >= m_max_cache_size) { m_trail.reset(); m_table.reset(); - STRACE("seq_regex", tout << "Op cache reset!" << std::endl;); - STRACE("seq_regex_brief", tout << "(OP CACHE RESET) ";); - STRACE("seq_verbose", tout << "Derivative op cache reset" << std::endl;); + STRACE(seq_regex, tout << "Op cache reset!" << std::endl;); + STRACE(seq_regex_brief, tout << "(OP CACHE RESET) ";); + STRACE(seq_verbose, tout << "Derivative op cache reset" << std::endl;); } } diff --git a/src/ast/rewriter/th_rewriter.cpp b/src/ast/rewriter/th_rewriter.cpp index bb4b9fef1..3551bb43e 100644 --- a/src/ast/rewriter/th_rewriter.cpp +++ b/src/ast/rewriter/th_rewriter.cpp @@ -548,7 +548,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { func_decl * f_prime = nullptr; expr_ref new_t(m()), new_e(m()), common(m()); bool first; - TRACE("push_ite", tout << "unifying:\n" << mk_ismt2_pp(t, m()) << "\n" << mk_ismt2_pp(e, m()) << "\n";); + TRACE(push_ite, tout << "unifying:\n" << mk_ismt2_pp(t, m()) << "\n" << mk_ismt2_pp(e, m()) << "\n";); if (unify(t, e, f_prime, new_t, new_e, common, first)) { if (first) result = m().mk_app(f_prime, common, m().mk_ite(c, new_t, new_e)); @@ -556,7 +556,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { result = m().mk_app(f_prime, m().mk_ite(c, new_t, new_e), common); return BR_DONE; } - TRACE("push_ite", tout << "failed\n";); + TRACE(push_ite, tout << "failed\n";); return BR_FAILED; } @@ -632,7 +632,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { } if (st != BR_DONE && st != BR_FAILED) { - CTRACE("th_rewriter_step", st != BR_FAILED, + CTRACE(th_rewriter_step, st != BR_FAILED, tout << f->get_name() << "\n"; for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << "\n"; tout << "---------->\n" << mk_ismt2_pp(result, m()) << "\n";); @@ -654,7 +654,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { st = m_ar_rw.mk_app_core(f, num, args, result); } - CTRACE("th_rewriter_step", st != BR_FAILED, + CTRACE(th_rewriter_step, st != BR_FAILED, tout << f->get_name() << "\n"; for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << "\n"; tout << "---------->\n" << mk_ismt2_pp(result, m()) << "\n";); @@ -823,7 +823,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { new_patterns_buf.size(), new_patterns_buf.data(), new_no_patterns_buf.size(), new_no_patterns_buf.data(), new_body); m_pinned.reset(); - TRACE("reduce_quantifier", tout << mk_ismt2_pp(old_q, m()) << "\n----->\n" << mk_ismt2_pp(q1, m()) << "\n";); + TRACE(reduce_quantifier, tout << mk_ismt2_pp(old_q, m()) << "\n----->\n" << mk_ismt2_pp(q1, m()) << "\n";); SASSERT(is_well_sorted(m(), q1)); if (m().proofs_enabled() && q1 != old_q) { p1 = m().mk_rewrite(old_q, q1); @@ -841,7 +841,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { result_pr = m().mk_transitivity(p1, p2); } - TRACE("reduce_quantifier", tout << "after elim_unused_vars:\n" << result << " " << result_pr << "\n" ;); + TRACE(reduce_quantifier, tout << "after elim_unused_vars:\n" << result << " " << result_pr << "\n" ;); proof_ref p2(m()); expr_ref r(m()); diff --git a/src/ast/rewriter/value_sweep.cpp b/src/ast/rewriter/value_sweep.cpp index 11cbb16b3..1dcff9f9c 100644 --- a/src/ast/rewriter/value_sweep.cpp +++ b/src/ast/rewriter/value_sweep.cpp @@ -111,7 +111,7 @@ void value_sweep::propagate_values() { m_args.push_back(get_value(arg)); expr_ref new_value(m.mk_app(p->get_decl(), m_args), m); m_rewrite(new_value); - TRACE("value_sweep", tout << "propagate " << mk_pp(p, m) << " " << new_value << "\n";); + TRACE(value_sweep, tout << "propagate " << mk_pp(p, m) << " " << new_value << "\n";); set_value_core(p, new_value); m_queue.push_back(p); } diff --git a/src/ast/rewriter/var_subst.cpp b/src/ast/rewriter/var_subst.cpp index 6c1edc04f..cd3d1605d 100644 --- a/src/ast/rewriter/var_subst.cpp +++ b/src/ast/rewriter/var_subst.cpp @@ -31,7 +31,7 @@ expr_ref var_subst::operator()(expr * n, unsigned num_args, expr * const * args) result = n; //application does not have free variables or nested quantifiers. //There is no need to print the bindings here? - SCTRACE("bindings", is_trace_enabled("coming_from_quant"), + SCTRACE(bindings, is_trace_enabled(TraceTag::coming_from_quant), tout << "(ground)\n"; for (unsigned i = 0; i < num_args; i++) { if (args[i]) { @@ -78,7 +78,7 @@ expr_ref var_subst::operator()(expr * n, unsigned num_args, expr * const * args) m_reducer.set_bindings(num_args, args); m_reducer(n, result); SASSERT(is_well_sorted(m, result)); - TRACE("var_subst_bug", + TRACE(var_subst_bug, tout << "m_std_order: " << m_std_order << "\n" << mk_ismt2_pp(n, m) << "\nusing\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], m) << "\n"; tout << "\n------>\n"; @@ -95,7 +95,7 @@ unused_vars_eliminator::unused_vars_eliminator(ast_manager & m, params_ref const expr_ref unused_vars_eliminator::operator()(quantifier* q) { expr_ref result(m); SASSERT(is_well_sorted(m, q)); - TRACE("elim_unused_vars", tout << expr_ref(q, m) << "\n";); + TRACE(elim_unused_vars, tout << expr_ref(q, m) << "\n";); if (is_lambda(q)) { result = q; return result; @@ -207,7 +207,7 @@ expr_ref unused_vars_eliminator::operator()(quantifier* q) { expr_ref elim_unused_vars(ast_manager & m, quantifier * q, params_ref const & params) { unused_vars_eliminator el(m, params); expr_ref result = el(q); - TRACE("elim_unused_vars", tout << expr_ref(q, m) << " -> " << result << "\n";); + TRACE(elim_unused_vars, tout << expr_ref(q, m) << " -> " << result << "\n";); return result; } @@ -215,11 +215,11 @@ expr_ref instantiate(ast_manager & m, quantifier * q, expr * const * exprs) { var_subst subst(m); expr_ref new_expr(m), result(m); new_expr = subst(q->get_expr(), q->get_num_decls(), exprs); - TRACE("var_subst", tout << mk_pp(q, m) << "\n" << new_expr << "\n";); + TRACE(var_subst, tout << mk_pp(q, m) << "\n" << new_expr << "\n";); inv_var_shifter shift(m); shift(new_expr, q->get_num_decls(), result); SASSERT(is_well_sorted(m, result)); - TRACE("instantiate_bug", tout << mk_ismt2_pp(q, m) << "\nusing\n"; + TRACE(instantiate_bug, tout << mk_ismt2_pp(q, m) << "\nusing\n"; for (unsigned i = 0; i < q->get_num_decls(); i++) tout << mk_ismt2_pp(exprs[i], m) << "\n"; tout << "\n----->\n" << mk_ismt2_pp(result, m) << "\n";); return result; diff --git a/src/ast/seq_decl_plugin.cpp b/src/ast/seq_decl_plugin.cpp index 1b90bc9e3..16c7e3492 100644 --- a/src/ast/seq_decl_plugin.cpp +++ b/src/ast/seq_decl_plugin.cpp @@ -70,7 +70,7 @@ bool seq_decl_plugin::match(ptr_vector& binding, sort* s, sort* sP) { return true; } else { - TRACE("seq", tout << "Could not match " << mk_pp(s, *m_manager) << " and " << mk_pp(sP, *m_manager) << "\n";); + TRACE(seq, tout << "Could not match " << mk_pp(s, *m_manager) << " and " << mk_pp(sP, *m_manager) << "\n";); return false; } } @@ -1643,7 +1643,7 @@ seq_util::rex::info seq_util::rex::get_info_rec(expr* e) const { else result = mk_info_rec(to_app(e)); m_infos.setx(e->get_id(), result, invalid_info); - STRACE("re_info", tout << "compute_info(" << pp(u.re, e, false) << ")=" << result << std::endl;); + STRACE(re_info, tout << "compute_info(" << pp(u.re, e, false) << ")=" << result << std::endl;); return result; } diff --git a/src/ast/simplifiers/bit_blaster.cpp b/src/ast/simplifiers/bit_blaster.cpp index eed751f39..444adad62 100644 --- a/src/ast/simplifiers/bit_blaster.cpp +++ b/src/ast/simplifiers/bit_blaster.cpp @@ -43,7 +43,7 @@ void bit_blaster_simplifier::reduce() { if (curr != new_curr) { m_num_steps += m_rewriter.get_num_steps(); change = true; - TRACE("bit_blaster", tout << mk_pp(curr, m) << " -> " << new_curr << "\n";); + TRACE(bit_blaster, tout << mk_pp(curr, m) << " -> " << new_curr << "\n";); m_fmls.update(idx, dependent_expr(m, new_curr, mp(p, new_pr), d)); } } diff --git a/src/ast/simplifiers/bound_manager.cpp b/src/ast/simplifiers/bound_manager.cpp index 130d00b56..cb9df3e67 100644 --- a/src/ast/simplifiers/bound_manager.cpp +++ b/src/ast/simplifiers/bound_manager.cpp @@ -107,7 +107,7 @@ bool bound_manager::is_numeral(expr* v, numeral& n, bool& is_int) { void bound_manager::operator()(expr * f, expr_dependency * d, proof* p) { if (p) return; - TRACE("bound_manager", tout << "processing:\n" << mk_ismt2_pp(f, m()) << "\n";); + TRACE(bound_manager, tout << "processing:\n" << mk_ismt2_pp(f, m()) << "\n";); expr * v; numeral n; if (is_disjunctive_bound(f, d)) @@ -142,7 +142,7 @@ void bound_manager::operator()(expr * f, expr_dependency * d, proof* p) { k = neg(k); if (is_int) norm(n, k); - TRACE("bound_manager", tout << "found bound for:\n" << mk_ismt2_pp(v, m()) << "\n";); + TRACE(bound_manager, tout << "found bound for:\n" << mk_ismt2_pp(v, m()) << "\n";); bool strict = is_strict(k); if (is_lower(k)) { insert_lower(v, strict, n, d); @@ -244,7 +244,7 @@ bool bound_manager::is_disjunctive_bound(expr * f, expr_dependency * d) { return false; } } - TRACE("bound_manager", tout << "bounds: " << lo << " " << hi << "\n";); + TRACE(bound_manager, tout << "bounds: " << lo << " " << hi << "\n";); insert_lower(v, false, lo, d); insert_upper(v, false, hi, d); return true; diff --git a/src/ast/simplifiers/bound_propagator.cpp b/src/ast/simplifiers/bound_propagator.cpp index c216928be..d2612ad7f 100644 --- a/src/ast/simplifiers/bound_propagator.cpp +++ b/src/ast/simplifiers/bound_propagator.cpp @@ -271,14 +271,14 @@ bool bound_propagator::assert_lower_core(var x, mpq & k, bool strict, bkind bk, SASSERT(m.is_int(k)); strict = false; } - TRACE("bound_propagator_detail", tout << "new lower x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";); + TRACE(bound_propagator_detail, tout << "new lower x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";); bound * old_lower = m_lowers[x]; if (old_lower) { bool improves = m.gt(k, old_lower->m_k) || (!old_lower->m_strict && strict && m.eq(k, old_lower->m_k)); if (!improves) { if (bk == DERIVED) { - TRACE("bound_propagator_detail", tout << "false alarm\n";); + TRACE(bound_propagator_detail, tout << "false alarm\n";); m_false_alarms++; } return false; @@ -286,7 +286,7 @@ bool bound_propagator::assert_lower_core(var x, mpq & k, bool strict, bkind bk, } if (bk == DERIVED) { - TRACE("bound_propagator_derived", tout << "new lower x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";); + TRACE(bound_propagator_derived, tout << "new lower x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";); m_propagations++; } @@ -294,10 +294,10 @@ bool bound_propagator::assert_lower_core(var x, mpq & k, bool strict, bkind bk, bk = AXIOM; // don't need justification at level 0 double approx_k = m.get_double(k); - TRACE("new_bound", tout << "x" << x << " lower: " << m.to_string(k) << " approx: " << approx_k << "\n";); + TRACE(new_bound, tout << "x" << x << " lower: " << m.to_string(k) << " approx: " << approx_k << "\n";); #ifdef RELAX_BOUNDS approx_k = PRECISION*floor(approx_k*INV_PRECISION + TOLERANCE); - TRACE("new_bound", tout << "x" << x << " lower: " << m.to_string(k) << " relaxed approx: " << approx_k << "\n";); + TRACE(new_bound, tout << "x" << x << " lower: " << m.to_string(k) << " relaxed approx: " << approx_k << "\n";); #endif void * mem = m_allocator.allocate(sizeof(bound)); bound * new_lower = new (mem) bound(m, k, approx_k, true, strict, scope_lvl(), m_timestamp, bk, c_idx, a, old_lower); @@ -323,14 +323,14 @@ bool bound_propagator::assert_upper_core(var x, mpq & k, bool strict, bkind bk, strict = false; } - TRACE("bound_propagator_detail", tout << "new upper x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";); + TRACE(bound_propagator_detail, tout << "new upper x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";); bound * old_upper = m_uppers[x]; if (old_upper) { bool improves = m.lt(k, old_upper->m_k) || (!old_upper->m_strict && strict && m.eq(k, old_upper->m_k)); if (!improves) { if (bk == DERIVED) { - TRACE("bound_propagator_detail", tout << "false alarm\n";); + TRACE(bound_propagator_detail, tout << "false alarm\n";); m_false_alarms++; } return false; @@ -339,17 +339,17 @@ bool bound_propagator::assert_upper_core(var x, mpq & k, bool strict, bkind bk, if (bk == DERIVED) { m_propagations++; - TRACE("bound_propagator_derived", tout << "new upper x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";); + TRACE(bound_propagator_derived, tout << "new upper x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";); } if (scope_lvl() == 0 && bk == DERIVED) bk = AXIOM; // don't need justification at level 0 double approx_k = m.get_double(k); - TRACE("new_bound", tout << "x" << x << " upper: " << m.to_string(k) << " approx: " << approx_k << "\n";); + TRACE(new_bound, tout << "x" << x << " upper: " << m.to_string(k) << " approx: " << approx_k << "\n";); #ifdef RELAX_BOUNDS approx_k = PRECISION*ceil(approx_k*INV_PRECISION - TOLERANCE); - TRACE("new_bound", tout << "x" << x << " upper: " << m.to_string(k) << " relaxed approx: " << approx_k << "\n";); + TRACE(new_bound, tout << "x" << x << " upper: " << m.to_string(k) << " relaxed approx: " << approx_k << "\n";); #endif void * mem = m_allocator.allocate(sizeof(bound)); @@ -374,7 +374,7 @@ bool bound_propagator::get_interval_size(var x, double & r) const { template bool bound_propagator::relevant_bound(var x, double new_k) const { - TRACE("bound_propagator_detail", tout << "relevant_bound x" << x << " " << new_k << " LOWER: " << LOWER << "\n"; + TRACE(bound_propagator_detail, tout << "relevant_bound x" << x << " " << new_k << " LOWER: " << LOWER << "\n"; if (LOWER && has_lower(x)) tout << "old: " << m.to_string(m_lowers[x]->m_k) << " | " << m_lowers[x]->m_approx_k << "\n"; if (!LOWER && has_upper(x)) tout << "old: " << m.to_string(m_uppers[x]->m_k) << " | " << m_uppers[x]->m_approx_k << "\n";); bound * b = LOWER ? m_lowers[x] : m_uppers[x]; @@ -397,13 +397,13 @@ bool bound_propagator::relevant_bound(var x, double new_k) const { if (LOWER) { if (new_k <= b->m_approx_k + improvement) { - TRACE("bound_propagator", tout << "LOWER new: " << new_k << " old: " << b->m_approx_k << " improvement is too small\n";); + TRACE(bound_propagator, tout << "LOWER new: " << new_k << " old: " << b->m_approx_k << " improvement is too small\n";); return false; // improvement is too small } } else { if (new_k >= b->m_approx_k - improvement) { - TRACE("bound_propagator", tout << "UPPER new: " << new_k << " old: " << b->m_approx_k << " improvement is too small\n";); + TRACE(bound_propagator, tout << "UPPER new: " << new_k << " old: " << b->m_approx_k << " improvement is too small\n";); return false; // improvement is too small } } @@ -449,7 +449,7 @@ void bound_propagator::check_feasibility(var x) { m_conflict = x; m_conflicts++; SASSERT(inconsistent()); - TRACE("bound_propagator", tout << "inconsistency detected: x" << x << "\n"; display(tout);); + TRACE(bound_propagator, tout << "inconsistency detected: x" << x << "\n"; display(tout);); } } @@ -465,7 +465,7 @@ void bound_propagator::propagate() { bound * b = is_lower ? m_lowers[x] : m_uppers[x]; SASSERT(b); unsigned ts = b->m_timestamp; - TRACE("bound_propagator_detail", tout << "propagating x" << x << "\n";); + TRACE(bound_propagator_detail, tout << "propagating x" << x << "\n";); m_qhead++; wlist const & wl = m_watches[x]; for (unsigned c_idx : wl) { @@ -510,7 +510,7 @@ bool bound_propagator::propagate_eq(unsigned c_idx) { } #endif - TRACE("bound_propagator_detail", tout << "propagating using eq: "; m_eq_manager.display(tout, *eq); tout << "\n";); + TRACE(bound_propagator_detail, tout << "propagating using eq: "; m_eq_manager.display(tout, *eq); tout << "\n";); // ll = (Sum_{a_i < 0} -a_i*lower(x_i)) + (Sum_{a_i > 0} -a_i * upper(x_i)) // uu = (Sum_{a_i > 0} -a_i*lower(x_i)) + (Sum_{a_i < 0} -a_i * upper(x_i)) unsigned ll_i = UINT_MAX; // position of the variable that couldn't contribute to ll @@ -678,17 +678,17 @@ bool bound_propagator::propagate_lower(unsigned c_idx, unsigned i) { var x_j = eq->x(j); mpz const & a_j = eq->a(j); bound * b_j = (m.is_neg(a_j) == neg_a_i) ? m_uppers[x_j] : m_lowers[x_j]; - TRACE("bound_propagator_step_detail", tout << "k: " << m.to_string(k) << " b_j->m_k: " << m.to_string(b_j->m_k) << + TRACE(bound_propagator_step_detail, tout << "k: " << m.to_string(k) << " b_j->m_k: " << m.to_string(b_j->m_k) << " a_j: " << m.to_string(a_j) << "\n";); SASSERT(b_j); if (b_j->m_strict) strict = true; m.addmul(k, a_j, b_j->m_k, k); } - TRACE("bound_propagator_step_detail", tout << "k: " << m.to_string(k) << "\n";); + TRACE(bound_propagator_step_detail, tout << "k: " << m.to_string(k) << "\n";); m.neg(k); m.div(k, a_i, k); - TRACE("bound_propagator_step", tout << "propagating lower x" << x_i << " " << m.to_string(k) << " strict: " << strict << " using\n"; + TRACE(bound_propagator_step, tout << "propagating lower x" << x_i << " " << m.to_string(k) << " strict: " << strict << " using\n"; m_eq_manager.display(tout, *eq); tout << "\n"; display_bounds_of(tout, *eq);); bool r = assert_lower_core(x_i, k, strict, DERIVED, c_idx, null_assumption); m.del(k); @@ -722,7 +722,7 @@ bool bound_propagator::propagate_upper(unsigned c_idx, unsigned i) { } m.neg(k); m.div(k, a_i, k); - TRACE("bound_propagator_step", tout << "propagating upper x" << x_i << " " << m.to_string(k) << " strict: " << strict << " using\n"; + TRACE(bound_propagator_step, tout << "propagating upper x" << x_i << " " << m.to_string(k) << " strict: " << strict << " using\n"; m_eq_manager.display(tout, *eq); tout << "\n"; display_bounds_of(tout, *eq);); bool r = assert_upper_core(x_i, k, strict, DERIVED, c_idx, null_assumption); m.del(k); diff --git a/src/ast/simplifiers/bound_simplifier.cpp b/src/ast/simplifiers/bound_simplifier.cpp index 2d5094c4f..b5e927961 100644 --- a/src/ast/simplifiers/bound_simplifier.cpp +++ b/src/ast/simplifiers/bound_simplifier.cpp @@ -72,13 +72,13 @@ br_status bound_simplifier::reduce_app(func_decl* f, unsigned num_args, expr* co return BR_FAILED; if (N > hi && lo >= 0) { result = x; - TRACE("propagate-ineqs", tout << expr_ref(m.mk_app(f, num_args, args), m) << " -> " << result << "\n"); + TRACE(propagate_ineqs, tout << expr_ref(m.mk_app(f, num_args, args), m) << " -> " << result << "\n"); return BR_DONE; } if (2 * N > hi && lo >= N) { result = a.mk_sub(x, a.mk_int(N)); m_rewriter(result); - TRACE("propagate-ineqs", tout << expr_ref(m.mk_app(f, num_args, args), m) << " -> " << result << "\n"); + TRACE(propagate_ineqs, tout << expr_ref(m.mk_app(f, num_args, args), m) << " -> " << result << "\n"); return BR_DONE; } IF_VERBOSE(2, verbose_stream() << "potentially missed simplification: " << mk_pp(x, m) << " " << lo << " " << hi << " not reduced\n"); @@ -289,7 +289,7 @@ void bound_simplifier::tighten_bound(dependent_expr const& de) { void bound_simplifier::assert_upper(expr* x, rational const& n, bool strict) { scoped_mpq c(nm); nm.set(c, n.to_mpq()); - TRACE("propagate-ineqs", tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " < " : " <= ") << n << "\n"); + TRACE(propagate_ineqs, tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " < " : " <= ") << n << "\n"); bp.assert_upper(to_var(x), c, strict); } @@ -297,7 +297,7 @@ void bound_simplifier::assert_upper(expr* x, rational const& n, bool strict) { void bound_simplifier::assert_lower(expr* x, rational const& n, bool strict) { scoped_mpq c(nm); nm.set(c, n.to_mpq()); - TRACE("propagate-ineqs", tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " > " : " >= ") << n << "\n"); + TRACE(propagate_ineqs, tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " > " : " >= ") << n << "\n"); bp.assert_lower(to_var(x), c, strict); } @@ -308,7 +308,7 @@ bool bound_simplifier::has_lower(expr* x, rational& n, bool& strict) { return false; strict = m_interval.lower_is_open(i); n = m_interval.lower(i); - TRACE("propagate-ineqs", tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " > " : " >= ") << n << "\n"); + TRACE(propagate_ineqs, tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " > " : " >= ") << n << "\n"); return true; } @@ -319,7 +319,7 @@ bool bound_simplifier::has_upper(expr* x, rational& n, bool& strict) { return false; strict = m_interval.upper_is_open(i); n = m_interval.upper(i); - TRACE("propagate-ineqs", tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " < " : " <= ") << n << "\n"); + TRACE(propagate_ineqs, tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " < " : " <= ") << n << "\n"); return true; } @@ -520,7 +520,7 @@ void bound_simplifier::reset() { #if 0 void find_ite_bounds(expr* root) { - TRACE("find_ite_bounds_bug", display_bounds(tout);); + TRACE(find_ite_bounds_bug, display_bounds(tout);); expr* n = root; expr* target = nullptr; expr* c, * t, * e; @@ -531,7 +531,7 @@ void find_ite_bounds(expr* root) { mpq curr; bool curr_strict; while (true) { - TRACE("find_ite_bounds_bug", tout << mk_ismt2_pp(n, m) << "\n";); + TRACE(find_ite_bounds_bug, tout << mk_ismt2_pp(n, m) << "\n";); if (m.is_ite(n, c, t, e)) { if (is_x_minus_y_eq_0(t, x, y)) @@ -548,7 +548,7 @@ void find_ite_bounds(expr* root) { break; } - TRACE("find_ite_bounds_bug", tout << "x: " << mk_ismt2_pp(x, m) << ", y: " << mk_ismt2_pp(y, m) << "\n"; + TRACE(find_ite_bounds_bug, tout << "x: " << mk_ismt2_pp(x, m) << ", y: " << mk_ismt2_pp(y, m) << "\n"; if (target) { tout << "target: " << mk_ismt2_pp(target, m) << "\n"; tout << "has_l: " << has_l << " " << nm.to_string(l_min) << " has_u: " << has_u << " " << nm.to_string(u_max) << "\n"; @@ -558,7 +558,7 @@ void find_ite_bounds(expr* root) { std::swap(x, y); if (!is_unbounded(x)) { - TRACE("find_ite_bounds_bug", tout << "x is already bounded\n";); + TRACE(find_ite_bounds_bug, tout << "x is already bounded\n";); break; } @@ -571,7 +571,7 @@ void find_ite_bounds(expr* root) { } else { has_l = false; - TRACE("find_ite_bounds_bug", tout << "y does not have lower\n";); + TRACE(find_ite_bounds_bug, tout << "y does not have lower\n";); } if (upper(y, curr, curr_strict)) { has_u = true; @@ -580,7 +580,7 @@ void find_ite_bounds(expr* root) { } else { has_u = false; - TRACE("find_ite_bounds_bug", tout << "y does not have upper\n";); + TRACE(find_ite_bounds_bug, tout << "y does not have upper\n";); } } else if (target == x) { @@ -593,7 +593,7 @@ void find_ite_bounds(expr* root) { } else { has_l = false; - TRACE("find_ite_bounds_bug", tout << "y does not have lower\n";); + TRACE(find_ite_bounds_bug, tout << "y does not have lower\n";); } } if (has_u) { @@ -605,7 +605,7 @@ void find_ite_bounds(expr* root) { } else { has_u = false; - TRACE("find_ite_bounds_bug", tout << "y does not have upper\n";); + TRACE(find_ite_bounds_bug, tout << "y does not have upper\n";); } } } @@ -617,7 +617,7 @@ void find_ite_bounds(expr* root) { break; if (n == nullptr) { - TRACE("find_ite_bounds", tout << "found bounds for: " << mk_ismt2_pp(target, m) << "\n"; + TRACE(find_ite_bounds, tout << "found bounds for: " << mk_ismt2_pp(target, m) << "\n"; tout << "has_l: " << has_l << " " << nm.to_string(l_min) << " l_strict: " << l_strict << "\n"; tout << "has_u: " << has_u << " " << nm.to_string(u_max) << " u_strict: " << u_strict << "\n"; tout << "root:\n" << mk_ismt2_pp(root, m) << "\n";); @@ -642,7 +642,7 @@ void find_ite_bounds() { find_ite_bounds(to_app(f)); } bp.propagate(); - TRACE("find_ite_bounds", display_bounds(tout);); + TRACE(find_ite_bounds, display_bounds(tout);); } #endif diff --git a/src/ast/simplifiers/card2bv.cpp b/src/ast/simplifiers/card2bv.cpp index d2d482aa3..6b70bc6c0 100644 --- a/src/ast/simplifiers/card2bv.cpp +++ b/src/ast/simplifiers/card2bv.cpp @@ -34,7 +34,7 @@ void card2bv::reduce() { rw1(f, new_f1); rw2(false, new_f1, new_f2, new_pr); if (new_f2 != f) { - TRACE("card2bv", tout << "Rewriting " << new_f1 << "\n" << new_f2 << "\n"); + TRACE(card2bv, tout << "Rewriting " << new_f1 << "\n" << new_f2 << "\n"); m_fmls.update(idx, dependent_expr(m, new_f2, mp(p, new_pr), d)); ++m_stats.m_num_rewrites; } diff --git a/src/ast/simplifiers/demodulator_simplifier.cpp b/src/ast/simplifiers/demodulator_simplifier.cpp index 0e42e3481..fe9b22ef1 100644 --- a/src/ast/simplifiers/demodulator_simplifier.cpp +++ b/src/ast/simplifiers/demodulator_simplifier.cpp @@ -116,13 +116,13 @@ bool demodulator_simplifier::rewrite1(func_decl* f, expr_ref_vector const& args, if (!m_index.find_fwd(f, set)) return false; - TRACE("demodulator", tout << "trying to rewrite: " << f->get_name() << " args:" << args << "\n"; m_index.display(tout)); + TRACE(demodulator, tout << "trying to rewrite: " << f->get_name() << " args:" << args << "\n"; m_index.display(tout)); for (unsigned i : *set) { auto const& [lhs, rhs] = m_rewrites[i]; - TRACE("demodulator", tout << "Matching with demodulator: " << i << " " << mk_pp(lhs, m) << "\n"); + TRACE(demodulator, tout << "Matching with demodulator: " << i << " " << mk_pp(lhs, m) << "\n"); if (lhs->get_num_args() != args.size()) continue; @@ -131,7 +131,7 @@ bool demodulator_simplifier::rewrite1(func_decl* f, expr_ref_vector const& args, if (m_match_subst(lhs, rhs, args.data(), np)) { - TRACE("demodulator_bug", tout << "succeeded...\n" << mk_pp(rhs, m) << "\n===>\n" << np << "\n"); + TRACE(demodulator_bug, tout << "succeeded...\n" << mk_pp(rhs, m) << "\n===>\n" << np << "\n"); if (dep(i)) m_dependencies.insert(i); return true; @@ -199,7 +199,7 @@ void demodulator_simplifier::reduce() { rewrite(i); if (m_util.is_demodulator(fml(i), large, small)) { func_decl* f = large->get_decl(); - TRACE("demodulator", tout << i << " " << mk_pp(fml(i), m) << ": " << large << " ==> " << small << "\n"); + TRACE(demodulator, tout << i << " " << mk_pp(fml(i), m) << ": " << large << " ==> " << small << "\n"); reschedule_processed(f); reschedule_demodulators(f, large); m_index.insert_fwd(f, i); diff --git a/src/ast/simplifiers/dominator_simplifier.cpp b/src/ast/simplifiers/dominator_simplifier.cpp index 0f9d70786..bed8119fc 100644 --- a/src/ast/simplifiers/dominator_simplifier.cpp +++ b/src/ast/simplifiers/dominator_simplifier.cpp @@ -60,7 +60,7 @@ expr_ref dominator_simplifier::simplify_ite(app * ite) { r = new_t; } else { - TRACE("simplify", tout << new_c << "\n" << new_t << "\n" << new_e << "\n";); + TRACE(simplify, tout << new_c << "\n" << new_t << "\n" << new_e << "\n";); r = m.mk_ite(new_c, new_t, new_e); } } @@ -73,7 +73,7 @@ expr_ref dominator_simplifier::simplify_arg(expr * e) { expr_ref r(m); r = get_cached(e); (*m_simplifier)(r); - CTRACE("simplify", e != r, tout << "depth: " << m_depth << " " << mk_pp(e, m) << " -> " << r << "\n";); + CTRACE(simplify, e != r, tout << "depth: " << m_depth << " " << mk_pp(e, m) << " -> " << r << "\n";); return r; } @@ -125,10 +125,10 @@ expr_ref dominator_simplifier::simplify_rec(expr * e0) { r = e; } } - CTRACE("simplify", e0 != r, tout << "depth before: " << m_depth << " " << mk_pp(e0, m) << " -> " << r << "\n";); + CTRACE(simplify, e0 != r, tout << "depth before: " << m_depth << " " << mk_pp(e0, m) << " -> " << r << "\n";); (*m_simplifier)(r); cache(e0, r); - CTRACE("simplify", e0 != r, tout << "depth: " << m_depth << " " << mk_pp(e0, m) << " -> " << r << "\n";); + CTRACE(simplify, e0 != r, tout << "depth: " << m_depth << " " << mk_pp(e0, m) << " -> " << r << "\n";); --m_depth; m_subexpr_cache.reset(); return r; @@ -237,7 +237,7 @@ void dominator_simplifier::reduce() { if (!m.is_true(r) && !m.is_false(r) && !p && !assert_expr(r, false)) r = m.mk_false(); - CTRACE("simplify", r != f, tout << r << " " << mk_pp(f, m) << "\n";); + CTRACE(simplify, r != f, tout << r << " " << mk_pp(f, m) << "\n";); change |= r != f; proof_ref new_pr(m); if (p) { @@ -260,7 +260,7 @@ void dominator_simplifier::reduce() { r = m.mk_false(); change |= r != f; - CTRACE("simplify", r != f, tout << r << " " << mk_pp(f, m) << "\n";); + CTRACE(simplify, r != f, tout << r << " " << mk_pp(f, m) << "\n";); proof_ref new_pr(m); if (r) { new_pr = m.mk_rewrite(f, r); diff --git a/src/ast/simplifiers/elim_unconstrained.cpp b/src/ast/simplifiers/elim_unconstrained.cpp index 95b76b0a2..48f8b9071 100644 --- a/src/ast/simplifiers/elim_unconstrained.cpp +++ b/src/ast/simplifiers/elim_unconstrained.cpp @@ -159,7 +159,7 @@ void elim_unconstrained::eliminate() { SASSERT(!m_heap.contains(p.term()->get_id())); app* t = to_app(e); - TRACE("elim_unconstrained", tout << "eliminating " << mk_bounded_pp(t, m) << "\n";); + TRACE(elim_unconstrained, tout << "eliminating " << mk_bounded_pp(t, m) << "\n";); unsigned sz = m_args.size(); for (expr* arg : *to_app(t)) m_args.push_back(reconstruct_term(root(arg))); @@ -180,7 +180,7 @@ void elim_unconstrained::eliminate() { IF_VERBOSE(4, verbose_stream() << "replace " << mk_bounded_pp(t, m) << " / " << mk_bounded_pp(rr, m) << " -> " << mk_bounded_pp(r, m) << "\n"); - TRACE("elim_unconstrained", tout << mk_bounded_pp(t, m) << " / " << mk_bounded_pp(rr, m) << " -> " << mk_bounded_pp(r, m) << "\n"); + TRACE(elim_unconstrained, tout << mk_bounded_pp(t, m) << " / " << mk_bounded_pp(rr, m) << " -> " << mk_bounded_pp(r, m) << "\n"); SASSERT(r->get_sort() == t->get_sort()); m_stats.m_num_eliminated++; node& rn = root(r); @@ -382,7 +382,7 @@ void elim_unconstrained::assert_normalized(vector& old_fmls) { if (f == g) continue; old_fmls.push_back(m_fmls[i]); - TRACE("elim_unconstrained", tout << mk_bounded_pp(f, m) << " -> " << mk_bounded_pp(g, m) << "\n"); + TRACE(elim_unconstrained, tout << mk_bounded_pp(f, m) << " -> " << mk_bounded_pp(g, m) << "\n"); m_fmls.update(i, dependent_expr(m, g, nullptr, d)); } } diff --git a/src/ast/simplifiers/eliminate_predicates.cpp b/src/ast/simplifiers/eliminate_predicates.cpp index 0dfb5a87e..c396e6235 100644 --- a/src/ast/simplifiers/eliminate_predicates.cpp +++ b/src/ast/simplifiers/eliminate_predicates.cpp @@ -313,7 +313,7 @@ bool eliminate_predicates::is_macro_safe(expr* e) { void eliminate_predicates::insert_macro(app* head, expr* def, clause& cl) { insert_macro(head, def, cl.m_dep); - TRACE("elim_predicates", tout << "remove " << cl << "\n"); + TRACE(elim_predicates, tout << "remove " << cl << "\n"); cl.m_alive = false; } @@ -342,7 +342,7 @@ void eliminate_predicates::insert_macro(app* head, expr* def, expr_dependency* d m_macros.insert(head->get_decl(), info); m_fmls.model_trail().push(head->get_decl(), _def, _dep, {}); // augment with definition for head m_is_macro.mark(head->get_decl(), true); - TRACE("elim_predicates", tout << "insert " << _head << " " << _def << "\n"); + TRACE(elim_predicates, tout << "insert " << _head << " " << _def << "\n"); ++m_stats.m_num_macros; } @@ -654,7 +654,7 @@ void eliminate_predicates::try_resolve(func_decl* p) { if (cl->m_alive) ++num_neg; - TRACE("elim_predicates", tout << "try resolve " << p->get_name() << " " << num_pos << " " << num_neg << "\n"); + TRACE(elim_predicates, tout << "try resolve " << p->get_name() << " " << num_pos << " " << num_neg << "\n"); if (num_pos >= 4 && num_neg >= 2) return; @@ -737,7 +737,7 @@ void eliminate_predicates::update_model(func_decl* p) { } rewrite(def); - TRACE("elim_predicates", tout << "insert " << p->get_name() << " " << def << "\n"); + TRACE(elim_predicates, tout << "insert " << p->get_name() << " " << def << "\n"); m_fmls.model_trail().push(p, def, dep, deleted); } diff --git a/src/ast/simplifiers/euf_completion.cpp b/src/ast/simplifiers/euf_completion.cpp index 61ff7f644..2f0d3868c 100644 --- a/src/ast/simplifiers/euf_completion.cpp +++ b/src/ast/simplifiers/euf_completion.cpp @@ -174,7 +174,7 @@ namespace euf { IF_VERBOSE(11, verbose_stream() << mk_bounded_pp(f, m, 3) << " -> " << mk_bounded_pp(g, m, 3) << "\n"); update_has_new_eq(g); } - CTRACE("euf_completion", g != f, tout << mk_bounded_pp(f, m) << " -> " << mk_bounded_pp(g, m) << "\n"); + CTRACE(euf_completion, g != f, tout << mk_bounded_pp(f, m) << " -> " << mk_bounded_pp(g, m) << "\n"); } } @@ -407,7 +407,7 @@ namespace euf { rep = k; m_reps.setx(n->get_id(), rep, nullptr); - TRACE("euf_completion", tout << "rep " << m_egraph.bpp(n) << " -> " << m_egraph.bpp(rep) << "\n"; + TRACE(euf_completion, tout << "rep " << m_egraph.bpp(n) << " -> " << m_egraph.bpp(rep) << "\n"; for (enode* k : enode_class(n)) tout << m_egraph.bpp(k) << "\n";); m_todo.push_back(n->get_expr()); for (enode* arg : enode_args(n)) { diff --git a/src/ast/simplifiers/linear_equation.cpp b/src/ast/simplifiers/linear_equation.cpp index 81f7a7cec..fe4282421 100644 --- a/src/ast/simplifiers/linear_equation.cpp +++ b/src/ast/simplifiers/linear_equation.cpp @@ -68,14 +68,14 @@ linear_equation * linear_equation_manager::mk(unsigned sz, mpq * as, var * xs, b m.lcm(r, l, l); } - TRACE("linear_equation_mk", tout << "lcm: " << m.to_string(l) << "\n";); + TRACE(linear_equation_mk, tout << "lcm: " << m.to_string(l) << "\n";); // copy l * as to m_int_buffer. m_int_buffer.reset(); for (unsigned i = 0; i < sz; i++) { - TRACE("linear_equation_mk", tout << "before as[" << i << "]: " << m.to_string(as[i]) << "\n";); + TRACE(linear_equation_mk, tout << "before as[" << i << "]: " << m.to_string(as[i]) << "\n";); m.mul(l, as[i], as[i]); - TRACE("linear_equation_mk", tout << "after as[" << i << "]: " << m.to_string(as[i]) << "\n";); + TRACE(linear_equation_mk, tout << "after as[" << i << "]: " << m.to_string(as[i]) << "\n";); SASSERT(m.is_int(as[i])); m_int_buffer.push_back(as[i].numerator()); } @@ -96,7 +96,7 @@ linear_equation * linear_equation_manager::mk_core(unsigned sz, mpz * as, var * } }); - TRACE("linear_equation_bug", for (unsigned i = 0; i < sz; i++) tout << m.to_string(as[i]) << "*x" << xs[i] << " "; tout << "\n";); + TRACE(linear_equation_bug, for (unsigned i = 0; i < sz; i++) tout << m.to_string(as[i]) << "*x" << xs[i] << " "; tout << "\n";); mpz g; m.set(g, as[0]); @@ -118,7 +118,7 @@ linear_equation * linear_equation_manager::mk_core(unsigned sz, mpz * as, var * } } - TRACE("linear_equation_bug", + TRACE(linear_equation_bug, tout << "g: " << m.to_string(g) << "\n"; for (unsigned i = 0; i < sz; i++) tout << m.to_string(as[i]) << "*x" << xs[i] << " "; tout << "\n";); diff --git a/src/ast/simplifiers/model_reconstruction_trail.cpp b/src/ast/simplifiers/model_reconstruction_trail.cpp index 98b77cbb7..85b22475f 100644 --- a/src/ast/simplifiers/model_reconstruction_trail.cpp +++ b/src/ast/simplifiers/model_reconstruction_trail.cpp @@ -24,7 +24,7 @@ void model_reconstruction_trail::add_vars(expr* e, ast_mark& free_vars) { for (expr* t : subterms::all(expr_ref(e, m))) { if (is_app(t) && is_uninterp(t)) { func_decl* f = to_app(t)->get_decl(); - TRACE("simplifier", tout << "add var " << f->get_name() << "\n"); + TRACE(simplifier, tout << "add var " << f->get_name() << "\n"); free_vars.mark(f, true); if (m_model_vars.is_marked(f)) m_intersects_with_model = true; @@ -51,7 +51,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt for (expr* a : assumptions) add_vars(a, free_vars); - TRACE("simplifier", + TRACE(simplifier, tout << "intersects " << m_intersects_with_model << "\n"; for (unsigned i = qhead; i < st.qtail(); ++i) tout << mk_bounded_pp(st[i].fml(), m) << "\n"; @@ -61,7 +61,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt return; for (auto& t : m_trail) { - TRACE("simplifier", tout << " active " << t->m_active << " hide " << t->is_hide() << " intersects " << t->intersects(free_vars) << " loose " << t->is_loose() << "\n"); + TRACE(simplifier, tout << " active " << t->m_active << " hide " << t->is_hide() << " intersects " << t->intersects(free_vars) << " loose " << t->is_loose() << "\n"); if (!t->m_active) continue; @@ -87,7 +87,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt if (t->is_loose_constraint()) { for (auto r : t->m_removed) { add_vars(r, free_vars); - TRACE("simplifier", tout << "replay removed " << r << "\n"); + TRACE(simplifier, tout << "replay removed " << r << "\n"); st.add(r); } t->m_active = false; @@ -102,7 +102,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt if (t->is_loose() && (!t->is_def() || !all_const || t->is_subst())) { for (auto r : t->m_removed) { add_vars(r, free_vars); - TRACE("simplifier", tout << "replay removed " << r << "\n"); + TRACE(simplifier, tout << "replay removed " << r << "\n"); st.add(r); } m_trail_stack.push(value_trail(t->m_active)); @@ -119,7 +119,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt args.push_back(m.mk_var(i, d->get_domain(i))); head = m.mk_app(d, args); mrp.insert(head, def, dep); - TRACE("simplifier", tout << mk_pp(d, m) << " " << mk_pp(def,m) << " " << "\n"); + TRACE(simplifier, tout << mk_pp(d, m) << " " << mk_pp(def,m) << " " << "\n"); dependent_expr de(m, def, nullptr, dep); add_vars(de, free_vars); } @@ -129,7 +129,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt expr_ref g(m); expr_dependency_ref dep2(m); mrp(f, dep1, g, dep2); - CTRACE("simplifier", f != g, tout << "updated " << mk_pp(g, m) << "\n"); + CTRACE(simplifier, f != g, tout << "updated " << mk_pp(g, m) << "\n"); if (f != g) st.update(i, dependent_expr(m, g, nullptr, dep2)); } @@ -175,7 +175,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt dep1 = m.mk_join(dep_exprs.size(), dep_exprs.data()); } dependent_expr d(m, g, nullptr, m.mk_join(dep1, dep2)); - CTRACE("simplifier", f != g, tout << "updated " << mk_pp(g, m) << "\n"); + CTRACE(simplifier, f != g, tout << "updated " << mk_pp(g, m) << "\n"); add_vars(d, free_vars); st.update(i, d); } @@ -189,7 +189,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt } } - TRACE("simplifier", st.display(tout)); + TRACE(simplifier, st.display(tout)); } /** @@ -218,7 +218,7 @@ void model_reconstruction_trail::append(generic_model_converter& mc) { mc.add(v, def); } } - TRACE("simplifier", display(tout); mc.display(tout)); + TRACE(simplifier, display(tout); mc.display(tout)); } diff --git a/src/ast/simplifiers/reduce_args_simplifier.cpp b/src/ast/simplifiers/reduce_args_simplifier.cpp index 96607734b..28345f31d 100644 --- a/src/ast/simplifiers/reduce_args_simplifier.cpp +++ b/src/ast/simplifiers/reduce_args_simplifier.cpp @@ -126,7 +126,7 @@ class reduce_args_simplifier : public dependent_expr_simplifier { for (auto i : indices()) quick_for_each_expr(proc, visited, m_fmls[i].fml()); - TRACE("reduce_args", tout << "non_candidates:\n"; for (func_decl* d : non_candidates) tout << d->get_name() << "\n";); + TRACE(reduce_args, tout << "non_candidates:\n"; for (func_decl* d : non_candidates) tout << d->get_name() << "\n";); } struct populate_decl2args_proc { @@ -196,7 +196,7 @@ class reduce_args_simplifier : public dependent_expr_simplifier { for (func_decl* a : bad_decls) decl2args.erase(a); - TRACE("reduce_args", tout << "decl2args:" << std::endl; + TRACE(reduce_args, tout << "decl2args:" << std::endl; for (auto const& [k, v] : decl2args) { tout << k->get_name() << ": "; for (unsigned i = 0; i < v.size(); ++i) diff --git a/src/ast/simplifiers/solve_context_eqs.cpp b/src/ast/simplifiers/solve_context_eqs.cpp index c58786f0e..665f43a3e 100644 --- a/src/ast/simplifiers/solve_context_eqs.cpp +++ b/src/ast/simplifiers/solve_context_eqs.cpp @@ -236,7 +236,7 @@ namespace euf { eqs[j++] = eq; } eqs.shrink(j); - TRACE("solve_eqs", + TRACE(solve_eqs, for (auto const& eq : eqs) tout << eq << "\n"); } diff --git a/src/ast/simplifiers/solve_eqs.cpp b/src/ast/simplifiers/solve_eqs.cpp index 61c72d65f..8e293cbfe 100644 --- a/src/ast/simplifiers/solve_eqs.cpp +++ b/src/ast/simplifiers/solve_eqs.cpp @@ -188,7 +188,7 @@ namespace euf { // because all cached values there do not depend on v. } - TRACE("solve_eqs", + TRACE(solve_eqs, tout << "after normalizing variables\n"; for (unsigned id : m_subst_ids) { auto const& eq = m_next[id][0]; @@ -300,7 +300,7 @@ namespace euf { return true; unsigned num = 0; m_num_occs.find(t, num); - TRACE("solve_eqs_check_occs", tout << mk_ismt2_pp(t, m) << " num_occs: " << num << " max: " << m_config.m_max_occs << "\n";); + TRACE(solve_eqs_check_occs, tout << mk_ismt2_pp(t, m) << " num_occs: " << num << " max: " << m_config.m_max_occs << "\n";); return num <= m_config.m_max_occs; } diff --git a/src/ast/simplifiers/then_simplifier.h b/src/ast/simplifiers/then_simplifier.h index e5a7ca104..cbbeb92eb 100644 --- a/src/ast/simplifiers/then_simplifier.h +++ b/src/ast/simplifiers/then_simplifier.h @@ -68,7 +68,7 @@ public: } void reduce() override { - TRACE("simplifier", tout << m_fmls); + TRACE(simplifier, tout << m_fmls); for (auto* s : m_simplifiers) { if (m_fmls.inconsistent()) break; @@ -84,7 +84,7 @@ public: catch (rewriter_exception &) { break; } - TRACE("simplifier", tout << s->name() << "\n" << m_fmls); + TRACE(simplifier, tout << s->name() << "\n" << m_fmls); if (m_bail_on_no_change && !m_fmls.updated()) break; } diff --git a/src/ast/sls/bvsls_opt_engine.cpp b/src/ast/sls/bvsls_opt_engine.cpp index 2f006dc9f..6f92cc2ed 100644 --- a/src/ast/sls/bvsls_opt_engine.cpp +++ b/src/ast/sls/bvsls_opt_engine.cpp @@ -34,13 +34,13 @@ bvsls_opt_engine::optimization_result bvsls_opt_engine::optimize( bool _maximize) { SASSERT(m_bv_util.is_bv(objective)); - TRACE("sls_opt", tout << "objective: " << (_maximize?"maximize":"minimize") << " " << + TRACE(sls_opt, tout << "objective: " << (_maximize?"maximize":"minimize") << " " << mk_ismt2_pp(objective, m()) << std::endl;); m_hard_tracker.initialize(m_assertions); setup_opt_tracker(objective, _maximize); if (initial_model.get() != nullptr) { - TRACE("sls_opt", tout << "Initial model provided: " << std::endl; + TRACE(sls_opt, tout << "Initial model provided: " << std::endl; for (unsigned i = 0; i < initial_model->get_num_constants(); i++) { func_decl * fd = initial_model->get_constant(i); expr * val = initial_model->get_const_interp(fd); @@ -53,7 +53,7 @@ bvsls_opt_engine::optimization_result bvsls_opt_engine::optimize( optimization_result res(m_manager); lbool is_sat = m_hard_tracker.is_sat() ? l_true : l_undef; - TRACE("sls_opt", tout << "initial model is sat? " << is_sat << std::endl;); + TRACE(sls_opt, tout << "initial model is sat? " << is_sat << std::endl;); for (m_stats.m_restarts = 0; m_stats.m_restarts < m_max_restarts; @@ -95,7 +95,7 @@ bvsls_opt_engine::optimization_result bvsls_opt_engine::optimize( is_sat = m_hard_tracker.is_sat() ? l_true : l_undef; } - TRACE("sls_opt", tout << "sat: " << res.is_sat << "; optimum: " << mk_ismt2_pp(res.optimum, m()) << std::endl;); + TRACE(sls_opt, tout << "sat: " << res.is_sat << "; optimum: " << mk_ismt2_pp(res.optimum, m()) << std::endl;); return res; } @@ -118,7 +118,7 @@ expr_ref bvsls_opt_engine::maximize() { SASSERT(m_hard_tracker.is_sat()); - TRACE("sls_opt", tout << "Initial opt model:" << std::endl; m_obj_tracker.show_model(tout);); + TRACE(sls_opt, tout << "Initial opt model:" << std::endl; m_obj_tracker.show_model(tout);); mpz score, old_score, max_score, new_value; unsigned new_const = (unsigned)-1, new_bit = 0; @@ -149,7 +149,7 @@ expr_ref bvsls_opt_engine::maximize() save_model(score); if (!randomize_wrt_hard()) { // Can't improve and can't randomize; can't do anything other than bail out. - TRACE("sls_opt", tout << "Got stuck; bailing out." << std::endl;); + TRACE(sls_opt, tout << "Got stuck; bailing out." << std::endl;); IF_VERBOSE(10, verbose_stream() << "No local improvements possible." << std::endl;); goto bailout; } @@ -157,7 +157,7 @@ expr_ref bvsls_opt_engine::maximize() } else { m_stats.m_moves++; - TRACE("sls_opt", tout << "New optimum: " << m_mpz_manager.to_string(score) << std::endl;); + TRACE(sls_opt, tout << "New optimum: " << m_mpz_manager.to_string(score) << std::endl;); IF_VERBOSE(10, verbose_stream() << "New optimum: " << m_mpz_manager.to_string(score) << std::endl;); func_decl * fd = consts[new_const]; incremental_score(fd, new_value); @@ -183,7 +183,7 @@ void bvsls_opt_engine::save_model(mpz const & score) { expr * val = obj_mdl->get_const_interp(fd); if (mdl->has_interpretation(fd)) { if (mdl->get_const_interp(fd) != val) - TRACE("sls_opt", tout << "model disagreement on " << fd->get_name() << ": " << + TRACE(sls_opt, tout << "model disagreement on " << fd->get_name() << ": " << mk_ismt2_pp(val, m()) << " != " << mk_ismt2_pp(mdl->get_const_interp(fd), m()) << std::endl;); SASSERT(mdl->get_const_interp(fd) == val); } @@ -215,7 +215,7 @@ bool bvsls_opt_engine::what_if( mpz cur_best(0); m_mpz_manager.set(cur_best, top_score()); - TRACE("sls_whatif", tout << "WHAT IF " << fd->get_name() << " WERE " << m_mpz_manager.to_string(temp) << + TRACE(sls_whatif, tout << "WHAT IF " << fd->get_name() << " WERE " << m_mpz_manager.to_string(temp) << " --> " << r << "; score=" << m_mpz_manager.to_string(cur_best) << std::endl;); if (m_mpz_manager.gt(cur_best, best_score)) { @@ -227,7 +227,7 @@ bool bvsls_opt_engine::what_if( } else { - TRACE("sls_whatif_failed", tout << "WHAT IF " << fd->get_name() << " WERE " << m_mpz_manager.to_string(temp) << + TRACE(sls_whatif_failed, tout << "WHAT IF " << fd->get_name() << " WERE " << m_mpz_manager.to_string(temp) << " --> unsatisfied hard constraints" << std::endl;); } @@ -351,7 +351,7 @@ bool bvsls_opt_engine::randomize_wrt_hard() { m_evaluator.update(random_fd, random_val); if (m_hard_tracker.is_sat()) { - TRACE("sls_opt", tout << "Randomizing " << random_fd->get_name() << " to " << + TRACE(sls_opt, tout << "Randomizing " << random_fd->get_name() << " to " << m_mpz_manager.to_string(random_val) << std::endl;); m_obj_evaluator.update(random_fd, random_val); return true; diff --git a/src/ast/sls/sls_arith_base.cpp b/src/ast/sls/sls_arith_base.cpp index b8a3c2abe..4bde7b90b 100644 --- a/src/ast/sls/sls_arith_base.cpp +++ b/src/ast/sls/sls_arith_base.cpp @@ -378,7 +378,7 @@ namespace sls { template void arith_base::find_linear_moves(ineq const& ineq, var_t v, num_t const& coeff) { num_t const& sum = ineq.m_args_value; - TRACE("arith_verbose", tout << ineq << " " << v << " " << value(v) << "\n"); + TRACE(arith_verbose, tout << ineq << " " << v << " " << value(v) << "\n"); if (ineq.is_true()) { switch (ineq.m_op) { case ineq_kind::LE: @@ -433,12 +433,12 @@ namespace sls { delta_out = delta; if (m_last_var == v && m_last_delta == -delta) { - TRACE("arith_verbose", tout << "flip back " << v << " " << delta << "\n";); + TRACE(arith_verbose, tout << "flip back " << v << " " << delta << "\n";); return false; } if (m_use_tabu && vi.is_tabu(m_stats.m_steps, delta)) { - TRACE("arith_verbose", tout << "tabu v" << v << " delta:" << delta << "\n"); + TRACE(arith_verbose, tout << "tabu v" << v << " delta:" << delta << "\n"); return false; } @@ -446,7 +446,7 @@ namespace sls { auto old_value = value(v); auto new_value = old_value + delta; if (!vi.in_range(new_value)) { - TRACE("arith", display(tout, v) << "out of range: v" << v << " " << old_value << " " << delta << " " << new_value << "\n";); + TRACE(arith, display(tout, v) << "out of range: v" << v << " " << old_value << " " << delta << " " << new_value << "\n";); return false; } @@ -747,11 +747,11 @@ namespace sls { if (old_value == new_value) return true; if (!vi.in_range(new_value)) { - TRACE("arith", display(tout << "out of range " << new_value << ": ", v) << "\n"; ); + TRACE(arith, display(tout << "out of range " << new_value << ": ", v) << "\n"; ); return false; } if (!in_bounds(v, new_value) && in_bounds(v, old_value)) { - TRACE("arith", tout << "out of bounds: v" << v << " " << old_value << " " << new_value << "\n";); + TRACE(arith, tout << "out of bounds: v" << v << " " << old_value << " " << new_value << "\n";); return false; } @@ -781,7 +781,7 @@ namespace sls { } IF_VERBOSE(5, verbose_stream() << "repair: v" << v << " := " << old_value << " -> " << new_value << "\n"); - TRACE("arith", tout << "update: v" << v << " " << mk_bounded_pp(vi.m_expr, m) << " := " << old_value << " -> " << new_value << "\n"); + TRACE(arith, tout << "update: v" << v << " " << mk_bounded_pp(vi.m_expr, m) << " := " << old_value << " -> " << new_value << "\n"); vi.set_value(new_value); ctx.new_value_eh(e); m_last_var = v; @@ -1061,7 +1061,7 @@ namespace sls { m_vars[v].m_op = k; m_vars[v].set_value(val); m_vars[vx].m_ops.push_back(v); - TRACE("arith", display(tout << "initialize op ", v) << " " << value(vx) << " op " << value(vy) << "\n"); + TRACE(arith, display(tout << "initialize op ", v) << " " << value(vx) << " op " << value(vy) << "\n"); if (vy != vx) m_vars[vy].m_ops.push_back(v); return v; @@ -1372,7 +1372,7 @@ namespace sls { if (!vi.is_arith_op()) return false; flet _tabu(m_use_tabu, false); - TRACE("sls_verbose", tout << "repair def " << mk_bounded_pp(vi.m_expr, m) << "\n"); + TRACE(sls_verbose, tout << "repair def " << mk_bounded_pp(vi.m_expr, m) << "\n"); switch (vi.m_op) { case arith_op_kind::LAST_ARITH_OP: break; @@ -2304,7 +2304,7 @@ namespace sls { bool r = update_checked(w, n); if (!r) { - TRACE("arith", tout << "set value failed " << mk_pp(e, m) << " := " << mk_pp(v, m) << "\n"; + TRACE(arith, tout << "set value failed " << mk_pp(e, m) << " := " << mk_pp(v, m) << "\n"; display(tout, w) << " := " << value(w) << "\n";); IF_VERBOSE(3, verbose_stream() << "set value failed " << mk_pp(e, m) << " := " << mk_pp(v, m) << "\n"; @@ -2523,7 +2523,7 @@ namespace sls { if (!vi.is_arith_op()) return true; IF_VERBOSE(10, verbose_stream() << vi.m_op << " repair def " << mk_bounded_pp(vi.m_expr, m) << "\n"); - TRACE("sls_verbose", tout << "repair def " << mk_bounded_pp(vi.m_expr, m) << "\n"); + TRACE(sls_verbose, tout << "repair def " << mk_bounded_pp(vi.m_expr, m) << "\n"); switch (vi.m_op) { case arith_op_kind::LAST_ARITH_OP: break; @@ -2623,7 +2623,7 @@ namespace sls { for (var_t v = 0; v < m_vars.size(); ++v) { if (!eval_is_correct(v)) { report_error(verbose_stream(), v); - TRACE("arith", report_error(tout, v)); + TRACE(arith, report_error(tout, v)); UNREACHABLE(); } } @@ -2636,7 +2636,7 @@ namespace sls { val += c * value(v); if (val != i.m_args_value) { IF_VERBOSE(0, verbose_stream() << val << ": " << i << "\n"; display(verbose_stream())); - TRACE("arith", display(tout << val << ": " << i << "\n")); + TRACE(arith, display(tout << val << ": " << i << "\n")); } SASSERT(val == i.m_args_value); VERIFY(val == i.m_args_value); @@ -2679,11 +2679,11 @@ namespace sls { if (old_value == new_value) return true; if (!vi.in_range(new_value)) { - TRACE("arith_verbose", tout << "Not in range v" << v << " " << new_value << "\n"); + TRACE(arith_verbose, tout << "Not in range v" << v << " " << new_value << "\n"); return false; } if (!in_bounds(v, new_value) && in_bounds(v, old_value)) { - TRACE("arith_verbose", tout << "out of bounds v" << v << " " << new_value << "\n"); + TRACE(arith_verbose, tout << "out of bounds v" << v << " " << new_value << "\n"); //verbose_stream() << "out of bounds v" << v << " " << new_value << "\n"; return false; } @@ -2708,7 +2708,7 @@ namespace sls { auto& vi = m_vars[v]; auto old_value = value(v); IF_VERBOSE(5, verbose_stream() << "update: v" << v << " " << mk_bounded_pp(vi.m_expr, m) << " := " << old_value << " -> " << new_value << "\n"); - TRACE("arith", tout << "update: v" << v << " " << mk_bounded_pp(vi.m_expr, m) << " := " << old_value << " -> " << new_value << "\n"); + TRACE(arith, tout << "update: v" << v << " " << mk_bounded_pp(vi.m_expr, m) << " := " << old_value << " -> " << new_value << "\n"); vi.set_value(new_value); ctx.new_value_eh(vi.m_expr); diff --git a/src/ast/sls/sls_arith_clausal.cpp b/src/ast/sls/sls_arith_clausal.cpp index d1cb01bcb..7ab2e26f9 100644 --- a/src/ast/sls/sls_arith_clausal.cpp +++ b/src/ast/sls/sls_arith_clausal.cpp @@ -39,7 +39,7 @@ namespace sls { initialize(); - TRACE("arith", ctx.display_all(tout)); + TRACE(arith, ctx.display_all(tout)); a.m_config.max_moves = a.m_stats.m_steps + a.m_config.max_moves_base; @@ -72,7 +72,7 @@ namespace sls { (void)bv; (void)v; - TRACE("arith", + TRACE(arith, if (bv != sat::null_bool_var) tout << "bool flip " << bv << "\n"; else if (v != null_arith_var) tout << "arith flip v" << v << "\n"; else tout << "no flip\n"; @@ -124,7 +124,7 @@ namespace sls { template void arith_clausal::add_lookahead_on_unsat_vars() { a.m_updates.reset(); - TRACE("arith_verbose", tout << "unsat-vars "; + TRACE(arith_verbose, tout << "unsat-vars "; for (auto v : ctx.unsat_vars()) if (a.get_ineq(v)) tout << mk_bounded_pp(ctx.atom(v), a.m) << " "; tout << "\n";); @@ -267,7 +267,7 @@ namespace sls { return; a.m_last_delta = delta; a.m_last_var = v; - TRACE("arith", tout << mt << " v" << v << " " << mk_bounded_pp(a.m_vars[v].m_expr, a.m) + TRACE(arith, tout << mt << " v" << v << " " << mk_bounded_pp(a.m_vars[v].m_expr, a.m) << " += " << delta << " score:" << m_best_score << "\n"); a.m_vars[v].set_step(a.m_stats.m_steps, a.m_stats.m_steps + 3 + ctx.rand(10), delta); VERIFY(a.update_num(v, delta)); @@ -278,7 +278,7 @@ namespace sls { DEBUG_CODE( for (sat::bool_var bv = 0; bv < ctx.num_bool_vars(); ++bv) { if (a.get_ineq(bv) && a.get_ineq(bv)->is_true() != ctx.is_true(bv)) { - TRACE("arith", tout << "bv:" << bv << " " << *a.get_ineq(bv) << " " << (ctx.is_true(bv)?"T":"F") << "\n"; + TRACE(arith, tout << "bv:" << bv << " " << *a.get_ineq(bv) << " " << (ctx.is_true(bv)?"T":"F") << "\n"; tout << "v" << v << " bool vars: " << a.m_vars[v].m_bool_vars_of << "\n"; tout << mk_bounded_pp(a.m_vars[v].m_expr, a.m) << "\n"; tout << mk_bounded_pp(ctx.atom(bv), a.m) << "\n"; @@ -291,7 +291,7 @@ namespace sls { template double arith_clausal::get_score(var_t v, num_t const& delta) { auto& vi = a.m_vars[v]; - TRACE("arith", tout << "get-score v" << v << " += " << delta << "\n";); + TRACE(arith, tout << "get-score v" << v << " += " << delta << "\n";); if (!a.update_num(v, delta)) return -1; double score = 0; @@ -309,7 +309,7 @@ namespace sls { ++num_true; } - CTRACE("arith_verbose", c.m_num_trues != num_true && (c.m_num_trues == 0 || num_true == 0), + CTRACE(arith_verbose, c.m_num_trues != num_true && (c.m_num_trues == 0 || num_true == 0), tout << "clause: " << c << " v" << v << " += " << delta << " new-true lits: " << num_true @@ -326,7 +326,7 @@ namespace sls { // verbose_stream() << num_clauses << " " << num_dup << "\n"; // revert the update - TRACE("arith", tout << "revert update v" << v << " -= " << delta << "\n";); + TRACE(arith, tout << "revert update v" << v << " -= " << delta << "\n";); a.update_unchecked(v, vi.value() - delta); return score; } @@ -348,7 +348,7 @@ namespace sls { #endif IF_VERBOSE(2, verbose_stream() << "restart sls-arith " << a.m_config.restart_next << "\n"); - TRACE("arith", tout << "restart\n";); + TRACE(arith, tout << "restart\n";); // reset values of (arithmetical) variables at bounds. for (auto& vi : a.m_vars) { if (vi.m_lo && !vi.m_lo->is_strict && vi.m_lo->value > 0) @@ -369,7 +369,7 @@ namespace sls { DEBUG_CODE( for (sat::bool_var bv = 0; bv < ctx.num_bool_vars(); ++bv) { if (a.get_ineq(bv) && a.get_ineq(bv)->is_true() != ctx.is_true(bv)) { - TRACE("arith", tout << "bv:" << bv << " " << *a.get_ineq(bv) << ctx.is_true(bv) << "\n"; + TRACE(arith, tout << "bv:" << bv << " " << *a.get_ineq(bv) << ctx.is_true(bv) << "\n"; tout << mk_bounded_pp(ctx.atom(bv), a.m) << "\n"; ctx.display(tout);); } @@ -403,7 +403,7 @@ namespace sls { template void arith_clausal::enter_bool_mode() { - CTRACE("arith", !m_bool_mode, tout << "enter bool mode\n";); + CTRACE(arith, !m_bool_mode, tout << "enter bool mode\n";); m_best_found_cost_bool = ctx.unsat().size(); if (!m_bool_mode) m_no_improve_bool = 0; @@ -420,7 +420,7 @@ namespace sls { template void arith_clausal::enter_arith_mode() { - CTRACE("arith", m_bool_mode, tout << "enter arith mode\n";); + CTRACE(arith, m_bool_mode, tout << "enter arith mode\n";); m_best_found_cost_arith = ctx.unsat().size(); if (m_bool_mode) m_no_improve_arith = 0; diff --git a/src/ast/sls/sls_arith_lookahead.cpp b/src/ast/sls/sls_arith_lookahead.cpp index adcc04de3..6d455b0b9 100644 --- a/src/ast/sls/sls_arith_lookahead.cpp +++ b/src/ast/sls/sls_arith_lookahead.cpp @@ -259,7 +259,7 @@ namespace sls { for (unsigned depth = m_min_depth; depth <= m_max_depth; ++depth) { for (unsigned i = 0; i < m_update_stack[depth].size(); ++i) { auto* a = m_update_stack[depth][i]; - TRACE("arith_verbose", tout << "update " << mk_bounded_pp(a, m) << " depth: " << depth << "\n";); + TRACE(arith_verbose, tout << "update " << mk_bounded_pp(a, m) << " depth: " << depth << "\n";); if (t != a) set_bool_value(a, get_bool_value_rec(a)); if (m_is_root.is_marked(a)) { @@ -311,7 +311,7 @@ namespace sls { if (!a.update_num(v, delta)) return; auto score = lookahead(e, false); - TRACE("arith_verbose", tout << "lookahead " << v << " " << mk_bounded_pp(e, m) << " := " << delta + old_value << " " << score << " (" << m_best_score << ")\n";); + TRACE(arith_verbose, tout << "lookahead " << v << " " << mk_bounded_pp(e, m) << " := " << delta + old_value << " " << score << " (" << m_best_score << ")\n";); if (score > m_best_score) { m_tabu_set = 0; m_best_score = score; @@ -565,7 +565,7 @@ namespace sls { else { var_t v = a.mk_term(m_best_expr); if (!a.update_num(v, m_best_value - a.value(v))) { - TRACE("arith", + TRACE(arith, tout << "could not move v" << v << " " << t << " " << mk_bounded_pp(m_best_expr, m) << " := " << a.value(v) << " " << m_top_score << "\n"; ); return false; @@ -576,8 +576,8 @@ namespace sls { clear_update_stack(); } - CTRACE("arith", !m_best_expr, tout << "no move " << t << "\n";); - CTRACE("arith", m_best_expr && autil.is_int_real(m_best_expr), { + CTRACE(arith, !m_best_expr, tout << "no move " << t << "\n";); + CTRACE(arith, m_best_expr && autil.is_int_real(m_best_expr), { var_t v = a.mk_term(m_best_expr); tout << t << " v" << v << " " << mk_bounded_pp(m_best_expr, m) << " := " << a.value(v) << " " << m_top_score << "\n"; }); @@ -677,9 +677,9 @@ namespace sls { initialize_bool_assignment(); rescore(); a.m_config.max_moves = a.m_stats.m_steps + a.m_config.max_moves_base; - TRACE("arith", tout << "search " << a.m_stats.m_steps << " " << a.m_config.max_moves << "\n";); + TRACE(arith, tout << "search " << a.m_stats.m_steps << " " << a.m_config.max_moves << "\n";); IF_VERBOSE(3, verbose_stream() << "lookahead-search steps:" << a.m_stats.m_steps << " max-moves:" << a.m_config.max_moves << "\n"); - TRACE("arith", a.display(tout)); + TRACE(arith, a.display(tout)); while (ctx.rlimit().inc() && a.m_stats.m_steps < a.m_config.max_moves) { a.m_stats.m_steps++; @@ -741,8 +741,8 @@ namespace sls { } m_last_atom = e; - CTRACE("arith", !e, tout << "no unsatisfiable candidate\n";); - CTRACE("arith", e, + CTRACE(arith, !e, tout << "no unsatisfiable candidate\n";); + CTRACE(arith, e, tout << "select " << mk_bounded_pp(e, m) << " "; for (auto v : get_fixable_exprs(e)) tout << mk_bounded_pp(v, m) << " "; diff --git a/src/ast/sls/sls_bv_engine.cpp b/src/ast/sls/sls_bv_engine.cpp index 96e355c2d..98da1bfcf 100644 --- a/src/ast/sls/sls_bv_engine.cpp +++ b/src/ast/sls/sls_bv_engine.cpp @@ -84,7 +84,7 @@ bool sls_engine::full_eval(model & mdl) { if (!m_manager.inc()) return false; if (!mdl.is_true(a)) { - TRACE("sls", tout << "Evaluation: false\n";); + TRACE(sls, tout << "Evaluation: false\n";); return false; } } @@ -96,7 +96,7 @@ double sls_engine::top_score() { for (expr* e : m_assertions) { top_sum += m_tracker.get_score(e); } - TRACE("sls_top", tout << "Score distribution:"; + TRACE(sls_top, tout << "Score distribution:"; for (expr* e : m_assertions) tout << " " << m_tracker.get_score(e); tout << " AVG: " << top_sum / (double)m_assertions.size() << std::endl;); @@ -152,7 +152,7 @@ bool sls_engine::what_if( else r = incremental_score(fd, temp); #ifdef Z3DEBUG - TRACE("sls_whatif", tout << "WHAT IF " << fd->get_name() << " WERE " << m_mpz_manager.to_string(temp) << + TRACE(sls_whatif, tout << "WHAT IF " << fd->get_name() << " WERE " << m_mpz_manager.to_string(temp) << " --> " << r << std::endl;); m_mpz_manager.del(old_value); @@ -268,7 +268,7 @@ void sls_engine::mk_random_move(ptr_vector & unsat_constants) NOT_IMPLEMENTED_YET(); } - TRACE("sls", tout << "Randomization candidates: "; + TRACE(sls, tout << "Randomization candidates: "; for (unsigned i = 0; i < unsat_constants.size(); i++) tout << unsat_constants[i]->get_name() << ", "; tout << std::endl; diff --git a/src/ast/sls/sls_bv_eval.cpp b/src/ast/sls/sls_bv_eval.cpp index 98e1e6e6b..a1aadba47 100644 --- a/src/ast/sls/sls_bv_eval.cpp +++ b/src/ast/sls/sls_bv_eval.cpp @@ -204,7 +204,7 @@ namespace sls { auto old_val = m_tmp_bool_values.get(id, l_undef); m_tmp_bool_values.setx(id, to_lbool(val), l_undef); m_tmp_bool_value_updates.push_back({ id, old_val }); - //TRACE("bv", tout << mk_bounded_pp(e, m) << " := " << val << " old: " << old_val << "\n"); + //TRACE(bv, tout << mk_bounded_pp(e, m) << " := " << val << " old: " << old_val << "\n"); } void bv_eval::set_bool_value_no_log(expr* e, bool val) { @@ -216,7 +216,7 @@ namespace sls { SASSERT(m.is_bool(e)); auto id = e->get_id(); auto val = m_tmp_bool_values.get(id, l_undef); - //TRACE("bv", tout << mk_bounded_pp(e, m) << " == " << val << "\n"); + //TRACE(bv, tout << mk_bounded_pp(e, m) << " == " << val << "\n"); if (val != l_undef) return val == l_true; bool b; @@ -227,12 +227,12 @@ namespace sls { b = bval1(e); m_tmp_bool_values.setx(id, to_lbool(b), l_undef); m_tmp_bool_value_updates.push_back({ id, l_undef }); - //TRACE("bv", tout << mk_bounded_pp(e, m) << " := " << b << " old: " << val << "\n"); + //TRACE(bv, tout << mk_bounded_pp(e, m) << " := " << b << " old: " << val << "\n"); return b; } void bv_eval::restore_bool_values(unsigned r) { - //TRACE("bv", tout << "restore " << m_tmp_bool_value_updates.size() - r << "\n";); + //TRACE(bv, tout << "restore " << m_tmp_bool_value_updates.size() - r << "\n";); for (auto i = m_tmp_bool_value_updates.size(); i-- > r; ) { auto& [id, val] = m_tmp_bool_value_updates[i]; m_tmp_bool_values.set(id, val); diff --git a/src/ast/sls/sls_bv_evaluator.h b/src/ast/sls/sls_bv_evaluator.h index 37502452d..a2119e64d 100644 --- a/src/ast/sls/sls_bv_evaluator.h +++ b/src/ast/sls/sls_bv_evaluator.h @@ -494,7 +494,7 @@ public: NOT_IMPLEMENTED_YET(); } - TRACE("sls_eval", tout << "(" << fd->get_name(); + TRACE(sls_eval, tout << "(" << fd->get_name(); for (unsigned i = 0; i < n_args; i++) tout << " " << m_mpz_manager.to_string(m_tracker.get_value(args[i])); tout << ") ---> " << m_mpz_manager.to_string(result); @@ -525,7 +525,7 @@ public: evaluator(q, temp); mpz check_res; m_tracker.value2mpz(temp, check_res); - CTRACE("sls", !m_mpz_manager.eq(check_res, result), + CTRACE(sls, !m_mpz_manager.eq(check_res, result), tout << "EVAL BUG: IS " << m_mpz_manager.to_string(result) << " SHOULD BE " << m_mpz_manager.to_string(check_res) << std::endl; ); SASSERT(m_mpz_manager.eq(check_res, result)); @@ -654,7 +654,7 @@ public: } void serious_update(func_decl * fd, const mpz & new_value) { - TRACE("sls", tout << "set: " << fd->get_name() << " to " << m_mpz_manager.to_string(new_value) << std::endl;); + TRACE(sls, tout << "set: " << fd->get_name() << " to " << m_mpz_manager.to_string(new_value) << std::endl;); m_tracker.set_value(fd, new_value); expr * ep = m_tracker.get_entry_point(fd); unsigned cur_depth = m_tracker.get_distance(ep); @@ -808,7 +808,7 @@ public: m_mpz_manager.del(temp); - TRACE("sls", tout << "Randomization candidate: " << unsat_constants[r]->get_name() << std::endl; + TRACE(sls, tout << "Randomization candidate: " << unsat_constants[r]->get_name() << std::endl; tout << "Locally randomized model: " << std::endl; m_tracker.show_model(tout); ); diff --git a/src/ast/sls/sls_bv_lookahead.cpp b/src/ast/sls/sls_bv_lookahead.cpp index 229ae3664..87398429e 100644 --- a/src/ast/sls/sls_bv_lookahead.cpp +++ b/src/ast/sls/sls_bv_lookahead.cpp @@ -58,7 +58,7 @@ namespace sls { initialize_bool_values(); rescore(); m_config.max_moves = m_stats.m_moves + m_config.max_moves_base; - TRACE("bv", tout << "search " << m_stats.m_moves << " " << m_config.max_moves << "\n";); + TRACE(bv, tout << "search " << m_stats.m_moves << " " << m_config.max_moves << "\n";); IF_VERBOSE(1, verbose_stream() << "lookahead-search moves:" << m_stats.m_moves << " max-moves:" << m_config.max_moves << "\n"); while (ctx.rlimit().inc() && m_stats.m_moves < m_config.max_moves) { @@ -129,7 +129,7 @@ namespace sls { unsigned start = ctx.rand(); for (unsigned i = 0; i < sz; ++i) add_updates(vars[(start + i) % sz]); - CTRACE("bv", !m_best_expr, tout << "no guided move\n";); + CTRACE(bv, !m_best_expr, tout << "no guided move\n";); return apply_update(m_last_atom, m_best_expr, m_best_value, move_type::guided_t); } @@ -162,7 +162,7 @@ namespace sls { if (vars.empty()) return false; expr* e = vars[ctx.rand(vars.size())]; - TRACE("bv", tout << "random move " << mk_bounded_pp(e, m) << "\n";); + TRACE(bv, tout << "random move " << mk_bounded_pp(e, m) << "\n";); if (m.is_bool(e)) { if (is_root(e)) return false; @@ -198,7 +198,7 @@ namespace sls { expr* e = nullptr; if (m_config.ucb) { double max = -1.0; - TRACE("bv", tout << "select\n"); + TRACE(bv, tout << "select\n"); for (auto a : get_root_assertions()) { auto const& vars = m_ev.terms.uninterp_occurs(a); //verbose_stream() << mk_bounded_pp(a, m) << " " << assertion_is_true(a) << " num vars " << vars.size() << "\n"; @@ -208,7 +208,7 @@ namespace sls { if (vars.empty()) continue; auto score = old_score(a); - TRACE("bv", tout << "score " << score << " " << mk_bounded_pp(a, m) << "\n"); + TRACE(bv, tout << "score " << score << " " << mk_bounded_pp(a, m) << "\n"); auto q = score + m_config.ucb_constant * sqrt(log((double)m_touched) / get_touched(a)) + m_config.ucb_noise * ctx.rand(512); @@ -226,7 +226,7 @@ namespace sls { if (!assertion_is_true(a) && !m_ev.terms.uninterp_occurs(e).empty() && ctx.rand() % ++n == 0) e = a; } - CTRACE("bv", !e, ; display_weights(ctx.display(tout << "no candidate\n"));); + CTRACE(bv, !e, ; display_weights(ctx.display(tout << "no candidate\n"));); m_last_atom = e; @@ -235,7 +235,7 @@ namespace sls { auto const& vars = m_ev.terms.uninterp_occurs(e); - TRACE("bv", tout << "candidates " << mk_bounded_pp(e, m) << ": "; + TRACE(bv, tout << "candidates " << mk_bounded_pp(e, m) << ": "; for (auto e : vars) tout << mk_bounded_pp(e, m) << " "; tout << "\n";); return vars; @@ -493,12 +493,12 @@ namespace sls { else if (m.is_bool(t)) m_ev.set_bool_value_no_log(t, !m_ev.get_bool_value(t)); - // TRACE("bv_verbose", tout << "lookahead update " << mk_bounded_pp(t, m) << " := " << new_value << "\n";); + // TRACE(bv_verbose, tout << "lookahead update " << mk_bounded_pp(t, m) << " := " << new_value << "\n";); for (unsigned depth = m_min_depth; depth <= m_max_depth; ++depth) { for (unsigned i = 0; i < m_update_stack[depth].size(); ++i) { auto const& [a, is_bv] = m_update_stack[depth][i]; - TRACE("bv_verbose", tout << "update " << mk_bounded_pp(a, m) << " depth: " << depth << "\n";); + TRACE(bv_verbose, tout << "update " << mk_bounded_pp(a, m) << " depth: " << depth << "\n";); if (t != a) { if (is_bv) @@ -512,7 +512,7 @@ namespace sls { } m_ev.restore_bool_values(restore_point); - TRACE("bv_verbose", tout << "lookahead update " << mk_bounded_pp(t, m) << " := " << new_value << " score: " << score << " " << m_best_score << "\n"); + TRACE(bv_verbose, tout << "lookahead update " << mk_bounded_pp(t, m) << " := " << new_value << " score: " << score << " " << m_best_score << "\n"); return score; } @@ -546,7 +546,7 @@ namespace sls { m_in_update_stack.reset(); for (auto e : m_bv_restore) { wval(e).restore_value(); - TRACE("sls_verbose", tout << "restore value " << mk_bounded_pp(e, m) << " " << wval(e) << "\n"); + TRACE(sls_verbose, tout << "restore value " << mk_bounded_pp(e, m) << " " << wval(e) << "\n"); } for (auto const& [e, b]: m_bool_restore) m_ev.set_bool_value_no_log(e, b); @@ -679,7 +679,7 @@ namespace sls { for (unsigned depth = max_depth; depth <= max_depth; ++depth) { for (unsigned i = 0; i < m_update_stack[depth].size(); ++i) { auto [e, is_bv] = m_update_stack[depth][i]; - TRACE("bv_verbose", tout << "update " << mk_bounded_pp(e, m) << "\n";); + TRACE(bv_verbose, tout << "update " << mk_bounded_pp(e, m) << "\n";); if (t == e) ; else if (is_bv) { @@ -690,7 +690,7 @@ namespace sls { SASSERT(m.is_bool(e)); auto v1 = m_ev.bval1(e); - CTRACE("bv_verbose", m_ev.get_bool_value(e) != v1, tout << "updated truth value " << mk_bounded_pp(e, m) << " := " << v1 << "\n";); + CTRACE(bv_verbose, m_ev.get_bool_value(e) != v1, tout << "updated truth value " << mk_bounded_pp(e, m) << " := " << v1 << "\n";); if (m_config.use_top_level_assertions) { @@ -715,7 +715,7 @@ namespace sls { bool rot = ctx.try_rotate(v, m_rotated, budget); if (rot) ++m_stats.m_rotations; - CTRACE("bv", rot, tout << "rotated: " << m_rotated << "\n";); + CTRACE(bv, rot, tout << "rotated: " << m_rotated << "\n";); } } } @@ -740,7 +740,7 @@ namespace sls { m_ev.commit_bool_values(); else m_ev.restore_bool_values(restore_point); - TRACE("bv", tout << mt << " " << mk_bounded_pp(t, m); + TRACE(bv, tout << mt << " " << mk_bounded_pp(t, m); if (bv.is_bv(t)) tout << " := " << new_value; else tout << " " << m_ev.get_bool_value(t); tout << " score " << m_top_score << "\n";); return true; @@ -755,7 +755,7 @@ namespace sls { } void bv_lookahead::insert_update(expr* e, bool is_bv) { - TRACE("sls_verbose", tout << "insert update " << mk_bounded_pp(e, m) << "\n"); + TRACE(sls_verbose, tout << "insert update " << mk_bounded_pp(e, m) << "\n"); if (is_bv) { SASSERT(bv.is_bv(e)); auto& v = wval(e); diff --git a/src/ast/sls/sls_bv_plugin.cpp b/src/ast/sls/sls_bv_plugin.cpp index c45c6bdd6..13da04c8f 100644 --- a/src/ast/sls/sls_bv_plugin.cpp +++ b/src/ast/sls/sls_bv_plugin.cpp @@ -56,7 +56,7 @@ namespace sls { auto a = to_app(e); if (!m_eval.eval_is_correct(a)) { - TRACE("sls", tout << "incorrect eval " << lit << ": " << mk_bounded_pp(e, m) << "\n";); + TRACE(sls, tout << "incorrect eval " << lit << ": " << mk_bounded_pp(e, m) << "\n";); IF_VERBOSE(20, verbose_stream() << "repair " << lit << " " << mk_bounded_pp(e, m) << "\n"); ctx.new_value_eh(e); } @@ -84,7 +84,7 @@ namespace sls { bool is_sat = true; for (auto t : ctx.subterms()) if (is_app(t) && bv.is_bv(t) && to_app(t)->get_family_id() == bv.get_fid() && !m_eval.eval_is_correct(to_app(t))) { - TRACE("sls", tout << "incorrect eval: " << mk_bounded_pp(t, m) << " " << m_eval.wval(t) << "\n";); + TRACE(sls, tout << "incorrect eval: " << mk_bounded_pp(t, m) << " " << m_eval.wval(t) << "\n";); ctx.new_value_eh(t); is_sat = false; } diff --git a/src/ast/sls/sls_bv_tracker.h b/src/ast/sls/sls_bv_tracker.h index 46e14684b..7c9b02a46 100644 --- a/src/ast/sls/sls_bv_tracker.h +++ b/src/ast/sls/sls_bv_tracker.h @@ -424,7 +424,7 @@ public: calculate_expr_distances(as); - TRACE("sls", tout << "Initial model:" << std::endl; show_model(tout); ); + TRACE(sls, tout << "Initial model:" << std::endl; show_model(tout); ); if (m_track_unsat) { @@ -617,7 +617,7 @@ public: } void randomize(ptr_vector const & as) { - TRACE("sls_verbose", tout << "Abandoned model:" << std::endl; show_model(tout); ); + TRACE(sls_verbose, tout << "Abandoned model:" << std::endl; show_model(tout); ); for (entry_point_type::iterator it = m_entry_points.begin(); it != m_entry_points.end(); it++) { func_decl * fd = it->m_key; @@ -627,11 +627,11 @@ public: m_mpz_manager.del(temp); } - TRACE("sls", tout << "Randomized model:" << std::endl; show_model(tout); ); + TRACE(sls, tout << "Randomized model:" << std::endl; show_model(tout); ); } void reset(ptr_vector const & as) { - TRACE("sls_verbose", tout << "Abandoned model:" << std::endl; show_model(tout); ); + TRACE(sls_verbose, tout << "Abandoned model:" << std::endl; show_model(tout); ); for (entry_point_type::iterator it = m_entry_points.begin(); it != m_entry_points.end(); it++) { set_value(it->m_value, m_zero); @@ -677,7 +677,7 @@ public: } double score_bool(expr * n, bool negated = false) { - TRACE("sls_score", tout << ((negated)?"NEG ":"") << "BOOL: " << mk_ismt2_pp(n, m_manager) << std::endl; ); + TRACE(sls_score, tout << ((negated)?"NEG ":"") << "BOOL: " << mk_ismt2_pp(n, m_manager) << std::endl; ); double res = 0.0; @@ -738,12 +738,12 @@ public: if (negated) { res = (m_mpz_manager.eq(v0, v1)) ? 0.0 : 1.0; - TRACE("sls_score", tout << "V0 = " << m_mpz_manager.to_string(v0) << " ; V1 = " << + TRACE(sls_score, tout << "V0 = " << m_mpz_manager.to_string(v0) << " ; V1 = " << m_mpz_manager.to_string(v1) << std::endl; ); } else if (m_manager.is_bool(arg0)) { res = m_mpz_manager.eq(v0, v1) ? 1.0 : 0.0; - TRACE("sls_score", tout << "V0 = " << m_mpz_manager.to_string(v0) << " ; V1 = " << + TRACE(sls_score, tout << "V0 = " << m_mpz_manager.to_string(v0) << " ; V1 = " << m_mpz_manager.to_string(v1) << std::endl; ); } else if (m_bv_util.is_bv(arg0)) { @@ -759,7 +759,7 @@ public: m_mpz_manager.machine_div(diff, m_two, diff); } res = 1.0 - (hamming_distance / (double) bv_sz); - TRACE("sls_score", tout << "V0 = " << m_mpz_manager.to_string(v0) << " ; V1 = " << + TRACE(sls_score, tout << "V0 = " << m_mpz_manager.to_string(v0) << " ; V1 = " << m_mpz_manager.to_string(v1) << " ; HD = " << hamming_distance << " ; SZ = " << bv_sz << std::endl; ); m_mpz_manager.del(diff); @@ -804,7 +804,7 @@ public: m_mpz_manager.del(diff); } } - TRACE("sls_score", tout << "x = " << m_mpz_manager.to_string(x) << " ; y = " << + TRACE(sls_score, tout << "x = " << m_mpz_manager.to_string(x) << " ; y = " << m_mpz_manager.to_string(y) << " ; SZ = " << bv_sz << std::endl; ); } else if (m_bv_util.is_bv_sle(n)) { // x <= y @@ -831,7 +831,7 @@ public: res = (dbl > 1.0) ? 0.0 : (dbl < 0.0) ? 1.0 : 1.0 - dbl; m_mpz_manager.del(diff); } - TRACE("sls_score", tout << "x = " << m_mpz_manager.to_string(x) << " ; y = " << + TRACE(sls_score, tout << "x = " << m_mpz_manager.to_string(x) << " ; y = " << m_mpz_manager.to_string(y) << " ; SZ = " << bv_sz << std::endl; ); } else { @@ -847,7 +847,7 @@ public: res = (dbl > 1.0) ? 0.0 : (dbl < 0.0) ? 1.0 : 1.0 - dbl; m_mpz_manager.del(diff); } - TRACE("sls_score", tout << "x = " << m_mpz_manager.to_string(x) << " ; y = " << + TRACE(sls_score, tout << "x = " << m_mpz_manager.to_string(x) << " ; y = " << m_mpz_manager.to_string(y) << " ; SZ = " << bv_sz << std::endl; ); } m_mpz_manager.del(x); @@ -887,7 +887,7 @@ public: if (afid == m_bv_util.get_family_id()) if (res < 1.0) res *= m_scale_unsat; - TRACE("sls_score", tout << "SCORE = " << res << std::endl; ); + TRACE(sls_score, tout << "SCORE = " << res << std::endl; ); return res; } @@ -964,7 +964,7 @@ public: if (!m_temp_constants.contains(fd)) m_temp_constants.push_back(fd); } - TRACE("sls", tout << "candidates "; for (auto f : m_temp_constants) tout << f->get_name() << " "; tout << std::endl;); + TRACE(sls, tout << "candidates "; for (auto f : m_temp_constants) tout << f->get_name() << " "; tout << std::endl;); return m_temp_constants; } @@ -976,7 +976,7 @@ public: if (!m_temp_constants.contains(fd)) m_temp_constants.push_back(fd); - TRACE("sls", tout << "candidates " << mk_bounded_pp(e, m_manager) << " "; + TRACE(sls, tout << "candidates " << mk_bounded_pp(e, m_manager) << " "; for (auto f : m_temp_constants) tout << f->get_name() << " "; tout << std::endl;); return m_temp_constants; diff --git a/src/ast/sls/sls_context.cpp b/src/ast/sls/sls_context.cpp index 91cfd5fae..57ddb793a 100644 --- a/src/ast/sls/sls_context.cpp +++ b/src/ast/sls/sls_context.cpp @@ -122,7 +122,7 @@ namespace sls { if (fid == basic_family_id) return false; auto p = m_plugins.get(fid, nullptr); - CTRACE("sls_verbose", p != nullptr, tout << "external " << mk_bounded_pp(a, m) << "\n"); + CTRACE(sls_verbose, p != nullptr, tout << "external " << mk_bounded_pp(a, m) << "\n"); return p != nullptr; } @@ -196,7 +196,7 @@ namespace sls { s.on_model(mdl); // verbose_stream() << *mdl << "\n"; - TRACE("sls", display(tout)); + TRACE(sls, display(tout)); } void context::validate_model(model& mdl) { @@ -210,7 +210,7 @@ namespace sls { if (bad_model) { IF_VERBOSE(0, verbose_stream() << lit << " " << a->get_id() << " " << mk_bounded_pp(a, m) << " " << eval_a << "\n"); - TRACE("sls", s.display(tout << lit << " " << a->get_id() << " " << mk_bounded_pp(a, m) << " " << eval_a << "\n"); + TRACE(sls, s.display(tout << lit << " " << a->get_id() << " " << mk_bounded_pp(a, m) << " " << eval_a << "\n"); for (expr* t : subterms::all(expr_ref(a, m))) tout << "#" << t->get_id() << ": " << mk_bounded_pp(t, m) << " := " << ev(t) << "\n"; ); @@ -240,13 +240,13 @@ namespace sls { while (!m_repair_down.empty() && !m_new_constraint && m.inc()) { auto id = m_repair_down.erase_min(); expr* e = term(id); - TRACE("sls", tout << "repair down " << mk_bounded_pp(e, m) << "\n"); + TRACE(sls, tout << "repair down " << mk_bounded_pp(e, m) << "\n"); if (is_app(e)) { auto p = m_plugins.get(get_fid(e), nullptr); ++m_stats.m_num_repair_down; if (p && !p->repair_down(to_app(e)) && !m_repair_up.contains(e->get_id())) { IF_VERBOSE(3, verbose_stream() << "revert repair: " << mk_bounded_pp(e, m) << "\n"); - TRACE("sls", tout << "revert repair: " << mk_bounded_pp(e, m) << "\n"); + TRACE(sls, tout << "revert repair: " << mk_bounded_pp(e, m) << "\n"); m_repair_up.insert(e->get_id()); } } @@ -255,7 +255,7 @@ namespace sls { auto id = m_repair_up.erase_min(); expr* e = term(id); ++m_stats.m_num_repair_up; - TRACE("sls", tout << "repair up " << mk_bounded_pp(e, m) << "\n"); + TRACE(sls, tout << "repair up " << mk_bounded_pp(e, m) << "\n"); if (is_app(e)) { auto p = m_plugins.get(get_fid(e), nullptr); if (p) diff --git a/src/ast/sls/sls_datatype_plugin.cpp b/src/ast/sls/sls_datatype_plugin.cpp index 7df9dee6a..b2b6baa2c 100644 --- a/src/ast/sls/sls_datatype_plugin.cpp +++ b/src/ast/sls/sls_datatype_plugin.cpp @@ -136,7 +136,7 @@ namespace sls { void datatype_plugin::add_edge(expr* child, expr* parent, expr* cond) { m_parents.insert_if_not_there(child, vector()).push_back({parent, expr_ref(cond, m)}); - TRACE("dt", tout << mk_bounded_pp(child, m) << " <- " << mk_bounded_pp(parent, m) << " " << mk_bounded_pp(cond, m) << "\n"); + TRACE(dt, tout << mk_bounded_pp(child, m) << " <- " << mk_bounded_pp(parent, m) << " " << mk_bounded_pp(cond, m) << "\n"); } void datatype_plugin::add_path_axioms() { @@ -164,7 +164,7 @@ namespace sls { } if (children[0]->get_sort() == parent->get_sort()) { lits.push_back(~ctx.mk_literal(m.mk_eq(children[0], parent))); - TRACE("dt", for (auto lit : lits) tout << (lit.sign() ? "~": "") << mk_pp(ctx.atom(lit.var()), m) << "\n";); + TRACE(dt, for (auto lit : lits) tout << (lit.sign() ? "~": "") << mk_pp(ctx.atom(lit.var()), m) << "\n";); ctx.add_clause(lits); lits.pop_back(); } @@ -260,7 +260,7 @@ namespace sls { } //collect_path_axioms(); - TRACE("dt", for (auto a : m_axioms) tout << mk_pp(a, m) << "\n";); + TRACE(dt, for (auto a : m_axioms) tout << mk_pp(a, m) << "\n";); for (auto a : m_axioms) ctx.add_constraint(a); @@ -279,7 +279,7 @@ namespace sls { if (m_axiomatic_mode) { init_values(); - TRACE("dt", tout << "get value " << mk_bounded_pp(e, m) << " " << m_values.size() << " " << g->find(e)->get_root_id() << "\n";); + TRACE(dt, tout << "get value " << mk_bounded_pp(e, m) << " " << m_values.size() << " " << g->find(e)->get_root_id() << "\n";); for (auto n : euf::enode_class(g->find(e))) { auto id = n->get_id(); if (m_values.get(id, nullptr)) @@ -295,7 +295,7 @@ namespace sls { void datatype_plugin::init_values() { if (!m_values.empty()) return; - TRACE("dt", g->display(tout)); + TRACE(dt, g->display(tout)); m_model = alloc(model, m); // retrieve e-graph from sls_euf_solver: add bridge in sls_context to share e-graph SASSERT(g); @@ -347,11 +347,11 @@ namespace sls { if (!has_null) { m_values.setx(id, m.mk_app(f, args)); m_model->register_value(m_values.get(id)); - TRACE("dt", tout << "Set interpretation "; trace_assignment(tout, n);); + TRACE(dt, tout << "Set interpretation "; trace_assignment(tout, n);); } } - TRACE("dt", + TRACE(dt, for (euf::enode* n : deps.top_sorted()) { tout << g->bpp(n) << ": "; tout << g->bpp(get_constructor(n)) << " :: "; @@ -394,7 +394,7 @@ namespace sls { worklist.push_back(p); SASSERT(all_of(args, [&](expr* e) { return e != nullptr; })); m_values.setx(p->get_id(), m.mk_app(f, args)); - TRACE("dt", tout << "Patched interpretation "; trace_assignment(tout, p);); + TRACE(dt, tout << "Patched interpretation "; trace_assignment(tout, p);); m_model->register_value(m_values.get(p->get_id())); } return all_processed; @@ -420,7 +420,7 @@ namespace sls { SASSERT(v); unsigned id = n->get_id(); m_values.setx(id, v); - TRACE("dt", tout << "Fresh interpretation "; trace_assignment(tout, n);); + TRACE(dt, tout << "Fresh interpretation "; trace_assignment(tout, n);); worklist.reset(); worklist.push_back(n); while (process_worklist(worklist)) @@ -432,7 +432,7 @@ namespace sls { if (!dt.is_datatype(n->get_expr())) return; euf::enode* con = get_constructor(n); - TRACE("dt", tout << g->bpp(n) << " con: " << g->bpp(con) << "\n";); + TRACE(dt, tout << g->bpp(n) << " con: " << g->bpp(con) << "\n";); if (!con) dep.insert(n, nullptr); else if (con->num_args() == 0) diff --git a/src/ast/sls/sls_euf_plugin.cpp b/src/ast/sls/sls_euf_plugin.cpp index 3b75419b6..870b5ec61 100644 --- a/src/ast/sls/sls_euf_plugin.cpp +++ b/src/ast/sls/sls_euf_plugin.cpp @@ -88,14 +88,14 @@ namespace sls { g.explain(explain, nullptr); g.end_explain(); double reward = -1; - TRACE("euf", + TRACE(euf, for (auto p : explain) { sat::literal l = to_literal(p); tout << l << " " << mk_pp(ctx.atom(l.var()), m) << " " << ctx.is_unit(l) << "\n"; }); for (auto p : explain) { sat::literal l = to_literal(p); - CTRACE("euf", !ctx.is_true(l), tout << "not true " << l << "\n"; ctx.display(tout);); + CTRACE(euf, !ctx.is_true(l), tout << "not true " << l << "\n"; ctx.display(tout);); SASSERT(ctx.is_true(l)); if (ctx.is_unit(l)) @@ -133,7 +133,7 @@ namespace sls { return; auto block = [&](euf::enode* a, euf::enode* b) { - TRACE("euf", tout << "block " << m_g->bpp(a) << " != " << m_g->bpp(b) << "\n"); + TRACE(euf, tout << "block " << m_g->bpp(a) << " != " << m_g->bpp(b) << "\n"); if (a->get_root() != b->get_root()) return; ptr_vector explain; @@ -197,7 +197,7 @@ namespace sls { g.mk(m.mk_false(), 0, 0, nullptr); // check for conflict with disequalities during propagation if (merge_eqs) { - TRACE("euf", tout << "root literals " << ctx.root_literals() << "\n"); + TRACE(euf, tout << "root literals " << ctx.root_literals() << "\n"); for (auto lit : ctx.root_literals()) { if (!ctx.is_true(lit)) lit.neg(); diff --git a/src/ast/sls/sls_smt_plugin.cpp b/src/ast/sls/sls_smt_plugin.cpp index 8ec7bb11d..209beae22 100644 --- a/src/ast/sls/sls_smt_plugin.cpp +++ b/src/ast/sls/sls_smt_plugin.cpp @@ -145,7 +145,7 @@ namespace sls { if (m_result == l_true && m_sls_model) { ast_translation tr(m_sls, m); mdl = m_sls_model->translate(tr); - TRACE("sls", tout << "model: " << *m_sls_model << "\n";); + TRACE(sls, tout << "model: " << *m_sls_model << "\n";); if (!canceled) ctx.set_finished(); } @@ -430,7 +430,7 @@ namespace sls { } lbool smt_plugin::on_save_model() { - TRACE("sls", display(tout)); + TRACE(sls, display(tout)); lbool r = l_true; while (unsat().empty()) { r = m_context.check(); diff --git a/src/ast/sls/sls_smt_solver.cpp b/src/ast/sls/sls_smt_solver.cpp index 4c27f57fa..cab62a674 100644 --- a/src/ast/sls/sls_smt_solver.cpp +++ b/src/ast/sls/sls_smt_solver.cpp @@ -54,12 +54,12 @@ namespace sls { if (m_on_save_model) return r; flet _on_save_model(m_on_save_model, true); - CTRACE("sls", unsat().empty(), display(tout)); + CTRACE(sls, unsat().empty(), display(tout)); while (unsat().empty()) { r = m_context.check(); if (!m_new_constraint) break; - TRACE("sls", display(tout)); + TRACE(sls, display(tout)); //m_ddfw.simplify(); m_ddfw.reinit(); m_new_constraint = false; diff --git a/src/ast/static_features.cpp b/src/ast/static_features.cpp index c5dedb16b..0fe422ea4 100644 --- a/src/ast/static_features.cpp +++ b/src/ast/static_features.cpp @@ -194,7 +194,7 @@ void static_features::update_core(expr * e) { if (fid_arg == m_afid) { m_num_arith_terms++; rational k; - TRACE("diff_term", tout << "diff_term: " << is_diff_term(arg, k) << "\n" << mk_pp(arg, m) << "\n";); + TRACE(diff_term, tout << "diff_term: " << is_diff_term(arg, k) << "\n" << mk_pp(arg, m) << "\n";); if (is_diff_term(arg, k)) { m_num_diff_terms++; acc_num(k); @@ -236,7 +236,7 @@ void static_features::update_core(expr * e) { bool _is_le_ge = m_autil.is_le(e) || m_autil.is_ge(e); if (_is_le_ge) { m_num_arith_ineqs++; - TRACE("diff_atom", tout << "diff_atom: " << is_diff_atom(e) << "\n" << mk_pp(e, m) << "\n";); + TRACE(diff_atom, tout << "diff_atom: " << is_diff_atom(e) << "\n" << mk_pp(e, m) << "\n";); if (is_diff_atom(e)) m_num_diff_ineqs++; if (!is_arith_expr(to_app(e)->get_arg(0))) @@ -253,7 +253,7 @@ void static_features::update_core(expr * e) { if (is_numeral(to_app(e)->get_arg(1))) { acc_num(to_app(e)->get_arg(1)); m_num_arith_eqs++; - TRACE("diff_atom", tout << "diff_atom: " << is_diff_atom(e) << "\n" << mk_pp(e, m) << "\n";); + TRACE(diff_atom, tout << "diff_atom: " << is_diff_atom(e) << "\n" << mk_pp(e, m) << "\n";); if (is_diff_atom(e)) m_num_diff_eqs++; if (!is_arith_expr(to_app(e)->get_arg(0))) @@ -328,7 +328,7 @@ void static_features::update_core(expr * e) { } } if (m_arrayutil.is_array(e)) { - TRACE("sf_array", tout << mk_ismt2_pp(e, m) << "\n";); + TRACE(sf_array, tout << mk_ismt2_pp(e, m) << "\n";); sort * ty = to_app(e)->get_decl()->get_range(); mark_theory(ty->get_family_id()); unsigned n = ty->get_num_parameters(); @@ -356,7 +356,7 @@ void static_features::update_core(expr * e) { SASSERT(!_is_le_ge); m_num_arith_terms++; rational k; - TRACE("diff_term", tout << "diff_term: " << is_diff_term(arg, k) << "\n" << mk_pp(arg, m) << "\n";); + TRACE(diff_term, tout << "diff_term: " << is_diff_term(arg, k) << "\n" << mk_pp(arg, m) << "\n";); if (is_diff_term(arg, k)) { m_num_diff_terms++; acc_num(k); diff --git a/src/ast/substitution/demodulator_rewriter.cpp b/src/ast/substitution/demodulator_rewriter.cpp index 6e7ac996c..28bef1275 100644 --- a/src/ast/substitution/demodulator_rewriter.cpp +++ b/src/ast/substitution/demodulator_rewriter.cpp @@ -102,7 +102,7 @@ bool demodulator_util::is_demodulator(expr * e, app_ref & large, expr_ref & smal if (m.is_eq(qe, lhs, rhs)) { int subset = is_subset(lhs, rhs); int smaller = is_smaller(lhs, rhs); - TRACE("demodulator", tout << "testing is_demodulator:\n" + TRACE(demodulator, tout << "testing is_demodulator:\n" << mk_pp(lhs, m) << "\n" << mk_pp(rhs, m) << "\n" << "subset: " << subset << ", smaller: " << smaller << "\n";); @@ -190,7 +190,7 @@ demodulator_rewriter_util::demodulator_rewriter_util(ast_manager& m): expr_ref demodulator_rewriter_util::rewrite(expr * n) { - TRACE("demodulator", tout << "rewrite: " << mk_pp(n, m) << std::endl; ); + TRACE(demodulator, tout << "rewrite: " << mk_pp(n, m) << std::endl; ); app * a; SASSERT(m_rewrite_todo.empty()); @@ -199,7 +199,7 @@ expr_ref demodulator_rewriter_util::rewrite(expr * n) { m_rewrite_todo.push_back(n); while (!m_rewrite_todo.empty()) { - TRACE("demodulator_stack", tout << "STACK: " << std::endl; + TRACE(demodulator_stack, tout << "STACK: " << std::endl; for (unsigned i = 0; i < m_rewrite_todo.size(); i++) tout << std::dec << i << ": " << std::hex << (size_t)m_rewrite_todo[i] << " = " << mk_pp(m_rewrite_todo[i], m) << std::endl; @@ -251,7 +251,7 @@ expr_ref demodulator_rewriter_util::rewrite(expr * n) { else { expr_ref na(m); na = m_th_rewriter.mk_app(f, m_new_args); - TRACE("demodulator_bug", tout << "e:\n" << mk_pp(e, m) << "\nnew_args: \n"; + TRACE(demodulator_bug, tout << "e:\n" << mk_pp(e, m) << "\nnew_args: \n"; tout << m_new_args << "\n"; tout << "=====>\n"; tout << "na:\n " << na << "\n";); @@ -289,7 +289,7 @@ expr_ref demodulator_rewriter_util::rewrite(expr * n) { SASSERT(ebp.second); expr * r = ebp.first; - TRACE("demodulator", tout << "rewrite result: " << mk_pp(r, m) << std::endl; ); + TRACE(demodulator, tout << "rewrite result: " << mk_pp(r, m) << std::endl; ); return expr_ref(r, m); } @@ -309,7 +309,7 @@ bool demodulator_rewriter_util::rewrite_visit_children(app * a) { for (expr* t : m_rewrite_todo) { if (t == v) { recursive = true; - TRACE("demodulator", tout << "Detected demodulator cycle: " << + TRACE(demodulator, tout << "Detected demodulator cycle: " << mk_pp(a, m) << " --> " << mk_pp(v, m) << std::endl;); rewrite_cache(e, v, true); break; @@ -362,7 +362,7 @@ demodulator_rewriter::~demodulator_rewriter() { void demodulator_rewriter::insert_fwd_idx(app * large, expr * small, quantifier * demodulator) { SASSERT(demodulator); SASSERT(large && small); - TRACE("demodulator_fwd", tout << "INSERT: " << mk_pp(demodulator, m) << std::endl; ); + TRACE(demodulator_fwd, tout << "INSERT: " << mk_pp(demodulator, m) << std::endl; ); func_decl * fd = to_app(large)->get_decl(); @@ -382,7 +382,7 @@ void demodulator_rewriter::insert_fwd_idx(app * large, expr * small, quantifier } void demodulator_rewriter::remove_fwd_idx(func_decl * f, quantifier * demodulator) { - TRACE("demodulator_fwd", tout << "REMOVE: " << std::hex << (size_t)demodulator << std::endl; ); + TRACE(demodulator_fwd, tout << "REMOVE: " << std::hex << (size_t)demodulator << std::endl; ); quantifier_set* qs; if (m_fwd_idx.find(f, qs)) { @@ -425,7 +425,7 @@ bool demodulator_rewriter::rewrite1(func_decl * f, expr_ref_vector const & args, quantifier_set* set; if (!m_fwd_idx.find(f, set)) return false; - TRACE("demodulator_bug", tout << "trying to rewrite: " << f->get_name() << " args:\n"; + TRACE(demodulator_bug, tout << "trying to rewrite: " << f->get_name() << " args:\n"; tout << m_new_args << "\n";); for (quantifier* d : *set) { @@ -435,12 +435,12 @@ bool demodulator_rewriter::rewrite1(func_decl * f, expr_ref_vector const & args, if (lhs->get_num_args() != args.size()) continue; - TRACE("demodulator_bug", tout << "Matching with demodulator: " << mk_pp(d, m) << std::endl; ); + TRACE(demodulator_bug, tout << "Matching with demodulator: " << mk_pp(d, m) << std::endl; ); SASSERT(lhs->get_decl() == f); if (m_match_subst(lhs, rhs, args.data(), np)) { - TRACE("demodulator_bug", tout << "succeeded...\n" << mk_pp(rhs, m) << "\n===>\n" << mk_pp(np, m) << "\n";); + TRACE(demodulator_bug, tout << "succeeded...\n" << mk_pp(rhs, m) << "\n===>\n" << mk_pp(np, m) << "\n";); m_new_exprs.push_back(np); return true; } @@ -464,7 +464,7 @@ bool demodulator_rewriter::rewrite_visit_children(app * a) { for (expr* t : m_rewrite_todo) { if (t == v) { recursive = true; - TRACE("demodulator", tout << "Detected demodulator cycle: " << + TRACE(demodulator, tout << "Detected demodulator cycle: " << mk_pp(a, m) << " --> " << mk_pp(v, m) << std::endl;); rewrite_cache(e, v, true); break; @@ -486,7 +486,7 @@ expr * demodulator_rewriter::rewrite(expr * n) { if (m_fwd_idx.empty()) return n; - TRACE("demodulator", tout << "rewrite: " << mk_pp(n, m) << std::endl; ); + TRACE(demodulator, tout << "rewrite: " << mk_pp(n, m) << std::endl; ); app * a; SASSERT(m_rewrite_todo.empty()); @@ -494,7 +494,7 @@ expr * demodulator_rewriter::rewrite(expr * n) { m_rewrite_todo.push_back(n); while (!m_rewrite_todo.empty()) { - TRACE("demodulator_stack", tout << "STACK: " << std::endl; + TRACE(demodulator_stack, tout << "STACK: " << std::endl; for (unsigned i = 0; i < m_rewrite_todo.size(); i++) tout << std::dec << i << ": " << std::hex << (size_t)m_rewrite_todo[i] << " = " << mk_pp(m_rewrite_todo[i], m) << std::endl; @@ -549,7 +549,7 @@ expr * demodulator_rewriter::rewrite(expr * n) { na = m.mk_app(f, m_new_args); else m_bsimp.mk_app(f, m_new_args.size(), m_new_args.data(), na); - TRACE("demodulator_bug", tout << "e:\n" << mk_pp(e, m) << "\nnew_args: \n"; + TRACE(demodulator_bug, tout << "e:\n" << mk_pp(e, m) << "\nnew_args: \n"; tout << m_new_args << "\n"; tout << "=====>\n"; tout << "na:\n " << na << "\n";); @@ -587,7 +587,7 @@ expr * demodulator_rewriter::rewrite(expr * n) { SASSERT(ebp.second); expr * r = ebp.first; - TRACE("demodulator", tout << "rewrite result: " << mk_pp(r, m) << std::endl; ); + TRACE(demodulator, tout << "rewrite result: " << mk_pp(r, m) << std::endl; ); return r; } @@ -703,7 +703,7 @@ void demodulator_rewriter::reschedule_demodulators(func_decl * f, expr * lhs) { if (!m_match_subst.can_rewrite(d, lhs)) continue; - TRACE("demodulator", tout << "Rescheduling: " << std::endl << mk_pp(d, m) << std::endl); + TRACE(demodulator, tout << "Rescheduling: " << std::endl << mk_pp(d, m) << std::endl); remove_fwd_idx(df, d); remove_bwd_idx(d); @@ -714,7 +714,7 @@ void demodulator_rewriter::reschedule_demodulators(func_decl * f, expr * lhs) { void demodulator_rewriter::operator()(expr_ref_vector const& exprs, expr_ref_vector & new_exprs) { - TRACE("demodulator", tout << "before demodulator:\n" << exprs); + TRACE(demodulator, tout << "before demodulator:\n" << exprs); // Initially, m_todo contains all formulas. That is, it contains the argument exprs. m_fwd_idx, m_processed, m_back_idx are empty. for (expr* e : exprs) @@ -745,7 +745,7 @@ void demodulator_rewriter::operator()(expr_ref_vector const& exprs, } else { // np is a demodulator that allows us to replace 'large' with 'small'. - TRACE("demodulator", tout << "Found demodulator:\n" << large << "\n ---> " << small << "\n"); + TRACE(demodulator, tout << "Found demodulator:\n" << large << "\n ---> " << small << "\n"); // let f be the top symbol of n' func_decl * f = large->get_decl(); @@ -764,18 +764,18 @@ void demodulator_rewriter::operator()(expr_ref_vector const& exprs, // the result is the contents of m_processed + all demodulators in m_fwd_idx. for (expr* e : m_processed) { new_exprs.push_back(e); - TRACE("demodulator", tout << mk_pp(e, m) << std::endl; ); + TRACE(demodulator, tout << mk_pp(e, m) << std::endl; ); } for (auto const& [k, set] : m_fwd_idx) { if (set) { for (expr* e : *set) new_exprs.push_back(e); - TRACE("demodulator", for (expr* e : *set) tout << mk_pp(e, m) << std::endl; ); + TRACE(demodulator, for (expr* e : *set) tout << mk_pp(e, m) << std::endl; ); } } - TRACE("demodulator", tout << "after demodulator:\n" << new_exprs << "\n";); + TRACE(demodulator, tout << "after demodulator:\n" << new_exprs << "\n";); } diff --git a/src/ast/substitution/substitution.cpp b/src/ast/substitution/substitution.cpp index dc5e35bc4..1443b618c 100644 --- a/src/ast/substitution/substitution.cpp +++ b/src/ast/substitution/substitution.cpp @@ -39,7 +39,7 @@ void substitution::reset() { void substitution::reset_cache() { - TRACE("subst_bug", tout << "substitution::reset_cache\n"; + TRACE(subst_bug, tout << "substitution::reset_cache\n"; for (unsigned i = 0; i < m_new_exprs.size(); i++) { tout << mk_pp(m_new_exprs.get(i), m_manager) << "\nref_count: " << m_new_exprs.get(i)->get_ref_count() << "\n"; }); m_apply_cache.reset(); @@ -74,7 +74,7 @@ inline void substitution::apply_visit(expr_offset const & n, bool & visited) { void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, expr_offset const & n, expr_offset const & s, expr_offset const & t, expr_ref & result) { - TRACE("subst_bug", tout << "BEGIN substitution::apply\n";); + TRACE(subst_bug, tout << "BEGIN substitution::apply\n";); // It is incorrect to cache results between different calls if we are applying a substitution @@ -95,13 +95,13 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e m_todo.push_back(n); while (!m_todo.empty()) { expr_offset n = m_todo.back(); - TRACE("subst_bug", tout << "n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() << "\n";); + TRACE(subst_bug, tout << "n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() << "\n";); if (m_apply_cache.contains(n)) { m_todo.pop_back(); continue; } expr_offset n_prime = n == s ? t : n; - TRACE("subst_bug", tout << "n_prime: " << mk_pp(n_prime.get_expr(), m_manager) << " : " << n_prime.get_offset() << "\n";); + TRACE(subst_bug, tout << "n_prime: " << mk_pp(n_prime.get_expr(), m_manager) << " : " << n_prime.get_offset() << "\n";); visited = true; e = n_prime.get_expr(); off = n_prime.get_offset(); @@ -109,13 +109,13 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e case AST_VAR: if (find(to_var(e)->get_idx(), off, n1)) { apply_visit(n1, visited); - TRACE("subst_bug", tout << "visited: " << visited << ", n1: " << mk_pp(n1.get_expr(), m_manager) << " : " << n1.get_offset() << "\n";); + TRACE(subst_bug, tout << "visited: " << visited << ", n1: " << mk_pp(n1.get_expr(), m_manager) << " : " << n1.get_offset() << "\n";); if (visited) { m_todo.pop_back(); expr * new_expr = nullptr; m_apply_cache.find(n1, new_expr); m_apply_cache.insert(n, new_expr); - TRACE("subst_bug", tout << "1. insert n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() + TRACE(subst_bug, tout << "1. insert n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() << " --> " << mk_pp(new_expr, m_manager) << "\n";); } } @@ -129,7 +129,7 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e m_new_exprs.push_back(new_expr); } m_apply_cache.insert(n, new_expr); - TRACE("subst_bug", tout << "2. insert n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() + TRACE(subst_bug, tout << "2. insert n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() << " --> " << mk_pp(new_expr, m_manager) << "\n";); } break; @@ -155,14 +155,14 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e } if (!has_new_args) { m_apply_cache.insert(n, e); - TRACE("subst_bug", tout << "3. insert n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() + TRACE(subst_bug, tout << "3. insert n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() << " --> " << mk_pp(e, m_manager) << "\n";); } else { expr * new_expr = m_manager.mk_app(to_app(e)->get_decl(), new_args.size(), new_args.data()); m_new_exprs.push_back(new_expr); m_apply_cache.insert(n, new_expr); - TRACE("subst_bug", tout << "3. insert n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() + TRACE(subst_bug, tout << "3. insert n: " << mk_pp(n.get_expr(), m_manager) << " : " << n.get_offset() << " --> " << mk_pp(new_expr, m_manager) << "\n";); } } @@ -221,7 +221,7 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e if (s != expr_offset(nullptr,0)) reset_cache(); - TRACE("subst_bug", tout << "END substitution::apply\nresult:\n" << mk_pp(e, m_manager) << "\nref_count: " << e->get_ref_count() << "\n";); + TRACE(subst_bug, tout << "END substitution::apply\nresult:\n" << mk_pp(e, m_manager) << "\nref_count: " << e->get_ref_count() << "\n";); } inline substitution::color substitution::get_color(expr_offset const & p) const { diff --git a/src/ast/substitution/substitution.h b/src/ast/substitution/substitution.h index e2329fb83..98a9379e2 100644 --- a/src/ast/substitution/substitution.h +++ b/src/ast/substitution/substitution.h @@ -132,7 +132,7 @@ public: // ----------------------------------- void insert(unsigned v_idx, unsigned offset, expr_offset const & t) { - TRACE("subst_insert", tout << "inserting: #" << v_idx << ":" << offset << " --> " << mk_pp(t.get_expr(), m_manager) + TRACE(subst_insert, tout << "inserting: #" << v_idx << ":" << offset << " --> " << mk_pp(t.get_expr(), m_manager) << ":" << t.get_offset() << "\n";); m_vars.push_back(var_offset(v_idx, offset)); m_refs.push_back(t.get_expr()); diff --git a/src/ast/substitution/substitution_tree.cpp b/src/ast/substitution/substitution_tree.cpp index af2ca1039..b8dd0ea94 100644 --- a/src/ast/substitution/substitution_tree.cpp +++ b/src/ast/substitution/substitution_tree.cpp @@ -106,7 +106,7 @@ void substitution_tree::linearize(svector & result) { If save_set_registers == true, then r_i's are stored in m_to_reset. */ void substitution_tree::process_args(app * in, app * out) { - CTRACE("subst_tree_bug", in->get_num_args() != out->get_num_args(), tout << mk_ismt2_pp(in, m_manager) << "\n" + CTRACE(subst_tree_bug, in->get_num_args() != out->get_num_args(), tout << mk_ismt2_pp(in, m_manager) << "\n" << mk_ismt2_pp(out, m_manager) << "\n";); unsigned num = out->get_num_args(); for (unsigned i = 0; i < num; i++) { @@ -622,7 +622,7 @@ void substitution_tree::display(std::ostream & out, node * n, unsigned delta) co bool substitution_tree::backtrack() { while (!m_bstack.empty()) { - TRACE("st", tout << "backtracking...\n";); + TRACE(st, tout << "backtracking...\n";); m_subst->pop_scope(); node * n = m_bstack.back(); @@ -636,9 +636,9 @@ bool substitution_tree::backtrack() { } inline expr_offset substitution_tree::find(expr_offset p) { - TRACE("substitution_tree_bug", tout << "find...\n";); + TRACE(substitution_tree_bug, tout << "find...\n";); while (is_var(p.get_expr())) { - TRACE("substitution_tree_bug", tout << mk_pp(p.get_expr(), m_manager) << " " << p.get_offset() << "\n";); + TRACE(substitution_tree_bug, tout << mk_pp(p.get_expr(), m_manager) << " " << p.get_offset() << "\n";); if (!m_subst->find(to_var(p.get_expr()), p.get_offset(), p)) return p; } @@ -647,7 +647,7 @@ inline expr_offset substitution_tree::find(expr_offset p) { template bool substitution_tree::bind_var(var * v, unsigned offset, expr_offset const & p) { - TRACE("st", tout << "bind_var: " << mk_pp(v, m_manager) << " " << offset << "\n" << + TRACE(st, tout << "bind_var: " << mk_pp(v, m_manager) << " " << offset << "\n" << mk_pp(p.get_expr(), m_manager) << " " << p.get_offset() << "\n";); if (Mode == STV_INST && offset == m_st_offset) { SASSERT(!is_var(p.get_expr()) || p.get_offset() != m_reg_offset); @@ -666,7 +666,7 @@ bool substitution_tree::bind_var(var * v, unsigned offset, expr_offset const & p return false; } m_subst->insert(v, offset, p); - TRACE("st_bug", tout << "substitution updated\n"; m_subst->display(tout);); + TRACE(st_bug, tout << "substitution updated\n"; m_subst->display(tout);); return true; } @@ -687,7 +687,7 @@ bool substitution_tree::unify_match(expr_offset p1, expr_offset p2) { SASSERT(!is_quantifier(n2)); bool v1 = is_var(n1); bool v2 = is_var(n2); - TRACE("st", + TRACE(st, tout << "n1: " << mk_pp(n1, m_manager) << " " << p1.get_offset() << "\n"; tout << "n2: " << mk_pp(n2, m_manager) << " " << p2.get_offset() << "\n";); if (v1 && v2) { @@ -758,7 +758,7 @@ bool substitution_tree::visit(svector const & sv) { svector::const_iterator end = sv.end(); for (; it != end; ++it) { subst const & s = *it; - TRACE("st", tout << "processing subst:\n"; display(tout, s); tout << "\n";); + TRACE(st, tout << "processing subst:\n"; display(tout, s); tout << "\n";); var * rin = s.first; expr * out = s.second; expr_offset p1(rin, m_reg_offset); @@ -778,9 +778,9 @@ bool substitution_tree::visit(expr * e, st_visitor & st, node * r) { while (true) { node * n = m_bstack.back(); - TRACE("st", tout << "push scope...\n";); + TRACE(st, tout << "push scope...\n";); m_subst->push_scope(); - TRACE("st", tout << "processing node:\n"; display(tout, n->m_subst); tout << "\n";); + TRACE(st, tout << "processing node:\n"; display(tout, n->m_subst); tout << "\n";); if (visit(n->m_subst)) { if (n->m_leaf) { // if searching for unifiers and the substitution is cyclic, then backtrack. @@ -789,7 +789,7 @@ bool substitution_tree::visit(expr * e, st_visitor & st, node * r) { break; } else { - TRACE("st_bug", tout << "found match:\n"; m_subst->display(tout); tout << "m_subst: " << m_subst << "\n";); + TRACE(st_bug, tout << "found match:\n"; m_subst->display(tout); tout << "m_subst: " << m_subst << "\n";); if (!st(n->m_expr)) { clear_stack(); return false; diff --git a/src/ast/substitution/unifier.cpp b/src/ast/substitution/unifier.cpp index 4942b5498..fc4532312 100644 --- a/src/ast/substitution/unifier.cpp +++ b/src/ast/substitution/unifier.cpp @@ -145,13 +145,13 @@ bool unifier::operator()(unsigned num_exprs, expr ** es, substitution & s, bool reset(num_offsets); m_subst = &s; #if 1 - TRACE("unifier", for (unsigned i = 0; i < num_exprs; ++i) tout << mk_pp(es[i], m_manager) << "\n";); + TRACE(unifier, for (unsigned i = 0; i < num_exprs; ++i) tout << mk_pp(es[i], m_manager) << "\n";); for (unsigned i = s.get_num_bindings(); i > 0; ) { --i; std::pair bound; expr_offset root, child; s.get_binding(i, bound, root); - TRACE("unifier", tout << bound.first << " |-> " << mk_pp(root.get_expr(), m_manager) << "\n";); + TRACE(unifier, tout << bound.first << " |-> " << mk_pp(root.get_expr(), m_manager) << "\n";); if (is_var(root.get_expr())) { var* v = m_manager.mk_var(bound.first,to_var(root.get_expr())->get_sort()); child = expr_offset(v, bound.second); diff --git a/src/ast/well_sorted.cpp b/src/ast/well_sorted.cpp index 84cdf28ad..3c952f651 100644 --- a/src/ast/well_sorted.cpp +++ b/src/ast/well_sorted.cpp @@ -49,7 +49,7 @@ struct well_sorted_proc { func_decl * decl = n->get_decl(); if (num_args != decl->get_arity() && !decl->is_associative() && !decl->is_right_associative() && !decl->is_left_associative()) { - TRACE("ws", tout << "unexpected number of arguments.\n" << mk_ismt2_pp(n, m_manager);); + TRACE(ws, tout << "unexpected number of arguments.\n" << mk_ismt2_pp(n, m_manager);); warning_msg("unexpected number of arguments."); m_error = true; return; @@ -59,7 +59,7 @@ struct well_sorted_proc { sort * actual_sort = n->get_arg(i)->get_sort(); sort * expected_sort = decl->is_associative() ? decl->get_domain(0) : decl->get_domain(i); if (expected_sort != actual_sort) { - TRACE("tc", tout << "sort mismatch on argument #" << i << ".\n" << mk_ismt2_pp(n, m_manager); + TRACE(tc, tout << "sort mismatch on argument #" << i << ".\n" << mk_ismt2_pp(n, m_manager); tout << "Sort mismatch for argument " << i+1 << " of " << mk_ismt2_pp(n, m_manager, false) << "\n"; tout << "Expected sort: " << mk_pp(expected_sort, m_manager) << "\n"; tout << "Actual sort: " << mk_pp(actual_sort, m_manager) << "\n"; diff --git a/src/cmd_context/cmd_context.cpp b/src/cmd_context/cmd_context.cpp index 7c489ccc3..4f093e749 100644 --- a/src/cmd_context/cmd_context.cpp +++ b/src/cmd_context/cmd_context.cpp @@ -60,15 +60,15 @@ func_decls::func_decls(ast_manager & m, func_decl * f): } void func_decls::finalize(ast_manager & m) { - TRACE("cmd_context_detail", tout << "finalizing func_decls...\n";); + TRACE(cmd_context_detail, tout << "finalizing func_decls...\n";); if (GET_TAG(m_decls) == 0) { m.dec_ref(UNTAG(func_decl *, m_decls)); } else { - TRACE("func_decls", tout << "finalize...\n";); + TRACE(func_decls, tout << "finalize...\n";); func_decl_set * fs = UNTAG(func_decl_set *, m_decls); for (func_decl * f : *fs) { - TRACE("func_decls", tout << "dec_ref of " << f->get_name() << " ref_count: " << f->get_ref_count() << "\n";); + TRACE(func_decls, tout << "dec_ref of " << f->get_name() << " ref_count: " << f->get_ref_count() << "\n";); m.dec_ref(f); } dealloc(fs); @@ -854,7 +854,7 @@ void cmd_context::init_manager_core(bool new_manager) { m_dt_eh = alloc(dt_eh, *this); m_pmanager->set_new_datatype_eh(m_dt_eh.get()); if (!has_logic() && new_manager) { - TRACE("cmd_context", tout << "init manager " << m_logic << "\n";); + TRACE(cmd_context, tout << "init manager " << m_logic << "\n";); // add list type only if the logic is not specified. // it prevents clashes with builtin types. register_plist(); @@ -896,7 +896,7 @@ void cmd_context::init_external_manager() { } bool cmd_context::set_logic(symbol const & s) { - TRACE("cmd_context", tout << s << "\n";); + TRACE(cmd_context, tout << s << "\n";); if (has_logic()) throw cmd_exception("the logic has already been set"); if (has_assertions() && m_main_ctx) @@ -946,13 +946,13 @@ void cmd_context::insert(symbol const & s, func_decl * f) { throw cmd_exception(std::move(msg)); } if (s != f->get_name()) { - TRACE("func_decl_alias", tout << "adding alias for: " << f->get_name() << ", alias: " << s << "\n";); + TRACE(func_decl_alias, tout << "adding alias for: " << f->get_name() << ", alias: " << s << "\n";); m_func_decl2alias.insert(f, s); } if (!m_global_decls) { m_func_decls_stack.push_back(sf_pair(s, f)); } - TRACE("cmd_context", tout << "new function decl\n" << mk_pp(f, m()) << "\n";); + TRACE(cmd_context, tout << "new function decl\n" << mk_pp(f, m()) << "\n";); } void cmd_context::insert(symbol const & s, psort_decl * p) { @@ -966,7 +966,7 @@ void cmd_context::insert(symbol const & s, psort_decl * p) { if (!m_global_decls) { m_psort_decls_stack.push_back(s); } - TRACE("cmd_context", tout << "new sort decl\n"; p->display(tout); tout << "\n";); + TRACE(cmd_context, tout << "new sort decl\n"; p->display(tout); tout << "\n";); } void cmd_context::insert(symbol const & s, unsigned arity, sort *const* domain, expr * t) { @@ -982,7 +982,7 @@ void cmd_context::insert(symbol const & s, unsigned arity, sort *const* domain, if (contains_func_decl(s, arity, domain, t->get_sort())) { throw cmd_exception("invalid named expression, declaration already defined with this name ", s); } - TRACE("insert_macro", tout << "new macro " << arity << "\n" << mk_pp(t, m()) << "\n";); + TRACE(insert_macro, tout << "new macro " << arity << "\n" << mk_pp(t, m()) << "\n";); insert_macro(s, arity, domain, t); if (!m_global_decls) { m_macros_stack.push_back(s); @@ -1055,7 +1055,7 @@ recfun::promise_def cmd_context::decl_rec_fun(const symbol &name, unsigned int a void cmd_context::insert_rec_fun(func_decl* f, expr_ref_vector const& binding, svector const& ids, expr* rhs) { - TRACE("recfun", tout<< "define recfun " << f->get_name() << " = " << mk_pp(rhs, m()) << "\n";); + TRACE(recfun, tout<< "define recfun " << f->get_name() << " = " << mk_pp(rhs, m()) << "\n";); recfun::decl::plugin& p = get_recfun_plugin(); @@ -1251,7 +1251,7 @@ bool cmd_context::try_mk_macro_app(symbol const & s, unsigned num_args, expr * c expr_ref _t(m()); expr_ref_vector coerced_args(m()); if (macros_find(s, num_args, args, coerced_args, _t)) { - TRACE("macro_bug", tout << "well_sorted_check_enabled(): " << well_sorted_check_enabled() << "\n"; + TRACE(macro_bug, tout << "well_sorted_check_enabled(): " << well_sorted_check_enabled() << "\n"; tout << "s: " << s << "\n"; tout << "body:\n" << mk_ismt2_pp(_t, m()) << "\n"; tout << "args:\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], m()) << "\n" << mk_pp(args[i]->get_sort(), m()) << "\n";); @@ -1733,7 +1733,7 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions return; IF_VERBOSE(100, verbose_stream() << "(started \"check-sat\")" << std::endl;); init_manager(); - TRACE("before_check_sat", dump_assertions(tout);); + TRACE(before_check_sat, dump_assertions(tout);); unsigned timeout = m_params.m_timeout; unsigned rlimit = m_params.rlimit(); scoped_watch sw(*this); @@ -2131,11 +2131,11 @@ void cmd_context::validate_model() { if (is_ground(a)) { r = nullptr; evaluator(a, r); - TRACE("model_validate", tout << "checking\n" << mk_ismt2_pp(a, m()) << "\nresult: " << mk_ismt2_pp(r, m()) << "\n";); + TRACE(model_validate, tout << "checking\n" << mk_ismt2_pp(a, m()) << "\nresult: " << mk_ismt2_pp(r, m()) << "\n";); if (m().is_true(r)) continue; - TRACE("model_validate", tout << *md << "\n";); + TRACE(model_validate, tout << *md << "\n";); // The evaluator for array expressions is not complete // If r contains as_array/store/map/const expressions, then we do not generate the error. @@ -2155,7 +2155,7 @@ void cmd_context::validate_model() { analyze_failure(seen, evaluator, a, true); IF_VERBOSE(11, model_smt2_pp(verbose_stream(), *this, *md, 0);); - TRACE("model_validate", model_smt2_pp(tout, *this, *md, 0);); + TRACE(model_validate, model_smt2_pp(tout, *this, *md, 0);); invalid_model |= m().is_false(r); } } @@ -2365,7 +2365,7 @@ format_ns::format * cmd_context::pp(sort * s) const { } format_ns::format* cmd_context::try_pp(sort* s) const { - TRACE("cmd_context", tout << "pp(sort * s), s: " << mk_pp(s, m()) << "\n";); + TRACE(cmd_context, tout << "pp(sort * s), s: " << mk_pp(s, m()) << "\n";); return pm().pp(get_pp_env(), s); } @@ -2470,15 +2470,15 @@ cmd_context::dt_eh::dt_eh(cmd_context & owner): } void cmd_context::dt_eh::operator()(sort * dt, pdecl* pd) { - TRACE("new_dt_eh", tout << "new datatype: "; m_owner.pm().display(tout, dt); tout << "\n";); + TRACE(new_dt_eh, tout << "new datatype: "; m_owner.pm().display(tout, dt); tout << "\n";); for (func_decl * c : *m_dt_util.get_datatype_constructors(dt)) { - TRACE("new_dt_eh", tout << "new constructor: " << c->get_name() << "\n";); + TRACE(new_dt_eh, tout << "new constructor: " << c->get_name() << "\n";); m_owner.insert(c); func_decl * r = m_dt_util.get_constructor_recognizer(c); m_owner.insert(r); - // TRACE("new_dt_eh", tout << "new recognizer: " << r->get_name() << "\n";); + // TRACE(new_dt_eh, tout << "new recognizer: " << r->get_name() << "\n";); for (func_decl * a : *m_dt_util.get_constructor_accessors(c)) { - TRACE("new_dt_eh", tout << "new accessor: " << a->get_name() << "\n";); + TRACE(new_dt_eh, tout << "new accessor: " << a->get_name() << "\n";); m_owner.insert(a); } } diff --git a/src/cmd_context/pdecl.cpp b/src/cmd_context/pdecl.cpp index 4dfb0f8bb..c0c63befb 100644 --- a/src/cmd_context/pdecl.cpp +++ b/src/cmd_context/pdecl.cpp @@ -466,7 +466,7 @@ bool paccessor_decl::has_missing_refs(symbol & missing) const { } bool paccessor_decl::fix_missing_refs(dictionary const & symbol2idx, symbol & missing) { - TRACE("fix_missing_refs", tout << "m_type.kind(): " << (int)m_type.kind() << "\n"; + TRACE(fix_missing_refs, tout << "m_type.kind(): " << (int)m_type.kind() << "\n"; if (m_type.kind() == ptype_kind::PTR_MISSING_REF) tout << m_type.get_missing_ref() << "\n";); if (m_type.kind() != ptype_kind::PTR_MISSING_REF) return true; @@ -504,7 +504,7 @@ pconstructor_decl::pconstructor_decl(unsigned id, unsigned num_params, pdecl_man m_recogniser_name(r), m_accessors(num_accessors, accessors) { m.inc_ref(num_accessors, accessors); - TRACE("pconstructor_decl", tout << "name: " << n << ", recognizer: " << r << "\n";); + TRACE(pconstructor_decl, tout << "name: " << n << ", recognizer: " << r << "\n";); } void pconstructor_decl::finalize(pdecl_manager & m) { @@ -651,7 +651,7 @@ std::ostream& pdatatype_decl::display(std::ostream & out) const { } bool pdatatype_decl::commit(pdecl_manager& m) { - TRACE("datatype", tout << m_name << "\n";); + TRACE(datatype, tout << m_name << "\n";); sort_ref_vector ps(m.m()); for (unsigned i = 0; i < m_num_params; ++i) { ps.push_back(m.m().mk_uninterpreted_sort(symbol(i), 0, nullptr)); @@ -685,7 +685,7 @@ void pdatatypes_decl::finalize(pdecl_manager & m) { } bool pdatatypes_decl::fix_missing_refs(symbol & missing) { - TRACE("fix_missing_refs", tout << "pdatatypes_decl::fix_missing_refs\n";); + TRACE(fix_missing_refs, tout << "pdatatypes_decl::fix_missing_refs\n";); dictionary symbol2idx; int idx = 0; for (pdatatype_decl* d : m_datatypes) @@ -697,7 +697,7 @@ bool pdatatypes_decl::fix_missing_refs(symbol & missing) { } sort* pdecl_manager::instantiate_datatype(psort_decl* p, symbol const& name, unsigned n, sort * const* s) { - TRACE("datatype", tout << name << " "; for (unsigned i = 0; i < n; ++i) tout << s[i]->get_name() << " "; tout << "\n";); + TRACE(datatype, tout << name << " "; for (unsigned i = 0; i < n; ++i) tout << s[i]->get_name() << " "; tout << "\n";); pdecl_manager& m = *this; sort * r = p->find(s); @@ -926,7 +926,7 @@ pdecl_manager::~pdecl_manager() { reset_sort_info(); for (auto const& kv : m_sort2psort) { del_decl_core(kv.m_value); - TRACE("pdecl_manager", tout << "orphan: " << mk_pp(kv.m_key, m()) << "\n";); + TRACE(pdecl_manager, tout << "orphan: " << mk_pp(kv.m_key, m()) << "\n";); } for (auto* p : m_table) { del_decl_core(p); @@ -970,7 +970,7 @@ pconstructor_decl * pdecl_manager::mk_pconstructor_decl(unsigned num_params, } pdatatype_decl * pdecl_manager::mk_pdatatype_decl(unsigned num_params, symbol const & s, unsigned num, pconstructor_decl * const * cs) { - TRACE("datatype", tout << s << " has " << num_params << " parameters\n";); + TRACE(datatype, tout << s << " has " << num_params << " parameters\n";); return new (a().allocate(sizeof(pdatatype_decl))) pdatatype_decl(m_id_gen.mk(), num_params, *this, s, num, cs); } @@ -1017,7 +1017,7 @@ sort * pdecl_manager::instantiate(psort * p, unsigned num, sort * const * args) void pdecl_manager::del_decl_core(pdecl * p) { - TRACE("pdecl_manager", + TRACE(pdecl_manager, tout << "del_decl_core:\n"; if (p->is_psort()) static_cast(p)->display(tout); else static_cast(p)->display(tout); @@ -1030,7 +1030,7 @@ void pdecl_manager::del_decl_core(pdecl * p) { } void pdecl_manager::del_decl(pdecl * p) { - TRACE("pdecl_manager", tout << "del psort "; p->display(tout); tout << "\n";); + TRACE(pdecl_manager, tout << "del psort "; p->display(tout); tout << "\n";); if (p->is_psort()) { psort * _p = static_cast(p); if (_p->is_sort_wrapper()) { diff --git a/src/cmd_context/tactic_cmds.cpp b/src/cmd_context/tactic_cmds.cpp index 539e0915b..90b0cbae6 100644 --- a/src/cmd_context/tactic_cmds.cpp +++ b/src/cmd_context/tactic_cmds.cpp @@ -192,7 +192,7 @@ public: labels_vec labels; goal_ref g = alloc(goal, m, ctx.produce_proofs(), ctx.produce_models(), ctx.produce_unsat_cores()); assert_exprs_from(ctx, *g); - TRACE("check_sat_using", g->display(tout);); + TRACE(check_sat_using, g->display(tout);); model_ref md; proof_ref pr(m); expr_dependency_ref core(m); diff --git a/src/math/automata/automaton.h b/src/math/automata/automaton.h index cb201e8b3..ee7ae162a 100644 --- a/src/math/automata/automaton.h +++ b/src/math/automata/automaton.h @@ -351,7 +351,7 @@ public: // void compress() { SASSERT(!m_delta.empty()); - TRACE("seq", display(tout);); + TRACE(seq, display(tout);); for (unsigned i = 0; i < m_delta.size(); ++i) { for (unsigned j = 0; j < m_delta[i].size(); ++j) { move const& mv = m_delta[i][j]; @@ -443,7 +443,7 @@ public: } } else { - TRACE("seq", tout << "epsilon not removed " << out_degree(src) << " " << is_final_state(src) << " " << is_final_state(dst) << "\n";); + TRACE(seq, tout << "epsilon not removed " << out_degree(src) << " " << is_final_state(src) << " " << is_final_state(dst) << "\n";); continue; } remove(src, dst, nullptr); @@ -464,7 +464,7 @@ public: } } sinkify_dead_states(); - TRACE("seq", display(tout);); + TRACE(seq, display(tout);); } bool is_sequence(unsigned& length) const { @@ -624,11 +624,11 @@ private: } to_remove.reset(); } - TRACE("seq", tout << "remove: " << dead_states << "\n"; + TRACE(seq, tout << "remove: " << dead_states << "\n"; tout << "final: " << m_final_states << "\n"; ); for (unsigned s : dead_states) { - CTRACE("seq", !m_delta[s].empty(), tout << "live state " << s << "\n";); + CTRACE(seq, !m_delta[s].empty(), tout << "live state " << s << "\n";); m_delta[s].reset(); } } diff --git a/src/math/automata/symbolic_automata_def.h b/src/math/automata/symbolic_automata_def.h index 7c71e329d..fa58e5a65 100644 --- a/src/math/automata/symbolic_automata_def.h +++ b/src/math/automata/symbolic_automata_def.h @@ -297,7 +297,7 @@ symbolic_automata::mk_determinstic_param(automaton_t& a, bool flip_accepta unsigned_vector new_final_states; // new final states unsigned p_state_id = 0; // next state identifier - TRACE("seq", tout << "mk-deterministic " << flip_acceptance << " " << set << " " << a.is_final_configuration(set) << "\n";); + TRACE(seq, tout << "mk-deterministic " << flip_acceptance << " " << set << " " << a.is_final_configuration(set) << "\n";); // adds non-final states of a to final if flipping and final otherwise unsigned_vector init_states; a.get_epsilon_closure(a.init(), init_states); @@ -347,7 +347,7 @@ symbolic_automata::mk_determinstic_param(automaton_t& a, bool flip_accepta bool is_new = !s2id.contains(set); if (is_new) { - TRACE("seq", tout << "mk-deterministic " << flip_acceptance << " " << set << " " << a.is_final_configuration(set) << "\n";); + TRACE(seq, tout << "mk-deterministic " << flip_acceptance << " " << set << " " << a.is_final_configuration(set) << "\n";); if (a.is_final_configuration(set) != flip_acceptance) { new_final_states.push_back(p_state_id); } diff --git a/src/math/dd/dd_bdd.cpp b/src/math/dd/dd_bdd.cpp index ee0f1600c..22ae1769d 100644 --- a/src/math/dd/dd_bdd.cpp +++ b/src/math/dd/dd_bdd.cpp @@ -305,7 +305,7 @@ namespace dd { goto go_down; } go_up: - TRACE("bdd", tout << "sift up " << lvl << "\n";); + TRACE(bdd, tout << "sift up " << lvl << "\n";); while (lvl < max_lvl) { sift_up(lvl++); double cost = current_cost(); @@ -326,7 +326,7 @@ namespace dd { return; } go_down: - TRACE("bdd", tout << "sift down " << lvl << "\n";); + TRACE(bdd, tout << "sift down " << lvl << "\n";); while (lvl > 0) { sift_up(--lvl); double cost = current_cost(); @@ -370,7 +370,7 @@ namespace dd { reorder_decref(h); m_T.push_back(n); } - TRACE("bdd", tout << "remove " << n << "\n";); + TRACE(bdd, tout << "remove " << n << "\n";); m_node_table.remove(m_nodes[n]); } m_level2nodes[lvl + 1].reset(); @@ -384,7 +384,7 @@ namespace dd { m_to_free.push_back(n); } else { - TRACE("bdd", tout << "set level " << n << " to " << lvl + 1 << "\n";); + TRACE(bdd, tout << "set level " << n << " to " << lvl + 1 << "\n";); m_node_table.insert(node); m_level2nodes[lvl + 1].push_back(n); } @@ -435,7 +435,7 @@ namespace dd { m_nodes[n].m_hi = bd; reorder_incref(ac); reorder_incref(bd); - TRACE("bdd", tout << "transform " << n << " " << " " << a << " " << b << " " << c << " " << d << " " << ac << " " << bd << "\n";); + TRACE(bdd, tout << "transform " << n << " " << " " << a << " " << b << " " << c << " " << d << " " << ac << " " << bd << "\n";); m_node_table.insert(m_nodes[n]); } unsigned v = m_level2var[lvl]; @@ -467,7 +467,7 @@ namespace dd { } } } - TRACE("bdd", tout << "sift " << lvl << "\n"; display(tout); ); + TRACE(bdd, tout << "sift " << lvl << "\n"; display(tout); ); DEBUG_CODE( for (unsigned i = 0; i < m_level2nodes.size(); ++i) { for (unsigned n : m_level2nodes[i]) { @@ -476,7 +476,7 @@ namespace dd { } }); - TRACE("bdd", + TRACE(bdd, for (unsigned i = 0; i < m_nodes.size(); ++i) { if (m_reorder_rc[i] != 0) { tout << i << " " << m_reorder_rc[i] << "\n"; @@ -503,7 +503,7 @@ namespace dd { reorder_incref(n.m_lo); reorder_incref(n.m_hi); } - TRACE("bdd", + TRACE(bdd, display(tout); for (unsigned i = 0; i < sz; ++i) { bdd_node const& n = m_nodes[i]; diff --git a/src/math/grobner/grobner.cpp b/src/math/grobner/grobner.cpp index 8aa109bdd..61866a6fc 100644 --- a/src/math/grobner/grobner.cpp +++ b/src/math/grobner/grobner.cpp @@ -427,7 +427,7 @@ bool grobner::is_eq_monomial_body(monomial const * m1, monomial const * m2) { \remark This method assumes the monomials are sorted. */ void grobner::merge_monomials(ptr_vector & monomials) { - TRACE("grobner", tout << "before merging monomials:\n"; display_monomials(tout, monomials.size(), monomials.data()); tout << "\n";); + TRACE(grobner, tout << "before merging monomials:\n"; display_monomials(tout, monomials.size(), monomials.data()); tout << "\n";); unsigned j = 0; unsigned sz = monomials.size(); if (sz == 0) @@ -459,7 +459,7 @@ void grobner::merge_monomials(ptr_vector & monomials) { j++; monomials.shrink(j); del_monomials(to_delete); - TRACE("grobner", tout << "after merging monomials:\n"; display_monomials(tout, monomials.size(), monomials.data()); tout << "\n";); + TRACE(grobner, tout << "after merging monomials:\n"; display_monomials(tout, monomials.size(), monomials.data()); tout << "\n";); } /** @@ -538,7 +538,7 @@ bool grobner::is_subset(monomial const * m1, monomial const * m2, ptr_vector= sz1) { for (; i2 < sz2; i2++) rest.push_back(m2->m_vars[i2]); - TRACE("grobner", + TRACE(grobner, tout << "monomial: "; display_monomial(tout, *m1); tout << " is a subset of "; display_monomial(tout, *m2); tout << "\n"; tout << "rest: "; display_vars(tout, rest.size(), rest.data()); tout << "\n";); @@ -563,7 +563,7 @@ bool grobner::is_subset(monomial const * m1, monomial const * m2, ptr_vectorm_scope_lvl > target->m_scope_lvl, moreover target is freezed, and new_equation contains the result. */ grobner::equation * grobner::simplify(equation const * source, equation * target) { - TRACE("grobner", tout << "simplifying: "; display_equation(tout, *target); tout << "using: "; display_equation(tout, *source);); + TRACE(grobner, tout << "simplifying: "; display_equation(tout, *target); tout << "using: "; display_equation(tout, *source);); if (source->get_num_monomials() == 0) return nullptr; if (!m_manager.inc()) @@ -673,7 +673,7 @@ grobner::equation * grobner::simplify(equation const * source, equation * target } } while (simplified && m_manager.inc()); - TRACE("grobner", tout << "result: "; display_equation(tout, *target);); + TRACE(grobner, tout << "result: "; display_equation(tout, *target);); return result ? target : nullptr; } @@ -686,7 +686,7 @@ grobner::equation * grobner::simplify(equation const * source, equation * target grobner::equation * grobner::simplify_using_processed(equation * eq) { bool result = false; bool simplified; - TRACE("grobner", tout << "simplifying: "; display_equation(tout, *eq); tout << "using already processed equalities\n";); + TRACE(grobner, tout << "simplifying: "; display_equation(tout, *eq); tout << "using already processed equalities\n";); do { simplified = false; for (equation const* p : m_processed) { @@ -702,7 +702,7 @@ grobner::equation * grobner::simplify_using_processed(equation * eq) { } } while (simplified); - TRACE("grobner", tout << "simplification result: "; display_equation(tout, *eq);); + TRACE(grobner, tout << "simplification result: "; display_equation(tout, *eq);); return result ? eq : nullptr; } @@ -739,7 +739,7 @@ grobner::equation * grobner::pick_next() { del_equation(e); if (r) m_to_process.erase(r); - TRACE("grobner", tout << "selected equation: "; if (!r) tout << "\n"; else display_equation(tout, *r);); + TRACE(grobner, tout << "selected equation: "; if (!r) tout << "\n"; else display_equation(tout, *r);); return r; } @@ -819,7 +819,7 @@ void grobner::simplify_to_process(equation * eq) { \brief If m1 = (* c M M1) and m2 = (* d M M2) and M is non empty, then return true and store M1 in rest1 and M2 in rest2. */ bool grobner::unify(monomial const * m1, monomial const * m2, ptr_vector & rest1, ptr_vector & rest2) { - TRACE("grobner", tout << "unifying: "; display_monomial(tout, *m1); tout << " "; display_monomial(tout, *m2); tout << "\n";); + TRACE(grobner, tout << "unifying: "; display_monomial(tout, *m1); tout << " "; display_monomial(tout, *m2); tout << "\n";); bool found_M = false; unsigned i1 = 0; unsigned i2 = 0; @@ -872,7 +872,7 @@ void grobner::superpose(equation * eq1, equation * eq2) { ptr_vector & rest2 = m_tmp_vars2; rest2.reset(); if (unify(eq1->m_monomials[0], eq2->m_monomials[0], rest1, rest2)) { - TRACE("grobner", tout << "superposing:\n"; display_equation(tout, *eq1); display_equation(tout, *eq2); + TRACE(grobner, tout << "superposing:\n"; display_equation(tout, *eq1); display_equation(tout, *eq2); tout << "rest1: "; display_vars(tout, rest1.size(), rest1.data()); tout << "\n"; tout << "rest2: "; display_vars(tout, rest2.size(), rest2.data()); tout << "\n";); ptr_vector & new_monomials = m_tmp_monomials; @@ -882,7 +882,7 @@ void grobner::superpose(equation * eq1, equation * eq2) { c.neg(); mul_append(1, eq2, c, rest1, new_monomials); simplify(new_monomials); - TRACE("grobner", tout << "resulting monomials: "; display_monomials(tout, new_monomials.size(), new_monomials.data()); tout << "\n";); + TRACE(grobner, tout << "resulting monomials: "; display_monomials(tout, new_monomials.size(), new_monomials.data()); tout << "\n";); if (new_monomials.empty()) return; m_num_new_equations++; @@ -929,7 +929,7 @@ bool grobner::compute_basis_step() { superpose(eq); m_processed.insert(eq); simplify_to_process(eq); - TRACE("grobner", tout << "end of iteration:\n"; display(tout);); + TRACE(grobner, tout << "end of iteration:\n"; display(tout);); return false; } diff --git a/src/math/grobner/pdd_simplifier.cpp b/src/math/grobner/pdd_simplifier.cpp index 6364d9ae6..8cc47c21e 100644 --- a/src/math/grobner/pdd_simplifier.cpp +++ b/src/math/grobner/pdd_simplifier.cpp @@ -71,7 +71,7 @@ namespace dd { simplify_exlin() || false)) { DEBUG_CODE(s.invariant();); - TRACE("dd.solver", s.display(tout);); + TRACE(dd_solver, s.display(tout);); } } catch (pdd_manager::mem_out) { @@ -88,7 +88,7 @@ namespace dd { }; bool simplifier::simplify_linear_step(bool binary) { - TRACE("dd.solver", tout << "binary " << binary << "\n";); + TRACE(dd_solver, tout << "binary " << binary << "\n";); IF_VERBOSE(3, verbose_stream() << "binary " << binary << "\n"); equation_vector linear; for (equation* e : s.m_to_simplify) { @@ -132,7 +132,7 @@ namespace dd { continue; unsigned v = src->poly().var(); equation_vector const& uses = use_list[v]; - TRACE("dd.solver", + TRACE(dd_solver, s.display(tout << "uses of: ", *src) << "\n"; for (equation* e : uses) s.display(tout, *e) << "\n";); bool changed_leading_term; @@ -184,7 +184,7 @@ namespace dd { since px = ry */ bool simplifier::simplify_cc_step() { - TRACE("dd.solver", tout << "cc\n";); + TRACE(dd_solver, tout << "cc\n";); IF_VERBOSE(3, verbose_stream() << "cc\n"); u_map los; bool reduced = false; @@ -215,7 +215,7 @@ namespace dd { \brief remove ax+b from p if x occurs as a leaf in p and a is a constant. */ bool simplifier::simplify_leaf_step() { - TRACE("dd.solver", tout << "leaf\n";); + TRACE(dd_solver, tout << "leaf\n";); IF_VERBOSE(3, verbose_stream() << "leaf\n"); use_list_t use_list = get_use_list(); equation_vector leaves; @@ -257,7 +257,7 @@ namespace dd { \brief treat equations as processed if top variable occurs only once. */ bool simplifier::simplify_elim_pure_step() { - TRACE("dd.solver", tout << "pure\n";); + TRACE(dd_solver, tout << "pure\n";); IF_VERBOSE(3, verbose_stream() << "pure\n"); use_list_t use_list = get_use_list(); solver::scoped_update sc(s.m_to_simplify); @@ -426,7 +426,7 @@ namespace dd { unsigned modest_num_eqs = std::max(eqs.size(), 500u); unsigned max_xlin_eqs = modest_num_eqs; unsigned max_degree = 5; - TRACE("dd.solver", tout << "augment " << nv << "\n"; + TRACE(dd_solver, tout << "augment " << nv << "\n"; for (auto const& o : orbits) tout << o.num_elems() << "\n";); vector n_eqs; unsigned start = rand(); @@ -475,7 +475,7 @@ namespace dd { end_of_new_eqs: s.m_config.m_random_seed = rand(); eqs.append(n_eqs); - TRACE("dd.solver", for (pdd const& p : eqs) tout << p << "\n";); + TRACE(dd_solver, for (pdd const& p : eqs) tout << p << "\n";); } void simplifier::simplify_exlin(vector const& orbits, vector const& eqs, vector& simp_eqs) { @@ -570,12 +570,12 @@ namespace dd { } } - TRACE("dd.solver", tout << bm << "\n";); + TRACE(dd_solver, tout << bm << "\n";); IF_VERBOSE(10, verbose_stream() << "bit-matrix solving\n"); bm.solve(); - TRACE("dd.solver", tout << bm << "\n";); + TRACE(dd_solver, tout << bm << "\n";); IF_VERBOSE(10, verbose_stream() << "bit-matrix solved\n"); for (auto const& r : bm) { @@ -603,7 +603,7 @@ namespace dd { } } if (!p.is_zero()) { - TRACE("dd.solver", tout << "new linear: " << p << "\n";); + TRACE(dd_solver, tout << "new linear: " << p << "\n";); simp_eqs.push_back(p); } } diff --git a/src/math/grobner/pdd_solver.cpp b/src/math/grobner/pdd_solver.cpp index 10f1eb88f..1d57a673d 100644 --- a/src/math/grobner/pdd_solver.cpp +++ b/src/math/grobner/pdd_solver.cpp @@ -93,10 +93,10 @@ namespace dd { if (done()) return; init_saturate(); - TRACE("dd.solver", display(tout);); + TRACE(dd_solver, display(tout);); try { while (!done() && step()) { - TRACE("dd.solver", display(tout);); + TRACE(dd_solver, display(tout);); DEBUG_CODE(invariant();); IF_VERBOSE(3, display_statistics(verbose_stream())); } @@ -159,7 +159,7 @@ namespace dd { if (eq.poly().is_unary() && eq.poly().hi().val() < 0) eq = -eq.poly(); - TRACE("dd.solver", display(tout << "simplification result: ", eq);); + TRACE(dd_solver, display(tout << "simplification result: ", eq);); } void solver::well_formed() { @@ -229,7 +229,7 @@ namespace dd { m_too_complex = true; return false; } - TRACE("dd.solver", + TRACE(dd_solver, tout << "reduce: " << dst.poly() << "\n"; tout << "using: " << t << "\n"; tout << "to: " << r << "\n";); @@ -246,7 +246,7 @@ namespace dd { pdd t = src.poly(); pdd r = dst.poly().reduce(t); changed_leading_term = dst.state() == processed && m.different_leading_term(r, dst.poly()); - TRACE("dd.solver", + TRACE(dd_solver, tout << "reduce: " << dst.poly() << "\n"; tout << "using: " << t << "\n"; tout << "to: " << r << "\n";); @@ -261,7 +261,7 @@ namespace dd { let eq1: ab+q=0, and eq2: ac+e=0, then qc - eb = 0 */ void solver::superpose(equation const& eq1, equation const& eq2) { - TRACE("dd.solver_d", display(tout << "eq1=", eq1); display(tout << "eq2=", eq2);); + TRACE(dd_solver_d, display(tout << "eq1=", eq1); display(tout << "eq2=", eq2);); pdd r(m); if (m.try_spoly(eq1.poly(), eq2.poly(), r) && !r.is_zero()) { if (is_too_complex(r)) { @@ -297,7 +297,7 @@ namespace dd { simplify_using(m_processed, eq); if (done()) return false; - TRACE("dd.solver", display(tout << "eq = ", eq);); + TRACE(dd_solver, display(tout << "eq = ", eq);); superpose(eq); simplify_using(m_to_simplify, eq); if (done()) diff --git a/src/math/hilbert/hilbert_basis.cpp b/src/math/hilbert/hilbert_basis.cpp index 308adf54f..88915506a 100644 --- a/src/math/hilbert/hilbert_basis.cpp +++ b/src/math/hilbert/hilbert_basis.cpp @@ -833,7 +833,7 @@ lbool hilbert_basis::saturate_orig(num_vector const& ineq, bool is_eq) { m_zero.reset(); m_index->reset(m_current_ineq+1); int_table support; - TRACE("hilbert_basis", display_ineq(tout, ineq, is_eq);); + TRACE(hilbert_basis, display_ineq(tout, ineq, is_eq);); iterator it = begin(); for (; it != end(); ++it) { offset_t idx = *it; @@ -847,7 +847,7 @@ lbool hilbert_basis::saturate_orig(num_vector const& ineq, bool is_eq) { support.insert(idx.m_offset); } } - TRACE("hilbert_basis", display(tout);); + TRACE(hilbert_basis, display(tout);); // resolve passive into active offset_t j = alloc_vector(); while (!m_passive->empty()) { @@ -855,7 +855,7 @@ lbool hilbert_basis::saturate_orig(num_vector const& ineq, bool is_eq) { return l_undef; } offset_t idx = m_passive->pop(); - TRACE("hilbert_basis", display(tout);); + TRACE(hilbert_basis, display(tout);); if (is_subsumed(idx)) { recycle(idx); continue; @@ -886,7 +886,7 @@ lbool hilbert_basis::saturate_orig(num_vector const& ineq, bool is_eq) { m_active.reset(); m_passive->reset(); m_zero.reset(); - TRACE("hilbert_basis", display(tout);); + TRACE(hilbert_basis, display(tout);); return m_basis.empty()?l_false:l_true; } @@ -906,7 +906,7 @@ lbool hilbert_basis::saturate(num_vector const& ineq, bool is_eq) { m_index->reset(m_current_ineq+1); m_passive2->reset(); m_sos.reset(); - TRACE("hilbert_basis", display_ineq(tout, ineq, is_eq);); + TRACE(hilbert_basis, display_ineq(tout, ineq, is_eq);); unsigned init_basis_size = 0; for (unsigned i = 0; i < m_basis.size(); ++i) { offset_t idx = m_basis[i]; @@ -937,12 +937,12 @@ lbool hilbert_basis::saturate(num_vector const& ineq, bool is_eq) { } } - TRACE("hilbert_basis", display(tout);); + TRACE(hilbert_basis, display(tout);); // resolve passive into active offset_t idx = alloc_vector(); while (checkpoint() && !m_passive2->empty()) { offset_t sos, pas; - TRACE("hilbert_basis", display(tout); ); + TRACE(hilbert_basis, display(tout); ); unsigned offset = m_passive2->pop(sos, pas); SASSERT(can_resolve(sos, pas, true)); resolve(sos, pas, idx); @@ -978,7 +978,7 @@ lbool hilbert_basis::saturate(num_vector const& ineq, bool is_eq) { m_basis.append(m_zero); std::sort(m_basis.begin(), m_basis.end(), vector_lt_t(*this)); m_zero.reset(); - TRACE("hilbert_basis", display(tout);); + TRACE(hilbert_basis, display(tout);); return m_basis.empty()?l_false:l_true; } @@ -1087,7 +1087,7 @@ void hilbert_basis::resolve(offset_t i, offset_t j, offset_t r) { for (unsigned k = 0; k < m_current_ineq; ++k) { u.weight(k) = v.weight(k) + w.weight(k); } - TRACE("hilbert_basis_verbose", + TRACE(hilbert_basis_verbose, display(tout, i); display(tout, j); display(tout, r); @@ -1115,7 +1115,7 @@ bool hilbert_basis::checkpoint() { } bool hilbert_basis::add_goal(offset_t idx) { - TRACE("hilbert_basis", display(tout, idx);); + TRACE(hilbert_basis, display(tout, idx);); values v = vec(idx); if (is_subsumed(idx)) { return false; @@ -1308,7 +1308,7 @@ bool hilbert_basis::is_subsumed(offset_t i, offset_t j) const { for (unsigned k = 0; r && k < m_current_ineq; ++k) { r = v.weight(k) >= w.weight(k); } - CTRACE("hilbert_basis", r, + CTRACE(hilbert_basis, r, display(tout, i); tout << " <= \n"; display(tout, j); diff --git a/src/math/interval/dep_intervals.h b/src/math/interval/dep_intervals.h index f4774c186..f5851c1f0 100644 --- a/src/math/interval/dep_intervals.h +++ b/src/math/interval/dep_intervals.h @@ -222,7 +222,7 @@ public: else { m_imanager.power(a, n, b); } - TRACE("dep_intervals", tout << "power of "; display(tout, a) << " = "; + TRACE(dep_intervals, tout << "power of "; display(tout, a) << " = "; display(tout, b) << "\n"; ); } @@ -317,7 +317,7 @@ public: if (!separated_from_zero_on_lower(i)) { return false; } - TRACE("dep_intervals", display(tout, i);); + TRACE(dep_intervals, display(tout, i);); dep = m_dep_manager.mk_join(dep, i.m_lower_dep); T expl; linearize(dep, expl); @@ -328,7 +328,7 @@ public: bool check_interval_for_conflict_on_zero_upper(const interval& i, u_dependency* dep, std::function f) { if (!separated_from_zero_on_upper(i)) return false; - TRACE("dep_intervals", display(tout, i);); + TRACE(dep_intervals, display(tout, i);); dep = m_dep_manager.mk_join(dep, i.m_upper_dep); T expl; linearize(dep, expl); diff --git a/src/math/interval/interval_def.h b/src/math/interval/interval_def.h index 9918f39a1..c0a3b54e2 100644 --- a/src/math/interval/interval_def.h +++ b/src/math/interval/interval_def.h @@ -200,7 +200,7 @@ void interval_manager::nth_root(numeral const & a, unsigned n, numeral const m().abs(A); nth_root_pos(A, n, p, lo, hi); - STRACE("nth_root_trace", + STRACE(nth_root_trace, tout << "[nth-root] ("; m().display(tout, A); tout << ")^(1/" << n << ") >= "; m().display(tout, lo); tout << "\n"; tout << "[nth-root] ("; m().display(tout, A); tout << ")^(1/" << n << ") <= "; m().display(tout, hi); tout << "\n";); if (is_neg) { @@ -309,7 +309,7 @@ void interval_manager::approx_nth_root(numeral const & A, unsigned n, numeral m().div(x_prime, _n, x_prime); m().sub(x_prime, x, d); m().abs(d); - TRACE("nth_root", + TRACE(nth_root, tout << "A: "; m().display(tout, A); tout << "\n"; tout << "x: "; m().display(tout, x); tout << "\n"; tout << "x_prime: "; m().display(tout, x_prime); tout << "\n"; @@ -338,7 +338,7 @@ void interval_manager::nth_root_pos(numeral const & A, unsigned n, numeral co else { // Check if hi is really a upper bound for A^(n-1) A_div_x_n(A, hi, n-1, true /* lo will be greater than the actual lower bound */, lo); - TRACE("nth_root_bug", + TRACE(nth_root_bug, tout << "Assuming upper\n"; tout << "A: "; m().display(tout, A); tout << "\n"; tout << "hi: "; m().display(tout, hi); tout << "\n"; @@ -387,7 +387,7 @@ void interval_manager::fact(unsigned n, numeral & o) { for (unsigned i = 2; i <= n; i++) { m().set(aux, static_cast(i)); m().mul(aux, o, o); - TRACE("fact_bug", tout << "i: " << i << ", o: " << m().to_rational_string(o) << "\n";); + TRACE(fact_bug, tout << "i: " << i << ", o: " << m().to_rational_string(o) << "\n";); } } @@ -407,24 +407,24 @@ void interval_manager::sine_series(numeral const & a, unsigned k, bool upper, bool sign = true; bool upper_factor = !upper; // since the first sign is negative, we must minimize factor to maximize result for (unsigned i = 3; i <= k; i+=2) { - TRACE("sine_bug", tout << "[begin-loop] o: " << m().to_rational_string(o) << "\ni: " << i << "\n"; + TRACE(sine_bug, tout << "[begin-loop] o: " << m().to_rational_string(o) << "\ni: " << i << "\n"; tout << "upper: " << upper << ", upper_factor: " << upper_factor << "\n"; tout << "o (default): " << m().to_string(o) << "\n";); set_rounding(upper_factor); m().power(a, i, f); - TRACE("sine_bug", tout << "a^i " << m().to_rational_string(f) << "\n";); + TRACE(sine_bug, tout << "a^i " << m().to_rational_string(f) << "\n";); set_rounding(!upper_factor); fact(i, aux); - TRACE("sine_bug", tout << "i! " << m().to_rational_string(aux) << "\n";); + TRACE(sine_bug, tout << "i! " << m().to_rational_string(aux) << "\n";); set_rounding(upper_factor); m().div(f, aux, f); - TRACE("sine_bug", tout << "a^i/i! " << m().to_rational_string(f) << "\n";); + TRACE(sine_bug, tout << "a^i/i! " << m().to_rational_string(f) << "\n";); set_rounding(upper); if (sign) m().sub(o, f, o); else m().add(o, f, o); - TRACE("sine_bug", tout << "o: " << m().to_rational_string(o) << "\n";); + TRACE(sine_bug, tout << "o: " << m().to_rational_string(o) << "\n";); sign = !sign; upper_factor = !upper_factor; } @@ -432,7 +432,7 @@ void interval_manager::sine_series(numeral const & a, unsigned k, bool upper, template void interval_manager::sine(numeral const & a, unsigned k, numeral & lo, numeral & hi) { - TRACE("sine", tout << "sine(a), a: " << m().to_rational_string(a) << "\na: " << m().to_string(a) << "\n";); + TRACE(sine, tout << "sine(a), a: " << m().to_rational_string(a) << "\na: " << m().to_string(a) << "\n";); SASSERT(&lo != &hi); if (m().is_zero(a)) { m().reset(lo); @@ -456,13 +456,13 @@ void interval_manager::sine(numeral const & a, unsigned k, numeral & lo, nume if (m().is_neg(error)) m().neg(error); m().power(error, k+1, error); - TRACE("sine", tout << "a^(k+1): " << m().to_rational_string(error) << "\nk : " << k << "\n";); + TRACE(sine, tout << "a^(k+1): " << m().to_rational_string(error) << "\nk : " << k << "\n";); round_to_minus_inf(); fact(k+1, aux); - TRACE("sine", tout << "(k+1)!: " << m().to_rational_string(aux) << "\n";); + TRACE(sine, tout << "(k+1)!: " << m().to_rational_string(aux) << "\n";); round_to_plus_inf(); m().div(error, aux, error); - TRACE("sine", tout << "error: " << m().to_rational_string(error) << "\n";); + TRACE(sine, tout << "error: " << m().to_rational_string(error) << "\n";); // Taylor series up to k with rounding to -oo sine_series(a, k, false, lo); @@ -480,10 +480,10 @@ void interval_manager::sine(numeral const & a, unsigned k, numeral & lo, nume } else { // We must recompute the series with rounding to +oo - TRACE("sine", tout << "lo before -error: " << m().to_rational_string(lo) << "\n";); + TRACE(sine, tout << "lo before -error: " << m().to_rational_string(lo) << "\n";); round_to_minus_inf(); m().sub(lo, error, lo); - TRACE("sine", tout << "lo: " << m().to_rational_string(lo) << "\n";); + TRACE(sine, tout << "lo: " << m().to_rational_string(lo) << "\n";); if (m().lt(lo, m_minus_one)) { m().set(lo, -1); m().set(hi, 1); @@ -492,7 +492,7 @@ void interval_manager::sine(numeral const & a, unsigned k, numeral & lo, nume sine_series(a, k, true, hi); round_to_plus_inf(); m().add(hi, error, hi); - TRACE("sine", tout << "hi: " << m().to_rational_string(hi) << "\n";); + TRACE(sine, tout << "hi: " << m().to_rational_string(hi) << "\n";); } } @@ -531,7 +531,7 @@ void interval_manager::cosine_series(numeral const & a, unsigned k, bool uppe template void interval_manager::cosine(numeral const & a, unsigned k, numeral & lo, numeral & hi) { - TRACE("cosine", tout << "cosine(a): "; m().display_decimal(tout, a, 32); tout << "\n";); + TRACE(cosine, tout << "cosine(a): "; m().display_decimal(tout, a, 32); tout << "\n";); SASSERT(&lo != &hi); if (m().is_zero(a)) { m().set(lo, 1); @@ -559,7 +559,7 @@ void interval_manager::cosine(numeral const & a, unsigned k, numeral & lo, nu fact(k+1, aux); round_to_plus_inf(); m().div(error, aux, error); - TRACE("sine", tout << "error: "; m().display_decimal(tout, error, 32); tout << "\n";); + TRACE(sine, tout << "error: "; m().display_decimal(tout, error, 32); tout << "\n";); // Taylor series up to k with rounding to -oo cosine_series(a, k, false, lo); @@ -1049,7 +1049,7 @@ void interval_manager::mul(interval const & i1, interval const & i2, interval if (is_N(i2)) { // x <= b <= 0, y <= d <= 0 --> b*d <= x*y // a <= x <= b <= 0, c <= y <= d <= 0 --> x*y <= a*c (we can use the fact that x or y is always negative (i.e., b is neg or d is neg)) - TRACE("interval_bug", tout << "(N, N) #" << call_id << "\n"; display(tout, i1); tout << "\n"; display(tout, i2); tout << "\n"; + TRACE(interval_bug, tout << "(N, N) #" << call_id << "\n"; display(tout, i1); tout << "\n"; display(tout, i2); tout << "\n"; tout << "a: "; m().display(tout, a); tout << "\n"; tout << "b: "; m().display(tout, b); tout << "\n"; tout << "c: "; m().display(tout, c); tout << "\n"; @@ -1069,7 +1069,7 @@ void interval_manager::mul(interval const & i1, interval const & i2, interval else if (is_M(i2)) { // a <= x <= b <= 0, y <= d, d > 0 --> a*d <= x*y (uses the fact that b is not positive) // a <= x <= b <= 0, c <= y, c < 0 --> x*y <= a*c (uses the fact that b is not positive) - TRACE("interval_bug", tout << "(N, M) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(N, M) #" << call_id << "\n";); set_lower_is_open(r, a_o || d_o); set_upper_is_open(r, a_o || c_o); @@ -1082,7 +1082,7 @@ void interval_manager::mul(interval const & i1, interval const & i2, interval else { // a <= x <= b <= 0, 0 <= c <= y <= d --> a*d <= x*y (uses the fact that x is neg (b is not positive) or y is pos (c is not negative)) // x <= b <= 0, 0 <= c <= y --> x*y <= b*c - TRACE("interval_bug", tout << "(N, P) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(N, P) #" << call_id << "\n";); SASSERT(is_P(i2)); // must update upper_is_open first, since value of is_N0(i1) and is_P0(i2) may be affected by update @@ -1099,7 +1099,7 @@ void interval_manager::mul(interval const & i1, interval const & i2, interval if (is_N(i2)) { // b > 0, x <= b, c <= y <= d <= 0 --> b*c <= x*y (uses the fact that d is not positive) // a < 0, a <= x, c <= y <= d <= 0 --> x*y <= a*c (uses the fact that d is not positive) - TRACE("interval_bug", tout << "(M, N) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(M, N) #" << call_id << "\n";); set_lower_is_open(r, b_o || c_o); set_upper_is_open(r, a_o || c_o); @@ -1153,7 +1153,7 @@ void interval_manager::mul(interval const & i1, interval const & i2, interval else { // a < 0, a <= x, 0 <= c <= y <= d --> a*d <= x*y (uses the fact that c is not negative) // b > 0, x <= b, 0 <= c <= y <= d --> x*y <= b*d (uses the fact that c is not negative) - TRACE("interval_bug", tout << "(M, P) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(M, P) #" << call_id << "\n";); SASSERT(is_P(i2)); set_lower_is_open(r, a_o || d_o); @@ -1170,7 +1170,7 @@ void interval_manager::mul(interval const & i1, interval const & i2, interval if (is_N(i2)) { // 0 <= a <= x <= b, c <= y <= d <= 0 --> x*y <= b*c (uses the fact that x is pos (a is not neg) or y is neg (d is not pos)) // 0 <= a <= x, y <= d <= 0 --> a*d <= x*y - TRACE("interval_bug", tout << "(P, N) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(P, N) #" << call_id << "\n";); // must update upper_is_open first, since value of is_P0(i1) and is_N0(i2) may be affected by update set_upper_is_open(r, (is_P0(i1) || is_N0(i2)) ? false : a_o || d_o); @@ -1184,7 +1184,7 @@ void interval_manager::mul(interval const & i1, interval const & i2, interval else if (is_M(i2)) { // 0 <= a <= x <= b, c <= y --> b*c <= x*y (uses the fact that a is not negative) // 0 <= a <= x <= b, y <= d --> x*y <= b*d (uses the fact that a is not negative) - TRACE("interval_bug", tout << "(P, M) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(P, M) #" << call_id << "\n";); set_lower_is_open(r, b_o || c_o); set_upper_is_open(r, b_o || d_o); @@ -1198,7 +1198,7 @@ void interval_manager::mul(interval const & i1, interval const & i2, interval SASSERT(is_P(i2)); // 0 <= a <= x, 0 <= c <= y --> a*c <= x*y // x <= b, y <= d --> x*y <= b*d (uses the fact that x is pos (a is not negative) or y is pos (c is not negative)) - TRACE("interval_bug", tout << "(P, P) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(P, P) #" << call_id << "\n";); set_lower_is_open(r, (is_P0(i1) || is_P0(i2)) ? false : a_o || c_o); set_upper_is_open(r, b_o || d_o); @@ -1215,7 +1215,7 @@ void interval_manager::mul(interval const & i1, interval const & i2, interval set_lower_is_inf(r, new_l_kind == EN_MINUS_INFINITY); set_upper_is_inf(r, new_u_kind == EN_PLUS_INFINITY); SASSERT(!(i1_contains_zero || i2_contains_zero) || contains_zero(r)); - TRACE("interval_bug", tout << "result: "; display(tout, r); tout << "\n";); + TRACE(interval_bug, tout << "result: "; display(tout, r); tout << "\n";); #ifdef _TRACE call_id++; #endif @@ -1336,7 +1336,7 @@ void interval_manager::power(interval const & a, unsigned n, interval & b) { else { // [l, u]^n = [0, max{l^n, u^n}] otherwise // we need both bounds to justify upper bound - TRACE("interval_bug", tout << "(M) #" << call_id << "\n"; display(tout, a); tout << "\nn:" << n << "\n";); + TRACE(interval_bug, tout << "(M) #" << call_id << "\n"; display(tout, a); tout << "\nn:" << n << "\n";); ext_numeral_kind un1_kind = lower_kind(a), un2_kind = upper_kind(a); numeral & un1 = m_result_lower; @@ -1383,7 +1383,7 @@ void interval_manager::power(interval const & a, unsigned n, interval & b) { set_upper_is_open(b, upper_is_open(a)); } } - TRACE("interval_bug", tout << "result: "; display(tout, b); tout << "\n";); + TRACE(interval_bug, tout << "result: "; display(tout, b); tout << "\n";); #ifdef _TRACE call_id++; #endif @@ -1432,7 +1432,7 @@ void interval_manager::nth_root(interval const & a, unsigned n, numeral const set_upper_is_open(b, upper_is_open(a) && m().eq(lo, hi)); m().set(upper(b), hi); } - TRACE("interval_nth_root", display(tout, a); tout << " --> "; display(tout, b); tout << "\n";); + TRACE(interval_nth_root, display(tout, a); tout << " --> "; display(tout, b); tout << "\n";); } template @@ -1464,7 +1464,7 @@ void interval_manager::xn_eq_y(interval const & y, unsigned n, numeral const nth_root(upper(y), n, p, lo, hi); // result is [-hi, hi] // result is open if upper(y) is open and lo == hi - TRACE("interval_xn_eq_y", tout << "x^n = "; display(tout, y); tout << "\n"; + TRACE(interval_xn_eq_y, tout << "x^n = "; display(tout, y); tout << "\n"; tout << "sqrt(y) in "; m().display(tout, lo); tout << " "; m().display(tout, hi); tout << "\n";); bool open = upper_is_open(y) && m().eq(lo, hi); set_lower_is_inf(x, false); @@ -1475,7 +1475,7 @@ void interval_manager::xn_eq_y(interval const & y, unsigned n, numeral const round_to_minus_inf(); m().set(lower(x), hi); m().neg(lower(x)); - TRACE("interval_xn_eq_y", tout << "interval for x: "; display(tout, x); tout << "\n";); + TRACE(interval_xn_eq_y, tout << "interval for x: "; display(tout, x); tout << "\n";); } } else { @@ -1527,7 +1527,7 @@ void interval_manager::inv(interval const & a, interval & b) { #endif // If the interval [l,u] does not contain 0, then 1/[l,u] = [1/u, 1/l] SASSERT(!contains_zero(a)); - TRACE("interval_bug", tout << "(inv) #" << call_id << "\n"; display(tout, a); tout << "\n";); + TRACE(interval_bug, tout << "(inv) #" << call_id << "\n"; display(tout, a); tout << "\n";); numeral & new_l_val = m_result_lower; numeral & new_u_val = m_result_upper; @@ -1594,7 +1594,7 @@ void interval_manager::inv(interval const & a, interval & b) { else { UNREACHABLE(); } - TRACE("interval_bug", tout << "result: "; display(tout, b); tout << "\n";); + TRACE(interval_bug, tout << "result: "; display(tout, b); tout << "\n";); #ifdef _TRACE call_id++; #endif @@ -1676,7 +1676,7 @@ void interval_manager::div(interval const & i1, interval const & i2, interval SASSERT(&i1 != &r); if (is_zero(i1)) { - TRACE("interval_bug", tout << "div #" << call_id << "\n"; display(tout, i1); tout << "\n"; display(tout, i2); tout << "\n";); + TRACE(interval_bug, tout << "div #" << call_id << "\n"; display(tout, i1); tout << "\n"; display(tout, i2); tout << "\n";); // 0/other = 0 if other != 0 m().reset(lower(r)); @@ -1701,7 +1701,7 @@ void interval_manager::div(interval const & i1, interval const & i2, interval numeral & new_u_val = m_result_upper; ext_numeral_kind new_l_kind, new_u_kind; - TRACE("interval_bug", tout << "div #" << call_id << "\n"; display(tout, i1); tout << "\n"; display(tout, i2); tout << "\n"; + TRACE(interval_bug, tout << "div #" << call_id << "\n"; display(tout, i1); tout << "\n"; display(tout, i2); tout << "\n"; tout << "a: "; m().display(tout, a); tout << "\n"; tout << "b: "; m().display(tout, b); tout << "\n"; tout << "c: "; m().display(tout, c); tout << "\n"; @@ -1712,7 +1712,7 @@ void interval_manager::div(interval const & i1, interval const & i2, interval if (is_N1(i2)) { // x <= b <= 0, c <= y <= d < 0 --> b/c <= x/y // a <= x <= b <= 0, y <= d < 0 --> x/y <= a/d - TRACE("interval_bug", tout << "(N, N) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(N, N) #" << call_id << "\n";); set_lower_is_open(r, is_N0(i1) ? false : b_o || c_o); set_upper_is_open(r, a_o || d_o); @@ -1732,7 +1732,7 @@ void interval_manager::div(interval const & i1, interval const & i2, interval else { // a <= x, a < 0, 0 < c <= y --> a/c <= x/y // x <= b <= 0, 0 < c <= y <= d --> x/y <= b/d - TRACE("interval_bug", tout << "(N, P) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(N, P) #" << call_id << "\n";); SASSERT(is_P1(i2)); set_upper_is_open(r, is_N0(i1) ? false : (b_o || d_o)); @@ -1755,7 +1755,7 @@ void interval_manager::div(interval const & i1, interval const & i2, interval if (is_N1(i2)) { // 0 < a <= x <= b < 0, y <= d < 0 --> b/d <= x/y // 0 < a <= x <= b < 0, y <= d < 0 --> x/y <= a/d - TRACE("interval_bug", tout << "(M, N) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(M, N) #" << call_id << "\n";); set_lower_is_open(r, b_o || d_o); set_upper_is_open(r, a_o || d_o); @@ -1771,14 +1771,14 @@ void interval_manager::div(interval const & i1, interval const & i2, interval ::div(m(), b, b_k, d, d_k, new_l_val, new_l_kind); round_to_plus_inf(); ::div(m(), a, a_k, d, d_k, new_u_val, new_u_kind); - TRACE("interval_bug", tout << "new_l_kind: " << new_l_kind << ", new_u_kind: " << new_u_kind << "\n";); + TRACE(interval_bug, tout << "new_l_kind: " << new_l_kind << ", new_u_kind: " << new_u_kind << "\n";); } } else { // 0 < a <= x <= b < 0, 0 < c <= y --> a/c <= x/y // 0 < a <= x <= b < 0, 0 < c <= y --> x/y <= b/c - TRACE("interval_bug", tout << "(M, P) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(M, P) #" << call_id << "\n";); SASSERT(is_P1(i2)); set_lower_is_open(r, a_o || c_o); @@ -1803,7 +1803,7 @@ void interval_manager::div(interval const & i1, interval const & i2, interval if (is_N1(i2)) { // b > 0, x <= b, c <= y <= d < 0 --> b/d <= x/y // 0 <= a <= x, c <= y <= d < 0 --> x/y <= a/c - TRACE("interval_bug", tout << "(P, N) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(P, N) #" << call_id << "\n";); set_upper_is_open(r, is_P0(i1) ? false : a_o || c_o); set_lower_is_open(r, b_o || d_o); @@ -1824,7 +1824,7 @@ void interval_manager::div(interval const & i1, interval const & i2, interval SASSERT(is_P1(i2)); // 0 <= a <= x, 0 < c <= y <= d --> a/d <= x/y // b > 0 x <= b, 0 < c <= y --> x/y <= b/c - TRACE("interval_bug", tout << "(P, P) #" << call_id << "\n";); + TRACE(interval_bug, tout << "(P, P) #" << call_id << "\n";); set_lower_is_open(r, is_P0(i1) ? false : a_o || d_o); set_upper_is_open(r, b_o || c_o); @@ -1848,7 +1848,7 @@ void interval_manager::div(interval const & i1, interval const & i2, interval set_lower_is_inf(r, new_l_kind == EN_MINUS_INFINITY); set_upper_is_inf(r, new_u_kind == EN_PLUS_INFINITY); } - TRACE("interval_bug", tout << "result: "; display(tout, r); tout << "\n";); + TRACE(interval_bug, tout << "result: "; display(tout, r); tout << "\n";); #ifdef _TRACE call_id++; #endif diff --git a/src/math/lp/bound_analyzer_on_row.h b/src/math/lp/bound_analyzer_on_row.h index cbe640399..70358ca7b 100644 --- a/src/math/lp/bound_analyzer_on_row.h +++ b/src/math/lp/bound_analyzer_on_row.h @@ -300,7 +300,7 @@ namespace lp { const auto& row = this->m_row; auto explain = [row, bound_j, coeff_before_j_is_pos, is_lower_bound, strict, lar]() { (void) strict; - TRACE("bound_analyzer", tout << "explain_bound_on_var_on_coeff, bound_j = " << bound_j << ", coeff_before_j_is_pos = " << coeff_before_j_is_pos << ", is_lower_bound = " << is_lower_bound << ", strict = " << strict << "\n";); + TRACE(bound_analyzer, tout << "explain_bound_on_var_on_coeff, bound_j = " << bound_j << ", coeff_before_j_is_pos = " << coeff_before_j_is_pos << ", is_lower_bound = " << is_lower_bound << ", strict = " << strict << "\n";); int bound_sign = (is_lower_bound ? 1 : -1); int j_sign = (coeff_before_j_is_pos ? 1 : -1) * bound_sign; diff --git a/src/math/lp/cross_nested.h b/src/math/lp/cross_nested.h index 82154c961..df0e25303 100644 --- a/src/math/lp/cross_nested.h +++ b/src/math/lp/cross_nested.h @@ -58,12 +58,12 @@ public: void run(nex *e) { - TRACE("nla_cn", tout << *e << "\n";); + TRACE(nla_cn, tout << *e << "\n";); SASSERT(m_nex_creator.is_simplified(*e)); m_e = e; #ifdef Z3DEBUG m_e_clone = m_nex_creator.clone(m_e); - TRACE("nla_cn", tout << "m_e_clone = " << * m_e_clone << "\n";); + TRACE(nla_cn, tout << "m_e_clone = " << * m_e_clone << "\n";); #endif vector front; @@ -72,7 +72,7 @@ public: static nex** pop_front(vector& front) { nex** c = front.back(); - TRACE("nla_cn", tout << **c << "\n";); + TRACE(nla_cn, tout << **c << "\n";); front.pop_back(); return c; } @@ -80,7 +80,7 @@ public: nex* extract_common_factor(nex* e) { nex_sum* c = to_sum(e); - TRACE("nla_cn", tout << "c=" << *c << "\n"; tout << "occs:"; dump_occurences(tout, m_nex_creator.occurences_map()) << "\n";); + TRACE(nla_cn, tout << "c=" << *c << "\n"; tout << "occs:"; dump_occurences(tout, m_nex_creator.occurences_map()) << "\n";); unsigned size = c->size(); bool have_factor = false; for (const auto & p : m_nex_creator.occurences_map()) { @@ -100,7 +100,7 @@ public: } static bool has_common_factor(const nex_sum* c) { - TRACE("nla_cn", tout << "c=" << *c << "\n";); + TRACE(nla_cn, tout << "c=" << *c << "\n";); auto & ch = *c; auto common_vars = get_vars_of_expr(ch[0]); for (lpvar j : common_vars) { @@ -110,7 +110,7 @@ public: divides_the_rest = false; } if (divides_the_rest) { - TRACE("nla_cn_common_factor", tout << c << "\n";); + TRACE(nla_cn_common_factor, tout << c << "\n";); return true; } } @@ -118,26 +118,26 @@ public: } bool proceed_with_common_factor(nex** c, vector& front) { - TRACE("nla_cn", tout << "c=" << **c << "\n";); + TRACE(nla_cn, tout << "c=" << **c << "\n";); nex* f = extract_common_factor(*c); if (f == nullptr) { - TRACE("nla_cn", tout << "no common factor\n"; ); + TRACE(nla_cn, tout << "no common factor\n"; ); return false; } - TRACE("nla_cn", tout << "common factor f=" << *f << "\n";); + TRACE(nla_cn, tout << "common factor f=" << *f << "\n";); nex* c_over_f = m_nex_creator.mk_div(**c, *f); c_over_f = m_nex_creator.simplify(c_over_f); - TRACE("nla_cn", tout << "c_over_f = " << *c_over_f << std::endl;); + TRACE(nla_cn, tout << "c_over_f = " << *c_over_f << std::endl;); nex_mul* cm; *c = cm = m_nex_creator.mk_mul(f, c_over_f); - TRACE("nla_cn", tout << "common factor=" << *f << ", c=" << **c << "\ne = " << *m_e << "\n";); + TRACE(nla_cn, tout << "common factor=" << *f << ", c=" << **c << "\ne = " << *m_e << "\n";); explore_expr_on_front_elem((*cm)[1].ee(), front); return true; } static void push_to_front(vector& front, nex** e) { - TRACE("nla_cn", tout << **e << "\n";); + TRACE(nla_cn, tout << **e << "\n";); front.push_back(e); } @@ -159,7 +159,7 @@ public: } void explore_expr_on_front_elem_vars(nex** c, vector& front, const svector & vars) { - TRACE("nla_cn", tout << "save c=" << **c << "; front:"; print_front(front, tout) << "\n";); + TRACE(nla_cn, tout << "save c=" << **c << "; front:"; print_front(front, tout) << "\n";); nex* copy_of_c = *c; auto copy_of_front = copy_front(front); int alloc_size = m_nex_creator.size(); @@ -173,11 +173,11 @@ public: explore_of_expr_on_sum_and_var(c, j, front); if (m_done) return; - TRACE("nla_cn", tout << "before restore c=" << **c << "\nm_e=" << *m_e << "\n";); + TRACE(nla_cn, tout << "before restore c=" << **c << "\nm_e=" << *m_e << "\n";); *c = copy_of_c; restore_front(copy_of_front, front); pop_allocated(alloc_size); - TRACE("nla_cn", tout << "after restore c=" << **c << "\nm_e=" << *m_e << "\n";); + TRACE(nla_cn, tout << "after restore c=" << **c << "\nm_e=" << *m_e << "\n";); } } @@ -202,7 +202,7 @@ public: } } remove_singular_occurences(); - TRACE("nla_cn_details", tout << "e=" << *e << "\noccs="; dump_occurences(tout, m_nex_creator.occurences_map()) << "\n";); + TRACE(nla_cn_details, tout << "e=" << *e << "\noccs="; dump_occurences(tout, m_nex_creator.occurences_map()) << "\n";); } void fill_vars_from_occurences_map(svector& vars) { @@ -210,7 +210,7 @@ public: vars.push_back(p.first); m_random_bit = m_random() % 2; - TRACE("nla_cn", tout << "m_random_bit = " << m_random_bit << "\n";); + TRACE(nla_cn, tout << "m_random_bit = " << m_random_bit << "\n";); std::sort(vars.begin(), vars.end(), [this](lpvar j, lpvar k) { auto it_j = m_nex_creator.occurences_map().find(j); @@ -247,15 +247,15 @@ public: if (proceed_with_common_factor_or_get_vars_to_factor_out(c, vars, front)) return; - TRACE("nla_cn", tout << "m_e=" << *m_e << "\nc=" << **c << ", c vars="; + TRACE(nla_cn, tout << "m_e=" << *m_e << "\nc=" << **c << ", c vars="; print_vector(vars, tout) << "; front:"; print_front(front, tout) << "\n";); if (vars.empty()) { if (front.empty()) { - TRACE("nla_cn", tout << "got the cn form: =" << *m_e << "\n";); + TRACE(nla_cn, tout << "got the cn form: =" << *m_e << "\n";); m_done = m_call_on_result(m_e) || ++m_reported > 100; #ifdef Z3DEBUG - TRACE("nla_cn", tout << "m_e_clone " << *m_e_clone << "\n";); + TRACE(nla_cn, tout << "m_e_clone " << *m_e_clone << "\n";); SASSERT(nex_creator::equal(m_e, m_e_clone)); #endif } else { @@ -276,13 +276,13 @@ public: // c is the sub expressiond which is going to be changed from sum to the cross nested form // front will be explored more void explore_of_expr_on_sum_and_var(nex** c, lpvar j, vector front) { - TRACE("nla_cn", tout << "m_e=" << *m_e << "\nc=" << **c << "\nj = " << nex_creator::ch(j) << "\nfront="; print_front(front, tout) << "\n";); + TRACE(nla_cn, tout << "m_e=" << *m_e << "\nc=" << **c << "\nj = " << nex_creator::ch(j) << "\nfront="; print_front(front, tout) << "\n";); if (!split_with_var(*c, j, front)) return; - TRACE("nla_cn", tout << "after split c=" << **c << "\nfront="; print_front(front, tout) << "\n";); + TRACE(nla_cn, tout << "after split c=" << **c << "\nfront="; print_front(front, tout) << "\n";); if (front.empty()) { #ifdef Z3DEBUG - TRACE("nla_cn", tout << "got the cn form: =" << *m_e << ", clone = " << *m_e_clone << "\n";); + TRACE(nla_cn, tout << "got the cn form: =" << *m_e << ", clone = " << *m_e_clone << "\n";); #endif m_done = m_call_on_result(m_e) || ++m_reported > 100; #ifdef Z3DEBUG @@ -316,7 +316,7 @@ public: it->second.m_power = std::min(it->second.m_power, jp); } } - TRACE("nla_cn_details", tout << "occs="; dump_occurences(tout, m_nex_creator.occurences_map()) << "\n";); + TRACE(nla_cn_details, tout << "occs="; dump_occurences(tout, m_nex_creator.occurences_map()) << "\n";); } void remove_singular_occurences() { @@ -348,7 +348,7 @@ public: } } remove_singular_occurences(); - TRACE("nla_cn_details", tout << "e=" << *e << "\noccs="; dump_occurences(tout, m_nex_creator.occurences_map()) << "\n";); + TRACE(nla_cn_details, tout << "e=" << *e << "\noccs="; dump_occurences(tout, m_nex_creator.occurences_map()) << "\n";); vector> ret; for (auto & p : m_nex_creator.occurences_map()) ret.push_back(p); @@ -373,12 +373,12 @@ public: } // all factors of j go to a, the rest to b void pre_split(nex_sum * e, lpvar j, nex_sum const*& a, nex const*& b) { - TRACE("nla_cn_details", tout << "e = " << * e << ", j = " << m_nex_creator.ch(j) << std::endl;); + TRACE(nla_cn_details, tout << "e = " << * e << ", j = " << m_nex_creator.ch(j) << std::endl;); SASSERT(m_nex_creator.is_simplified(*e)); nex_creator::sum_factory sf(m_nex_creator); m_b_split_vec.clear(); for (nex const* ce: *e) { - TRACE("nla_cn_details", tout << "ce = " << *ce << "\n";); + TRACE(nla_cn_details, tout << "ce = " << *ce << "\n";); if (is_divisible_by_var(ce, j)) { sf += m_nex_creator.mk_div(*ce , j); } else { @@ -386,22 +386,22 @@ public: } } a = sf.mk(); - TRACE("nla_cn_details", tout << "a = " << *a << "\n";); + TRACE(nla_cn_details, tout << "a = " << *a << "\n";); SASSERT(a->size() >= 2 && m_b_split_vec.size()); a = to_sum(m_nex_creator.simplify_sum(const_cast(a))); if (m_b_split_vec.size() == 1) { b = m_b_split_vec[0]; - TRACE("nla_cn_details", tout << "b = " << *b << "\n";); + TRACE(nla_cn_details, tout << "b = " << *b << "\n";); } else { SASSERT(m_b_split_vec.size() > 1); b = m_nex_creator.mk_sum(m_b_split_vec); - TRACE("nla_cn_details", tout << "b = " << *b << "\n";); + TRACE(nla_cn_details, tout << "b = " << *b << "\n";); } } void update_front_with_split_with_non_empty_b(nex* &e, lpvar j, vector & front, nex_sum const* a, nex const* b) { - TRACE("nla_cn_details", tout << "b = " << *b << "\n";); + TRACE(nla_cn_details, tout << "b = " << *b << "\n";); e = m_nex_creator.mk_sum(m_nex_creator.mk_mul(m_nex_creator.mk_var(j), a), b); // e = j*a + b if (!a->is_linear()) { nex **ptr_to_a = e->to_sum()[0]->to_mul()[1].ee(); @@ -426,7 +426,7 @@ public: // it returns true if the recursion brings a cross-nested form bool split_with_var(nex*& e, lpvar j, vector & front) { SASSERT(e->is_sum()); - TRACE("nla_cn", tout << "e = " << *e << ", j=" << nex_creator::ch(j) << "\n";); + TRACE(nla_cn, tout << "e = " << *e << ", j=" << nex_creator::ch(j) << "\n";); nex_sum const* a; nex const* b; pre_split(to_sum(e), j, a, b); /* @@ -458,7 +458,7 @@ public: } nex * normalize_mul(nex_mul* a) { - TRACE("nla_cn", tout << *a << "\n";); + TRACE(nla_cn, tout << *a << "\n";); NOT_IMPLEMENTED_YET(); return nullptr; } diff --git a/src/math/lp/dioph_eq.cpp b/src/math/lp/dioph_eq.cpp index df93e4d09..f97363ecd 100644 --- a/src/math/lp/dioph_eq.cpp +++ b/src/math/lp/dioph_eq.cpp @@ -551,8 +551,8 @@ namespace lp { } void undo_add_term_method(const lar_term* t) { - TRACE("d_undo", tout << "t:" << t << ", t->j():" << t->j() << std::endl;); - TRACE("dio", lra.print_term(*t, tout); tout << ", t->j() =" << t->j() << std::endl;); + TRACE(d_undo, tout << "t:" << t << ", t->j():" << t->j() << std::endl;); + TRACE(dio, lra.print_term(*t, tout); tout << ", t->j() =" << t->j() << std::endl;); if (!contains(m_active_terms, t)) { for (auto i = m_added_terms.size(); i-- > 0; ) { if (m_added_terms[i] != t) @@ -565,7 +565,7 @@ namespace lp { } // deregister the term that has been activated for (const auto& p : t->ext_coeffs()) { - TRACE("dio_reg", tout << "derigister p.var():" << p.var() << "->" << t->j() << std::endl;); + TRACE(dio_reg, tout << "derigister p.var():" << p.var() << "->" << t->j() << std::endl;); auto it = m_columns_to_terms.find(p.var()); SASSERT(it != m_columns_to_terms.end()); it->second.erase(t->j()); @@ -576,7 +576,7 @@ namespace lp { SASSERT(std::find(m_added_terms.begin(), m_added_terms.end(), t) == m_added_terms.end()); SASSERT(contains(m_active_terms, t)); m_active_terms.erase(t); - TRACE("dio", tout << "the deleted term column in m_l_matrix" << std::endl; for (auto p : m_l_matrix.column(t->j())) { tout << "p.coeff():" << p.coeff() << ", row " << p.var() << std::endl; } tout << "m_l_matrix has " << m_l_matrix.column_count() << " columns" << std::endl; tout << "and " << m_l_matrix.row_count() << " rows" << std::endl; print_lar_term_L(*t, tout); tout << "; t->j()=" << t->j() << std::endl;); + TRACE(dio, tout << "the deleted term column in m_l_matrix" << std::endl; for (auto p : m_l_matrix.column(t->j())) { tout << "p.coeff():" << p.coeff() << ", row " << p.var() << std::endl; } tout << "m_l_matrix has " << m_l_matrix.column_count() << " columns" << std::endl; tout << "and " << m_l_matrix.row_count() << " rows" << std::endl; print_lar_term_L(*t, tout); tout << "; t->j()=" << t->j() << std::endl;); shrink_matrices(); } @@ -764,7 +764,7 @@ namespace lp { } void add_changed_column(unsigned j) { - TRACE("dio", lra.print_column_info(j, tout);); + TRACE(dio, lra.print_column_info(j, tout);); m_changed_f_columns.insert(j); } std_vector m_added_terms; @@ -785,13 +785,13 @@ namespace lp { // we add all terms, even those with big numbers, but we might choose to non process the latter. void add_term_callback(const lar_term* t) { unsigned j = t->j(); - TRACE("dio", tout << "term column t->j():" << j << std::endl; lra.print_term(*t, tout) << std::endl;); + TRACE(dio, tout << "term column t->j():" << j << std::endl; lra.print_term(*t, tout) << std::endl;); if (!lra.column_is_int(j)) { - TRACE("dio", tout << "ignored a non-integral column" << std::endl;); + TRACE(dio, tout << "ignored a non-integral column" << std::endl;); m_some_terms_are_ignored = true; return; } - CTRACE("dio", !lra.column_has_term(j), tout << "added term that is not associated with a column yet" << std::endl;); + CTRACE(dio, !lra.column_has_term(j), tout << "added term that is not associated with a column yet" << std::endl;); m_added_terms.push_back(t); mark_term_change(t->j()); auto undo = undo_add_term(*this, t); @@ -799,7 +799,7 @@ namespace lp { } void mark_term_change(unsigned j) { - TRACE("dio", tout << "marked term change j:" << j << std::endl;); + TRACE(dio, tout << "marked term change j:" << j << std::endl;); m_changed_terms.insert(j); } @@ -810,7 +810,7 @@ namespace lp { m_terms_to_tighten.insert(j); // the boundary of the term has changed: we can be successful to tighten this term if (!lra.column_is_fixed(j)) return; - TRACE("dio", tout << "j:" << j << "\n"; lra.print_column_info(j, tout);); + TRACE(dio, tout << "j:" << j << "\n"; lra.print_column_info(j, tout);); m_changed_f_columns.insert(j); lra.trail().push(undo_fixed_column(*this, j)); } @@ -839,10 +839,10 @@ namespace lp { } void register_columns_to_term(const lar_term& t) { - CTRACE("dio_reg", t.j() == 1337, tout << "register term:"; lra.print_term(t, tout); tout << ", t.j()=" << t.j() << std::endl;); + CTRACE(dio_reg, t.j() == 1337, tout << "register term:"; lra.print_term(t, tout); tout << ", t.j()=" << t.j() << std::endl;); for (const auto& p : t.ext_coeffs()) { auto it = m_columns_to_terms.find(p.var()); - TRACE("dio_reg", tout << "register p.var():" << p.var() << "->" << t.j() << std::endl;); + TRACE(dio_reg, tout << "register p.var():" << p.var() << "->" << t.j() << std::endl;); if (it != m_columns_to_terms.end()) { it->second.insert(t.j()); @@ -881,7 +881,7 @@ namespace lp { } subs_entry(entry_index); SASSERT(entry_invariant(entry_index)); - TRACE("dio_entry", print_entry(entry_index, tout) << std::endl;); + TRACE(dio_entry, print_entry(entry_index, tout) << std::endl;); } void subs_entry(unsigned ei) { if (ei >= m_e_matrix.row_count()) return; @@ -892,7 +892,7 @@ namespace lp { m_q.push(p.var()); } if (m_q.size() == 0) { - TRACE("dio", tout << "nothing to subst on ei:" << ei << "\n";); + TRACE(dio, tout << "nothing to subst on ei:" << ei << "\n";); return; } substitute_on_q(ei); @@ -912,7 +912,7 @@ namespace lp { } void substitute_with_fresh_def(unsigned ei, unsigned j, const mpq& alpha) { const lar_term& sub_term = m_fresh_k2xt_terms.get_by_key(j).first; - TRACE("dio", print_lar_term_L(sub_term, tout) << std::endl;); + TRACE(dio, print_lar_term_L(sub_term, tout) << std::endl;); SASSERT(sub_term.get_coeff(j).is_one()); // we need to eliminate alpha*j in ei's row add_term_to_entry(-alpha, sub_term, ei); @@ -966,7 +966,7 @@ namespace lp { } void recalculate_entry(unsigned ei) { - TRACE("dio", print_entry(ei, tout) << std::endl;); + TRACE(dio, print_entry(ei, tout) << std::endl;); mpq& fixed_sum = m_sum_of_fixed[ei]; fixed_sum = mpq(0); open_l_term_to_espace(ei, fixed_sum); @@ -1129,7 +1129,7 @@ namespace lp { if (lra.settings().get_cancel_flag()) return true; for (unsigned ei = 0; ei < m_e_matrix.row_count(); ei++) { if (entry_invariant(ei) == false) { - TRACE("dio", tout << "bad entry:"; print_entry(ei, tout);); + TRACE(dio, tout << "bad entry:"; print_entry(ei, tout);); return false; } if (belongs_to_f(ei)) { @@ -1137,7 +1137,7 @@ namespace lp { const auto& row = m_e_matrix.m_rows[ei]; for (const auto& p : row) { if (m_k2s.has_key(p.var())) { - TRACE("dio", + TRACE(dio, tout << "entry:" << ei << " belongs to f but depends on column " << p.var() << std::endl; tout << "m_var_register.local_to_external(p.var()):" << m_var_register.local_to_external(p.var()) << std::endl; print_entry(ei, tout); @@ -1220,13 +1220,13 @@ namespace lp { // The function returns true if and only if there is no conflict. bool normalize_e_by_gcd(unsigned ei, mpq& g) { mpq& e = m_sum_of_fixed[ei]; - TRACE("dio", print_entry(ei, tout) << std::endl;); + TRACE(dio, print_entry(ei, tout) << std::endl;); g = gcd_of_coeffs(m_e_matrix.m_rows[ei], false); if (g.is_zero() || g.is_one()) { SASSERT(g.is_one() || e.is_zero()); return true; } - TRACE("dio", tout << "g:" << g << std::endl;); + TRACE(dio, tout << "g:" << g << std::endl;); mpq c_g = e / g; if (c_g.is_int()) { for (auto& p : m_e_matrix.m_rows[ei]) { @@ -1238,7 +1238,7 @@ namespace lp { p.coeff() /= g; } - TRACE("dio", tout << "ep_m_e:"; + TRACE(dio, tout << "ep_m_e:"; print_entry(ei, tout) << std::endl;); SASSERT(entry_invariant(ei)); return true; @@ -1249,7 +1249,7 @@ namespace lp { lia_move subs_qfront_by_fresh(unsigned k, protected_queue& q, unsigned j) { const lar_term& e = m_fresh_k2xt_terms.get_by_key(k).first; - TRACE("dio", tout << "k:" << k << ", in "; + TRACE(dio, tout << "k:" << k << ", in "; print_term_o(create_term_from_espace(), tout) << std::endl; tout << "subs with e:"; print_lar_term_L(e, tout) << std::endl;); @@ -1269,7 +1269,7 @@ namespace lp { } // there is no change in m_l_matrix - TRACE("dio", tout << "after subs k:" << k << "\n"; + TRACE(dio, tout << "after subs k:" << k << "\n"; print_term_o(create_term_from_espace(), tout) << std::endl; tout << "m_lspace:{"; print_lar_term_L(m_lspace.m_data, tout); tout << "}, opened:"; print_ml(m_lspace.to_term(), tout) << std::endl;); @@ -1284,7 +1284,7 @@ namespace lp { lia_move subs_qfront_by_S(unsigned k, protected_queue& q, unsigned j) { const mpq& e = m_sum_of_fixed[m_k2s[k]]; - TRACE("dio", tout << "k:" << k << ", in "; + TRACE(dio, tout << "k:" << k << ", in "; print_term_o(create_term_from_espace(), tout) << std::endl; tout << "subs with e:"; print_entry(m_k2s[k], tout) << std::endl;); @@ -1314,7 +1314,7 @@ namespace lp { } m_c += coeff * e; add_l_row_to_term_with_index(coeff, sub_index(k)); - TRACE("dio", tout << "after subs k:" << k << "\n"; + TRACE(dio, tout << "after subs k:" << k << "\n"; print_term_o(create_term_from_espace(), tout) << std::endl; tout << "m_lspace:{"; print_lar_term_L(m_lspace.to_term(), tout); tout << "}, opened:"; print_ml(m_lspace.to_term(), tout) << std::endl;); @@ -1459,7 +1459,7 @@ namespace lp { if (ls != rs) { std::cout << "enabling trace dio\n"; enable_trace("dio"); - TRACE("dio", tout << "ls:"; print_term_o(ls, tout) << "\n"; + TRACE(dio, tout << "ls:"; print_term_o(ls, tout) << "\n"; tout << "rs:"; print_term_o(rs, tout) << "\n";); return false; } @@ -1512,7 +1512,7 @@ namespace lp { lia_move r = lia_move::undef; // Process sorted terms - TRACE("dio", + TRACE(dio, tout << "changed terms:"; for (auto j : sorted_changed_terms) tout << j << " "; tout << std::endl; print_S(tout); // lra.display(tout); @@ -1532,7 +1532,7 @@ namespace lp { } for (unsigned j : processed_terms) m_terms_to_tighten.remove(j); - TRACE("dio", tout << r << "\n"); + TRACE(dio, tout << r << "\n"); return r; } @@ -1648,7 +1648,7 @@ namespace lp { lia_move tighten_bounds_for_term_column(unsigned j) { // q is the queue of variables that can be substituted in term_to_tighten protected_queue q; - TRACE("dio", tout << "j:" << j << " , initial term t: "; print_lar_term_L(lra.get_term(j), tout) << std::endl; + TRACE(dio, tout << "j:" << j << " , initial term t: "; print_lar_term_L(lra.get_term(j), tout) << std::endl; for( const auto& p : lra.get_term(j).ext_coeffs()) { lra.print_column_info(p.var(), tout); } @@ -1656,7 +1656,7 @@ namespace lp { if (!init_substitutions(lra.get_term(j), q)) return lia_move::undef; - TRACE("dio", tout << "t:"; + TRACE(dio, tout << "t:"; tout << "m_espace:"; print_term_o(create_term_from_espace(), tout) << std::endl; tout << "in lar_solver indices:\n"; @@ -1774,20 +1774,20 @@ namespace lp { SASSERT(!g.is_zero() && !g.is_one()); if (lra.has_bound_of_type(j, b_dep, rs, is_strict, is_upper)) { - TRACE("dio", tout << "x" << j << (is_upper? " <= ":" >= ") << rs << std::endl;); + TRACE(dio, tout << "x" << j << (is_upper? " <= ":" >= ") << rs << std::endl;); mpq rs_g = (rs - m_c) % g; if (rs_g.is_neg()) rs_g += g; SASSERT(rs_g.is_int() && !rs_g.is_neg()); - TRACE("dio", tout << "(rs - m_c) % g:" << rs_g << std::endl;); + TRACE(dio, tout << "(rs - m_c) % g:" << rs_g << std::endl;); if (!rs_g.is_zero()) { if (tighten_bound_kind(g, j, rs, rs_g, is_upper)) return lia_move::conflict; } else - TRACE("dio", tout << "rs_g is zero: no improvement in the bound\n";); + TRACE(dio, tout << "rs_g is zero: no improvement in the bound\n";); } return lia_move::undef; } @@ -1832,7 +1832,7 @@ namespace lp { mpq bound = upper ? rs - rs_g : rs + g - rs_g; - TRACE("dio", tout << "is upper:" << upper << std::endl; + TRACE(dio, tout << "is upper:" << upper << std::endl; tout << "new " << (upper ? "upper" : "lower") << " bound:" << bound << std::endl;); SASSERT((upper && bound < lra.get_upper_bound(j).x) || @@ -1840,7 +1840,7 @@ namespace lp { lconstraint_kind kind = upper ? lconstraint_kind::LE : lconstraint_kind::GE; u_dependency* dep = upper ? lra.get_column_upper_bound_witness(j) : lra.get_column_lower_bound_witness(j); auto fixed_part_of_the_term = open_fixed_from_ml(m_lspace); - TRACE("dio", + TRACE(dio, tout << "fixed_part_of_the_term:"; print_term_o(fixed_part_of_the_term.to_term(), tout); ); @@ -1851,12 +1851,12 @@ namespace lp { SASSERT(is_fixed(p.var())); if (p.coeff().is_int() && (p.coeff() % g).is_zero()) { // we can skip this dependency as explained above - TRACE("dio", tout << "skipped dep:\n"; print_deps(tout, lra.get_bound_constraint_witnesses_for_column(p.var()));); + TRACE(dio, tout << "skipped dep:\n"; print_deps(tout, lra.get_bound_constraint_witnesses_for_column(p.var()));); continue; } dep = lra.join_deps(dep, lra.get_bound_constraint_witnesses_for_column(p.var())); } - TRACE("dio", tout << "jterm:"; + TRACE(dio, tout << "jterm:"; print_lar_term_L(lra.get_term(j), tout) << "\ndep:"; print_deps(tout, dep) << std::endl;); if (lra.settings().get_cancel_flag()) @@ -1932,7 +1932,7 @@ namespace lp { if (r == lia_move::conflict) { return lia_move::conflict; } - TRACE("dio_s", print_S(tout)); + TRACE(dio_s, print_S(tout)); return lia_move::undef; } @@ -1944,7 +1944,7 @@ namespace lp { ret = tighten_terms_with_S(); if (ret == lia_move::conflict) lra.stats().m_dio_tighten_conflicts++; - TRACE("dio", print_S(tout);); + TRACE(dio, print_S(tout);); return ret; } @@ -1958,7 +1958,7 @@ namespace lp { const mpq& j_coeff = p.coeff(); SASSERT(j_coeff.is_one() || j_coeff.is_minus_one()); c += j_coeff * lra.get_lower_bound(local_to_lar_solver(j)).x; - TRACE("dio_br", tout << "the value of the vixed var is:" << lra.get_lower_bound(local_to_lar_solver(j)).x << ", m_sum_of_fixed[" << ei << "]:" << m_sum_of_fixed[ei] << ", new free coeff c:" << c << std::endl;); + TRACE(dio_br, tout << "the value of the vixed var is:" << lra.get_lower_bound(local_to_lar_solver(j)).x << ", m_sum_of_fixed[" << ei << "]:" << m_sum_of_fixed[ei] << ", new free coeff c:" << c << std::endl;); continue; } if (g.is_zero()) { @@ -1981,7 +1981,7 @@ namespace lp { We only can get a conflict when j is substituted, and the entry m_k2s[j], the entry defining the substitution becomes infeaseable, that is the gcd of the monomial coeffitients does not divide the free coefficient. In other cases the gcd of the monomials will remain to be 1. */ if (m_k2s.has_key(j)) { // j is substituted but using an entry - TRACE("dio_br", + TRACE(dio_br, tout << "fixed j:" << j << ", was substited by "; print_entry(m_k2s[j], tout);); if (check_fixing(j) == lia_move::conflict) { @@ -2023,12 +2023,12 @@ namespace lp { unsigned j = p.first; const auto it = m_columns_to_terms.find(j); if (it == m_columns_to_terms.end()) { - TRACE("dio", tout << "column j" << j << " is not registered" << std::endl; tout << "the column belongs to the the following terms:"; for (unsigned tj : p.second) { tout << " " << tj; } tout << std::endl;); + TRACE(dio, tout << "column j" << j << " is not registered" << std::endl; tout << "the column belongs to the the following terms:"; for (unsigned tj : p.second) { tout << " " << tj; } tout << std::endl;); return false; } if (it->second != p.second) { - TRACE("dioph_eq_deb", tout << "m_columns_to_terms[" << j << "] has to be "; tout << "{"; for (unsigned lll : p.second) { tout << lll << ", "; } tout << "}, \nbut it is {"; for (unsigned lll : it->second) { tout << lll << ", "; }; tout << "}" << std::endl; + TRACE(dioph_eq_deb, tout << "m_columns_to_terms[" << j << "] has to be "; tout << "{"; for (unsigned lll : p.second) { tout << lll << ", "; } tout << "}, \nbut it is {"; for (unsigned lll : it->second) { tout << lll << ", "; }; tout << "}" << std::endl; ); return false; @@ -2039,7 +2039,7 @@ namespace lp { unsigned j = p.first; const auto it = c2t.find(j); if (it == c2t.end()) { - TRACE("dio", tout << "should not be registered j " << j << std::endl; + TRACE(dio, tout << "should not be registered j " << j << std::endl; lra.print_terms(tout);); return false; } @@ -2076,7 +2076,7 @@ namespace lp { public: lia_move check() { lra.stats().m_dio_calls++; - TRACE("dio", tout << lra.stats().m_dio_calls << std::endl;); + TRACE(dio, tout << lra.stats().m_dio_calls << std::endl;); std_vector f_vector; lia_move ret; do { @@ -2130,7 +2130,7 @@ namespace lp { SASSERT(belongs_to_s(ei)); const auto& e = m_sum_of_fixed[ei]; SASSERT(j_sign_is_correct(ei, j, j_sign)); - TRACE("dio", tout << "eliminate var:" << j << " by using:"; + TRACE(dio, tout << "eliminate var:" << j << " by using:"; print_entry(ei, tout) << std::endl;); auto& column = m_e_matrix.m_columns[j]; auto it = @@ -2158,16 +2158,16 @@ namespace lp { SASSERT(c.var() != ei && entry_invariant(c.var())); mpq coeff = m_e_matrix.get_val(c); unsigned i = c.var(); - TRACE("dio", tout << "before pivot entry:"; + TRACE(dio, tout << "before pivot entry:"; print_entry(i, tout) << std::endl;); m_sum_of_fixed[i] -= j_sign * coeff * e; m_e_matrix.pivot_row_to_row_given_cell_with_sign(ei, c, j, j_sign); // m_sum_of_fixed[i].m_l -= j_sign * coeff * e.m_l; m_l_matrix.add_rows(-j_sign * coeff, ei, i); - TRACE("dio", tout << "after pivoting c_row:"; + TRACE(dio, tout << "after pivoting c_row:"; print_entry(i, tout);); CTRACE( - "dio", !entry_invariant(i), tout << "invariant delta:"; { + dio, !entry_invariant(i), tout << "invariant delta:"; { print_term_o(get_term_from_entry(ei) - fix_vars(open_ml(m_l_matrix.m_rows[ei])), tout) @@ -2182,7 +2182,7 @@ namespace lp { // matrix m_l_matrix is not changed since it is a substitution of a fresh variable void eliminate_var_in_f_with_term(const lar_term& t, unsigned j, int j_sign) { SASSERT(abs(t.get_coeff(j)).is_one()); - TRACE("dio", tout << "eliminate var:" << j << " by using:"; + TRACE(dio, tout << "eliminate var:" << j << " by using:"; print_lar_term_L(t, tout) << std::endl;); auto& column = m_e_matrix.m_columns[j]; @@ -2192,9 +2192,9 @@ namespace lp { continue; mpq coeff = m_e_matrix.get_val(c); - TRACE("dio", tout << "before pivot entry :"; print_entry(c.var(), tout) << std::endl;); + TRACE(dio, tout << "before pivot entry :"; print_entry(c.var(), tout) << std::endl;); m_e_matrix.pivot_term_to_row_given_cell(t, c, j, j_sign); - TRACE("dio", tout << "after pivoting c_row:"; + TRACE(dio, tout << "after pivoting c_row:"; print_entry(c.var(), tout);); SASSERT(entry_invariant(c.var())); } @@ -2239,7 +2239,7 @@ namespace lp { unsigned j = local_to_lar_solver(p.var()); if (is_fixed(j)) { enable_trace("dio"); - TRACE("dio", tout << "x" << j << "(local: " << "x" << p.var() << ") should not be fixed\nbad entry:"; print_entry(ei, tout) << "\n";); + TRACE(dio, tout << "x" << j << "(local: " << "x" << p.var() << ") should not be fixed\nbad entry:"; print_entry(ei, tout) << "\n";); return false; } } @@ -2249,7 +2249,7 @@ namespace lp { if (!ls_val.is_zero()) { std::cout << "ls_val is not zero\n"; enable_trace("dio"); - TRACE("dio", { + TRACE(dio, { tout << "get_term_from_entry(" << ei << "):"; print_term_o(get_term_from_entry(ei), tout) << std::endl; tout << "ls:"; @@ -2267,7 +2267,7 @@ namespace lp { bool ret = ls == fix_vars(open_ml(m_l_matrix.m_rows[ei])); if (!ret) { enable_trace("dio"); - CTRACE("dio", !ret, + CTRACE(dio, !ret, { tout << "get_term_from_entry(" << ei << "):"; print_term_o(get_term_from_entry(ei), tout) << std::endl; @@ -2295,7 +2295,7 @@ namespace lp { while (!q.empty()) { unsigned xt = q.pop_front(); // xt is a fresh var const lar_term& fresh_t = m_fresh_k2xt_terms.get_by_val(xt).first; - TRACE("dio_remove_fresh", print_lar_term_L(fresh_t, tout);); + TRACE(dio_remove_fresh, print_lar_term_L(fresh_t, tout);); SASSERT(fresh_t.get_coeff(xt).is_minus_one()); if (!t.contains(xt)) continue; @@ -2521,12 +2521,12 @@ namespace lp { break; } if (h == UINT_MAX) { - TRACE("dio", tout << "done - cannot find an entry to rewrite\n"); + TRACE(dio, tout << "done - cannot find an entry to rewrite\n"); return lia_move::undef; } SASSERT(h == f_vector[ih]); if (min_ahk.is_one()) { - TRACE("dio", tout << "push to S:\n"; print_entry(h, tout);); + TRACE(dio, tout << "push to S:\n"; print_entry(h, tout);); move_entry_from_f_to_s(kh, h); eliminate_var_in_f(h, kh, kh_sign); f_vector[ih] = f_vector.back(); @@ -2544,7 +2544,7 @@ namespace lp { void explain(explanation& ex) { SASSERT(ex.empty()); if (has_conflict_index()) { - TRACE("dio", print_entry(m_normalize_conflict_index, tout << "conflict:", true) << std::endl;); + TRACE(dio, print_entry(m_normalize_conflict_index, tout << "conflict:", true) << std::endl;); for (auto ci : lra.flatten(explain_fixed_in_meta_term(m_l_matrix.m_rows[m_normalize_conflict_index], m_normalize_conflict_gcd))) ex.push_back(ci); } @@ -2552,7 +2552,7 @@ namespace lp { for (auto ci : m_infeas_explanation) ex.push_back(ci.ci()); } - TRACE("dio", lra.print_expl(tout, ex);); + TRACE(dio, lra.print_expl(tout, ex);); } // needed for the template bound_analyzer_on_row.h diff --git a/src/math/lp/emonics.cpp b/src/math/lp/emonics.cpp index e6e52e57b..afceade0c 100644 --- a/src/math/lp/emonics.cpp +++ b/src/math/lp/emonics.cpp @@ -37,7 +37,7 @@ void emonics::inc_visited() const { } void emonics::push() { - TRACE("nla_solver_mons", display(tout << "push\n");); + TRACE(nla_solver_mons, display(tout << "push\n");); SASSERT(invariant()); m_u_f_stack.push_scope(); m_ve.push(); @@ -48,7 +48,7 @@ void emonics::push() { void emonics::pop_monic() { m_ve.pop(1); monic& m = m_monics.back(); - TRACE("nla_solver_mons", display(tout << m << "\n");); + TRACE(nla_solver_mons, display(tout << m << "\n");); remove_cg_mon(m); m_var2index[m.var()] = UINT_MAX; do_canonize(m); @@ -65,7 +65,7 @@ void emonics::pop_monic() { } void emonics::pop(unsigned n) { - TRACE("nla_solver_mons", tout << "pop: " << n << "\n";); + TRACE(nla_solver_mons, tout << "pop: " << n << "\n";); SASSERT(invariant()); for (unsigned i = 0; i < n; ++i) { m_ve.pop(1); @@ -126,7 +126,7 @@ void emonics::unmerge_cells(head_tail& root, head_tail& other) { cell* other_head = other.m_head; cell* other_tail = other.m_tail; - TRACE("nla_solver_mons", + TRACE(nla_solver_mons, display(tout << "other: ", other_head) << "\n"; display(tout << "root: ", root_head) << "\n"; ); @@ -142,7 +142,7 @@ void emonics::unmerge_cells(head_tail& root, head_tail& other) { root_tail->m_next = root_head; other_tail->m_next = other_head; } - TRACE("nla_solver_mons", + TRACE(nla_solver_mons, display(tout << "other: ", other_head) << "\n"; display(tout << "root: ", root_head) << "\n"; ); } @@ -166,8 +166,8 @@ monic const* emonics::find_canonical(svector const& vars) const { } void emonics::remove_cg(lpvar v) { - TRACE("nla_solver_mons", tout << "remove: " << v << "\n";); -// TRACE("nla_solver_mons", display(tout);); + TRACE(nla_solver_mons, tout << "remove: " << v << "\n";); +// TRACE(nla_solver_mons, display(tout);); cell* c = m_use_lists[v].m_head; if (c == nullptr) { return; @@ -225,7 +225,7 @@ void emonics::insert_cg(lpvar v) { do { unsigned idx = c->m_index; c = c->m_next; - TRACE("nla_solver_mons", tout << "inserting v" << v << " for " << idx << "\n";); + TRACE(nla_solver_mons, tout << "inserting v" << v << " for " << idx << "\n";); monic & m = m_monics[idx]; if (!is_visited(m)) { set_visited(m); @@ -233,7 +233,7 @@ void emonics::insert_cg(lpvar v) { } } while (c != first); - TRACE("nla_solver_mons", tout << "insert: " << v << "\n";); + TRACE(nla_solver_mons, tout << "insert: " << v << "\n";); } bool emonics::elists_are_consistent(std::unordered_map, hash_svector>& lists) const { @@ -257,7 +257,7 @@ bool emonics::elists_are_consistent(std::unordered_mapsecond != c, + CTRACE(nla_solver_mons, it->second != c, tout << "m = " << m << "\n"; tout << "c = " ; print_vector(c, tout); tout << "\n"; if (it == lists.end()) { @@ -280,7 +280,7 @@ bool emonics::elists_are_consistent(std::unordered_map " << r1 << "\n";); + TRACE(nla_solver_mons, tout << r2 << " -> " << r1 << "\n";); unmerge_cells(m_use_lists[r2.var()], m_use_lists[r1.var()]); rehash_cg(r1.var()); } @@ -514,7 +514,7 @@ std::ostream& emonics::display(std::ostream& out, cell* c) const { bool emonics::invariant() const { - TRACE("nla_solver_mons", display(tout);); + TRACE(nla_solver_mons, display(tout);); // the variable index contains exactly the active monomials unsigned mons = 0; for (lpvar v = 0; v < m_var2index.size(); v++) @@ -522,7 +522,7 @@ bool emonics::invariant() const { mons++; if (m_monics.size() != mons) { - TRACE("nla_solver_mons", tout << "missmatch of monic vars\n";); + TRACE(nla_solver_mons, tout << "missmatch of monic vars\n";); return false; } @@ -540,7 +540,7 @@ bool emonics::invariant() const { auto w1 = m_ve.find(w); found |= v1.var() == w1.var(); } - CTRACE("nla_solver_mons", !found, tout << "not found v" << v << ": " << m << "\n";); + CTRACE(nla_solver_mons, !found, tout << "not found v" << v << ": " << m << "\n";); SASSERT(found); (void)found; c = c->m_next; @@ -563,18 +563,18 @@ bool emonics::invariant() const { c = c->m_next; } while (c != c0 && !found); - CTRACE("nla_solver_mons", !found, tout << "m" << idx << " not found in use list for v" << v << "\n";); + CTRACE(nla_solver_mons, !found, tout << "m" << idx << " not found in use list for v" << v << "\n";); return found; }; unsigned idx = 0; for (auto const& m : m_monics) { - CTRACE("nla_solver_mons", !m_cg_table.contains(m.var()), tout << "removed " << m << "\n"; ); + CTRACE(nla_solver_mons, !m_cg_table.contains(m.var()), tout << "removed " << m << "\n"; ); SASSERT(m_cg_table.contains(m.var())); SASSERT(m_cg_table[m.var()].contains(m.var())); // same with rooted variables for (auto v : m.rvars()) { if (!find_index(v, idx)) { - TRACE("nla_solver_mons", tout << "rooted var not found in monic use list" << v << "\n";); + TRACE(nla_solver_mons, tout << "rooted var not found in monic use list" << v << "\n";); return false; } } @@ -587,7 +587,7 @@ bool emonics::invariant() const { for (auto const& k : m_cg_table) { auto const& v = k.m_value; if (!v.empty() && v[0] != k.m_key) { - TRACE("nla_solver_mons", tout << "bad table entry: " << k.m_key << ": " << k.m_value << "\n";); + TRACE(nla_solver_mons, tout << "bad table entry: " << k.m_key << ": " << k.m_value << "\n";); return false; } } diff --git a/src/math/lp/emonics.h b/src/math/lp/emonics.h index f6326c044..7038018da 100644 --- a/src/math/lp/emonics.h +++ b/src/math/lp/emonics.h @@ -135,7 +135,7 @@ public: } void unmerge_eh(unsigned i, unsigned j) { - TRACE("nla_solver", tout << "unmerged " << i << " and " << j << "\n";); + TRACE(nla_solver, tout << "unmerged " << i << " and " << j << "\n";); } void merge_eh(unsigned r2, unsigned r1, unsigned v2, unsigned v1) {} diff --git a/src/math/lp/gomory.cpp b/src/math/lp/gomory.cpp index d5db5093d..ce09bb03f 100644 --- a/src/math/lp/gomory.cpp +++ b/src/math/lp/gomory.cpp @@ -59,7 +59,7 @@ struct create_cut { void int_case_in_gomory_cut(unsigned j) { SASSERT(is_int(j) && m_fj.is_pos()); - TRACE("gomory_cut_detail", + TRACE(gomory_cut_detail, tout << " k = " << m_k; tout << ", fj: " << m_fj << ", "; tout << (at_lower(j)?"at_lower":"at_upper")<< std::endl; @@ -81,7 +81,7 @@ struct create_cut { push_explanation(column_upper_bound_constraint(j)); } m_t.add_monomial(new_a, j); - TRACE("gomory_cut_detail", tout << "new_a = " << new_a << ", k = " << m_k << "\n";); + TRACE(gomory_cut_detail, tout << "new_a = " << new_a << ", k = " << m_k << "\n";); if (numerator(new_a) > m_big_number) m_found_big = true; } @@ -93,7 +93,7 @@ struct create_cut { } void real_case_in_gomory_cut(const mpq & a, unsigned j) { - TRACE("gomory_cut_detail_real", tout << "j = " << j << ", a = " << a << ", m_k = " << m_k << "\n";); + TRACE(gomory_cut_detail_real, tout << "j = " << j << ", a = " << a << ", m_k = " << m_k << "\n";); mpq new_a; if (at_lower(j)) { if (a.is_pos()) { @@ -126,7 +126,7 @@ struct create_cut { push_explanation(column_upper_bound_constraint(j)); } m_t.add_monomial(new_a, j); - TRACE("gomory_cut_detail_real", tout << "add " << new_a << "*v" << j << ", k: " << m_k << "\n"; + TRACE(gomory_cut_detail_real, tout << "add " << new_a << "*v" << j << ", k: " << m_k << "\n"; tout << "m_t = "; lia.lra.print_term(m_t, tout) << "\nk: " << m_k << "\n";); if (numerator(new_a) > m_big_number) @@ -245,7 +245,7 @@ public: } lia_move cut() { - TRACE("gomory_cut", dump(tout);); + TRACE(gomory_cut, dump(tout);); // If m_polarity is MAX, then // the row constraints the base variable to be at the maximum, // MIN - at the minimum, @@ -257,7 +257,7 @@ public: m_t.clear(); m_ex->clear(); m_found_big = false; - TRACE("gomory_cut_detail", tout << "m_f: " << m_f << ", "; + TRACE(gomory_cut_detail, tout << "m_f: " << m_f << ", "; tout << "1 - m_f: " << 1 - m_f << ", get_value(m_inf_col).x - m_f = " << get_value(m_inf_col).x - m_f << "\n";); SASSERT(m_f.is_pos() && (get_value(m_inf_col).x - m_f).is_int()); auto set_polarity_for_int = [&](const mpq & a, lpvar j) { @@ -319,13 +319,13 @@ public: if (m_t.is_empty()) { return report_conflict_from_gomory_cut(); } - TRACE("gomory_cut", print_linear_combination_of_column_indices_only(m_t.coeffs_as_vector(), tout << "gomory cut: "); tout << " >= " << m_k << std::endl;); + TRACE(gomory_cut, print_linear_combination_of_column_indices_only(m_t.coeffs_as_vector(), tout << "gomory cut: "); tout << " >= " << m_k << std::endl;); m_dep = nullptr; for (auto c : *m_ex) m_dep = lia.lra.join_deps(lia.lra.dep_manager().mk_leaf(c.ci()), m_dep); - TRACE("gomory_cut_detail", dump_cut_and_constraints_as_smt_lemma(tout); + TRACE(gomory_cut_detail, dump_cut_and_constraints_as_smt_lemma(tout); lia.lra.display(tout)); SASSERT(lia.current_solution_is_inf_on_cut()); @@ -363,7 +363,7 @@ public: if (p.coeff().is_int() && lia.column_is_int(j) && lia.get_value(j).is_int()) continue; if ( !lia.at_bound(j) || lia.get_value(j).y != 0) { - TRACE("gomory_cut", tout << "row is not gomory cut target:\n"; + TRACE(gomory_cut, tout << "row is not gomory cut target:\n"; lia.display_column(tout, j); tout << "infinitesimal: " << !(lia.get_value(j).y ==0) << "\n";); return false; diff --git a/src/math/lp/hnf.h b/src/math/lp/hnf.h index d48c81f34..51dd88779 100644 --- a/src/math/lp/hnf.h +++ b/src/math/lp/hnf.h @@ -196,7 +196,7 @@ mpq determinant_of_rectangular_matrix(const M& m, svector & basis_rows for (unsigned i = 0; i < rank; i++) { basis_rows.push_back(m_copy.adjust_row(i)); } - TRACE("hnf_calc", tout << "basis_rows = "; print_vector(basis_rows, tout); m_copy.print(tout, "m_copy = ");); + TRACE(hnf_calc, tout << "basis_rows = "; print_vector(basis_rows, tout); m_copy.print(tout, "m_copy = ");); return gcd_of_row_starting_from_diagonal(m_copy, rank - 1); } } // end of namespace hnf_calc @@ -229,7 +229,7 @@ class hnf { mpq mod_R(const mpq & a) const { mpq t = a % m_R; t = is_neg(t) ? t + m_R : t; - CTRACE("hnf", is_neg(t), tout << "a=" << a << ", m_R= " << m_R << std::endl;); + CTRACE(hnf, is_neg(t), tout << "a=" << a << ", m_R= " << m_R << std::endl;); return t; } @@ -464,14 +464,14 @@ class hnf { bool is_correct_final() const { if (!is_correct()) { - TRACE("hnf_calc", + TRACE(hnf_calc, tout << "m_H = "; m_H.print(tout, 17); tout << "\nm_A_orig * m_U = "; (m_A_orig * m_U).print(tout, 17); tout << "is_correct() does not hold" << std::endl;); return false; } if (!is_correct_form()) { - TRACE("hnf_calc", tout << "is_correct_form() does not hold" << std::endl;); + TRACE(hnf_calc, tout << "is_correct_form() does not hold" << std::endl;); return false; } return true; @@ -605,7 +605,7 @@ public: #endif calculate_by_modulo(); #ifdef Z3DEBUG - CTRACE("hnf_calc", m_H != m_W, + CTRACE(hnf_calc, m_H != m_W, tout << "A = "; m_A_orig.print(tout, 4); tout << std::endl; tout << "H = "; m_H.print(tout, 4); tout << std::endl; tout << "W = "; m_W.print(tout, 4); tout << std::endl;); diff --git a/src/math/lp/hnf_cutter.cpp b/src/math/lp/hnf_cutter.cpp index 294467177..423a34613 100644 --- a/src/math/lp/hnf_cutter.cpp +++ b/src/math/lp/hnf_cutter.cpp @@ -251,7 +251,7 @@ branch y_i >= ceil(y0_i) is impossible. if (!init_terms_for_hnf_cut()) return lia_move::undef; lia.settings().stats().m_hnf_cutter_calls++; - TRACE("hnf_cut", tout << "settings().stats().m_hnf_cutter_calls = " << lia.settings().stats().m_hnf_cutter_calls << "\n"; + TRACE(hnf_cut, tout << "settings().stats().m_hnf_cutter_calls = " << lia.settings().stats().m_hnf_cutter_calls << "\n"; for (u_dependency* d : constraints_for_explanation()) for (auto ci : lra.flatten(d)) lra.constraints().display(tout, ci); @@ -267,7 +267,7 @@ branch y_i >= ceil(y0_i) is impossible. ); if (r == lia_move::cut) { - TRACE("hnf_cut", + TRACE(hnf_cut, lra.print_term(lia.get_term(), tout << "cut:"); tout << " <= " << lia.offset() << std::endl; for (auto* dep : constraints_for_explanation()) diff --git a/src/math/lp/horner.cpp b/src/math/lp/horner.cpp index 0cd62ecaf..2afad8980 100644 --- a/src/math/lp/horner.cpp +++ b/src/math/lp/horner.cpp @@ -39,9 +39,9 @@ bool horner::row_has_monomial_to_refine(const T& row) const { // Returns true if the row has at least two monomials sharing a variable template bool horner::row_is_interesting(const T& row) const { - TRACE("nla_solver_details", c().print_row(row, tout);); + TRACE(nla_solver_details, c().print_row(row, tout);); if (row.size() > c().params().arith_nl_horner_row_length_limit()) { - TRACE("nla_solver_details", tout << "disregard\n";); + TRACE(nla_solver_details, tout << "disregard\n";); return false; } SASSERT(row_has_monomial_to_refine(row)); @@ -68,7 +68,7 @@ bool horner::row_is_interesting(const T& row) const { } bool horner::lemmas_on_expr(cross_nested& cn, nex_sum* e) { - TRACE("nla_horner", tout << "e = " << *e << "\n";); + TRACE(nla_horner, tout << "e = " << *e << "\n";); cn.run(e); return cn.done(); } @@ -81,7 +81,7 @@ bool horner::lemmas_on_row(const T& row) { create_sum_from_row(row, m_nex_creator, m_row_sum, dep); c().set_active_vars_weights(m_nex_creator); // without this call the comparisons will be incorrect nex* e = m_nex_creator.simplify(m_row_sum.mk()); - TRACE("nla_horner", tout << "e = " << * e << "\n";); + TRACE(nla_horner, tout << "e = " << * e << "\n";); if (e->get_degree() < 2) return false; if (!e->is_sum()) @@ -99,7 +99,7 @@ bool horner::lemmas_on_row(const T& row) { bool horner::horner_lemmas() { if (!c().params().arith_nl_horner()) { - TRACE("nla_solver", tout << "not generating horner lemmas\n";); + TRACE(nla_solver, tout << "not generating horner lemmas\n";); return false; } c().lp_settings().stats().m_horner_calls++; diff --git a/src/math/lp/int_branch.cpp b/src/math/lp/int_branch.cpp index d3a7e8de7..c7b02960f 100644 --- a/src/math/lp/int_branch.cpp +++ b/src/math/lp/int_branch.cpp @@ -30,7 +30,7 @@ lia_move int_branch::operator()() { } lia_move int_branch::create_branch_on_column(int j) { - TRACE("check_main_int", tout << "branching" << std::endl;); + TRACE(check_main_int, tout << "branching" << std::endl;); lia.get_term().clear(); SASSERT(j != -1); @@ -44,7 +44,7 @@ lia_move int_branch::create_branch_on_column(int j) { lia.offset() = lia.is_upper()? floor(lia.get_value(j)) : ceil(lia.get_value(j)); } - TRACE("int_solver", + TRACE(int_solver, lia.display_column(tout << "branching v" << j << " = " << lia.get_value(j) << "\n", j); tout << "k = " << lia.offset() << std::endl;); return lia_move::branch; diff --git a/src/math/lp/int_cube.cpp b/src/math/lp/int_cube.cpp index fc9d5678b..da7cfb6aa 100644 --- a/src/math/lp/int_cube.cpp +++ b/src/math/lp/int_cube.cpp @@ -26,7 +26,7 @@ namespace lp { lia_move int_cube::operator()() { lia.settings().stats().m_cube_calls++; - TRACE("cube", + TRACE(cube, for (unsigned j = 0; j < lra.number_of_vars(); j++) lia.display_column(tout, j); tout << lra.constraints(); @@ -41,7 +41,7 @@ namespace lp { lp_status st = lra.find_feasible_solution(); if (st != lp_status::FEASIBLE && st != lp_status::OPTIMAL) { - TRACE("cube", tout << "cannot find a feasible solution";); + TRACE(cube, tout << "cannot find a feasible solution";); lra.pop(); lra.move_non_basic_columns_to_bounds(); // it can happen that we found an integer solution here @@ -51,7 +51,7 @@ namespace lp { lra.round_to_integer_solution(); lra.set_status(lp_status::FEASIBLE); SASSERT(lia.settings().get_cancel_flag() || lia.is_feasible()); - TRACE("cube", tout << "success";); + TRACE(cube, tout << "success";); lia.settings().stats().m_cube_success++; return lia_move::sat; } @@ -61,7 +61,7 @@ namespace lp { return true; const lar_term& t = lra.get_term(i); impq delta = get_cube_delta_for_term(t); - TRACE("cube", lra.print_term_as_indices(t, tout); tout << ", delta = " << delta << "\n";); + TRACE(cube, lra.print_term_as_indices(t, tout); tout << ", delta = " << delta << "\n";); if (is_zero(delta)) return true; return lra.tighten_term_bounds_by_delta(i, delta); @@ -70,7 +70,7 @@ namespace lp { bool int_cube::tighten_terms_for_cube() { for (const lar_term* t: lra.terms()) if (!tighten_term_for_cube(t->j())) { - TRACE("cube", tout << "cannot tighten";); + TRACE(cube, tout << "cannot tighten";); return false; } return true; diff --git a/src/math/lp/int_gcd_test.cpp b/src/math/lp/int_gcd_test.cpp index 3615e8989..012dd3a0a 100644 --- a/src/math/lp/int_gcd_test.cpp +++ b/src/math/lp/int_gcd_test.cpp @@ -60,7 +60,7 @@ namespace lp { lia_move int_gcd_test::operator()() { lia.settings().stats().m_gcd_calls++; - TRACE("int_solver", tout << "gcd-test " << lia.settings().stats().m_gcd_calls << "\n";); + TRACE(int_solver, tout << "gcd-test " << lia.settings().stats().m_gcd_calls << "\n";); if (gcd_test()) { m_delay = m_next_gcd++; return lia_move::undef; @@ -69,7 +69,7 @@ namespace lp { m_next_gcd = 0; m_delay = 0; lia.settings().stats().m_gcd_conflicts++; - TRACE("gcd_test", tout << "gcd conflict\n";); + TRACE(gcd_test, tout << "gcd conflict\n";); return lia_move::conflict; } } @@ -147,7 +147,7 @@ namespace lp { } SASSERT(gcds.is_int()); SASSERT(m_least_coeff.is_int()); - TRACE("gcd_test_bug", tout << "coeff: " << a << ", gcds: " << gcds + TRACE(gcd_test_bug, tout << "coeff: " << a << ", gcds: " << gcds << " least_coeff: " << m_least_coeff << " consts: " << m_consts << "\n";); } @@ -160,7 +160,7 @@ namespace lp { } if (!(m_consts / gcds).is_int()) { - TRACE("gcd_test", tout << "row failed the GCD test:\n"; lia.display_row_info(tout, i);); + TRACE(gcd_test, tout << "row failed the GCD test:\n"; lia.display_row_info(tout, i);); fill_explanation_from_fixed_columns(A.m_rows[i]); return false; } @@ -178,7 +178,7 @@ namespace lp { } bool int_gcd_test::ext_gcd_test(const row_strip & row) { - TRACE("ext_gcd_test", tout << "row = "; lra.print_row(row, tout);); + TRACE(ext_gcd_test, tout << "row = "; lra.print_row(row, tout);); mpq gcds(0); mpq l(m_consts); mpq u(m_consts); @@ -187,7 +187,7 @@ namespace lp { unsigned j; for (const auto & c : row) { j = c.var(); - TRACE("ext_gcd_test", tout << "col = "; lra.print_column_info(j, tout);); + TRACE(ext_gcd_test, tout << "col = "; lra.print_column_info(j, tout);); const mpq & a = c.coeff(); if (lra.column_is_fixed(j)) continue; @@ -229,7 +229,7 @@ namespace lp { if (u1 < l1) { fill_explanation_from_fixed_columns(row); - TRACE("gcd_test", tout << "row failed the GCD test:\n"; lia.display_row(tout, row);); + TRACE(gcd_test, tout << "row failed the GCD test:\n"; lia.display_row(tout, row);); return false; } return true; @@ -279,7 +279,7 @@ namespace lp { offset = mod(offset, modulus); if (!least_sign && offset != 0) offset = modulus - offset; - TRACE("gcd_test", tout << least_idx << " modulus: " << modulus << " consts: " << m_consts << " sign " << least_sign << " offset: " << offset << "\n";); + TRACE(gcd_test, tout << least_idx << " modulus: " << modulus << " consts: " << m_consts << " sign " << least_sign << " offset: " << offset << "\n";); SASSERT(0 <= offset && offset < modulus); return insert_parity(least_idx, row, offset, modulus); diff --git a/src/math/lp/int_solver.cpp b/src/math/lp/int_solver.cpp index 38b94f5f5..51247e39d 100644 --- a/src/math/lp/int_solver.cpp +++ b/src/math/lp/int_solver.cpp @@ -268,7 +268,7 @@ namespace lp { const auto & x = lrac.r_x(); impq v = m_t.apply(x); mpq sign = m_upper ? one_of_type() : -one_of_type(); - CTRACE("current_solution_is_inf_on_cut", v * sign <= impq(m_k) * sign, + CTRACE(current_solution_is_inf_on_cut, v * sign <= impq(m_k) * sign, tout << "m_upper = " << m_upper << std::endl; tout << "v = " << v << ", k = " << m_k << std::endl; tout << "term:";lra.print_term(m_t, tout) << "\n"; @@ -316,11 +316,11 @@ namespace lp { if (abs(value.x) < small_value || (lra.column_has_upper_bound(j) && small_value > upper_bound(j).x - value.x) || (has_lower(j) && small_value > value.x - lower_bound(j).x)) { - TRACE("int_solver", tout << "small j" << j << "\n"); + TRACE(int_solver, tout << "small j" << j << "\n"); add_column(true, r_small_value, n_small_value, j); continue; } - TRACE("int_solver", tout << "any j" << j << "\n"); + TRACE(int_solver, tout << "any j" << j << "\n"); add_column(usage >= prev_usage, r_any_value, n_any_value, j); if (usage > prev_usage) prev_usage = usage; @@ -529,7 +529,7 @@ namespace lp { if (lrac.m_r_heading[j] >= 0 || is_fixed(j)) // basic or fixed var return false; - TRACE("random_update", display_column(tout, j) << ", is_int = " << column_is_int(j) << "\n";); + TRACE(random_update, display_column(tout, j) << ", is_int = " << column_is_int(j) << "\n";); impq const & xj = get_value(j); inf_l = true; @@ -545,7 +545,7 @@ namespace lp { const auto & A = lra.A_r(); - TRACE("random_update", tout << "m = " << m << "\n";); + TRACE(random_update, tout << "m = " << m << "\n";); auto delta = [](mpq const& x, impq const& y, impq const& z) { if (x.is_one()) @@ -584,7 +584,7 @@ namespace lp { l += xj; u += xj; - TRACE("freedom_interval", + TRACE(freedom_interval, tout << "freedom variable for:\n"; tout << lra.get_variable_name(j); tout << "["; @@ -736,13 +736,13 @@ namespace lp { mpq r = a - b; if (!r.is_pos()) return false; - TRACE("int_solver", tout << "a = " << a << ", b = " << b << ", r = " << r<< ", m = " << m << "\n";); + TRACE(int_solver, tout << "a = " << a << ", b = " << b << ", r = " << r<< ", m = " << m << "\n";); if (r < mpq(range)) range = static_cast(r.get_uint64()); mpq s = b + mpq(lra.settings().random_next() % (range + 1)); impq new_val = x + m * impq(s); - TRACE("int_solver", tout << "new_val = " << new_val << "\n";); + TRACE(int_solver, tout << "new_val = " << new_val << "\n";); SASSERT(l <= new_val && new_val <= u); lra.set_value_for_nbasic_column(j, new_val); return true; diff --git a/src/math/lp/lar_core_solver_def.h b/src/math/lp/lar_core_solver_def.h index 29d93405b..64138e9ee 100644 --- a/src/math/lp/lar_core_solver_def.h +++ b/src/math/lp/lar_core_solver_def.h @@ -83,13 +83,13 @@ unsigned lar_core_solver::get_number_of_non_ints() const { } void lar_core_solver::solve() { - TRACE("lar_solver", tout << m_r_solver.get_status() << "\n";); + TRACE(lar_solver, tout << m_r_solver.get_status() << "\n";); SASSERT(m_r_solver.non_basic_columns_are_set_correctly()); SASSERT(m_r_solver.inf_heap_is_correct()); - TRACE("find_feas_stats", tout << "infeasibles = " << m_r_solver.inf_heap_size() << ", int_infs = " << get_number_of_non_ints() << std::endl;); + TRACE(find_feas_stats, tout << "infeasibles = " << m_r_solver.inf_heap_size() << ", int_infs = " << get_number_of_non_ints() << std::endl;); if (m_r_solver.current_x_is_feasible() && m_r_solver.m_look_for_feasible_solution_only) { m_r_solver.set_status(lp_status::OPTIMAL); - TRACE("lar_solver", tout << m_r_solver.get_status() << "\n";); + TRACE(lar_solver, tout << m_r_solver.get_status() << "\n";); return; } ++m_r_solver.m_settings.stats().m_need_to_solve_inf; @@ -118,7 +118,7 @@ void lar_core_solver::solve() { SASSERT(m_r_solver.non_basic_columns_are_set_correctly()); SASSERT(m_r_solver.inf_heap_is_correct()); - TRACE("lar_solver", tout << m_r_solver.get_status() << "\n";); + TRACE(lar_solver, tout << m_r_solver.get_status() << "\n";); } } // namespace lp diff --git a/src/math/lp/lar_solver.cpp b/src/math/lp/lar_solver.cpp index c742f74bc..33eb4bb6a 100644 --- a/src/math/lp/lar_solver.cpp +++ b/src/math/lp/lar_solver.cpp @@ -117,7 +117,7 @@ namespace lp { lar_solver solver; solver.m_validate_blocker = true; - TRACE("lar_solver_validate", tout << lra.get_variable_name(j) << " " << lconstraint_kind_string(kind) << " " << rs << std::endl;); + TRACE(lar_solver_validate, tout << lra.get_variable_name(j) << " " << lconstraint_kind_string(kind) << " " << rs << std::endl;); lra.add_dep_constraints_to_solver(solver, dep); if (solver.external_to_local(j) == null_lpvar) { return false; // we have to mention j in the dep @@ -163,12 +163,12 @@ namespace lp { } } - CTRACE("arith", !lra.column_is_fixed(k), lra.print_terms(tout);); + CTRACE(arith, !lra.column_is_fixed(k), lra.print_terms(tout);); // SASSERT(column_is_fixed(k)); if (j != k && lra.column_is_fixed(k)) { SASSERT(lra.column_is_int(j) == lra.column_is_int(k)); equal_to_j = k; - TRACE("lar_solver", tout << "found equal column k = " << k << + TRACE(lar_solver, tout << "found equal column k = " << k << ", external = " << equal_to_j << "\n";); } } @@ -375,7 +375,7 @@ namespace lp { lp_status lar_solver::get_status() const { return m_imp->m_status; } void lar_solver::set_status(lp_status s) { - TRACE("lar_solver", tout << "setting status to " << s << "\n";); + TRACE(lar_solver, tout << "setting status to " << s << "\n";); m_imp->m_status = s; } const u_dependency* lar_solver::crossed_bounds_deps() const { return m_imp->m_crossed_bounds_deps;} @@ -548,7 +548,7 @@ namespace lp { void lar_solver::pop(unsigned k) { - TRACE("lar_solver", tout << "k = " << k << std::endl;); + TRACE(lar_solver, tout << "k = " << k << std::endl;); m_imp->m_crossed_bounds_column = null_lpvar; m_imp->m_crossed_bounds_deps = nullptr; m_imp->m_trail.pop_scope(k); @@ -559,7 +559,7 @@ namespace lp { SASSERT(get_core_solver().m_r_solver.m_basis.size() == A_r().row_count()); SASSERT(get_core_solver().m_r_solver.basis_heading_is_correct()); SASSERT(A_r().column_count() == n); - TRACE("lar_solver_details", for (unsigned j = 0; j < n; j++) print_column_info(j, tout) << "\n";); + TRACE(lar_solver_details, for (unsigned j = 0; j < n; j++) print_column_info(j, tout) << "\n";); get_core_solver().pop(k); remove_non_fixed_from_fixed_var_table(); @@ -592,7 +592,7 @@ namespace lp { get_core_solver().m_r_solver.set_status(lp_status::FEASIBLE); get_core_solver().solve(); lp_status st = get_core_solver().m_r_solver.get_status(); - TRACE("lar_solver", tout << st << "\n";); + TRACE(lar_solver, tout << st << "\n";); SASSERT(get_core_solver().m_r_solver.calc_current_x_is_feasible_include_non_basis()); if (st == lp_status::UNBOUNDED || st == lp_status::CANCELLED) { return false; @@ -613,7 +613,7 @@ namespace lp { for (const auto & [d_j, j]: max_coeffs) { SASSERT (!d_j.is_zero()); - TRACE("lar_solver_improve_bounds", tout << "d[" << j << "] = " << d_j << "\n"; + TRACE(lar_solver_improve_bounds, tout << "d[" << j << "] = " << d_j << "\n"; this->get_core_solver().m_r_solver.print_column_info(j, tout);); const column& ul = m_imp->m_columns[j]; u_dependency * bound_dep; @@ -621,7 +621,7 @@ namespace lp { bound_dep = ul.upper_bound_witness(); else bound_dep = ul.lower_bound_witness(); - TRACE("lar_solver_improve_bounds", { + TRACE(lar_solver_improve_bounds, { svector cs; dep_manager().linearize(bound_dep, cs); for (auto c : cs) @@ -646,7 +646,7 @@ namespace lp { if (lower_bound) term.negate(); vector> max_coeffs; - TRACE("lar_solver_improve_bounds", tout << "j = " << j << ", "; print_term(term, tout << "term to maximize\n");); + TRACE(lar_solver_improve_bounds, tout << "j = " << j << ", "; print_term(term, tout << "term to maximize\n");); impq term_max; if (!maximize_term_on_feasible_r_solver(term, term_max, &max_coeffs)) return nullptr; @@ -664,7 +664,7 @@ namespace lp { if (column_has_lower_bound(j) && column_is_int(j) && bound <= column_lower_bound(j).x) return nullptr; - TRACE("lar_solver_improve_bounds", + TRACE(lar_solver_improve_bounds, tout << "setting lower bound for " << j << " to " << bound << "\n"; if (column_has_lower_bound(j)) tout << "bound was = " << column_lower_bound(j) << "\n";); } @@ -676,7 +676,7 @@ namespace lp { if (bound >= column_upper_bound(j).x) return nullptr; } - TRACE("lar_solver_improve_bounds", + TRACE(lar_solver_improve_bounds, tout << "setting upper bound for " << j << " to " << bound << "\n"; if (column_has_upper_bound(j)) tout << "bound was = " << column_upper_bound(j) << "\n";;); } @@ -716,7 +716,7 @@ namespace lp { } void lar_solver::prepare_costs_for_r_solver(const lar_term& term) { - TRACE("lar_solver", print_term(term, tout << "prepare: ") << "\n";); + TRACE(lar_solver, print_term(term, tout << "prepare: ") << "\n";); auto& rslv = get_core_solver().m_r_solver; SASSERT(costs_are_zeros_for_r_solver()); SASSERT(reduced_costs_are_zeroes_for_r_solver()); @@ -795,7 +795,7 @@ namespace lp { auto& x = get_core_solver().r_x(j); auto delta = new_val - x; x = new_val; - TRACE("lar_solver_feas", tout << "setting " << j << " to " + TRACE(lar_solver_feas, tout << "setting " << j << " to " << new_val << (column_is_feasible(j)?"feas":"non-feas") << "\n";); change_basic_columns_dependend_on_a_given_nb_column(j, delta); } @@ -804,7 +804,7 @@ namespace lp { impq& term_max, vector>* max_coeffs = nullptr) { settings().backup_costs = false; bool ret = false; - TRACE("lar_solver", print_term(term, tout << "maximize: ") << "\n" + TRACE(lar_solver, print_term(term, tout << "maximize: ") << "\n" << constraints() << ", strategy = " << (int)settings().simplex_strategy() << "\n";); if (settings().simplex_strategy() != simplex_strategy_enum::tableau_costs) m_imp->require_nbasis_sort(); @@ -817,7 +817,7 @@ namespace lp { if (d_j.is_zero()) continue; max_coeffs->push_back(std::make_pair(d_j, j)); - TRACE("lar_solver", tout<<"m_d["<m_basic_columns_with_changed_cost.insert(bj); } get_core_solver().m_r_solver.add_delta_to_x_and_track_feasibility(bj, -A_r().get_val(c) * delta); - TRACE("change_x_del", + TRACE(change_x_del, tout << "changed basis column " << bj << ", it is " << (column_is_feasible(bj) ? "feas" : "inf") << std::endl;); } @@ -1300,7 +1300,7 @@ namespace lp { for (auto const& c : m_imp->m_constraints.active()) { if (!constraint_holds(c, var_map)) { - TRACE("lar_solver", + TRACE(lar_solver, m_imp->m_constraints.display(tout, c) << "\n"; for (auto p : c.coeffs()) { get_core_solver().m_r_solver.print_column_info(p.second, tout); @@ -1498,7 +1498,7 @@ namespace lp { for (unsigned j = 0; j < n; j++) variable_values[j] = get_value(j); - TRACE("lar_solver_model", tout << "delta = " << m_imp->m_delta << "\nmodel:\n"; + TRACE(lar_solver_model, tout << "delta = " << m_imp->m_delta << "\nmodel:\n"; for (auto p : variable_values) tout << this->get_variable_name(p.first) << " = " << p.second << "\n";); } @@ -1508,8 +1508,8 @@ namespace lp { SASSERT(A_r().column_count() == rslv.m_costs.size()); SASSERT(A_r().column_count() == get_core_solver().r_x().size()); SASSERT(A_r().column_count() == rslv.m_d.size()); - CTRACE("lar_solver_model",!m_imp->m_columns_with_changed_bounds.empty(), tout << "non-empty changed bounds\n"); - TRACE("lar_solver_model", tout << get_status() << "\n"); + CTRACE(lar_solver_model,!m_imp->m_columns_with_changed_bounds.empty(), tout << "non-empty changed bounds\n"); + TRACE(lar_solver_model, tout << get_status() << "\n"); auto status = get_status(); SASSERT((status != lp_status::OPTIMAL && status != lp_status::FEASIBLE) || rslv.calc_current_x_is_feasible_include_non_basis()); @@ -1535,7 +1535,7 @@ namespace lp { } } } while (j != n); - TRACE("lar_solver_model", tout << "delta = " << m_imp->m_delta << "\nmodel:\n";); + TRACE(lar_solver_model, tout << "delta = " << m_imp->m_delta << "\nmodel:\n";); return true; } @@ -1569,7 +1569,7 @@ namespace lp { auto& v = get_core_solver().r_x(j); if (!v.y.is_zero()) { v = impq(v.x + delta * v.y); - TRACE("lar_solver_feas", tout << "x[" << j << "] = " << v << "\n";); + TRACE(lar_solver_feas, tout << "x[" << j << "] = " << v << "\n";); } } } @@ -1660,7 +1660,7 @@ namespace lp { void lar_solver::fill_var_set_for_random_update(unsigned sz, lpvar const* vars, vector& column_list) { - TRACE("lar_solver_rand", tout << "sz = " << sz << "\n";); + TRACE(lar_solver_rand, tout << "sz = " << sz << "\n";); for (unsigned i = 0; i < sz; i++) { lpvar var = vars[i]; if (column_has_term(var)) { @@ -1895,7 +1895,7 @@ namespace lp { }; lpvar lar_solver::add_var(unsigned ext_j, bool is_int) { - TRACE("add_var", tout << "adding var " << ext_j << (is_int ? " int" : " nonint") << std::endl;); + TRACE(add_var, tout << "adding var " << ext_j << (is_int ? " int" : " nonint") << std::endl;); lpvar local_j; if (m_imp->m_var_register.external_is_used(ext_j, local_j)) return local_j; @@ -1931,7 +1931,7 @@ namespace lp { void lar_solver::add_new_var_to_core_fields_for_mpq(bool register_in_basis) { unsigned j = A_r().column_count(); - TRACE("add_var", tout << "j = " << j << std::endl;); + TRACE(add_var, tout << "j = " << j << std::endl;); A_r().add_column(); SASSERT(get_core_solver().r_x().size() == j); // SASSERT(get_core_solver().m_r_lower_bounds.size() == j && get_core_solver().m_r_upper_bounds.size() == j); // restore later @@ -2007,7 +2007,7 @@ namespace lp { } // if UINT_MAX == null_lpvar then the term does not correspond and external variable lpvar lar_solver::add_term(const vector>& coeffs, unsigned ext_i) { - TRACE("lar_solver_terms", print_linear_combination_of_column_indices_only(coeffs, tout) << ", ext_i =" << ext_i << "\n";); + TRACE(lar_solver_terms, print_linear_combination_of_column_indices_only(coeffs, tout) << ", ext_i =" << ext_i << "\n";); SASSERT(!m_imp->m_var_register.external_is_used(ext_i)); SASSERT(all_vars_are_registered(coeffs)); lar_term* t = new lar_term(coeffs); @@ -2026,7 +2026,7 @@ namespace lp { } void lar_solver::add_row_from_term_no_constraint(lar_term* term, unsigned ext_index) { - TRACE("dump_terms", print_term(*term, tout) << std::endl;); + TRACE(dump_terms, print_term(*term, tout) << std::endl;); register_new_external_var(ext_index, term_is_int(term)); // j will be a new variable unsigned j = A_r().column_count(); @@ -2127,7 +2127,7 @@ namespace lp { } constraint_index lar_solver::mk_var_bound(lpvar j, lconstraint_kind kind, const mpq& right_side) { - TRACE("lar_solver", tout << "j = " << get_variable_name(j) << " " << lconstraint_kind_string(kind) << " " << right_side << std::endl;); + TRACE(lar_solver, tout << "j = " << get_variable_name(j) << " " << lconstraint_kind_string(kind) << " " << right_side << std::endl;); constraint_index ci; if (!column_has_term(j)) { mpq rs = adjust_bound_for_int(j, kind, right_side); @@ -2161,7 +2161,7 @@ namespace lp { void lar_solver::update_column_type_and_bound(unsigned j, const mpq& right_side, constraint_index constr_index) { - TRACE("lar_solver_feas", tout << "j = " << j << " was " << (this->column_is_feasible(j)?"feas":"non-feas") << std::endl;); + TRACE(lar_solver_feas, tout << "j = " << j << " was " << (this->column_is_feasible(j)?"feas":"non-feas") << std::endl;); m_imp->m_constraints.activate(constr_index); lconstraint_kind kind = m_imp->m_constraints[constr_index].kind(); u_dependency* dep = m_imp->m_constraints[constr_index].dep(); @@ -2200,7 +2200,7 @@ namespace lp { } void lar_solver::add_constraint_to_validate(lar_solver& ls, constraint_index ci) { auto const& c = m_imp->m_constraints[ci]; - TRACE("lar_solver_validate", tout << "adding constr with column = "<< c.column() << "\n"; m_imp->m_constraints.display(tout, c); tout << std::endl;); + TRACE(lar_solver_validate, tout << "adding constr with column = "<< c.column() << "\n"; m_imp->m_constraints.display(tout, c); tout << std::endl;); vector> coeffs; for (auto const& [coeff, jext] : c.coeffs()) { lpvar j = ls.external_to_local(jext); @@ -2225,7 +2225,7 @@ namespace lp { void lar_solver::update_column_type_and_bound(unsigned j, lconstraint_kind kind, const mpq& right_side, u_dependency* dep) { // SASSERT(validate_bound(j, kind, right_side, dep)); TRACE( - "lar_solver_feas", + lar_solver_feas, tout << "j" << j << " " << lconstraint_kind_string(kind) << " " << right_side << std::endl; print_column_info(j, tout) << "\n"; if (dep) { @@ -2250,7 +2250,7 @@ namespace lp { m_imp->m_fixed_base_var_set.insert(j); - TRACE("lar_solver_feas", tout << "j = " << j << " became " << (this->column_is_feasible(j) ? "feas" : "non-feas") << ", and " << (this->column_is_bounded(j) ? "bounded" : "non-bounded") << std::endl;); + TRACE(lar_solver_feas, tout << "j = " << j << " became " << (this->column_is_feasible(j) ? "feas" : "non-feas") << ", and " << (this->column_is_bounded(j) ? "bounded" : "non-bounded") << std::endl;); if (m_update_column_bound_callback) m_update_column_bound_callback(j); @@ -2266,7 +2266,7 @@ namespace lp { void lar_solver::insert_to_columns_with_changed_bounds(unsigned j) { m_imp->m_columns_with_changed_bounds.insert(j); - TRACE("lar_solver", tout << "column " << j << (column_is_feasible(j) ? " feas" : " non-feas") << "\n";); + TRACE(lar_solver, tout << "column " << j << (column_is_feasible(j) ? " feas" : " non-feas") << "\n";); } void lar_solver::update_column_type_and_bound_check_on_equal(unsigned j, @@ -2532,15 +2532,15 @@ namespace lp { bool lar_solver::tighten_term_bounds_by_delta(lpvar j, const impq& delta) { SASSERT(column_has_term(j)); - TRACE("cube", tout << "delta = " << delta << std::endl; + TRACE(cube, tout << "delta = " << delta << std::endl; m_imp->m_int_solver->display_column(tout, j); ); if (column_has_upper_bound(j) && column_has_lower_bound(j)) { if (get_upper_bound(j) - delta < get_lower_bound(j) + delta) { - TRACE("cube", tout << "cannot tighten, delta = " << delta;); + TRACE(cube, tout << "cannot tighten, delta = " << delta;); return false; } } - TRACE("cube", tout << "can tighten";); + TRACE(cube, tout << "can tighten";); if (column_has_upper_bound(j)) { if (!is_zero(delta.y) || !is_zero(get_upper_bound(j).y)) add_var_bound(j, lconstraint_kind::LT, get_upper_bound(j).x - delta.x); @@ -2564,7 +2564,7 @@ namespace lp { impq & v = get_core_solver().r_x(j); if (v.is_int()) continue; - TRACE("cube", m_imp->m_int_solver->display_column(tout, j);); + TRACE(cube, m_imp->m_int_solver->display_column(tout, j);); impq flv = impq(floor(v)); auto del = flv - v; // del is negative if (del < -impq(mpq(1, 2))) { @@ -2575,7 +2575,7 @@ namespace lp { v = flv; } m_imp->m_incorrect_columns.insert(j); - TRACE("cube", tout << "new val = " << v << " column: " << j << "\n";); + TRACE(cube, tout << "new val = " << v << " column: " << j << "\n";); } if (!m_imp->m_incorrect_columns.empty()) { fix_terms_with_rounded_columns(); @@ -2671,18 +2671,18 @@ namespace lp { void lar_solver::register_normalized_term(const lar_term& t, lpvar j) { mpq a; lar_term normalized_t = t.get_normalized_by_min_var(a); - TRACE("lar_solver_terms", tout << "t="; print_term_as_indices(t, tout); + TRACE(lar_solver_terms, tout << "t="; print_term_as_indices(t, tout); tout << ", normalized_t="; print_term_as_indices(normalized_t, tout) << "\n";); if (m_imp->m_normalized_terms_to_columns.find(normalized_t) == m_imp->m_normalized_terms_to_columns.end()) { m_imp->m_normalized_terms_to_columns[normalized_t] = std::make_pair(a, j); } else { - TRACE("lar_solver_terms", tout << "the term has been seen already\n";); + TRACE(lar_solver_terms, tout << "the term has been seen already\n";); } } void lar_solver::deregister_normalized_term(const lar_term& t) { - TRACE("lar_solver_terms", tout << "deregister term "; + TRACE(lar_solver_terms, tout << "deregister term "; print_term_as_indices(t, tout) << "\n";); mpq a; lar_term normalized_t = t.get_normalized_by_min_var(a); @@ -2691,7 +2691,7 @@ namespace lp { void lar_solver::register_existing_terms() { if (!m_imp->m_need_register_terms) { - TRACE("nla_solver", tout << "registering " << m_imp->m_terms.size() << " terms\n";); + TRACE(nla_solver, tout << "registering " << m_imp->m_terms.size() << " terms\n";); for (const lar_term* t : m_imp->m_terms) { register_normalized_term(*t, t->j()); } @@ -2701,15 +2701,15 @@ namespace lp { // a_j.first gives the normalised coefficient, // a_j.second givis the column bool lar_solver::fetch_normalized_term_column(const lar_term& c, std::pair& a_j) const { - TRACE("lar_solver_terms", print_term_as_indices(c, tout << "looking for term ") << "\n";); + TRACE(lar_solver_terms, print_term_as_indices(c, tout << "looking for term ") << "\n";); SASSERT(c.is_normalized()); auto it = m_imp->m_normalized_terms_to_columns.find(c); if (it != m_imp->m_normalized_terms_to_columns.end()) { - TRACE("lar_solver_terms", tout << "got " << it->second << "\n";); + TRACE(lar_solver_terms, tout << "got " << it->second << "\n";); a_j = it->second; return true; } - TRACE("lar_solver_terms", tout << "have not found\n";); + TRACE(lar_solver_terms, tout << "have not found\n";); return false; } @@ -2758,7 +2758,7 @@ namespace lp { u_dependency* bdep = lower_bound? ul.lower_bound_witness() : ul.upper_bound_witness(); SASSERT(bdep != nullptr); m_imp->m_crossed_bounds_deps = dep_manager().mk_join(bdep, dep); - TRACE("dio", tout << "crossed_bound_deps:\n"; print_explanation(tout, flatten(m_imp->m_crossed_bounds_deps)) << "\n";); + TRACE(dio, tout << "crossed_bound_deps:\n"; print_explanation(tout, flatten(m_imp->m_crossed_bounds_deps)) << "\n";); } const indexed_uint_set & lar_solver::touched_rows() const { return m_imp->m_touched_rows; } indexed_uint_set & lar_solver::touched_rows() { return m_imp->m_touched_rows; } diff --git a/src/math/lp/lar_solver.h b/src/math/lp/lar_solver.h index bd5453186..12ce46a46 100644 --- a/src/math/lp/lar_solver.h +++ b/src/math/lp/lar_solver.h @@ -349,7 +349,7 @@ public: basic_columns_with_changed_cost().insert(bj); get_core_solver().m_r_solver.add_delta_to_x_and_track_feasibility(bj, -A_r().get_val(c) * delta); after(bj); - TRACE("change_x_del", + TRACE(change_x_del, tout << "changed basis column " << bj << ", it is " << (get_core_solver().m_r_solver.column_is_feasible(bj) ? "feas" : "inf") << std::endl;); } } @@ -371,7 +371,7 @@ public: const Blocker& is_blocked, const ChangeReport& change_report) { if (is_base(j)) { - TRACE("nla_solver", get_int_solver()->display_row_info(tout, row_of_basic_column(j)) << "\n";); + TRACE(nla_solver, get_int_solver()->display_row_info(tout, row_of_basic_column(j)) << "\n";); if (!remove_from_basis(j)) return false; } @@ -379,7 +379,7 @@ public: impq ival(val); if (is_blocked(j, ival)) return false; - TRACE("nla_solver", tout << "j" << j << " not blocked\n";); + TRACE(nla_solver, tout << "j" << j << " not blocked\n";); impq delta = get_column_value(j) - ival; for (auto c : A_r().column(j)) { unsigned row_index = c.var(); diff --git a/src/math/lp/lp_bound_propagator.h b/src/math/lp/lp_bound_propagator.h index bfd728fc7..2568c51fb 100644 --- a/src/math/lp/lp_bound_propagator.h +++ b/src/math/lp/lp_bound_propagator.h @@ -90,7 +90,7 @@ private: explanation ex; explain_fixed_in_row(r1, ex); explain_fixed_in_row(r2, ex); - TRACE("eq", print_row(tout, r1); print_row(tout, r2); tout << v1 << " == " << v2 << " = " << val(v1) << "\n"); + TRACE(eq, print_row(tout, r1); print_row(tout, r2); tout << v1 << " == " << v2 << " = " << val(v1) << "\n"); add_eq_on_columns(ex, v1, v2, true); } @@ -162,12 +162,12 @@ public: found_bound.m_bound = v; found_bound.m_strict = strict; found_bound.set_explain(explain_bound); - TRACE("add_bound", lp().print_implied_bound(found_bound, tout);); + TRACE(add_bound, lp().print_implied_bound(found_bound, tout);); } } else { m_improved_lower_bounds.insert(j, static_cast(m_ibounds.size())); m_ibounds.push_back(implied_bound(v, j, is_low, strict, explain_bound)); - TRACE("add_bound", lp().print_implied_bound(m_ibounds.back(), tout);); + TRACE(add_bound, lp().print_implied_bound(m_ibounds.back(), tout);); } } else { // the upper bound case unsigned k; @@ -178,12 +178,12 @@ public: found_bound.m_bound = v; found_bound.m_strict = strict; found_bound.set_explain(explain_bound); - TRACE("add_bound", lp().print_implied_bound(found_bound, tout);); + TRACE(add_bound, lp().print_implied_bound(found_bound, tout);); } } else { m_improved_upper_bounds.insert(j, static_cast(m_ibounds.size())); m_ibounds.push_back(implied_bound(v, j, is_low, strict, explain_bound)); - TRACE("add_bound", lp().print_implied_bound(m_ibounds.back(), tout);); + TRACE(add_bound, lp().print_implied_bound(m_ibounds.back(), tout);); } } } @@ -217,7 +217,7 @@ public: SASSERT(je != ke && is_int(je) == is_int(ke)); SASSERT(ival(je) == ival(ke)); - TRACE("eq", + TRACE(eq, tout << "reported idx " << je << ", " << ke << "\n"; lp().print_expl(tout, exp); tout << "theory_vars v" << lp().local_to_external(je) << " == v" << lp().local_to_external(ke) << "\n";); @@ -247,7 +247,7 @@ public: } void explain_fixed_in_row(unsigned row, explanation& ex) { - TRACE("eq", tout << lp().get_row(row) << std::endl); + TRACE(eq, tout << lp().get_row(row) << std::endl); for (const auto& c : lp().get_row(row)) if (lp().column_is_fixed(c.var())) lp().explain_fixed_column(c.var(), ex); @@ -255,7 +255,7 @@ public: unsigned explain_fixed_in_row_and_get_base(unsigned row, explanation& ex) { unsigned base = UINT_MAX; - TRACE("eq", tout << lp().get_row(row) << std::endl); + TRACE(eq, tout << lp().get_row(row) << std::endl); for (const auto& c : lp().get_row(row)) { if (lp().column_is_fixed(c.var())) { lp().explain_fixed_column(c.var(), ex); @@ -342,7 +342,7 @@ public: try_add_equation_with_internal_fixed_tables(row_index); return; } - TRACE("eq", + TRACE(eq, tout << "v_j = "; lp().print_column_info(v_j, tout) << std::endl; tout << "found j " << j << std::endl; lp().print_column_info(j, tout) << std::endl; @@ -356,7 +356,7 @@ public: void cheap_eq_on_nbase(unsigned row_index) { reset_cheap_eq _reset(*this); - TRACE("eq", tout << "row_index = " << row_index << "\n"; + TRACE(eq, tout << "row_index = " << row_index << "\n"; print_row(tout, row_index) << "\n";); if (!check_insert(m_visited_rows, row_index)) return; @@ -378,7 +378,7 @@ public: SASSERT(lp().is_base(y) == false); auto& table = y_sign == 1 ? m_row2index_pos : m_row2index_neg; table.insert(val(x), row_index); - TRACE("eq", tout << "y = " << y << "\n";); + TRACE(eq, tout << "y = " << y << "\n";); for (const column_cell& c : lp().get_column(y)) { unsigned i = c.var(); // the running index of the row @@ -406,7 +406,7 @@ public: continue; explain_fixed_in_row(found_i, ex); explain_fixed_in_row(i, ex); - TRACE("eq", { + TRACE(eq, { print_row(tout, i); print_row(tout, found_i) << "\n"; lp().print_column_info(base_of_found, tout); diff --git a/src/math/lp/lp_core_solver_base.h b/src/math/lp/lp_core_solver_base.h index 239031d4e..3ad839544 100644 --- a/src/math/lp/lp_core_solver_base.h +++ b/src/math/lp/lp_core_solver_base.h @@ -55,7 +55,7 @@ private: lp_status m_status; public: bool current_x_is_feasible() const { - TRACE("feas_bug", + TRACE(feas_bug, if (!m_inf_heap.empty()) { tout << "column " << *m_inf_heap.begin() << " is infeasible" << std::endl; print_column_info(*m_inf_heap.begin(), tout); @@ -211,7 +211,7 @@ public: d -= this->m_costs[this->m_basis[cc.var()]] * this->m_A.get_val(cc); } if (m_d[j] != d) { - TRACE("lar_solver", tout << "reduced costs are incorrect for column j = " << j << " should be " << d << " but we have m_d[j] = " << m_d[j] << std::endl;); + TRACE(lar_solver, tout << "reduced costs are incorrect for column j = " << j << " should be " << d << " but we have m_d[j] = " << m_d[j] << std::endl;); return false; } } @@ -364,7 +364,7 @@ public: } void change_basis_unconditionally(unsigned entering, unsigned leaving) { - TRACE("lar_solver", tout << "entering = " << entering << ", leaving = " << leaving << "\n";); + TRACE(lar_solver, tout << "entering = " << entering << ", leaving = " << leaving << "\n";); SASSERT(m_basis_heading[entering] < 0); int place_in_non_basis = -1 - m_basis_heading[entering]; if (static_cast(place_in_non_basis) >= m_nbasis.size()) { @@ -384,7 +384,7 @@ public: } void change_basis(unsigned entering, unsigned leaving) { - TRACE("lar_solver", tout << "entering = " << entering << ", leaving = " << leaving << "\n";); + TRACE(lar_solver, tout << "entering = " << entering << ", leaving = " << leaving << "\n";); SASSERT(m_basis_heading[entering] < 0); SASSERT(m_basis_heading[leaving] >= 0); @@ -410,7 +410,7 @@ public: bool non_basic_columns_are_set_correctly() const { for (unsigned j : this->m_nbasis) if (!column_is_feasible(j)) { - TRACE("lp_core", tout << "inf col "; print_column_info(j, tout) << "\n";); + TRACE(lp_core, tout << "inf col "; print_column_info(j, tout) << "\n";); return false; } @@ -545,20 +545,20 @@ public: } void add_delta_to_x_and_track_feasibility(unsigned j, const X & del) { - TRACE("lar_solver_feas", tout << "del = " << del << ", was x[" << j << "] = " << m_x[j] << "\n";); + TRACE(lar_solver_feas, tout << "del = " << del << ", was x[" << j << "] = " << m_x[j] << "\n";); m_x[j] += del; - TRACE("lar_solver_feas", tout << "became x[" << j << "] = " << m_x[j] << "\n";); + TRACE(lar_solver_feas, tout << "became x[" << j << "] = " << m_x[j] << "\n";); track_column_feasibility(j); } void update_x(unsigned j, const X & v) { m_x[j] = v; - TRACE("lar_solver_feas", tout << "not tracking feas j = " << j << ", v = " << v << (column_is_feasible(j)? " feas":" non-feas") << "\n";); + TRACE(lar_solver_feas, tout << "not tracking feas j = " << j << ", v = " << v << (column_is_feasible(j)? " feas":" non-feas") << "\n";); } void add_delta_to_x(unsigned j, const X& delta) { m_x[j] += delta; - TRACE("lar_solver_feas", tout << "not tracking feas j = " << j << " v = " << m_x[j] << " delta = " << delta << (column_is_feasible(j) ? " feas" : " non-feas") << "\n";); + TRACE(lar_solver_feas, tout << "not tracking feas j = " << j << " v = " << m_x[j] << " delta = " << delta << (column_is_feasible(j) ? " feas" : " non-feas") << "\n";); } void track_column_feasibility(unsigned j) { @@ -571,20 +571,20 @@ public: if (!m_inf_heap.contains(j)) { m_inf_heap.reserve(j+1); m_inf_heap.insert(j); - TRACE("lar_solver_inf_heap", tout << "insert into inf_heap j = " << j << "\n";); + TRACE(lar_solver_inf_heap, tout << "insert into inf_heap j = " << j << "\n";); } SASSERT(!column_is_feasible(j)); } void remove_column_from_inf_heap(unsigned j) { if (m_inf_heap.contains(j)) { - TRACE("lar_solver_inf_heap", tout << "erase from heap j = " << j << "\n";); + TRACE(lar_solver_inf_heap, tout << "erase from heap j = " << j << "\n";); m_inf_heap.erase(j); } SASSERT(column_is_feasible(j)); } void clear_inf_heap() { - TRACE("lar_solver_feas",); + TRACE(lar_solver_feas,); m_inf_heap.clear(); } diff --git a/src/math/lp/lp_core_solver_base_def.h b/src/math/lp/lp_core_solver_base_def.h index 82afd7a27..2a1f76afd 100644 --- a/src/math/lp/lp_core_solver_base_def.h +++ b/src/math/lp/lp_core_solver_base_def.h @@ -116,11 +116,11 @@ pretty_print(std::ostream & out) { template void lp_core_solver_base:: add_delta_to_entering(unsigned entering, const X& delta) { m_x[entering] += delta; - TRACE("lar_solver_feas", tout << "not tracking feas entering = " << entering << " = " << m_x[entering] << (column_is_feasible(entering) ? " feas" : " non-feas") << "\n";); + TRACE(lar_solver_feas, tout << "not tracking feas entering = " << entering << " = " << m_x[entering] << (column_is_feasible(entering) ? " feas" : " non-feas") << "\n";); for (const auto & c : m_A.m_columns[entering]) { unsigned i = c.var(); m_x[m_basis[i]] -= delta * m_A.get_val(c); - TRACE("lar_solver_feas", tout << "not tracking feas m_basis[i] = " << m_basis[i] << " = " << m_x[m_basis[i]] << (column_is_feasible(m_basis[i]) ? " feas" : " non-feas") << "\n";); + TRACE(lar_solver_feas, tout << "not tracking feas m_basis[i] = " << m_basis[i] << " = " << m_x[m_basis[i]] << (column_is_feasible(m_basis[i]) ? " feas" : " non-feas") << "\n";); } } @@ -201,7 +201,7 @@ template bool lp_core_solver_base::calc_current_x unsigned j = this->m_n(); while (j--) { if (!column_is_feasible(j)) { - TRACE("lar_solver", tout << "infeasible column: "; print_column_info(j, tout) << "\n";); + TRACE(lar_solver, tout << "infeasible column: "; print_column_info(j, tout) << "\n";); return false; } } @@ -213,7 +213,7 @@ template bool lp_core_solver_base::inf_heap_is_co bool belongs_to_set = m_inf_heap.contains(j); bool is_feas = column_is_feasible(j); if (is_feas == belongs_to_set) { - TRACE("lp_core", tout << "incorrectly set column in inf set "; print_column_info(j, tout) << "\n";); + TRACE(lp_core, tout << "incorrectly set column in inf set "; print_column_info(j, tout) << "\n";); return false; } } @@ -333,12 +333,12 @@ non_basis_is_correctly_represented_in_heading(std::list* non_basis_lis nbasis_set.insert(j); if (non_basis_list->size() != nbasis_set.size()) { - TRACE("lp_core", tout << "non_basis_list.size() = " << non_basis_list->size() << ", nbasis_set.size() = " << nbasis_set.size() << "\n";); + TRACE(lp_core, tout << "non_basis_list.size() = " << non_basis_list->size() << ", nbasis_set.size() = " << nbasis_set.size() << "\n";); return false; } for (auto it = non_basis_list->begin(); it != non_basis_list->end(); it++) { if (nbasis_set.find(*it) == nbasis_set.end()) { - TRACE("lp_core", tout << "column " << *it << " is in m_non_basis_list but not in m_nbasis\n";); + TRACE(lp_core, tout << "column " << *it << " is in m_non_basis_list but not in m_nbasis\n";); return false; } } @@ -347,7 +347,7 @@ non_basis_is_correctly_represented_in_heading(std::list* non_basis_lis nbasis_set.clear(); for (auto it = non_basis_list->begin(); it != non_basis_list->end(); it++) { if (nbasis_set.find(*it) != nbasis_set.end()) { - TRACE("lp_core", tout << "column " << *it << " is in m_non_basis_list twice\n";); + TRACE(lp_core, tout << "column " << *it << " is in m_non_basis_list twice\n";); return false; } nbasis_set.insert(*it); diff --git a/src/math/lp/lp_primal_core_solver.h b/src/math/lp/lp_primal_core_solver.h index f925f74f3..cb7454c14 100644 --- a/src/math/lp/lp_primal_core_solver.h +++ b/src/math/lp/lp_primal_core_solver.h @@ -394,8 +394,8 @@ namespace lp { const X &new_val_for_leaving = get_val_for_leaving(leaving); X theta = (this->m_x[leaving] - new_val_for_leaving) / a_ent; this->m_x[leaving] = new_val_for_leaving; - TRACE("lar_solver_feas", tout << "entering = " << entering << ", leaving = " << leaving << ", new_val_for_leaving = " << new_val_for_leaving << ", theta = " << theta << "\n";); - TRACE("lar_solver_feas", tout << "leaving = " << leaving + TRACE(lar_solver_feas, tout << "entering = " << entering << ", leaving = " << leaving << ", new_val_for_leaving = " << new_val_for_leaving << ", theta = " << theta << "\n";); + TRACE(lar_solver_feas, tout << "leaving = " << leaving << " removed from inf_heap()\n";); // this will remove the leaving from the heap this->inf_heap().erase_min(); diff --git a/src/math/lp/lp_primal_core_solver_def.h b/src/math/lp/lp_primal_core_solver_def.h index 74bbad1fc..fd7c91457 100644 --- a/src/math/lp/lp_primal_core_solver_def.h +++ b/src/math/lp/lp_primal_core_solver_def.h @@ -74,7 +74,7 @@ template bool lp_primal_core_solver::column_is_benefitial_for_entering_basis(unsigned j) const { const T& dj = this->m_d[j]; if (dj.is_zero()) return false; - TRACE("lar_solver", tout << "d[" << j <<"] = " << dj << "\n";); + TRACE(lar_solver, tout << "d[" << j <<"] = " << dj << "\n";); SASSERT(correctly_moved_to_bounds(j)); switch (this->m_column_types[j]) { case column_type::fixed: break; diff --git a/src/math/lp/lp_primal_core_solver_tableau_def.h b/src/math/lp/lp_primal_core_solver_tableau_def.h index 1a1bf0553..417db0191 100644 --- a/src/math/lp/lp_primal_core_solver_tableau_def.h +++ b/src/math/lp/lp_primal_core_solver_tableau_def.h @@ -37,7 +37,7 @@ template void lp_primal_core_solver::advance_on_e X t; int leaving = find_leaving_and_t_tableau(entering, t); if (leaving == -1) { - TRACE("lar_solver", tout << "nothing leaving " << entering << "\n";); + TRACE(lar_solver, tout << "nothing leaving " << entering << "\n";); this->set_status(lp_status::UNBOUNDED); return; } @@ -91,7 +91,7 @@ template void lp_primal_core_solver::advance_on_e template unsigned lp_primal_core_solver::solve() { - TRACE("lar_solver", tout << "solve " << this->get_status() << "\n";); + TRACE(lar_solver, tout << "solve " << this->get_status() << "\n";); init_run_tableau(); if (this->current_x_is_feasible() && this->m_look_for_feasible_solution_only) { this->set_status(lp_status::FEASIBLE); @@ -108,7 +108,7 @@ unsigned lp_primal_core_solver::solve() { } else { one_iteration_tableau(); } - TRACE("lar_solver", tout << "one iteration tableau " << this->get_status() << "\n";); + TRACE(lar_solver, tout << "one iteration tableau " << this->get_status() << "\n";); switch (this->get_status()) { case lp_status::OPTIMAL: // check again that we are at optimum break; diff --git a/src/math/lp/monomial_bounds.cpp b/src/math/lp/monomial_bounds.cpp index 43b85757d..cf78fa3dd 100644 --- a/src/math/lp/monomial_bounds.cpp +++ b/src/math/lp/monomial_bounds.cpp @@ -45,7 +45,7 @@ namespace nla { void monomial_bounds::propagate_fixed_var(lpvar v) { SASSERT(c().var_is_fixed(v)); - TRACE("nla_solver", tout << "propagate fixed var: " << c().var_str(v) << "\n";); + TRACE(nla_solver, tout << "propagate fixed var: " << c().var_str(v) << "\n";); for (auto const& m : c().emons().get_use_list(v)) propagate_fixed_var(m, v); } @@ -113,7 +113,7 @@ namespace nla { new_lemma lemma(c(), "propagate value - upper bound of range is below value"); lemma &= ex; lemma |= ineq(v, cmp, upper); - TRACE("nla_solver", dep.display(tout << c().val(v) << " > ", range) << "\n" << lemma << "\n";); + TRACE(nla_solver, dep.display(tout << c().val(v) << " > ", range) << "\n" << lemma << "\n";); propagated = true; } if (should_propagate_lower(range, v, 1)) { @@ -127,7 +127,7 @@ namespace nla { new_lemma lemma(c(), "propagate value - lower bound of range is above value"); lemma &= ex; lemma |= ineq(v, cmp, lower); - TRACE("nla_solver", dep.display(tout << c().val(v) << " < ", range) << "\n" << lemma << "\n";); + TRACE(nla_solver, dep.display(tout << c().val(v) << " < ", range) << "\n" << lemma << "\n";); propagated = true; } return propagated; @@ -419,7 +419,7 @@ namespace nla { void monomial_bounds::propagate_fixed_to_zero(monic const& m, lpvar fixed_to_zero) { auto* dep = c().lra.get_bound_constraint_witnesses_for_column(fixed_to_zero); - TRACE("nla_solver", tout << "propagate fixed " << m << " = 0, fixed_to_zero = " << fixed_to_zero << "\n";); + TRACE(nla_solver, tout << "propagate fixed " << m << " = 0, fixed_to_zero = " << fixed_to_zero << "\n";); c().lra.update_column_type_and_bound(m.var(), lp::lconstraint_kind::EQ, rational(0), dep); // propagate fixed equality @@ -429,7 +429,7 @@ namespace nla { void monomial_bounds::propagate_fixed(monic const& m, rational const& k) { auto* dep = explain_fixed(m, k); - TRACE("nla_solver", tout << "propagate fixed " << m << " = " << k << "\n";); + TRACE(nla_solver, tout << "propagate fixed " << m << " = " << k << "\n";); c().lra.update_column_type_and_bound(m.var(), lp::lconstraint_kind::EQ, k, dep); // propagate fixed equality @@ -443,7 +443,7 @@ namespace nla { coeffs.push_back({rational::one(), m.var()}); lp::lpvar j = c().lra.add_term(coeffs, UINT_MAX); auto* dep = explain_fixed(m, k); - TRACE("nla_solver", tout << "propagate nonfixed " << m << " = " << k << " " << w << "\n";); + TRACE(nla_solver, tout << "propagate nonfixed " << m << " = " << k << " " << w << "\n";); c().lra.update_column_type_and_bound(j, lp::lconstraint_kind::EQ, mpq(0), dep); if (k == 1) { diff --git a/src/math/lp/nex.h b/src/math/lp/nex.h index 7217374d5..2010663e8 100644 --- a/src/math/lp/nex.h +++ b/src/math/lp/nex.h @@ -233,7 +233,7 @@ public: } void get_powers_from_mul(std::unordered_map & r) const { - TRACE("nla_cn_details", tout << "powers of " << *this << "\n";); + TRACE(nla_cn_details, tout << "powers of " << *this << "\n";); r.clear(); for (const auto & c : *this) { if (c.e()->is_var()) { @@ -242,7 +242,7 @@ public: r[j] = c.pow(); } } - TRACE("nla_cn_details", tout << "powers of " << *this << "\n"; print_vector(r, tout)<< "\n";); + TRACE(nla_cn_details, tout << "powers of " << *this << "\n"; print_vector(r, tout)<< "\n";); } unsigned get_degree() const override { @@ -288,18 +288,18 @@ public: unsigned size() const override { return m_children.size(); } bool is_linear() const override { - TRACE("nex_details", tout << *this << "\n";); + TRACE(nex_details, tout << *this << "\n";); for (auto e : *this) { if (!e->is_linear()) return false; } - TRACE("nex_details", tout << "linear\n";); + TRACE(nex_details, tout << "linear\n";); return true; } // we need a linear combination of at least two variables bool is_a_linear_term() const { - TRACE("nex_details", tout << *this << "\n";); + TRACE(nex_details, tout << *this << "\n";); unsigned number_of_non_scalars = 0; for (auto e : *this) { int d = e->get_degree(); @@ -307,7 +307,7 @@ public: if (d > 1) return false; number_of_non_scalars++; } - TRACE("nex_details", tout << (number_of_non_scalars > 1?"linear":"non-linear") << "\n";); + TRACE(nex_details, tout << (number_of_non_scalars > 1?"linear":"non-linear") << "\n";); return number_of_non_scalars > 1; } @@ -405,7 +405,7 @@ inline rational get_nex_val(const nex* e, std::function var case expr_type::VAR: return var_val(e->to_var().var()); default: - TRACE("nla_cn_details", tout << e->type() << "\n";); + TRACE(nla_cn_details, tout << e->type() << "\n";); SASSERT(false); return rational(); } @@ -430,7 +430,7 @@ inline std::unordered_set get_vars_of_expr(const nex *e ) { r.insert(e->to_var().var()); return r; default: - TRACE("nla_cn_details", tout << e->type() << "\n";); + TRACE(nla_cn_details, tout << e->type() << "\n";); SASSERT(false); return r; } diff --git a/src/math/lp/nex_creator.cpp b/src/math/lp/nex_creator.cpp index c43b723ef..763251a9e 100644 --- a/src/math/lp/nex_creator.cpp +++ b/src/math/lp/nex_creator.cpp @@ -60,7 +60,7 @@ bool nex_creator::eat_scalar_pow(rational& r, const nex_pow& p, unsigned pow) { void nex_creator::simplify_children_of_mul(vector & children, rational& coeff) { - TRACE("grobner_d", print_vector(children, tout << "children_of_mul: "); tout << "\n";); + TRACE(grobner_d, print_vector(children, tout << "children_of_mul: "); tout << "\n";); vector to_promote; unsigned j = 0; for (nex_pow& p : children) { @@ -78,10 +78,10 @@ void nex_creator::simplify_children_of_mul(vector & children, rational& children.shrink(j); for (nex_pow & p : to_promote) { - TRACE("grobner_d", tout << p << "\n";); + TRACE(grobner_d, tout << p << "\n";); nex_mul &pm = p.e()->to_mul(); for (nex_pow& pp : pm) { - TRACE("grobner_d", tout << pp << "\n";); + TRACE(grobner_d, tout << pp << "\n";); if (!eat_scalar_pow(coeff, pp, p.pow())) children.push_back(nex_pow(pp.e(), pp.pow() * p.pow())); } @@ -90,7 +90,7 @@ void nex_creator::simplify_children_of_mul(vector & children, rational& mul_to_powers(children); - TRACE("grobner_d", print_vector(children, tout);); + TRACE(grobner_d, print_vector(children, tout);); } template @@ -123,12 +123,12 @@ bool nex_creator::gt_on_powers_mul_same_degree(const T& a, const nex_mul& b) con if (it_b != b.end()) b_pow = it_b->pow(); } - TRACE("nex_gt", tout << "a = "; print_vector(a, tout) << (ret?" > ":" <= ") << b << "\n";); + TRACE(nex_gt, tout << "a = "; print_vector(a, tout) << (ret?" > ":" <= ") << b << "\n";); return ret; } bool nex_creator::gt_on_mul_mul(const nex_mul& a, const nex_mul& b) const { - TRACE("grobner_d", tout << "a = " << a << " , b = " << b << "\n";); + TRACE(grobner_d, tout << "a = " << a << " , b = " << b << "\n";); SASSERT(is_simplified(a) && is_simplified(b)); unsigned a_deg = a.get_degree(); unsigned b_deg = b.get_degree(); @@ -190,7 +190,7 @@ bool nex_creator::gt_on_sum_sum(const nex_sum& a, const nex_sum& b) const { // the only difference with gt() that it disregards the coefficient in nex_mul bool nex_creator::gt_for_sort_join_sum(const nex* a, const nex* b) const { - TRACE("grobner_d_", tout << *a << " ? " << *b << "\n";); + TRACE(grobner_d_, tout << *a << " ? " << *b << "\n";); if (a == b) return false; bool ret; @@ -215,12 +215,12 @@ bool nex_creator::gt_for_sort_join_sum(const nex* a, const nex* b) const { UNREACHABLE(); return false; } - TRACE("grobner_d_", tout << *a << (ret?" < ":" >= ") << *b << "\n";); + TRACE(grobner_d_, tout << *a << (ret?" < ":" >= ") << *b << "\n";); return ret; } bool nex_creator::gt(const nex& a, const nex& b) const { - TRACE("grobner_d_", tout << a << " ? " << b << "\n";); + TRACE(grobner_d_, tout << a << " ? " << b << "\n";); if (&a == &b) return false; bool ret; @@ -243,14 +243,14 @@ bool nex_creator::gt(const nex& a, const nex& b) const { UNREACHABLE(); return false; } - TRACE("grobner_d_", tout << a << (ret?" < ":" >= ") << b << "\n";); + TRACE(grobner_d_, tout << a << (ret?" < ":" >= ") << b << "\n";); return ret; } bool nex_creator::is_sorted(const nex_mul& e) const { for (unsigned j = 0; j < e.size() - 1; j++) { if (!(gt_on_nex_pow(e[j], e[j+1]))) { - TRACE("grobner_d", tout << "not sorted e " << e << "\norder is incorrect " << + TRACE(grobner_d, tout << "not sorted e " << e << "\norder is incorrect " << e[j] << " >= " << e[j + 1]<< "\n";); return false; @@ -260,28 +260,28 @@ bool nex_creator::is_sorted(const nex_mul& e) const { } bool nex_creator::mul_is_simplified(const nex_mul& e) const { - TRACE("nla_cn_", tout << "e = " << e << "\n";); + TRACE(nla_cn_, tout << "e = " << e << "\n";); if (e.size() == 0) { - TRACE("nla_cn", ); + TRACE(nla_cn, ); return false; // it has to be a scalar } if (e.size() == 1 && e.begin()->pow() == 1 && e.coeff().is_one()) { - TRACE("nla_cn", ); + TRACE(nla_cn, ); return false; } std::set s([this](const nex* a, const nex* b) {return gt(a, b); }); for (const auto &p : e) { const nex* ee = p.e(); if (p.pow() == 0) { - TRACE("nla_cn", tout << "not simplified " << *ee << "\n";); + TRACE(nla_cn, tout << "not simplified " << *ee << "\n";); return false; } if (ee->is_mul()) { - TRACE("nla_cn", tout << "not simplified " << *ee << "\n";); + TRACE(nla_cn, tout << "not simplified " << *ee << "\n";); return false; } if (ee->is_scalar() && to_scalar(ee)->value().is_one()) { - TRACE("nla_cn", tout << "not simplified " << *ee << "\n";); + TRACE(nla_cn, tout << "not simplified " << *ee << "\n";); return false; } @@ -289,7 +289,7 @@ bool nex_creator::mul_is_simplified(const nex_mul& e) const { if (it == s.end()) { s.insert(ee); } else { - TRACE("nla_cn", tout << "not simplified " << *ee << "\n";); + TRACE(nla_cn, tout << "not simplified " << *ee << "\n";); return false; } } @@ -297,7 +297,7 @@ bool nex_creator::mul_is_simplified(const nex_mul& e) const { } nex * nex_creator::simplify_mul(nex_mul *e) { - TRACE("grobner_d", tout << *e << "\n";); + TRACE(grobner_d, tout << *e << "\n";); rational& coeff = e->m_coeff; simplify_children_of_mul(e->m_children, coeff); if (e->size() == 1 && (*e)[0].pow() == 1 && coeff.is_one()) @@ -305,13 +305,13 @@ nex * nex_creator::simplify_mul(nex_mul *e) { if (e->size() == 0 || e->coeff().is_zero()) return mk_scalar(e->coeff()); - TRACE("grobner_d", tout << *e << "\n";); + TRACE(grobner_d, tout << *e << "\n";); SASSERT(is_simplified(*e)); return e; } nex* nex_creator::simplify_sum(nex_sum *e) { - TRACE("grobner_d", tout << "was e = " << *e << "\n";); + TRACE(grobner_d, tout << "was e = " << *e << "\n";); simplify_children_of_sum(*e); nex *r; if (e->size() == 1) { @@ -321,7 +321,7 @@ nex* nex_creator::simplify_sum(nex_sum *e) { } else { r = const_cast(e); } - TRACE("grobner_d", tout << "became r = " << *r << "\n";); + TRACE(grobner_d, tout << "became r = " << *r << "\n";); return r; } @@ -329,22 +329,22 @@ bool nex_creator::sum_is_simplified(const nex_sum& e) const { if (e.size() < 2) return false; bool scalar = false; for (nex const* ee : e) { - TRACE("nla_cn_details", tout << "ee = " << *ee << "\n";); + TRACE(nla_cn_details, tout << "ee = " << *ee << "\n";); if (ee->is_sum()) { - TRACE("nla_cn", tout << "not simplified e = " << e << "\n" + TRACE(nla_cn, tout << "not simplified e = " << e << "\n" << " has a child which is a sum " << *ee << "\n";); return false; } if (ee->is_scalar()) { if (scalar) { - TRACE("nla_cn", tout << "not simplified e = " << e << "\n" + TRACE(nla_cn, tout << "not simplified e = " << e << "\n" << " have more than one scalar " << *ee << "\n";); return false; } if (to_scalar(ee)->value().is_zero()) { if (scalar) { - TRACE("nla_cn", tout << "have a zero scalar " << *ee << "\n";); + TRACE(nla_cn, tout << "have a zero scalar " << *ee << "\n";); return false; } @@ -380,15 +380,15 @@ void nex_creator::mul_to_powers(vector& children) { // returns true if the key exists already bool nex_creator::register_in_join_map(std::map& map, nex const* e, const rational& r) const{ - TRACE("grobner_d", tout << *e << ", r = " << r << std::endl;); + TRACE(grobner_d, tout << *e << ", r = " << r << std::endl;); auto map_it = map.find(e); if (map_it == map.end()) { map[e] = r; - TRACE("grobner_d", tout << "inserting " << std::endl;); + TRACE(grobner_d, tout << "inserting " << std::endl;); return false; } else { map_it->second += r; - TRACE("grobner_d", tout << "adding " << r << " , got " << map_it->second << std::endl;); + TRACE(grobner_d, tout << "adding " << r << " , got " << map_it->second << std::endl;); return true; } } @@ -418,14 +418,14 @@ bool nex_creator::fill_join_map_for_sum( } // a + 3bc + 2bc => a + 5bc void nex_creator::sort_join_sum(nex_sum& sum) { - TRACE("grobner_d", tout << sum << "\n";); + TRACE(grobner_d, tout << sum << "\n";); std::map map([this](const nex *a , const nex *b) { return gt_for_sort_join_sum(a, b); }); std::unordered_set allocated_nexs; // handling (nex*) as numbers rational common_scalar(0); fill_join_map_for_sum(sum, map, allocated_nexs, common_scalar); - TRACE("grobner_d", for (auto & p : map ) { tout << "(" << *p.first << ", " << p.second << ") ";}); + TRACE(grobner_d, for (auto & p : map ) { tout << "(" << *p.first << ", " << p.second << ") ";}); sum.m_children.reset(); for (auto& p : map) { process_map_pair(const_cast(p.first), p.second, sum, allocated_nexs); @@ -433,7 +433,7 @@ void nex_creator::sort_join_sum(nex_sum& sum) { if (!common_scalar.is_zero()) { sum.m_children.push_back(mk_scalar(common_scalar)); } - TRACE("grobner_d", + TRACE(grobner_d, tout << "map="; for (auto & p : map ) tout << "(" << *p.first << ", " << p.second << ") "; tout << "\nchildren=" << sum << "\n";); @@ -479,7 +479,7 @@ nex * nex_creator::mk_div_sum_by_mul(const nex_sum& m, const nex_mul& b) { sf += mk_div_by_mul(*e, b); } nex* r = sf.mk(); - TRACE("grobner_d", tout << *r << "\n";); + TRACE(grobner_d, tout << *r << "\n";); return r; } @@ -488,11 +488,11 @@ nex * nex_creator::mk_div_mul_by_mul(const nex_mul& a, const nex_mul& b) { b.get_powers_from_mul(m_powers); m_mk_mul.reset(); for (auto& p_from_a : a) { - TRACE("grobner_d", tout << "p_from_a = " << p_from_a << "\n";); + TRACE(grobner_d, tout << "p_from_a = " << p_from_a << "\n";); const nex* e = p_from_a.e(); if (e->is_scalar()) { m_mk_mul *= nex_pow(clone(e), p_from_a.pow()); - TRACE("grobner_d", tout << "processed scalar\n";); + TRACE(grobner_d, tout << "processed scalar\n";); continue; } SASSERT(e->is_var()); @@ -520,7 +520,7 @@ nex * nex_creator::mk_div_mul_by_mul(const nex_mul& a, const nex_mul& b) { SASSERT(m_powers.size() == 0); m_mk_mul *= (a.coeff() / b.coeff()); nex* ret = m_mk_mul.mk_reduced(); - TRACE("grobner_d", tout << *ret << "\n";); + TRACE(grobner_d, tout << *ret << "\n";); return ret; } @@ -536,7 +536,7 @@ nex * nex_creator::mk_div_by_mul(const nex& a, const nex_mul& b) { } nex * nex_creator::mk_div(const nex& a, const nex& b) { - TRACE("grobner_d", tout << a <<" / " << b << "\n";); + TRACE(grobner_d, tout << a <<" / " << b << "\n";); if (b.is_var()) { return mk_div(a, b.to_var().var()); } @@ -545,23 +545,23 @@ nex * nex_creator::mk_div(const nex& a, const nex& b) { nex* nex_creator::simplify(nex* e) { nex* es; - TRACE("grobner_d", tout << *e << std::endl;); + TRACE(grobner_d, tout << *e << std::endl;); if (e->is_mul()) es = simplify_mul(to_mul(e)); else if (e->is_sum()) es = simplify_sum(to_sum(e)); else es = e; - TRACE("grobner_d", tout << "simplified = " << *es << std::endl;); + TRACE(grobner_d, tout << "simplified = " << *es << std::endl;); SASSERT(is_simplified(*es)); return es; } // adds to children the corrected expression and also adds to allocated the new expressions void nex_creator::process_map_pair(nex*e, const rational& coeff, nex_sum & sum, std::unordered_set& allocated_nexs) { - TRACE("grobner_d", tout << "e=" << *e << " , coeff= " << coeff << "\n";); + TRACE(grobner_d, tout << "e=" << *e << " , coeff= " << coeff << "\n";); if (coeff.is_zero()) { - TRACE("grobner_d", tout << "did nothing\n";); + TRACE(grobner_d, tout << "did nothing\n";); return; } bool e_is_old = allocated_nexs.find(e) != allocated_nexs.end(); @@ -585,7 +585,7 @@ void nex_creator::process_map_pair(nex*e, const rational& coeff, nex_sum & sum, } bool nex_creator::is_simplified(const nex& e) const { - TRACE("nla_cn_details", tout << "e = " << e << "\n";); + TRACE(nla_cn_details, tout << "e = " << e << "\n";); if (e.is_mul()) return mul_is_simplified(e.to_mul()); if (e.is_sum()) @@ -602,7 +602,7 @@ unsigned nex_creator::find_sum_in_mul(const nex_mul* a) const { } nex* nex_creator::canonize_mul(nex_mul *a) { - TRACE("grobner_d", tout << "a = " << *a << "\n";); + TRACE(grobner_d, tout << "a = " << *a << "\n";); unsigned j = find_sum_in_mul(a); if (j + 1 == 0) return a; @@ -625,7 +625,7 @@ nex* nex_creator::canonize_mul(nex_mul *a) { sf += mf.mk(); } nex* r = sf.mk(); - TRACE("grobner_d", tout << "canonized a = " << *r << "\n";); + TRACE(grobner_d, tout << "canonized a = " << *r << "\n";); return canonize(r); } @@ -640,14 +640,14 @@ nex* nex_creator::canonize(const nex *a) { s[j] = canonize(s[j]); } t = simplify(&s); - TRACE("grobner_d", tout << *t << "\n";); + TRACE(grobner_d, tout << *t << "\n";); return t; } return canonize_mul(to_mul(t)); } bool nex_creator::equal(const nex* a, const nex* b) { - TRACE("grobner_d", tout << *a << " against " << *b << "\n";); + TRACE(grobner_d, tout << *a << " against " << *b << "\n";); nex_creator cn; unsigned n = 0; for (lpvar j : get_vars_of_expr(a)) { @@ -662,8 +662,8 @@ bool nex_creator::equal(const nex* a, const nex* b) { } nex * ca = cn.canonize(a); nex * cb = cn.canonize(b); - TRACE("grobner_d", tout << "a = " << *a << ", canonized a = " << *ca << "\n";); - TRACE("grobner_d", tout << "b = " << *b << ", canonized b = " << *cb << "\n";); + TRACE(grobner_d, tout << "a = " << *a << ", canonized a = " << *ca << "\n";); + TRACE(grobner_d, tout << "b = " << *b << ", canonized b = " << *cb << "\n";); return !(cn.gt(ca, cb) || cn.gt(cb, ca)); } diff --git a/src/math/lp/nex_creator.h b/src/math/lp/nex_creator.h index 9bce46395..396855375 100644 --- a/src/math/lp/nex_creator.h +++ b/src/math/lp/nex_creator.h @@ -133,7 +133,7 @@ public: void add_to_allocated(nex* r) { m_allocated.push_back(r); - CTRACE("grobner_stats_d", m_allocated.size() % 1000 == 0, tout << "m_allocated.size() = " << m_allocated.size() << "\n";); + CTRACE(grobner_stats_d, m_allocated.size() % 1000 == 0, tout << "m_allocated.size() = " << m_allocated.size() << "\n";); } // NSB: we can use region allocation, but still need to invoke destructor @@ -142,7 +142,7 @@ public: for (unsigned j = sz; j < m_allocated.size(); j++) dealloc(m_allocated[j]); m_allocated.resize(sz); - TRACE("grobner_stats_d", tout << "m_allocated.size() = " << m_allocated.size() << "\n";); + TRACE(grobner_stats_d, tout << "m_allocated.size() = " << m_allocated.size() << "\n";); } void clear() { diff --git a/src/math/lp/nla_basics_lemmas.cpp b/src/math/lp/nla_basics_lemmas.cpp index 705247aa1..5a480ec16 100644 --- a/src/math/lp/nla_basics_lemmas.cpp +++ b/src/math/lp/nla_basics_lemmas.cpp @@ -22,7 +22,7 @@ bool basics::basic_sign_lemma_on_two_monics(const monic& m, const monic& n) { const rational sign = sign_to_rat(m.rsign() ^ n.rsign()); if (var_val(m) == var_val(n) * sign) return false; - TRACE("nla_solver", tout << "sign contradiction:\nm = " << pp_mon(c(), m) << "n= " << pp_mon(c(), n) << "sign: " << sign << "\n";); + TRACE(nla_solver, tout << "sign contradiction:\nm = " << pp_mon(c(), m) << "n= " << pp_mon(c(), n) << "sign: " << sign << "\n";); generate_sign_lemma(m, n, sign); return true; } @@ -46,7 +46,7 @@ void basics::generate_zero_lemmas(const monic& m) { if (sign && is_even(zero_power)) { sign = 0; } - TRACE("nla_solver_details", tout << "zero_j = " << zero_j << ", sign = " << sign << "\n";); + TRACE(nla_solver_details, tout << "zero_j = " << zero_j << ", sign = " << sign << "\n";); if (sign == 0) { // have to generate a non-convex lemma add_trivial_zero_lemma(zero_j, m); } else { // here we know the sign of zero_j @@ -80,7 +80,7 @@ void basics::get_non_strict_sign(lpvar j, int& sign) const { void basics::basic_sign_lemma_model_based_one_mon(const monic& m, int product_sign) { if (product_sign == 0) { - TRACE("nla_solver_bl", tout << "zero product sign: " << pp_mon(_(), m)<< "\n";); + TRACE(nla_solver_bl, tout << "zero product sign: " << pp_mon(_(), m)<< "\n";); generate_zero_lemmas(m); } else { new_lemma lemma(c(), __FUNCTION__); @@ -113,21 +113,21 @@ bool basics::basic_sign_lemma_on_mon(lpvar v, std::unordered_set & exp return false; } const monic& m_v = c().emons()[v]; - TRACE("nla_solver", tout << "m_v = " << pp_mon_with_vars(c(), m_v);); - CTRACE("nla_solver", !c().emons().is_canonized(m_v), + TRACE(nla_solver, tout << "m_v = " << pp_mon_with_vars(c(), m_v);); + CTRACE(nla_solver, !c().emons().is_canonized(m_v), c().emons().display(c(), tout); c().m_evars.display(tout); ); SASSERT(c().emons().is_canonized(m_v)); for (auto const& m : c().emons().enum_sign_equiv_monics(v)) { - TRACE("nla_solver_details", tout << "m = " << pp_mon_with_vars(c(), m);); + TRACE(nla_solver_details, tout << "m = " << pp_mon_with_vars(c(), m);); SASSERT(m.rvars() == m_v.rvars()); if (m_v.var() != m.var() && basic_sign_lemma_on_two_monics(m_v, m) && done()) return true; } - TRACE("nla_solver_details", tout << "return false\n";); + TRACE(nla_solver_details, tout << "return false\n";); return false; } @@ -150,7 +150,7 @@ bool basics::basic_sign_lemma(bool derived) { // but it is not the case in the model void basics::generate_sign_lemma(const monic& m, const monic& n, const rational& sign) { new_lemma lemma(c(), "sign lemma"); - TRACE("nla_solver", + TRACE(nla_solver, tout << "m = " << pp_mon_with_vars(_(), m); tout << "n = " << pp_mon_with_vars(_(), n); ); @@ -181,7 +181,7 @@ void basics::add_trivial_zero_lemma(lpvar zero_j, const monic& m) { } void basics::generate_strict_case_zero_lemma(const monic& m, unsigned zero_j, int sign_of_zj) { - TRACE("nla_solver_bl", tout << "sign_of_zj = " << sign_of_zj << "\n";); + TRACE(nla_solver_bl, tout << "sign_of_zj = " << sign_of_zj << "\n";); // we know all the signs new_lemma lemma(c(), "strict case 0"); lemma |= ineq(zero_j, sign_of_zj == 1? llc::GT : llc::LT, 0); @@ -200,7 +200,7 @@ void basics::add_fixed_zero_lemma(const monic& m, lpvar j) { } void basics::negate_strict_sign(new_lemma& lemma, lpvar j) { - TRACE("nla_solver_details", tout << pp_var(c(), j) << " " << val(j).is_zero() << "\n";); + TRACE(nla_solver_details, tout << pp_var(c(), j) << " " << val(j).is_zero() << "\n";); if (!val(j).is_zero()) { int sign = nla::rat_sign(val(j)); lemma |= ineq(j, (sign == 1? llc::LE : llc::GE), 0); @@ -225,7 +225,7 @@ bool basics::basic_lemma_for_mon_zero(const monic& rm, const factorization& f) { if (val(j).is_zero()) return false; } - TRACE("nla_solver", c().trace_print_monic_and_factorization(rm, f, tout);); + TRACE(nla_solver, c().trace_print_monic_and_factorization(rm, f, tout);); new_lemma lemma(c(), "xy = 0 -> x = 0 or y = 0"); lemma.explain_fixed(var(rm)); std::unordered_set processed; @@ -245,7 +245,7 @@ bool basics::basic_lemma(bool derived) { if (derived) return false; const auto& mon_inds_to_ref = c().m_to_refine; - TRACE("nla_solver", tout << "mon_inds_to_ref = "; print_vector(mon_inds_to_ref, tout) << "\n";); + TRACE(nla_solver, tout << "mon_inds_to_ref = "; print_vector(mon_inds_to_ref, tout) << "\n";); unsigned start = c().random(); unsigned sz = mon_inds_to_ref.size(); for (unsigned j = 0; j < sz; ++j) { @@ -292,7 +292,7 @@ bool basics::basic_lemma_for_mon_derived(const monic& rm) { // x = 0 or y = 0 -> xy = 0 bool basics::basic_lemma_for_mon_non_zero_derived(const monic& rm, const factorization& f) { - TRACE("nla_solver", c().trace_print_monic_and_factorization(rm, f, tout);); + TRACE(nla_solver, c().trace_print_monic_and_factorization(rm, f, tout);); if (!c().var_is_separated_from_zero(var(rm))) return false; for (auto fc : f) { @@ -314,10 +314,10 @@ bool basics::basic_lemma_for_mon_non_zero_derived(const monic& rm, const factori // |x*a| = |x| & x != 0 -> |a| = 1 bool basics::basic_lemma_for_mon_neutral_derived(const monic& rm, const factorization& f) { - TRACE("nla_solver", c().trace_print_monic_and_factorization(rm, f, tout);); + TRACE(nla_solver, c().trace_print_monic_and_factorization(rm, f, tout);); lpvar mon_var = c().emons()[rm.var()].var(); - TRACE("nla_solver", c().trace_print_monic_and_factorization(rm, f, tout); tout << "\nmon_var = " << mon_var << "\n";); + TRACE(nla_solver, c().trace_print_monic_and_factorization(rm, f, tout); tout << "\nmon_var = " << mon_var << "\n";); const auto mv = val(mon_var); const auto abs_mv = abs(mv); @@ -415,7 +415,7 @@ void basics::generate_pl_on_mon(const monic& m, unsigned k) { */ void basics::generate_pl(const monic& m, const factorization& fc, int factor_index) { SASSERT(!c().has_real(fc)); - TRACE("nla_solver", tout << "factor_index = " << factor_index << ", m = " + TRACE(nla_solver, tout << "factor_index = " << factor_index << ", m = " << pp_mon(c(), m); tout << ", fc = " << c().pp(fc); tout << "orig mon = "; c().print_monic(c().emons()[m.var()], tout);); @@ -457,7 +457,7 @@ bool basics::is_separated_from_zero(const factorization& f) const { // here we use the fact xy = 0 -> x = 0 or y = 0 void basics::basic_lemma_for_mon_zero_model_based(const monic& rm, const factorization& f) { - TRACE("nla_solver", c().trace_print_monic_and_factorization(rm, f, tout);); + TRACE(nla_solver, c().trace_print_monic_and_factorization(rm, f, tout);); SASSERT(var_val(rm).is_zero() && !c().rm_check(rm)); new_lemma lemma(c(), "xy = 0 -> x = 0 or y = 0"); if (!is_separated_from_zero(f)) { @@ -475,7 +475,7 @@ void basics::basic_lemma_for_mon_zero_model_based(const monic& rm, const factori } void basics::basic_lemma_for_mon_model_based(const monic& rm) { - TRACE("nla_solver_bl", tout << "rm = " << pp_mon(_(), rm) << "\n";); + TRACE(nla_solver_bl, tout << "rm = " << pp_mon(_(), rm) << "\n";); if (var_val(rm).is_zero()) { for (auto factorization : factorization_factory_imp(rm, c())) { if (factorization.is_empty()) @@ -528,7 +528,7 @@ bool basics::basic_lemma_for_mon_neutral_from_factors_to_monic_model_based_fm(co // |uvw| = |u| and uvw != 0 -> |v| = 1 bool basics::basic_lemma_for_mon_neutral_monic_to_factor_model_based(const monic& rm, const factorization& f) { lpvar mon_var = c().emons()[rm.var()].var(); - TRACE("nla_solver_bl", c().trace_print_monic_and_factorization(rm, f, tout); tout << "\nmon_var = " << mon_var << "\n";); + TRACE(nla_solver_bl, c().trace_print_monic_and_factorization(rm, f, tout); tout << "\nmon_var = " << mon_var << "\n";); const auto mv = val(mon_var); const auto abs_mv = abs(mv); @@ -581,10 +581,10 @@ void basics::basic_lemma_for_mon_neutral_model_based(const monic& rm, const fact template bool basics::can_create_lemma_for_mon_neutral_from_factors_to_monic_model_based(const monic& m, const T& f, lpvar ¬_one, rational& sign) { sign = rational(1); - // TRACE("nla_solver_bl", tout << pp_mon_with_vars(_(), m) <<"\nf = " << c().pp(f) << "sign = " << sign << '\n';); + // TRACE(nla_solver_bl, tout << pp_mon_with_vars(_(), m) <<"\nf = " << c().pp(f) << "sign = " << sign << '\n';); not_one = null_lpvar; for (auto j : f) { - TRACE("nla_solver_bl", tout << "j = "; c().print_factor_with_vars(j, tout);); + TRACE(nla_solver_bl, tout << "j = "; c().print_factor_with_vars(j, tout);); auto v = val(j); if (v.is_one()) @@ -609,7 +609,7 @@ bool basics::can_create_lemma_for_mon_neutral_from_factors_to_monic_model_based( return false; } if (not_one != null_lpvar && var_val(m) == val(not_one) * sign) { - TRACE("nla_solver", tout << "the whole is equal to the factor" << std::endl;); + TRACE(nla_solver, tout << "the whole is equal to the factor" << std::endl;); return false; } @@ -639,14 +639,14 @@ bool basics::basic_lemma_for_mon_neutral_from_factors_to_monic_model_based(const for (auto j : f) if (j.sign()) return false; - TRACE("nla_solver_bl", tout << "not_one = " << not_one << "\n";); + TRACE(nla_solver_bl, tout << "not_one = " << not_one << "\n";); new_lemma lemma(c(), __FUNCTION__); for (auto j : f) { lpvar var_j = var(j); if (not_one == var_j) continue; - TRACE("nla_solver_bl", tout << "j = "; c().print_factor_with_vars(j, tout);); + TRACE(nla_solver_bl, tout << "j = "; c().print_factor_with_vars(j, tout);); lemma |= ineq(var_j, llc::NE, val(var_j)); } @@ -656,13 +656,13 @@ bool basics::basic_lemma_for_mon_neutral_from_factors_to_monic_model_based(const lemma |= ineq(term(m.var(), -sign, not_one), llc::EQ, 0); lemma &= m; lemma &= f; - TRACE("nla_solver", tout << "m = " << pp_mon_with_vars(c(), m);); + TRACE(nla_solver, tout << "m = " << pp_mon_with_vars(c(), m);); return true; } // x = 0 or y = 0 -> xy = 0 void basics::basic_lemma_for_mon_non_zero_model_based(const monic& rm, const factorization& f) { - TRACE("nla_solver_bl", c().trace_print_monic_and_factorization(rm, f, tout);); + TRACE(nla_solver_bl, c().trace_print_monic_and_factorization(rm, f, tout);); for (auto j : f) { if (val(j).is_zero()) { new_lemma lemma(c(), "x = 0 => x*... = 0"); diff --git a/src/math/lp/nla_common.cpp b/src/math/lp/nla_common.cpp index 795020513..258fca2bd 100644 --- a/src/math/lp/nla_common.cpp +++ b/src/math/lp/nla_common.cpp @@ -99,11 +99,11 @@ nex * common::nexvar(const rational & coeff, lpvar j, nex_creator& cn, u_depende else { c().insert_to_active_var_set(k); mf *= cn.mk_var(k); - CTRACE("nla_grobner", c().is_monic_var(k), c().print_var(k, tout) << "\n";); + CTRACE(nla_grobner, c().is_monic_var(k), c().print_var(k, tout) << "\n";); } } nex* e = mf.mk(); - TRACE("nla_grobner", tout << *e;); + TRACE(nla_grobner, tout << *e;); return e; } @@ -113,7 +113,7 @@ template void common::create_sum_from_row(const T& row, nex_creator::sum_factory& sum, u_dependency*& dep) { - TRACE("nla_horner", tout << "row="; m_core.print_row(row, tout) << "\n";); + TRACE(nla_horner, tout << "row="; m_core.print_row(row, tout) << "\n";); SASSERT(row.size() > 1); sum.reset(); for (const auto &p : row) { diff --git a/src/math/lp/nla_core.cpp b/src/math/lp/nla_core.cpp index cc9d9388c..3f16f32b6 100644 --- a/src/math/lp/nla_core.cpp +++ b/src/math/lp/nla_core.cpp @@ -135,13 +135,13 @@ void core::add_monic(lpvar v, unsigned sz, lpvar const* vs) { } void core::push() { - TRACE("nla_solver_verbose", tout << "\n";); + TRACE(nla_solver_verbose, tout << "\n";); m_emons.push(); } void core::pop(unsigned n) { - TRACE("nla_solver_verbose", tout << "n = " << n << "\n";); + TRACE(nla_solver_verbose, tout << "n = " << n << "\n";); m_emons.pop(n); SASSERT(elists_are_consistent(false)); } @@ -166,7 +166,7 @@ bool core::check_monic(const monic& m) const { return true; bool ret = product_value(m) == lra.get_column_value(m.var()).x; - CTRACE("nla_solver_check_monic", !ret, print_monic(m, tout) << '\n';); + CTRACE(nla_solver_check_monic, !ret, print_monic(m, tout) << '\n';); return ret; } @@ -406,14 +406,14 @@ bool core::explain_by_equiv(const lp::lar_term& t, lp::explanation& e) const { return false; m_evars.explain(signed_var(i, false), signed_var(j, sign), e); - TRACE("nla_solver", tout << "explained :"; lra.print_term_as_indices(t, tout);); + TRACE(nla_solver, tout << "explained :"; lra.print_term_as_indices(t, tout);); return true; } void core::mk_ineq_no_expl_check(new_lemma& lemma, lp::lar_term& t, llc cmp, const rational& rs) { - TRACE("nla_solver_details", lra.print_term_as_indices(t, tout << "t = ");); + TRACE(nla_solver_details, lra.print_term_as_indices(t, tout << "t = ");); lemma |= ineq(cmp, t, rs); - CTRACE("nla_solver", ineq_holds(ineq(cmp, t, rs)), print_ineq(ineq(cmp, t, rs), tout) << "\n";); + CTRACE(nla_solver, ineq_holds(ineq(cmp, t, rs)), print_ineq(ineq(cmp, t, rs), tout) << "\n";); SASSERT(!ineq_holds(ineq(cmp, t, rs))); } @@ -433,7 +433,7 @@ void core::fill_explanation_and_lemma_sign(new_lemma& lemma, const monic& a, con SASSERT(sign == 1 || sign == -1); lemma &= a; lemma &= b; - TRACE("nla_solver", tout << "used constraints: " << lemma;); + TRACE(nla_solver, tout << "used constraints: " << lemma;); SASSERT(lemma.num_ineqs() == 0); lemma |= ineq(term(rational(1), a.var(), -sign, b.var()), llc::EQ, 0); } @@ -447,7 +447,7 @@ svector core::reduce_monic_to_rooted(const svector & vars, rationa for (lpvar v : vars) { auto root = m_evars.find(v); s ^= root.sign(); - TRACE("nla_solver_eq", + TRACE(nla_solver_eq, tout << pp(v) << " mapped to " << pp(root.var()) << "\n";); ret.push_back(root.var()); } @@ -524,7 +524,7 @@ bool core::sign_contradiction(const monic& m) const { /* unsigned_vector eq_vars(lpvar j) const { - TRACE("nla_solver_eq", tout << "j = " << pp(j) << "eqs = "; + TRACE(nla_solver_eq, tout << "j = " << pp(j) << "eqs = "; for(auto jj : m_evars.eq_vars(j)) tout << pp(jj) << " "; }); return m_evars.eq_vars(j); @@ -692,7 +692,7 @@ void core::collect_equivs() { continue; lpvar j = t->j(); if (var_is_fixed_to_zero(j)) { - TRACE("nla_solver_mons", s.print_term_as_indices(*t, tout << "term = ") << "\n";); + TRACE(nla_solver_mons, s.print_term_as_indices(*t, tout << "term = ") << "\n";); add_equivalence_maybe(t, s.get_column_upper_bound_witness(j), s.get_column_lower_bound_witness(j)); } } @@ -809,7 +809,7 @@ void core::clear() { } void core::init_search() { - TRACE("nla_solver_mons", tout << "init\n";); + TRACE(nla_solver_mons, tout << "init\n";); SASSERT(m_emons.invariant()); clear(); init_vars_equivalence(); @@ -818,19 +818,19 @@ void core::init_search() { } void core::insert_to_refine(lpvar j) { - TRACE("lar_solver", tout << "j=" << j << '\n';); + TRACE(lar_solver, tout << "j=" << j << '\n';); m_to_refine.insert(j); } void core::erase_from_to_refine(lpvar j) { - TRACE("lar_solver", tout << "j=" << j << '\n';); + TRACE(lar_solver, tout << "j=" << j << '\n';); if (m_to_refine.contains(j)) m_to_refine.remove(j); } void core::init_to_refine() { - TRACE("nla_solver_details", tout << "emons:" << pp_emons(*this, m_emons);); + TRACE(nla_solver_details, tout << "emons:" << pp_emons(*this, m_emons);); m_to_refine.reset(); unsigned r = random(), sz = m_emons.number_of_monics(); for (unsigned k = 0; k < sz; k++) { @@ -839,7 +839,7 @@ void core::init_to_refine() { insert_to_refine(m.var()); } - TRACE("nla_solver", + TRACE(nla_solver, tout << m_to_refine.size() << " mons to refine:\n"; for (lpvar v : m_to_refine) tout << pp_mon(*this, m_emons[v]) << ":error = " << (val(v) - mul_val(m_emons[v])).get_double() << "\n";); @@ -872,19 +872,19 @@ std::unordered_set core::collect_vars(const lemma& l) const { // divides bc by c, so bc = b*c bool core::divide(const monic& bc, const factor& c, factor & b) const { svector c_rvars = sorted_rvars(c); - TRACE("nla_solver_div", tout << "c_rvars = "; print_product(c_rvars, tout); tout << "\nbc_rvars = "; print_product(bc.rvars(), tout);); + TRACE(nla_solver_div, tout << "c_rvars = "; print_product(c_rvars, tout); tout << "\nbc_rvars = "; print_product(bc.rvars(), tout);); if (!lp::is_proper_factor(c_rvars, bc.rvars())) return false; auto b_rvars = lp::vector_div(bc.rvars(), c_rvars); - TRACE("nla_solver_div", tout << "b_rvars = "; print_product(b_rvars, tout);); + TRACE(nla_solver_div, tout << "b_rvars = "; print_product(b_rvars, tout);); SASSERT(b_rvars.size() > 0); if (b_rvars.size() == 1) { b = factor(b_rvars[0], factor_type::VAR); } else { monic const* sv = m_emons.find_canonical(b_rvars); if (sv == nullptr) { - TRACE("nla_solver_div", tout << "not in rooted";); + TRACE(nla_solver_div, tout << "not in rooted";); return false; } b = factor(sv->var(), factor_type::MON); @@ -894,7 +894,7 @@ bool core::divide(const monic& bc, const factor& c, factor & b) const { // Dividing by bc.rvars() we get canonize_sign(bc) = canonize_sign(b)*canonize_sign(c) // Currently, canonize_sign(b) is 1, we might need to adjust it b.sign() = canonize_sign(b) ^ canonize_sign(c) ^ canonize_sign(bc); - TRACE("nla_solver", tout << "success div:" << pp(b) << "\n";); + TRACE(nla_solver, tout << "success div:" << pp(b) << "\n";); return true; } @@ -959,7 +959,7 @@ void core::maybe_add_a_factor(lpvar i, } else { if (try_insert(i, found_rm)) { r.push_back(factor(i, factor_type::MON)); - TRACE("nla_solver", tout << "inserting factor = "; print_factor_with_vars(factor(i, factor_type::MON), tout); ); + TRACE(nla_solver, tout << "inserting factor = "; print_factor_with_vars(factor(i, factor_type::MON), tout); ); } } } @@ -994,7 +994,7 @@ bool core::find_bfc_to_refine_on_monic(const monic& m, factorization & bf) { auto b = f[1]; if (var_val(m) != val(a) * val(b)) { bf = f; - TRACE("nla_solver", tout << "found bf"; + TRACE(nla_solver, tout << "found bf"; tout << ":m:" << pp_mon_with_vars(*this, m) << "\n"; tout << "bf:"; print_bfc(bf, tout);); @@ -1023,7 +1023,7 @@ bool core::find_bfc_to_refine(const monic* & m, factorization & bf){ } if (find_bfc_to_refine_on_monic(*m, bf)) { - TRACE("nla_solver", + TRACE(nla_solver, tout << "bf = "; print_factorization(bf, tout); tout << "\nval(*m) = " << var_val(*m) << ", should be = (val(bf[0])=" << val(bf[0]) << ")*(val(bf[1]) = " << val(bf[1]) << ") = " << val(bf[0])*val(bf[1]) << "\n";); return true; @@ -1046,7 +1046,7 @@ new_lemma::new_lemma(core& c, char const* name):name(name), c(c) { new_lemma& new_lemma::operator|=(ineq const& ineq) { if (!c.explain_ineq(*this, ineq.term(), ineq.cmp(), ineq.rs())) { - CTRACE("nla_solver", c.ineq_holds(ineq), c.print_ineq(ineq, tout) << "\n";); + CTRACE(nla_solver, c.ineq_holds(ineq), c.print_ineq(ineq, tout) << "\n";); SASSERT(!c.ineq_holds(ineq)); current().push_back(ineq); } @@ -1064,7 +1064,7 @@ new_lemma::~new_lemma() { } IF_VERBOSE(4, verbose_stream() << name << "\n"); IF_VERBOSE(4, verbose_stream() << *this << "\n"); - TRACE("nla_solver", tout << name << " " << (++i) << "\n" << *this; ); + TRACE(nla_solver, tout << name << " " << (++i) << "\n" << *this; ); } lemma& new_lemma::current() const { @@ -1138,7 +1138,7 @@ new_lemma& new_lemma::explain_existing_lower_bound(lpvar j) { lp::explanation ex; c.lra.push_explanation(c.lra.get_column_lower_bound_witness(j), ex); *this &= ex; - TRACE("nla_solver", tout << j << ": " << *this << "\n";); + TRACE(nla_solver, tout << j << ": " << *this << "\n";); return *this; } @@ -1236,7 +1236,7 @@ bool core::var_breaks_correct_monic_as_factor(lpvar j, const monic& m) const { bool core::var_breaks_correct_monic(lpvar j) const { if (is_monic_var(j) && !m_to_refine.contains(j)) { - TRACE("nla_solver", tout << "j = " << j << ", m = "; print_monic(emon(j), tout) << "\n";); + TRACE(nla_solver, tout << "j = " << j << ", m = "; print_monic(emon(j), tout) << "\n";); return true; // changing the value of a correct monic } @@ -1297,30 +1297,30 @@ bool core::has_real(const monic& m) const { // returns true if the patching is blocking bool core::is_patch_blocked(lpvar u, const lp::impq& ival) const { - TRACE("nla_solver", tout << "u = " << u << '\n';); + TRACE(nla_solver, tout << "u = " << u << '\n';); if (m_cautious_patching && (!lra.inside_bounds(u, ival) || (var_is_int(u) && ival.is_int() == false))) { - TRACE("nla_solver", tout << "u = " << u << " blocked, for feas or integr\n";); + TRACE(nla_solver, tout << "u = " << u << " blocked, for feas or integr\n";); return true; // block } if (u == m_patched_var) { - TRACE("nla_solver", tout << "u == m_patched_var, no block\n";); + TRACE(nla_solver, tout << "u == m_patched_var, no block\n";); return false; // do not block } // we can change only one variable in variables of m_patched_var if (m_patched_monic->contains_var(u) || u == var(*m_patched_monic)) { - TRACE("nla_solver", tout << "u = " << u << " blocked as contained\n";); + TRACE(nla_solver, tout << "u = " << u << " blocked as contained\n";); return true; // block } if (var_breaks_correct_monic(u)) { - TRACE("nla_solver", tout << "u = " << u << " blocked as used in a correct monomial\n";); + TRACE(nla_solver, tout << "u = " << u << " blocked as used in a correct monomial\n";); return true; } - TRACE("nla_solver", tout << "u = " << u << ", m_patched_m = "; print_monic(*m_patched_monic, tout) << + TRACE(nla_solver, tout << "u = " << u << ", m_patched_m = "; print_monic(*m_patched_monic, tout) << ", not blocked\n";); return false; @@ -1343,7 +1343,7 @@ bool core::to_refine_is_correct() const { if (!is_monic_var(j)) continue; bool valid = check_monic(emon(j)); if (valid == m_to_refine.contains(j)) { - TRACE("nla_solver", tout << "inconstency in m_to_refine : "; + TRACE(nla_solver, tout << "inconstency in m_to_refine : "; print_monic(emon(j), tout) << "\n"; if (valid) tout << "should NOT be in to_refine\n"; else tout << "should be in to_refine\n";); @@ -1356,7 +1356,7 @@ bool core::to_refine_is_correct() const { void core::patch_monomial(lpvar j) { m_patched_monic =& (emon(j)); m_patched_var = j; - TRACE("nla_solver", tout << "m = "; print_monic(*m_patched_monic, tout) << "\n";); + TRACE(nla_solver, tout << "m = "; print_monic(*m_patched_monic, tout) << "\n";); rational v = mul_val(*m_patched_monic); if (val(j) == v) { erase_from_to_refine(j); @@ -1368,18 +1368,18 @@ void core::patch_monomial(lpvar j) { } // We could not patch j, now we try patching the factor variables. - TRACE("nla_solver", tout << " trying squares\n";); + TRACE(nla_solver, tout << " trying squares\n";); // handle perfect squares if ((*m_patched_monic).vars().size() == 2 && (*m_patched_monic).vars()[0] == (*m_patched_monic).vars()[1]) { rational root; if (v.is_perfect_square(root)) { m_patched_var = (*m_patched_monic).vars()[0]; if (!var_breaks_correct_monic(m_patched_var) && (try_to_patch(root) || try_to_patch(-root))) { - TRACE("nla_solver", tout << "patched square\n";); + TRACE(nla_solver, tout << "patched square\n";); return; } } - TRACE("nla_solver", tout << " cannot patch\n";); + TRACE(nla_solver, tout << " cannot patch\n";); return; } @@ -1388,13 +1388,13 @@ void core::patch_monomial(lpvar j) { if (!v.is_zero()) { rational r = val(j) / v; SASSERT((*m_patched_monic).is_sorted()); - TRACE("nla_solver", tout << "r = " << r << ", v = " << v << "\n";); + TRACE(nla_solver, tout << "r = " << r << ", v = " << v << "\n";); for (unsigned l = 0; l < (*m_patched_monic).size(); l++) { m_patched_var = (*m_patched_monic).vars()[l]; if (!in_power((*m_patched_monic).vars(), l) && !var_breaks_correct_monic(m_patched_var) && try_to_patch(r * val(m_patched_var))) { // r * val(k) gives the right value of k - TRACE("nla_solver", tout << "patched " << m_patched_var << "\n";); + TRACE(nla_solver, tout << "patched " << m_patched_var << "\n";); SASSERT(mul_val((*m_patched_monic)) == val(j)); erase_from_to_refine(j); break; @@ -1415,7 +1415,7 @@ void core::patch_monomials_on_to_refine() { for (unsigned i = 0; i < sz && !m_to_refine.empty(); i++) patch_monomial(to_refine[(start + i) % sz]); - TRACE("nla_solver", tout << "sz = " << sz << ", m_to_refine = " << m_to_refine.size() << + TRACE(nla_solver, tout << "sz = " << sz << ", m_to_refine = " << m_to_refine.size() << (sz > m_to_refine.size()? " less" : " same" ) << "\n";); } @@ -1471,7 +1471,7 @@ void core::add_bounds() { m_emons.set_bound_propagated(m); // split the free variable (j <= 0, or j > 0), and return m_literals.push_back(ineq(j, lp::lconstraint_kind::EQ, rational::zero())); - TRACE("nla_solver", print_ineq(m_literals.back(), tout) << "\n"); + TRACE(nla_solver, print_ineq(m_literals.back(), tout) << "\n"); ++lp_settings().stats().m_nla_add_bounds; return; } @@ -1480,11 +1480,11 @@ void core::add_bounds() { lbool core::check() { lp_settings().stats().m_nla_calls++; - TRACE("nla_solver", tout << "calls = " << lp_settings().stats().m_nla_calls << "\n";); + TRACE(nla_solver, tout << "calls = " << lp_settings().stats().m_nla_calls << "\n";); lra.get_rid_of_inf_eps(); if (!(lra.get_status() == lp::lp_status::OPTIMAL || lra.get_status() == lp::lp_status::FEASIBLE)) { - TRACE("nla_solver", tout << "unknown because of the lra.m_status = " << lra.get_status() << "\n";); + TRACE(nla_solver, tout << "unknown because of the lra.m_status = " << lra.get_status() << "\n";); return l_undef; } @@ -1567,9 +1567,9 @@ lbool core::check() { lp_settings().stats().m_nla_lemmas += m_lemmas.size(); - TRACE("nla_solver", tout << "ret = " << ret << ", lemmas count = " << m_lemmas.size() << "\n";); + TRACE(nla_solver, tout << "ret = " << ret << ", lemmas count = " << m_lemmas.size() << "\n";); IF_VERBOSE(5, if(ret == l_undef) {verbose_stream() << "Monomials\n"; print_monics(verbose_stream());}); - CTRACE("nla_solver", ret == l_undef, tout << "Monomials\n"; print_monics(tout);); + CTRACE(nla_solver, ret == l_undef, tout << "Monomials\n"; print_monics(tout);); return ret; } @@ -1610,7 +1610,7 @@ lbool core::bounded_nlsat() { bool core::no_lemmas_hold() const { for (auto & l : m_lemmas) { if (lemma_holds(l)) { - TRACE("nla_solver", print_lemma(l, tout);); + TRACE(nla_solver, print_lemma(l, tout);); return false; } } diff --git a/src/math/lp/nla_grobner.cpp b/src/math/lp/nla_grobner.cpp index 234b56efa..6cf57c551 100644 --- a/src/math/lp/nla_grobner.cpp +++ b/src/math/lp/nla_grobner.cpp @@ -102,7 +102,7 @@ namespace nla { for (auto eq : m_solver.equations()) { if (is_conflicting(*eq)) { lp_settings().stats().m_grobner_conflicts++; - TRACE("grobner", m_solver.display(tout)); + TRACE(grobner, m_solver.display(tout)); IF_VERBOSE(3, verbose_stream() << "grobner conflict\n"); return true; } @@ -229,7 +229,7 @@ namespace nla { m_solver.reset(); try { set_level2var(); - TRACE("grobner", + TRACE(grobner, tout << "base vars: "; for (lpvar j : c().active_var_set()) if (lra.is_base(j)) @@ -247,7 +247,7 @@ namespace nla { IF_VERBOSE(2, verbose_stream() << "pdd throw\n"); return false; } - TRACE("grobner", m_solver.display(tout)); + TRACE(grobner, m_solver.display(tout)); #if 0 IF_VERBOSE(2, m_pdd_grobner.display(verbose_stream())); @@ -323,7 +323,7 @@ namespace nla { scoped_dep_interval i(di), i_wd(di); evali.get_interval(e.poly(), i); if (!di.separated_from_zero(i)) { - TRACE("grobner", m_solver.display(tout << "not separated from 0 ", e) << "\n"; + TRACE(grobner, m_solver.display(tout << "not separated from 0 ", e) << "\n"; evali.get_interval_distributed(e.poly(), i); tout << "separated from 0: " << di.separated_from_zero(i) << "\n"; for (auto j : e.poly().free_vars()) { @@ -348,7 +348,7 @@ namespace nla { lemma &= e; }; if (di.check_interval_for_conflict_on_zero(i_wd, e.dep(), f)) { - TRACE("grobner", m_solver.display(tout << "conflict ", e) << "\n"); + TRACE(grobner, m_solver.display(tout << "conflict ", e) << "\n"); return true; } else { @@ -356,7 +356,7 @@ namespace nla { if (add_nla_conflict(e)) return true; #endif - TRACE("grobner", m_solver.display(tout << "no conflict ", e) << "\n"); + TRACE(grobner, m_solver.display(tout << "no conflict ", e) << "\n"); return false; } } @@ -439,7 +439,7 @@ namespace nla { // a free column over the reals can be assigned if (lra.column_is_free(k) && k != j && !lra.var_is_int(k)) continue; - CTRACE("grobner", matrix.m_rows[row].size() > c().params().arith_nl_grobner_row_length_limit(), + CTRACE(grobner, matrix.m_rows[row].size() > c().params().arith_nl_grobner_row_length_limit(), tout << "ignore the row " << row << " with the size " << matrix.m_rows[row].size() << "\n";); // limits overhead of grobner equations, unless this is for extracting a complete COI of the non-satisfied subset. if (!m_add_all_eqs && matrix.m_rows[row].size() > c().params().arith_nl_horner_row_length_limit()) @@ -564,14 +564,14 @@ namespace nla { dd::pdd sum = m_pdd_manager.mk_val(rational(0)); for (const auto &p : row) sum += pdd_expr(p.coeff(), p.var(), dep); - TRACE("grobner", c().print_row(row, tout) << " " << sum << "\n"); + TRACE(grobner, c().print_row(row, tout) << " " << sum << "\n"); add_eq(sum, dep); } void grobner::find_nl_cluster() { prepare_rows_and_active_vars(); svector q; - TRACE("grobner", for (lpvar j : c().m_to_refine) print_monic(c().emons()[j], tout) << "\n";); + TRACE(grobner, for (lpvar j : c().m_to_refine) print_monic(c().emons()[j], tout) << "\n";); for (lpvar j : c().m_to_refine) q.push_back(j); @@ -581,7 +581,7 @@ namespace nla { q.pop_back(); add_var_and_its_factors_to_q_and_collect_new_rows(j, q); } - TRACE("grobner", tout << "vars in cluster: "; + TRACE(grobner, tout << "vars in cluster: "; for (lpvar j : c().active_var_set()) tout << "j" << j << " "; tout << "\n"; display_matrix_of_m_rows(tout); ); @@ -630,7 +630,7 @@ namespace nla { m_pdd_manager.reset(l2v); - TRACE("grobner", + TRACE(grobner, for (auto v : sorted_vars) tout << "j" << v << " w:" << weighted_vars[v] << " "; tout << "\n"); @@ -698,13 +698,13 @@ namespace nla { void grobner::check_missing_propagation(const dd::solver::equation& e) { bool is_confl = is_nla_conflict(e); - CTRACE("grobner", is_confl, m_solver.display(tout << "missed conflict ", e);); + CTRACE(grobner, is_confl, m_solver.display(tout << "missed conflict ", e);); if (is_confl) { IF_VERBOSE(2, verbose_stream() << "missed conflict\n"); return; } //lbool r = c().m_nra.check_tight(e.poly()); - //CTRACE("grobner", r == l_false, m_solver.display(tout << "tight equality ", e);); + //CTRACE(grobner, r == l_false, m_solver.display(tout << "tight equality ", e);); } diff --git a/src/math/lp/nla_intervals.cpp b/src/math/lp/nla_intervals.cpp index 791251fee..27fb8b2ce 100644 --- a/src/math/lp/nla_intervals.cpp +++ b/src/math/lp/nla_intervals.cpp @@ -101,13 +101,13 @@ bool intervals::check_nex(const nex* n, u_dependency* initial_deps) { } scoped_dep_interval interv_wd(get_dep_intervals()); interval_of_expr(n, 1, interv_wd, f); - TRACE("nla_intervals", display_separating_interval(tout, n, interv_wd, initial_deps);); + TRACE(nla_intervals, display_separating_interval(tout, n, interv_wd, initial_deps);); m_dep_intervals.check_interval_for_conflict_on_zero(interv_wd, initial_deps, f); return true; } void intervals::add_mul_of_degree_one_to_vector(const nex_mul* e, vector> &v) { - TRACE("nla_intervals_details", tout << *e << "\n";); + TRACE(nla_intervals_details, tout << *e << "\n";); SASSERT(e->size() == 1); SASSERT((*e)[0].pow() == 1); const nex *ev = (*e)[0].e(); @@ -116,7 +116,7 @@ void intervals::add_mul_of_degree_one_to_vector(const nex_mul* e, vector> &v) { - TRACE("nla_intervals_details", tout << *e << "\n";); + TRACE(nla_intervals_details, tout << *e << "\n";); switch (e->type()) { case expr_type::MUL: add_mul_of_degree_one_to_vector(to_mul(e), v); @@ -132,7 +132,7 @@ void intervals::add_linear_to_vector(const nex* e, vector> v; b = rational(0); @@ -150,7 +150,7 @@ lp::lar_term intervals::expression_to_normalized_term(const nex_sum* e, rational } } } - TRACE("nla_intervals_details", tout << "a_index = " << a_index << ", v="; print_vector(v, tout) << "\n";); + TRACE(nla_intervals_details, tout << "a_index = " << a_index << ", v="; print_vector(v, tout) << "\n";); a = v[a_index].first; lp::lar_term t; @@ -167,7 +167,7 @@ lp::lar_term intervals::expression_to_normalized_term(const nex_sum* e, rational t.add_var(p.second); } } - TRACE("nla_intervals_details", tout << a << "* ("; + TRACE(nla_intervals_details, tout << a << "* ("; lp::lar_solver::print_term_as_indices(t, tout) << ") + " << b << std::endl;); SASSERT(t.is_normalized()); return t; @@ -244,7 +244,7 @@ std::ostream& intervals::display(std::ostream& out, const interval& i) const { template void intervals::set_var_interval(lpvar v, interval& b) { - TRACE("nla_intervals_details", m_core->print_var(v, tout) << "\n";); + TRACE(nla_intervals_details, m_core->print_var(v, tout) << "\n";); u_dependency* dep = nullptr; rational val; bool is_strict; @@ -285,7 +285,7 @@ bool intervals::interval_from_term(const nex& e, scoped_dep_interval& i) { } i.get().m_upper_dep = i.get().m_lower_dep; } - TRACE("nla_intervals", tout << "explain_by_equiv\n";); + TRACE(nla_intervals, tout << "explain_by_equiv\n";); return true; } lpvar j = find_term_column(norm_t, a); @@ -298,7 +298,7 @@ bool intervals::interval_from_term(const nex& e, scoped_dep_interval& i) { m_dep_intervals.add(b, bi); m_dep_intervals.set(i, bi); - TRACE("nla_intervals", + TRACE(nla_intervals, m_core->lra.print_column_info(j, tout) << "\n"; tout << "a=" << a << ", b=" << b << "\n"; tout << e << ", interval = "; display(tout, i);); @@ -315,20 +315,20 @@ bool intervals::interval_of_sum_no_term(const nex_sum& e, scoped_dep_interval & if (!interval_of_expr(e[0], 1, sdi, f)) return false; for (unsigned k = 1; k < e.size(); k++) { - TRACE("nla_intervals_details", tout << "e[" << k << "]= " << *e[k] << "\n";); + TRACE(nla_intervals_details, tout << "e[" << k << "]= " << *e[k] << "\n";); scoped_dep_interval b(get_dep_intervals()); if (!interval_of_expr(e[k], 1, b, f)) { return false; } scoped_dep_interval c(get_dep_intervals()); - TRACE("nla_intervals_details", tout << "sdi = "; display(tout, sdi) << "\nb = "; display(tout, b) << "\n";); + TRACE(nla_intervals_details, tout << "sdi = "; display(tout, sdi) << "\nb = "; display(tout, b) << "\n";); m_dep_intervals.add(sdi, b, c); m_dep_intervals.set(sdi, c); - TRACE("nla_intervals_details", tout << *e[k] << ", "; + TRACE(nla_intervals_details, tout << *e[k] << ", "; display(tout, sdi); tout << "\n";); } - TRACE("nla_intervals_details", tout << "e=" << e << "\n"; + TRACE(nla_intervals_details, tout << "e=" << e << "\n"; tout << " interv = "; display(tout, sdi);); return true; // no conflict } @@ -355,21 +355,21 @@ bool intervals::conflict_u_l(const interval& a, const interval& b) const { template bool intervals::interval_of_sum(const nex_sum& e, scoped_dep_interval& a, const std::function& f) { - TRACE("nla_intervals_details", tout << "e=" << e << "\n";); + TRACE(nla_intervals_details, tout << "e=" << e << "\n";); if(! interval_of_sum_no_term(e, a, f)) { return false; } - TRACE("nla_intervals_details", tout << "a = "; display(tout, a);); + TRACE(nla_intervals_details, tout << "a = "; display(tout, a);); if (e.is_a_linear_term()) { SASSERT(e.is_sum() && e.size() > 1); scoped_dep_interval i_from_term(get_dep_intervals()); if (interval_from_term(e, i_from_term)) { scoped_dep_interval r(get_dep_intervals()); m_dep_intervals.intersect(a, i_from_term, r); - TRACE("nla_intervals_details", tout << "intersection="; display(tout, r) << "\n";); + TRACE(nla_intervals_details, tout << "intersection="; display(tout, r) << "\n";); if (m_dep_intervals.is_empty(r)) { - TRACE("nla_intervals_details", tout << "empty\n";); + TRACE(nla_intervals_details, tout << "empty\n";); if (wd == e_with_deps::with_deps) { T expl; if (conflict_u_l(a, i_from_term)) { @@ -395,7 +395,7 @@ bool intervals::interval_of_sum(const nex_sum& e, scoped_dep_interval& a, const template bool intervals::interval_of_mul(const nex_mul& e, scoped_dep_interval& a, const std::function& f) { - TRACE("nla_intervals_details", tout << "e = " << e << "\n";); + TRACE(nla_intervals_details, tout << "e = " << e << "\n";); const nex* zero_interval_child = get_zero_interval_child(e); if (zero_interval_child) { bool r = interval_of_expr(zero_interval_child, 1, a, f); @@ -403,25 +403,25 @@ bool intervals::interval_of_mul(const nex_mul& e, scoped_dep_interval& a, const (void)r; if(wd == e_with_deps::with_deps) set_zero_interval_deps_for_mult(a); - TRACE("nla_intervals_details", tout << "zero_interval_child = " << *zero_interval_child << std::endl << "a = "; display(tout, a); ); + TRACE(nla_intervals_details, tout << "zero_interval_child = " << *zero_interval_child << std::endl << "a = "; display(tout, a); ); return true; // regural calculation: no conflict } m_dep_intervals.set_interval_for_scalar(a, e.coeff()); - TRACE("nla_intervals_details", tout << "a = "; display(tout, a); ); + TRACE(nla_intervals_details, tout << "a = "; display(tout, a); ); for (const auto& ep : e) { scoped_dep_interval b(get_dep_intervals()); if (!interval_of_expr(ep.e(), ep.pow(), b, f)) return false; - TRACE("nla_intervals_details", tout << "ep = " << ep << ", "; display(tout, b); ); + TRACE(nla_intervals_details, tout << "ep = " << ep << ", "; display(tout, b); ); scoped_dep_interval c(get_dep_intervals()); m_dep_intervals.mul(a, b, c); - TRACE("nla_intervals_details", tout << "a "; display(tout, a);); - TRACE("nla_intervals_details", tout << "c "; display(tout, c);); + TRACE(nla_intervals_details, tout << "a "; display(tout, a);); + TRACE(nla_intervals_details, tout << "c "; display(tout, c);); m_dep_intervals.set(a, c); - TRACE("nla_intervals_details", tout << "part mult "; display(tout, a);); + TRACE(nla_intervals_details, tout << "part mult "; display(tout, a);); } - TRACE("nla_intervals_details", tout << "e=" << e << "\n"; + TRACE(nla_intervals_details, tout << "e=" << e << "\n"; tout << " return "; display(tout, a);); return true; } @@ -465,7 +465,7 @@ bool intervals::interval_of_expr(const nex* e, unsigned p, scoped_dep_interval& } break; default: - TRACE("nla_intervals_details", tout << e->type() << "\n";); + TRACE(nla_intervals_details, tout << e->type() << "\n";); UNREACHABLE(); } return true; // no conflict diff --git a/src/math/lp/nla_order_lemmas.cpp b/src/math/lp/nla_order_lemmas.cpp index 902e208fc..fb47fefcc 100644 --- a/src/math/lp/nla_order_lemmas.cpp +++ b/src/math/lp/nla_order_lemmas.cpp @@ -18,9 +18,9 @@ typedef lp::lar_term term; // The order lemma is // a > b && c > 0 => ac > bc void order::order_lemma() { - TRACE("nla_solver", ); + TRACE(nla_solver, ); if (!c().params().arith_nl_order()) { - TRACE("nla_solver", tout << "not generating order lemmas\n";); + TRACE(nla_solver, tout << "not generating order lemmas\n";); return; } @@ -38,7 +38,7 @@ void order::order_lemma() { // Consider here some binary factorizations of m=ac and // try create order lemmas with either factor playing the role of c. void order::order_lemma_on_monic(const monic& m) { - TRACE("nla_solver_details", + TRACE(nla_solver_details, tout << "m = " << pp_mon(c(), m);); for (auto ac : factorization_factory_imp(m, _())) { if (ac.size() != 2) @@ -56,7 +56,7 @@ void order::order_lemma_on_monic(const monic& m) { // a > b && c > 0 => ac > bc, // with either variable of ac playing the role of c void order::order_lemma_on_binomial(const monic& ac) { - TRACE("nla_solver", tout << pp_mon_with_vars(c(), ac);); + TRACE(nla_solver, tout << pp_mon_with_vars(c(), ac);); SASSERT(!check_monic(ac) && ac.size() == 2); const rational mult_val = mul_val(ac); const rational acv = var_val(ac); @@ -93,14 +93,14 @@ void order::order_lemma_on_binomial_sign(const monic& xy, lpvar x, lpvar y, int // We look for monics e = m.rvars()[k]*d and see if we can create an order lemma for m and e void order::order_lemma_on_factor_binomial_explore(const monic& ac, bool k) { - TRACE("nla_solver", tout << "ac = " << pp_mon_with_vars(c(), ac);); + TRACE(nla_solver, tout << "ac = " << pp_mon_with_vars(c(), ac);); SASSERT(ac.size() == 2); lpvar c = ac.vars()[k]; for (monic const& bd : _().emons().get_products_of(c)) { if (bd.var() == ac.var()) continue; - TRACE("nla_solver", tout << "bd = " << pp_mon_with_vars(_(), bd);); + TRACE(nla_solver, tout << "bd = " << pp_mon_with_vars(_(), bd);); order_lemma_on_factor_binomial_rm(ac, k, bd); if (done()) break; @@ -110,7 +110,7 @@ void order::order_lemma_on_factor_binomial_explore(const monic& ac, bool k) { // ac is a binomial // create order lemma on monics bd where d is equivalent to ac[k] void order::order_lemma_on_factor_binomial_rm(const monic& ac, bool k, const monic& bd) { - TRACE("nla_solver", + TRACE(nla_solver, tout << "ac=" << pp_mon_with_vars(_(), ac) << "\n"; tout << "k=" << k << "\n"; tout << "bd=" << pp_mon_with_vars(_(), bd) << "\n"; @@ -126,7 +126,7 @@ void order::order_lemma_on_factor_binomial_rm(const monic& ac, bool k, const mon void order::order_lemma_on_binomial_ac_bd(const monic& ac, bool k, const monic& bd, const factor& b, lpvar d) { lpvar a = ac.vars()[!k]; lpvar c = ac.vars()[k]; - TRACE("nla_solver", + TRACE(nla_solver, tout << "ac = " << pp_mon(_(), ac) << "a = " << pp_var(_(), a) << "c = " << pp_var(_(), c) << "\nbd = " << pp_mon(_(), bd) << "b = " << pp_fac(_(), b) << "d = " << pp_var(_(), d) << "\n"; ); SASSERT(_().m_evars.find(c).var() == d); @@ -138,7 +138,7 @@ void order::order_lemma_on_binomial_ac_bd(const monic& ac, bool k, const monic& rational bv = val(b); // Notice that ac/|c| = a*c_sign , and bd/|d| = b*d_sign auto av_c_s = av*c_sign; auto bv_d_s = bv*d_sign; - TRACE("nla_solver", + TRACE(nla_solver, tout << "acv = " << acv << ", av = " << av << ", c_sign = " << c_sign << ", d_sign = " << d_sign << ", bdv = " << bdv << "\nbv = " << bv << ", av_c_s = " << av_c_s << ", bv_d_s = " << bv_d_s << "\n";); @@ -187,7 +187,7 @@ bool order::order_lemma_on_ac_and_bc(const monic& rm_ac, const factorization& ac_f, bool k, const monic& rm_bd) { - TRACE("nla_solver", + TRACE(nla_solver, tout << "rm_ac = " << pp_mon_with_vars(_(), rm_ac) << "\n"; tout << "rm_bd = " << pp_mon_with_vars(_(), rm_bd) << "\n"; tout << "ac_f[k] = "; @@ -209,7 +209,7 @@ void order::order_lemma_on_factorization(const monic& m, const factorization& ab const rational rsign = sign_to_rat(sign); const rational fv = val(var(ab[0])) * val(var(ab[1])); const rational mv = rsign * var_val(m); - TRACE("nla_solver", + TRACE(nla_solver, tout << "ab.size()=" << ab.size() << "\n"; tout << "we should have mv =" << mv << " = " << fv << " = fv\n"; tout << "m = "; _().print_monic_with_vars(m, tout); tout << "\nab ="; _().print_factorization(ab, tout);); @@ -230,9 +230,9 @@ void order::order_lemma_on_factorization(const monic& m, const factorization& ab void order::order_lemma_on_ac_explore(const monic& rm, const factorization& ac, bool k) { const factor c = ac[k]; - TRACE("nla_solver", tout << "c = "; _().print_factor_with_vars(c, tout); ); + TRACE(nla_solver, tout << "c = "; _().print_factor_with_vars(c, tout); ); if (c.is_var()) { - TRACE("nla_solver", tout << "var(c) = " << var(c);); + TRACE(nla_solver, tout << "var(c) = " << var(c);); for (monic const& bc : _().emons().get_use_list(c.var())) { if (order_lemma_on_ac_and_bc(rm, ac, k, bc)) return; @@ -278,7 +278,7 @@ void order::generate_ol(const monic& ac, const factor& b) { new_lemma lemma(_(), __FUNCTION__); - TRACE("nla_solver", _().trace_print_ol(ac, a, c, bc, b, tout);); + TRACE(nla_solver, _().trace_print_ol(ac, a, c, bc, b, tout);); IF_VERBOSE(10, verbose_stream() << var_val(ac) << "(" << mul_val(ac) << "): " << ac << " " << var_val(bc) << "(" << mul_val(bc) << "): " << bc << "\n" << " a " << "*v" << var(a) << " " << val(a) << "\n" @@ -344,7 +344,7 @@ void order::order_lemma_on_ab_gt(new_lemma& lemma, const monic& m, const rationa lemma b != val(b) || sign*m >= a*val(b) */ void order::order_lemma_on_ab_lt(new_lemma& lemma, const monic& m, const rational& sign, lpvar a, lpvar b) { - TRACE("nla_solver", tout << "sign = " << sign << ", m = "; c().print_monic(m, tout) << ", a = "; c().print_var(a, tout) << + TRACE(nla_solver, tout << "sign = " << sign << ", m = "; c().print_monic(m, tout) << ", a = "; c().print_var(a, tout) << ", b = "; c().print_var(b, tout) << "\n";); SASSERT(sign * var_val(m) < val(a) * val(b)); // negate b == val(b) diff --git a/src/math/lp/nla_powers.cpp b/src/math/lp/nla_powers.cpp index d7804c8fc..b934ad16a 100644 --- a/src/math/lp/nla_powers.cpp +++ b/src/math/lp/nla_powers.cpp @@ -79,7 +79,7 @@ am().set(rval, am_value(r)); namespace nla { lbool powers::check(lpvar r, lpvar x, lpvar y, vector& lemmas) { - TRACE("nla", tout << r << " == " << x << "^" << y << "\n"); + TRACE(nla, tout << r << " == " << x << "^" << y << "\n"); core& c = m_core; if (x == null_lpvar || y == null_lpvar || r == null_lpvar) return l_undef; diff --git a/src/math/lp/nla_tangent_lemmas.cpp b/src/math/lp/nla_tangent_lemmas.cpp index 56ebbfacc..ff4b6f93c 100644 --- a/src/math/lp/nla_tangent_lemmas.cpp +++ b/src/math/lp/nla_tangent_lemmas.cpp @@ -50,7 +50,7 @@ public: void operator()() { get_points(); - TRACE("nla_solver", print_tangent_domain(tout << "tang domain = ") << std::endl;); + TRACE(nla_solver, print_tangent_domain(tout << "tang domain = ") << std::endl;); generate_line1(); generate_line2(); generate_plane(m_a); @@ -113,7 +113,7 @@ private: rational delta = rational(1); if (!all_ints ) delta = std::min(delta, abs(m_correct_v - m_v)); - TRACE("nla_solver", tout << "delta = " << delta << "\n";); + TRACE(nla_solver, tout << "delta = " << delta << "\n";); if (!m_below){ m_a = point(x - delta, y + delta); m_b = point(x + delta, y - delta); @@ -140,9 +140,9 @@ private: while (steps-- && !c().done()) { del *= rational(2); point na = m_xy + del; - TRACE("nla_solver_tp", tout << "del = " << del << std::endl;); + TRACE(nla_solver_tp, tout << "del = " << del << std::endl;); if (!plane_is_correct_cut(na)) { - TRACE("nla_solver_tp", tout << "exit\n";); + TRACE(nla_solver_tp, tout << "exit\n";); return; } a = na; @@ -155,11 +155,11 @@ private: void get_points() { get_initial_points(); - TRACE("nla_solver", tout << "xy = " << m_xy << ", correct val = " << m_correct_v; + TRACE(nla_solver, tout << "xy = " << m_xy << ", correct val = " << m_correct_v; print_tangent_domain(tout << "\ntang points:") << std::endl;); push_point(m_a); push_point(m_b); - TRACE("nla_solver", + TRACE(nla_solver, tout << "pushed a = " << m_a << std::endl << "pushed b = " << m_b << std::endl << "tang_plane(a) = " << tang_plane(m_a) << " , val = " << m_a << ", " @@ -171,7 +171,7 @@ private: } bool plane_is_correct_cut(const point& plane) const { - TRACE("nla_solver", tout << "plane = " << plane << "\n"; + TRACE(nla_solver, tout << "plane = " << plane << "\n"; tout << "tang_plane() = " << tang_plane(plane) << ", v = " << m_v << ", correct_v = " << m_correct_v << "\n";); SASSERT((m_below && m_v < m_correct_v) || ((!m_below) && m_v > m_correct_v)); diff --git a/src/math/lp/nra_solver.cpp b/src/math/lp/nra_solver.cpp index be4395f0e..360378e78 100644 --- a/src/math/lp/nra_solver.cpp +++ b/src/math/lp/nra_solver.cpp @@ -160,7 +160,7 @@ struct solver::imp { for (unsigned i : m_term_set) add_term(i); - TRACE("nra", m_nlsat->display(tout)); + TRACE(nra, m_nlsat->display(tout)); smt_params_helper p(m_params); if (p.arith_nl_log()) { @@ -194,7 +194,7 @@ struct solver::imp { } } m_nlsat->collect_statistics(st); - TRACE("nra", + TRACE(nra, m_nlsat->display(tout << r << "\n"); display(tout); for (auto [j, x] : m_lp2nl) tout << "j" << j << " := x" << x << "\n";); @@ -224,7 +224,7 @@ struct solver::imp { for (auto c : core) { unsigned idx = static_cast(static_cast(c) - this); ex.push_back(idx); - TRACE("nra", lra.display_constraint(tout << "ex: " << idx << ": ", idx) << "\n";); + TRACE(nra, lra.display_constraint(tout << "ex: " << idx << ": ", idx) << "\n";); } nla::new_lemma lemma(m_nla_core, __FUNCTION__); lemma &= ex; diff --git a/src/math/lp/random_updater_def.h b/src/math/lp/random_updater_def.h index 861068106..92e389d8f 100644 --- a/src/math/lp/random_updater_def.h +++ b/src/math/lp/random_updater_def.h @@ -34,7 +34,7 @@ random_updater::random_updater( m_range(100000) { for (unsigned j : column_indices) m_var_set.insert(j); - TRACE("lar_solver_rand", tout << "size = " << m_var_set.size() << "\n";); + TRACE(lar_solver_rand, tout << "size = " << m_var_set.size() << "\n";); } @@ -62,7 +62,7 @@ void random_updater::update() { } for (auto j : columns) { if (!m_var_set.contains(j)) { - TRACE("lar_solver_rand", tout << "skipped " << j << "\n";); + TRACE(lar_solver_rand, tout << "skipped " << j << "\n";); continue; } if (!m_lar_solver.is_base(j)) @@ -78,7 +78,7 @@ void random_updater::update() { } } } - TRACE("lar_solver_rand", tout << "m_var_set.size() = " << m_var_set.size() << "\n";); + TRACE(lar_solver_rand, tout << "m_var_set.size() = " << m_var_set.size() << "\n";); } } diff --git a/src/math/lp/var_eqs.h b/src/math/lp/var_eqs.h index b2b3f24cf..223b0d81b 100644 --- a/src/math/lp/var_eqs.h +++ b/src/math/lp/var_eqs.h @@ -116,7 +116,7 @@ public: unsigned max_i = std::max(v1.index(), v2.index()) + 2; m_eqs.reserve(max_i); while (m_uf.get_num_vars() <= max_i) m_uf.mk_var(); - TRACE("nla_solver_mons", tout << v1 << " == " << v2 << " " << m_uf.find(v1.index()) << " == " << m_uf.find(v2.index()) << "\n";); + TRACE(nla_solver_mons, tout << v1 << " == " << v2 << " " << m_uf.find(v1.index()) << " == " << m_uf.find(v2.index()) << "\n";); m_trail.push_back(std::make_pair(v1, v2)); m_uf.merge(v1.index(), v2.index()); m_uf.merge((~v1).index(), (~v2).index()); diff --git a/src/math/polynomial/algebraic_numbers.cpp b/src/math/polynomial/algebraic_numbers.cpp index 6cdd735a1..8024c38e4 100644 --- a/src/math/polynomial/algebraic_numbers.cpp +++ b/src/math/polynomial/algebraic_numbers.cpp @@ -287,7 +287,7 @@ namespace algebraic_numbers { return true; if (a.to_algebraic()->m_not_rational) return false; // we know for sure a is not a rational - TRACE("algebraic_bug", tout << "is_rational(a):\n"; display_root(tout, a); tout << "\n"; display_interval(tout, a); tout << "\n";); + TRACE(algebraic_bug, tout << "is_rational(a):\n"; display_root(tout, a); tout << "\n"; display_interval(tout, a); tout << "\n";); algebraic_cell * c = a.to_algebraic(); save_intervals saved_a(*this, a); mpz & a_n = c->m_p[c->m_p_sz - 1]; @@ -299,7 +299,7 @@ namespace algebraic_numbers { unsigned k = qm().log2(abs_a_n); k++; - TRACE("algebraic_bug", tout << "abs(an): " << qm().to_string(abs_a_n) << ", k: " << k << "\n";); + TRACE(algebraic_bug, tout << "abs(an): " << qm().to_string(abs_a_n) << ", k: " << k << "\n";); // make sure the isolating interval size is less than 1/2^k if (!refine_until_prec(a, k)) { @@ -307,7 +307,7 @@ namespace algebraic_numbers { return true; } - TRACE("algebraic_bug", tout << "interval after refinement: "; display_interval(tout, a); tout << "\n";); + TRACE(algebraic_bug, tout << "interval after refinement: "; display_interval(tout, a); tout << "\n";); // Find unique candidate rational in the isolating interval scoped_mpbq a_n_lower(bqm()); @@ -507,7 +507,7 @@ namespace algebraic_numbers { } SASSERT(acell_inv(*a.to_algebraic())); } - TRACE("algebraic", tout << "a: "; display_root(tout, a); tout << "\n";); + TRACE(algebraic, tout << "a: "; display_root(tout, a); tout << "\n";); } void set(numeral & a, numeral const & b) { @@ -552,7 +552,7 @@ namespace algebraic_numbers { scoped_upoly & up_sqf = m_isolate_tmp3; up_sqf.reset(); upm().square_free(up.size(), up.data(), up_sqf); - TRACE("algebraic", upm().display(tout, up_sqf.size(), up_sqf.data()); tout << "\n";); + TRACE(algebraic, upm().display(tout, up_sqf.size(), up_sqf.data()); tout << "\n";); r.push_back(up_sqf, 1); return false; } @@ -582,7 +582,7 @@ namespace algebraic_numbers { (void)c_lt_a; // (a <= b & b <= c) => a <= c // b < a or c < b or !(c < a) - CTRACE("algebraic_bug", + CTRACE(algebraic_bug, (!b_lt_a && !c_lt_b && c_lt_a), display_root(tout << "a ", a) << "\n"; display_root(tout << "b ", b) << "\n"; @@ -601,7 +601,7 @@ namespace algebraic_numbers { } void isolate_roots(scoped_upoly const & up, numeral_vector & roots) { - TRACE("algebraic", upm().display(tout, up); tout << "\n";); + TRACE(algebraic, upm().display(tout, up); tout << "\n";); if (up.empty()) return; // ignore the zero polynomial factors & fs = m_isolate_factors; @@ -622,12 +622,12 @@ namespace algebraic_numbers { upolynomial::numeral_vector const & f = fs[i]; // polynomial f contains the non zero roots unsigned d = upm().degree(f); - TRACE("algebraic", tout << "factor " << i << " degree: " << d << "\n";); + TRACE(algebraic, tout << "factor " << i << " degree: " << d << "\n";); if (d == 0) continue; // found all roots of f scoped_mpq r(qm()); if (d == 1) { - TRACE("algebraic", tout << "linear polynomial...\n";); + TRACE(algebraic, tout << "linear polynomial...\n";); // f is a linear polynomial ax + b // set r <- -b/a qm().set(r, f[0]); @@ -640,7 +640,7 @@ namespace algebraic_numbers { upm().sqf_isolate_roots(f.size(), f.data(), bqm(), m_isolate_roots, m_isolate_lowers, m_isolate_uppers); // collect rational/basic roots unsigned sz = m_isolate_roots.size(); - TRACE("algebraic", tout << "isolated roots: " << sz << "\n";); + TRACE(algebraic, tout << "isolated roots: " << sz << "\n";); for (unsigned i = 0; i < sz; i++) { to_mpq(qm(), m_isolate_roots[i], r); roots.push_back(numeral(mk_basic_cell(r))); @@ -670,7 +670,7 @@ namespace algebraic_numbers { void isolate_roots(polynomial_ref const & p, numeral_vector & roots) { SASSERT(is_univariate(p)); - TRACE("algebraic", tout << "isolating roots of: " << p << "\n";); + TRACE(algebraic, tout << "isolating roots of: " << p << "\n";); if (::is_zero(p)) return; // ignore the zero polynomial scoped_upoly & up = m_isolate_tmp1; @@ -688,7 +688,7 @@ namespace algebraic_numbers { scoped_numeral_vector roots(m_wrapper); isolate_roots(up, roots); unsigned num_roots = roots.size(); - TRACE("algebraic", tout << "num-roots: " << num_roots << "\n"; + TRACE(algebraic, tout << "num-roots: " << num_roots << "\n"; for (unsigned i = 0; i < num_roots; i++) { display_interval(tout, roots[i]); tout << "\n"; @@ -701,7 +701,7 @@ namespace algebraic_numbers { void mk_root(polynomial_ref const & p, unsigned i, numeral & r) { SASSERT(i != 0); SASSERT(is_univariate(p)); - TRACE("algebraic", tout << "isolating roots of: " << p << "\n";); + TRACE(algebraic, tout << "isolating roots of: " << p << "\n";); scoped_upoly & up = m_isolate_tmp1; upm().to_numeral_vector(p, up); mk_root(up, i, r); @@ -711,7 +711,7 @@ namespace algebraic_numbers { SASSERT(i != 0); scoped_upoly & up = m_isolate_tmp1; sexpr2upolynomial(upm(), p, up); - TRACE("algebraic", tout << "mk_root " << i << "\n"; upm().display(tout, up); tout << "\n";); + TRACE(algebraic, tout << "mk_root " << i << "\n"; upm().display(tout, up); tout << "\n";); mk_root(up, i, r); } @@ -985,13 +985,13 @@ namespace algebraic_numbers { \pre lV and uV are the sign variations (in seq) for r_i.lower() and r_i.upper() */ void set_core(numeral & c, scoped_upoly & p, mpbqi & r_i, upolynomial::scoped_upolynomial_sequence & seq, int lV, int uV, bool minimal) { - TRACE("algebraic", tout << "set_core p: "; upm().display(tout, p); tout << "\n";); + TRACE(algebraic, tout << "set_core p: "; upm().display(tout, p); tout << "\n";); if (bqim().contains_zero(r_i)) { if (upm().has_zero_roots(p.size(), p.data())) { // zero is a root of p, and r_i is an isolating interval containing zero, // then c is zero reset(c); - TRACE("algebraic", tout << "resetting\nresult: "; display_root(tout, c); tout << "\n";); + TRACE(algebraic, tout << "resetting\nresult: "; display_root(tout, c); tout << "\n";); return; } int zV = upm().sign_variations_at_zero(seq); @@ -1024,7 +1024,7 @@ namespace algebraic_numbers { set(c, r); } else { - TRACE("algebraic", tout << "set_core...\n";); + TRACE(algebraic, tout << "set_core...\n";); set(c, nz_p.size(), nz_p.data(), r_i.lower(), r_i.upper(), minimal); } } @@ -1052,14 +1052,14 @@ namespace algebraic_numbers { scoped_upoly p(upm()); scoped_upoly f(upm()); mk_poly(cell_a, cell_b, p); - TRACE("anum_mk_binary", tout << "a: "; display_root(tout, a); tout << "\nb: "; display_root(tout, b); tout << "\np: "; + TRACE(anum_mk_binary, tout << "a: "; display_root(tout, a); tout << "\nb: "; display_root(tout, b); tout << "\np: "; upm().display(tout, p); tout << "\n";); factors fs(upm()); bool full_fact = factor(p, fs); unsigned num_fs = fs.distinct_factors(); scoped_ptr_vector seqs; for (unsigned i = 0; i < num_fs; i++) { - TRACE("anum_mk_binary", tout << "factor " << i << "\n"; upm().display(tout, fs[i]); tout << "\n";); + TRACE(anum_mk_binary, tout << "factor " << i << "\n"; upm().display(tout, fs[i]); tout << "\n";); typename upolynomial::scoped_upolynomial_sequence * seq = alloc(typename upolynomial::scoped_upolynomial_sequence, upm()); upm().sturm_seq(fs[i].size(), fs[i].data(), *seq); seqs.push_back(seq); @@ -1082,11 +1082,11 @@ namespace algebraic_numbers { for (unsigned i = 0; i < num_fs; i++) { if (seqs[i] == nullptr) continue; // sequence was discarded because it does not contain the root. - TRACE("anum_mk_binary", tout << "sequence " << i << "\n"; upm().display(tout, *(seqs[i])); tout << "\n";); + TRACE(anum_mk_binary, tout << "sequence " << i << "\n"; upm().display(tout, *(seqs[i])); tout << "\n";); int lV = upm().sign_variations_at(*(seqs[i]), r_i.lower()); int uV = upm().sign_variations_at(*(seqs[i]), r_i.upper()); int V = lV - uV; - TRACE("algebraic", tout << "r_i: "; bqim().display(tout, r_i); tout << "\n"; + TRACE(algebraic, tout << "r_i: "; bqim().display(tout, r_i); tout << "\n"; tout << "lV: " << lV << ", uV: " << uV << "\n"; tout << "a.m_interval: "; bqim().display(tout, cell_a->m_interval); tout << "\n"; tout << "b.m_interval: "; bqim().display(tout, cell_b->m_interval); tout << "\n"; @@ -1108,7 +1108,7 @@ namespace algebraic_numbers { if (num_rem == 1 && target_i != UINT_MAX) { // found isolating interval - TRACE("anum_mk_binary", tout << "target_i: " << target_i << "\n";); + TRACE(anum_mk_binary, tout << "target_i: " << target_i << "\n";); saved_a.restore_if_too_small(); saved_b.restore_if_too_small(); upm().set(fs[target_i].size(), fs[target_i].data(), f); @@ -1163,7 +1163,7 @@ namespace algebraic_numbers { int lV = upm().sign_variations_at(*(seqs[i]), r_i.lower()); int uV = upm().sign_variations_at(*(seqs[i]), r_i.upper()); int V = lV - uV; - TRACE("algebraic", tout << "r_i: "; bqim().display(tout, r_i); tout << "\n"; + TRACE(algebraic, tout << "r_i: "; bqim().display(tout, r_i); tout << "\n"; tout << "lV: " << lV << ", uV: " << uV << "\n"; tout << "a.m_interval: "; bqim().display(tout, cell_a->m_interval); tout << "\n"; ); @@ -1319,7 +1319,7 @@ namespace algebraic_numbers { if (qm().root(a_val, k, r_a_val)) { // the result is rational - TRACE("root_core", tout << "r_a_val: " << r_a_val << " a_val: "; qm().display(tout, a_val); tout << "\n";); + TRACE(root_core, tout << "r_a_val: " << r_a_val << " a_val: "; qm().display(tout, a_val); tout << "\n";); set(b, r_a_val); return; } @@ -1360,7 +1360,7 @@ namespace algebraic_numbers { bqm().add(upper, mpz(1), upper); // make sure (a_val)^{1/k} < upper } SASSERT(bqm().lt(lower, upper)); - TRACE("algebraic", tout << "root_core:\n"; upm().display(tout, p.size(), p.data()); tout << "\n";); + TRACE(algebraic, tout << "root_core:\n"; upm().display(tout, p.size(), p.data()); tout << "\n";); // p is not necessarily a minimal polynomial. // So, we set the m_minimal flag to false. TODO: try to factor. set(b, p.size(), p.data(), lower, upper, false); @@ -1434,7 +1434,7 @@ namespace algebraic_numbers { template void add(algebraic_cell * a, basic_cell * b, numeral & c) { - TRACE("algebraic", tout << "adding algebraic and basic cells:\n"; + TRACE(algebraic, tout << "adding algebraic and basic cells:\n"; tout << "a: "; upm().display(tout, a->m_p_sz, a->m_p); tout << " "; bqim().display(tout, a->m_interval); tout << "\n"; tout << "b: "; qm().display(tout, b->m_value); tout << "\n";); scoped_mpq nbv(qm()); @@ -1457,18 +1457,18 @@ namespace algebraic_numbers { scoped_mpq iu(qm()); to_mpq(qm(), i.lower(), il); to_mpq(qm(), i.upper(), iu); - TRACE("algebraic", + TRACE(algebraic, tout << "nbv: " << nbv << "\n"; tout << "il: " << il << ", iu: " << iu << "\n";); qm().add(il, nbv, il); qm().add(iu, nbv, iu); // (il, iu) is an isolating refinable (rational) interval for the new polynomial. if (!upm().convert_q2bq_interval(m_add_tmp.size(), m_add_tmp.data(), il, iu, bqm(), l, u)) { - TRACE("algebraic", tout << "conversion failed\n"); + TRACE(algebraic, tout << "conversion failed\n"); } } - TRACE("algebraic", + TRACE(algebraic, upm().display(tout, m_add_tmp.size(), m_add_tmp.data()); tout << ", l: " << l << ", u: " << u << "\n"; tout << "l_sign: " << upm().eval_sign_at(m_add_tmp.size(), m_add_tmp.data(), l) << "\n"; @@ -1541,7 +1541,7 @@ namespace algebraic_numbers { } void mul(algebraic_cell * a, basic_cell * b, numeral & c) { - TRACE("algebraic", tout << "mult algebraic and basic cells:\n"; + TRACE(algebraic, tout << "mult algebraic and basic cells:\n"; tout << "a: "; upm().display(tout, a->m_p_sz, a->m_p); tout << " "; bqim().display(tout, a->m_interval); tout << "\n"; tout << "b: "; qm().display(tout, b->m_value); tout << "\n";); SASSERT(upm().eval_sign_at(a->m_p_sz, a->m_p, lower(a)) == -upm().eval_sign_at(a->m_p_sz, a->m_p, upper(a))); @@ -1568,7 +1568,7 @@ namespace algebraic_numbers { scoped_mpq iu(qm()); to_mpq(qm(), i.lower(), il); to_mpq(qm(), i.upper(), iu); - TRACE("algebraic", + TRACE(algebraic, tout << "nbv: " << nbv << "\n"; tout << "il: " << il << ", iu: " << iu << "\n";); qm().mul(il, nbv, il); @@ -1577,10 +1577,10 @@ namespace algebraic_numbers { qm().swap(il, iu); // (il, iu) is an isolating refinable (rational) interval for the new polynomial. if (!upm().convert_q2bq_interval(mulp.size(), mulp.data(), il, iu, bqm(), l, u)) { - TRACE("algebraic", tout << "conversion failed\n"); + TRACE(algebraic, tout << "conversion failed\n"); } } - TRACE("algebraic", + TRACE(algebraic, upm().display(tout, mulp.size(), mulp.data()); tout << ", l: " << l << ", u: " << u << "\n"; tout << "l_sign: " << upm().eval_sign_at(mulp.size(), mulp.data(), l) << "\n"; @@ -1679,7 +1679,7 @@ namespace algebraic_numbers { qm().inv(a.to_basic()->m_value); } else { - TRACE("algebraic_bug", tout << "before inv: "; display_root(tout, a); tout << "\n"; display_interval(tout, a); tout << "\n";); + TRACE(algebraic_bug, tout << "before inv: "; display_root(tout, a); tout << "\n"; display_interval(tout, a); tout << "\n";); algebraic_cell * cell_a = a.to_algebraic(); upm().p_1_div_x(cell_a->m_p_sz, cell_a->m_p); // convert binary rational bounds into rational bounds @@ -1690,13 +1690,13 @@ namespace algebraic_numbers { qm().inv(inv_lower); qm().inv(inv_upper); qm().swap(inv_lower, inv_upper); - TRACE("algebraic_bug", tout << "inv new_bounds: " << qm().to_string(inv_lower) << ", " << qm().to_string(inv_upper) << "\n";); + TRACE(algebraic_bug, tout << "inv new_bounds: " << qm().to_string(inv_lower) << ", " << qm().to_string(inv_upper) << "\n";); // convert isolating interval back as a binary rational bound if (!upm().convert_q2bq_interval(cell_a->m_p_sz, cell_a->m_p, inv_lower, inv_upper, bqm(), lower(cell_a), upper(cell_a))) { - TRACE("algebraic_bug", tout << "root isolation failed\n"); + TRACE(algebraic_bug, tout << "root isolation failed\n"); throw algebraic_exception("inversion of algebraic number failed"); } - TRACE("algebraic_bug", tout << "after inv: "; display_root(tout, a); tout << "\n"; display_interval(tout, a); tout << "\n";); + TRACE(algebraic_bug, tout << "after inv: "; display_root(tout, a); tout << "\n"; display_interval(tout, a); tout << "\n";); update_sign_lower(cell_a); SASSERT(acell_inv(*cell_a)); } @@ -1792,7 +1792,7 @@ namespace algebraic_numbers { return sign_zero; } - TRACE("algebraic", tout << "comparing\n"; + TRACE(algebraic, tout << "comparing\n"; tout << "a: "; upm().display(tout, cell_a->m_p_sz, cell_a->m_p); tout << "\n"; bqim().display(tout, cell_a->m_interval); tout << "\ncell_a->m_minimal: " << cell_a->m_minimal << "\n"; tout << "b: "; upm().display(tout, cell_b->m_p_sz, cell_b->m_p); tout << "\n"; bqim().display(tout, cell_b->m_interval); @@ -1893,7 +1893,7 @@ namespace algebraic_numbers { unsigned V1 = upm().sign_variations_at(seq, a_lower); unsigned V2 = upm().sign_variations_at(seq, a_upper); int V = V1 - V2; - TRACE("algebraic", tout << "comparing using sturm\n"; + TRACE(algebraic, tout << "comparing using sturm\n"; display_interval(tout, a) << "\n"; display_interval(tout, b) << "\n"; tout << "V: " << V << " V1 " << V1 << " V2 " << V2 @@ -1943,7 +1943,7 @@ namespace algebraic_numbers { } ::sign compare(numeral & a, numeral & b) { - TRACE("algebraic", tout << "comparing: "; display_interval(tout, a); tout << " "; display_interval(tout, b); tout << "\n";); + TRACE(algebraic, tout << "comparing: "; display_interval(tout, a); tout << " "; display_interval(tout, b); tout << "\n";); if (a.is_basic()) { if (b.is_basic()) return compare(basic_value(a), basic_value(b)); @@ -2058,7 +2058,7 @@ namespace algebraic_numbers { mpq const & operator()(polynomial::var x) const override { anum const & v = m_x2v(x); SASSERT(v.is_basic()); - TRACE("var2basic", tout << "getting value of x" << x << " -> " << m().to_string(m_imp.basic_value(v)) << "\n";); + TRACE(var2basic, tout << "getting value of x" << x << " -> " << m().to_string(m_imp.basic_value(v)) << "\n";); return m_imp.basic_value(v); } }; @@ -2082,7 +2082,7 @@ namespace algebraic_numbers { polynomial::var_vector m_eval_sign_vars; sign eval_sign_at(polynomial_ref const & p, polynomial::var2anum const & x2v) { polynomial::manager & ext_pm = p.m(); - TRACE("anum_eval_sign", tout << "evaluating sign of: " << p << "\n";); + TRACE(anum_eval_sign, tout << "evaluating sign of: " << p << "\n";); while (true) { bool restart = false; // Optimistic: maybe x2v contains only rational values @@ -2090,7 +2090,7 @@ namespace algebraic_numbers { opt_var2basic x2v_basic(*this, x2v); scoped_mpq r(qm()); ext_pm.eval(p, x2v_basic, r); - TRACE("anum_eval_sign", tout << "all variables are assigned to rationals, value of p: " << r << "\n";); + TRACE(anum_eval_sign, tout << "all variables are assigned to rationals, value of p: " << r << "\n";); return ::to_sign(qm().sign(r)); } catch (const opt_var2basic::failed &) { @@ -2101,7 +2101,7 @@ namespace algebraic_numbers { polynomial_ref p_prime(ext_pm); var2basic x2v_basic(*this, x2v); p_prime = ext_pm.substitute(p, x2v_basic); - TRACE("anum_eval_sign", tout << "p after eliminating rationals: " << p_prime << "\n";); + TRACE(anum_eval_sign, tout << "p after eliminating rationals: " << p_prime << "\n";); if (ext_pm.is_zero(p_prime)) { // polynomial vanished after substituting rational values. @@ -2125,7 +2125,7 @@ namespace algebraic_numbers { while (true) { checkpoint(); ext_pm.eval(p_prime, x2v_interval, ri); - TRACE("anum_eval_sign", tout << "evaluating using intervals: " << ri << "\n";); + TRACE(anum_eval_sign, tout << "evaluating using intervals: " << ri << "\n";); if (!bqim().contains_zero(ri)) { return bqim().is_pos(ri) ? sign_pos : sign_neg; } @@ -2144,7 +2144,7 @@ namespace algebraic_numbers { restart = true; break; } - TRACE("anum_eval_sign", tout << "refined algebraic interval\n";); + TRACE(anum_eval_sign, tout << "refined algebraic interval\n";); SASSERT(!v.is_basic()); refined = true; } @@ -2158,7 +2158,7 @@ namespace algebraic_numbers { if (restart) { // Some non-basic value became basic. // So, restarting the whole process - TRACE("anum_eval_sign", tout << "restarting some algebraic_cell became basic\n";); + TRACE(anum_eval_sign, tout << "restarting some algebraic_cell became basic\n";); continue; } @@ -2174,7 +2174,7 @@ namespace algebraic_numbers { // Evaluating sign using algebraic arithmetic scoped_anum ra(m_wrapper); ext_pm.eval(p_prime, x2v, ra); - TRACE("anum_eval_sign", tout << "value of p as algebraic number " << ra << "\n";); + TRACE(anum_eval_sign, tout << "value of p as algebraic number " << ra << "\n";); if (is_zero(ra)) return 0; return is_pos(ra) ? 1 : -1; @@ -2234,7 +2234,7 @@ namespace algebraic_numbers { scoped_upoly & _R = m_eval_sign_tmp; upm().to_numeral_vector(R, _R); unsigned k = upm().nonzero_root_lower_bound(_R.size(), _R.data()); - TRACE("anum_eval_sign", tout << "R: " << R << "\nk: " << k << "\nri: "<< ri << "\n";); + TRACE(anum_eval_sign, tout << "R: " << R << "\nk: " << k << "\nri: "<< ri << "\n";); scoped_mpbq mL(bqm()), L(bqm()); bqm().set(mL, -1); bqm().set(L, 1); @@ -2261,7 +2261,7 @@ namespace algebraic_numbers { while (!restart) { checkpoint(); ext_pm.eval(p_prime, x2v_interval, ri); - TRACE("anum_eval_sign", tout << "evaluating using intervals: " << ri << "\n"; + TRACE(anum_eval_sign, tout << "evaluating using intervals: " << ri << "\n"; tout << "zero lower bound is: " << L << "\n";); if (!bqim().contains_zero(ri)) { return bqim().is_pos(ri) ? sign_pos : sign_neg; @@ -2279,7 +2279,7 @@ namespace algebraic_numbers { restart = true; break; } - TRACE("anum_eval_sign", tout << "refined algebraic interval\n";); + TRACE(anum_eval_sign, tout << "refined algebraic interval\n";); SASSERT(!v.is_basic()); } } @@ -2332,7 +2332,7 @@ namespace algebraic_numbers { // Remove from roots any solution r such that p does not evaluate to 0 at x2v extended with x->r. void filter_roots(polynomial_ref const & p, polynomial::var2anum const & x2v, polynomial::var x, numeral_vector & roots) { - TRACE("isolate_roots", tout << "before filtering roots, x: x" << x << "\n"; + TRACE(isolate_roots, tout << "before filtering roots, x: x" << x << "\n"; for (unsigned i = 0; i < roots.size(); i++) { display_root(tout, roots[i]); tout << "\n"; }); @@ -2342,9 +2342,9 @@ namespace algebraic_numbers { for (unsigned i = 0; i < sz; i++) { checkpoint(); ext_var2num ext_x2v(m_wrapper, x2v, x, roots[i]); - TRACE("isolate_roots", tout << "filter_roots i: " << i << ", ext_x2v: x" << x << " -> "; display_root(tout, roots[i]); tout << "\n";); + TRACE(isolate_roots, tout << "filter_roots i: " << i << ", ext_x2v: x" << x << " -> "; display_root(tout, roots[i]); tout << "\n";); sign sign = eval_sign_at(p, ext_x2v); - TRACE("isolate_roots", tout << "filter_roots i: " << i << ", result sign: " << sign << "\n";); + TRACE(isolate_roots, tout << "filter_roots i: " << i << ", result sign: " << sign << "\n";); if (sign != 0) continue; if (i != j) @@ -2355,7 +2355,7 @@ namespace algebraic_numbers { del(roots[i]); roots.shrink(j); - TRACE("isolate_roots", tout << "after filtering roots:\n"; + TRACE(isolate_roots, tout << "after filtering roots:\n"; for (unsigned i = 0; i < roots.size(); i++) { display_root(tout, roots[i]); tout << "\n"; }); @@ -2381,16 +2381,16 @@ namespace algebraic_numbers { polynomial::var_vector m_isolate_roots_vars; void isolate_roots(polynomial_ref const & p, polynomial::var2anum const & x2v, numeral_vector & roots, bool nested_call = false) { - TRACE("isolate_roots", tout << "isolating roots of: " << p << "\n";); + TRACE(isolate_roots, tout << "isolating roots of: " << p << "\n";); SASSERT(roots.empty()); polynomial::manager & ext_pm = p.m(); if (ext_pm.is_zero(p) || ext_pm.is_const(p)) { - TRACE("isolate_roots", tout << "p is zero or the constant polynomial\n";); + TRACE(isolate_roots, tout << "p is zero or the constant polynomial\n";); return; } if (ext_pm.is_univariate(p)) { - TRACE("isolate_roots", tout << "p is univariate, using univariate procedure\n";); + TRACE(isolate_roots, tout << "p is univariate, using univariate procedure\n";); isolate_roots(p, roots); return; } @@ -2399,10 +2399,10 @@ namespace algebraic_numbers { polynomial_ref p_prime(ext_pm); var2basic x2v_basic(*this, x2v); p_prime = ext_pm.substitute(p, x2v_basic); - TRACE("isolate_roots", tout << "p after applying (rational fragment of) x2v:\n" << p_prime << "\n";); + TRACE(isolate_roots, tout << "p after applying (rational fragment of) x2v:\n" << p_prime << "\n";); if (ext_pm.is_zero(p_prime) || ext_pm.is_const(p_prime)) { - TRACE("isolate_roots", tout << "p is zero or the constant polynomial after applying (rational fragment of) x2v\n";); + TRACE(isolate_roots, tout << "p is zero or the constant polynomial after applying (rational fragment of) x2v\n";); return; } @@ -2413,7 +2413,7 @@ namespace algebraic_numbers { // So, the polynomial does not have any roots return; } - TRACE("isolate_roots", tout << "p is univariate after applying (rational fragment of) x2v... using univariate procedure\n";); + TRACE(isolate_roots, tout << "p is univariate after applying (rational fragment of) x2v... using univariate procedure\n";); isolate_roots(p_prime, roots); return; } @@ -2425,7 +2425,7 @@ namespace algebraic_numbers { // sort variables by the degree of the values std::stable_sort(xs.begin(), xs.end(), var_degree_lt(*this, x2v)); - TRACE("isolate_roots", tout << "there are " << (xs.size() - 1) << " variables assigned to nonbasic numbers...\n";); + TRACE(isolate_roots, tout << "there are " << (xs.size() - 1) << " variables assigned to nonbasic numbers...\n";); // last variables is the one not assigned by x2v, or the unassigned variable vanished polynomial::var x = xs.back(); @@ -2453,7 +2453,7 @@ namespace algebraic_numbers { algebraic_cell * c = v.to_algebraic(); p_y = ext_pm.to_polynomial(c->m_p_sz, c->m_p, y); ext_pm.resultant(q, p_y, y, q); - TRACE("isolate_roots", tout << "resultant loop i: " << i << ", y: x" << y << "\np_y: " << p_y << "\n"; + TRACE(isolate_roots, tout << "resultant loop i: " << i << ", y: x" << y << "\np_y: " << p_y << "\n"; tout << "q: " << q << "\n";); if (ext_pm.is_zero(q)) { SASSERT(!nested_call); @@ -2462,7 +2462,7 @@ namespace algebraic_numbers { } if (ext_pm.is_zero(q)) { - TRACE("isolate_roots", tout << "q vanished\n";); + TRACE(isolate_roots, tout << "q vanished\n";); // q may vanish at some of the other roots of the polynomial defining the values. // To decide if p_prime vanishes at x2v or not, we start evaluating each coefficient of p_prime at x2v // until we find one that is not zero at x2v. @@ -2473,7 +2473,7 @@ namespace algebraic_numbers { SASSERT(n > 0); if (n == 1) { // p_prime is linear on p, so we just evaluate the coefficients... - TRACE("isolate_roots", tout << "p is linear after applying (rational fragment) of x2v\n";); + TRACE(isolate_roots, tout << "p is linear after applying (rational fragment) of x2v\n";); polynomial_ref c0(ext_pm); polynomial_ref c1(ext_pm); c0 = ext_pm.coeff(p_prime, x, 0); @@ -2484,14 +2484,14 @@ namespace algebraic_numbers { ext_pm.eval(c1, x2v, a1); // the root must be - a0/a1 if a1 != 0 if (is_zero(a1)) { - TRACE("isolate_roots", tout << "coefficient of degree 1 vanished, so p does not have roots at x2v\n";); + TRACE(isolate_roots, tout << "coefficient of degree 1 vanished, so p does not have roots at x2v\n";); // p_prime does not have any root return; } roots.push_back(anum()); div(a0, a1, roots[0]); neg(roots[0]); - TRACE("isolate_roots", tout << "after trivial solving p has only one root:\n"; display_root(tout, roots[0]); tout << "\n";); + TRACE(isolate_roots, tout << "after trivial solving p has only one root:\n"; display_root(tout, roots[0]); tout << "\n";); } else { polynomial_ref c(ext_pm); @@ -2506,7 +2506,7 @@ namespace algebraic_numbers { if (i == 0) { // all coefficients of x vanished, so // the polynomial has no roots - TRACE("isolate_roots", tout << "all coefficients vanished... polynomial does not have roots\n";); + TRACE(isolate_roots, tout << "all coefficients vanished... polynomial does not have roots\n";); return; } SASSERT(!is_zero(a)); @@ -2527,7 +2527,7 @@ namespace algebraic_numbers { xi_p = pm().mk_polynomial(x, i); z_p = pm().mk_polynomial(z); q2 = z_p*xi_p + q2; - TRACE("isolate_roots", tout << "invoking isolate_roots with q2:\n" << q2 << "\n"; + TRACE(isolate_roots, tout << "invoking isolate_roots with q2:\n" << q2 << "\n"; tout << "z: x" << z << " -> "; display_root(tout, a); tout << "\n";); // extend x2p with z->a ext_var2num ext_x2v(m_wrapper, x2v, z, a); @@ -2536,7 +2536,7 @@ namespace algebraic_numbers { } else if (ext_pm.is_const(q)) { // q does not have any roots, so p_prime also does not have roots at x2v. - TRACE("isolate_roots", tout << "q is the constant polynomial, so p does not contain any roots at x2v\n";); + TRACE(isolate_roots, tout << "q is the constant polynomial, so p does not contain any roots at x2v\n";); } else { SASSERT(is_univariate(q)); @@ -2619,7 +2619,7 @@ namespace algebraic_numbers { // Select a numeral between prev and curr. // Pre: prev < curr void select(numeral & prev, numeral & curr, numeral & result) { - TRACE("algebraic_select", + TRACE(algebraic_select, tout << "prev: "; display_interval(tout, prev); tout << "\n"; tout << "curr: "; display_interval(tout, curr); tout << "\n";); SASSERT(lt(prev, curr)); @@ -2674,7 +2674,7 @@ namespace algebraic_numbers { signs.push_back(s); } else { - TRACE("isolate_roots_bug", tout << "p: " << p << "\n"; + TRACE(isolate_roots_bug, tout << "p: " << p << "\n"; polynomial::var_vector xs; p.m().vars(p, xs); for (unsigned i = 0; i < xs.size(); i++) { @@ -2694,7 +2694,7 @@ namespace algebraic_numbers { scoped_anum w(m_wrapper); int_lt(roots[0], w); - TRACE("isolate_roots_bug", tout << "w: "; display_root(tout, w); tout << "\n";); + TRACE(isolate_roots_bug, tout << "w: "; display_root(tout, w); tout << "\n";); { ext2_var2num ext_x2v(m_wrapper, x2v, w); auto s = eval_sign_at(p, ext_x2v); @@ -2996,15 +2996,15 @@ namespace algebraic_numbers { } void manager::power(numeral const & a, unsigned k, numeral & b) { - TRACE("anum_detail", display_root(tout, a); tout << "^" << k << "\n";); + TRACE(anum_detail, display_root(tout, a); tout << "^" << k << "\n";); m_imp->power(const_cast(a), k, b); - TRACE("anum_detail", tout << "^ result: "; display_root(tout, b); tout << "\n";); + TRACE(anum_detail, tout << "^ result: "; display_root(tout, b); tout << "\n";); } void manager::add(numeral const & a, numeral const & b, numeral & c) { - TRACE("anum_detail", display_root(tout, a); tout << " + "; display_root(tout, b); tout << "\n";); + TRACE(anum_detail, display_root(tout, a); tout << " + "; display_root(tout, b); tout << "\n";); m_imp->add(const_cast(a), const_cast(b), c); - TRACE("anum_detail", tout << "+ result: "; display_root(tout, c); tout << "\n";); + TRACE(anum_detail, tout << "+ result: "; display_root(tout, c); tout << "\n";); } void manager::add(numeral const & a, mpz const & b, numeral & c) { @@ -3014,15 +3014,15 @@ namespace algebraic_numbers { } void manager::sub(numeral const & a, numeral const & b, numeral & c) { - TRACE("anum_detail", display_root(tout, a); tout << " - "; display_root(tout, b); tout << "\n";); + TRACE(anum_detail, display_root(tout, a); tout << " - "; display_root(tout, b); tout << "\n";); m_imp->sub(const_cast(a), const_cast(b), c); - TRACE("anum_detail", tout << "- result: "; display_root(tout, c); tout << "\n";); + TRACE(anum_detail, tout << "- result: "; display_root(tout, c); tout << "\n";); } void manager::mul(numeral const & a, numeral const & b, numeral & c) { - TRACE("anum_detail", display_root(tout, a); tout << " * "; display_root(tout, b); tout << "\n";); + TRACE(anum_detail, display_root(tout, a); tout << " * "; display_root(tout, b); tout << "\n";); m_imp->mul(const_cast(a), const_cast(b), c); - TRACE("anum_detail", tout << "* result: "; display_root(tout, c); tout << "\n";); + TRACE(anum_detail, tout << "* result: "; display_root(tout, c); tout << "\n";); } void manager::div(numeral const & a, numeral const & b, numeral & c) { diff --git a/src/math/polynomial/linear_eq_solver.h b/src/math/polynomial/linear_eq_solver.h index 4196e5434..75e860e75 100644 --- a/src/math/polynomial/linear_eq_solver.h +++ b/src/math/polynomial/linear_eq_solver.h @@ -86,7 +86,7 @@ public: // Return false if the matrix is singular bool solve(numeral * xs) { for (unsigned k = 0; k < n; k++) { - TRACE("linear_eq_solver", tout << "iteration " << k << "\n"; display(tout);); + TRACE(linear_eq_solver, tout << "iteration " << k << "\n"; display(tout);); // find pivot unsigned i = k; for (; i < n; i++) { @@ -120,7 +120,7 @@ public: unsigned k = n; while (k > 0) { --k; - TRACE("linear_eq_solver", tout << "iteration " << k << "\n"; display(tout);); + TRACE(linear_eq_solver, tout << "iteration " << k << "\n"; display(tout);); SASSERT(m.is_one(A[k][k])); // save result m.set(xs[k], b[k]); diff --git a/src/math/polynomial/polynomial.cpp b/src/math/polynomial/polynomial.cpp index 76f717da0..9a0f572dd 100644 --- a/src/math/polynomial/polynomial.cpp +++ b/src/math/polynomial/polynomial.cpp @@ -363,7 +363,7 @@ namespace polynomial { bool found = false; for (unsigned i = 0; i < m_size; i++) { if (get_var(i) < x) { - CTRACE("poly_bug", !(y != null_var && get_var(i) <= y), + CTRACE(poly_bug, !(y != null_var && get_var(i) <= y), tout << "m: "; display(tout); tout << "\n"; tout << "x: " << x << "\n"; tout << "y: " << y << "\n"; @@ -685,7 +685,7 @@ namespace polynomial { var m_min; lex_lt2(var m):m_min(m) {} bool operator()(monomial * m1, monomial * m2) const { - TRACE("lex_bug", tout << "min: x" << m_min << "\n"; m1->display(tout); tout << "\n"; m2->display(tout); tout << "\n";); + TRACE(lex_bug, tout << "min: x" << m_min << "\n"; m1->display(tout); tout << "\n"; m2->display(tout); tout << "\n";); return lex_compare2(m1, m2, m_min) < 0; } }; @@ -797,7 +797,7 @@ namespace polynomial { ~monomial_manager() { dec_ref(m_unit); - CTRACE("polynomial", !m_monomials.empty(), + CTRACE(polynomial, !m_monomials.empty(), tout << "monomials leaked (can happen during cancelation)\n"; for (auto * m : m_monomials) { m->display(tout << m->id() << " " << m->ref_count() << " ") << "\n"; @@ -965,14 +965,14 @@ namespace polynomial { j++; } product_tmp.set_size(j); - TRACE("monomial_mul_bug", + TRACE(monomial_mul_bug, tout << "before mk_monomial\n"; tout << "pws1: "; for (unsigned i = 0; i < sz1; i++) tout << pws1[i] << " "; tout << "\n"; tout << "pws2: "; for (unsigned i = 0; i < sz2; i++) tout << pws2[i] << " "; tout << "\n"; tout << "product_tmp: "; for (unsigned i = 0; i < product_tmp.size(); i++) tout << product_tmp.get_power(i) << " "; tout << "\n";); monomial * r = mk_monomial(product_tmp); - TRACE("monomial_mul_bug", + TRACE(monomial_mul_bug, tout << "j: " << j << "\n"; tout << "r: "; r->display(tout); tout << "\n"; tout << "pws1: "; for (unsigned i = 0; i < sz1; i++) tout << pws1[i] << " "; tout << "\n"; @@ -1453,7 +1453,7 @@ namespace polynomial { m_lex_sorted = true; DEBUG_CODE({ for (unsigned i = 0; i < m_size - 1; i++) { - CTRACE("poly_bug", lex_compare(m_ms[i], m_ms[i+1]) <= 0, + CTRACE(poly_bug, lex_compare(m_ms[i], m_ms[i+1]) <= 0, tout << "i: " << i << "\npoly: "; display(tout, nm); tout << "\n";); SASSERT(lex_compare(m_ms[i], m_ms[i+1]) > 0); } @@ -2367,7 +2367,7 @@ namespace polynomial { m_manager.del(m_zero_numeral); m_mgcd_iterpolators.flush(); m_mgcd_skeletons.reset(); - CTRACE("polynomial", !m_polynomials.empty(), + CTRACE(polynomial, !m_polynomials.empty(), tout << "leaked polynomials\n"; for (auto* p : m_polynomials) { if (p) p->display(tout, m_manager) << "\n"; @@ -2427,7 +2427,7 @@ namespace polynomial { } void del(polynomial * p) { - TRACE("polynomial", tout << "deleting: "; p->display(tout, m_manager); tout << "\n";); + TRACE(polynomial, tout << "deleting: "; p->display(tout, m_manager); tout << "\n";); if (m_del_eh != nullptr) { del_eh * curr = m_del_eh; do { @@ -2977,7 +2977,7 @@ namespace polynomial { \brief Add a new datapoint */ void add(numeral const & input, polynomial const * output) { - TRACE("newton", tout << m().to_string(input) << " -> "; output->display(tout, m()); tout << "\n";); + TRACE(newton, tout << m().to_string(input) << " -> "; output->display(tout, m()); tout << "\n";); SASSERT(m().modular()); unsigned sz = num_sample_points(); if (sz > 0) { @@ -2995,7 +2995,7 @@ namespace polynomial { m().inv(product); m_inputs.push_back(input); m_invs.push_back(product); - TRACE("newton", tout << "invs[" << k << "]: " << product << "\n";); + TRACE(newton, tout << "invs[" << k << "]: " << product << "\n";); SASSERT(m().eq(m_inputs[k], input)); // Compute newton's coefficient polynomial_ref temp(pm.m_wrapper); @@ -3015,7 +3015,7 @@ namespace polynomial { aux_poly = pm.mul(m_invs[sz], aux_poly); SASSERT(pm.is_p_normalized(aux_poly)); m_vs.push_back(aux_poly); - TRACE("newton", tout << "vs[" << k << "]: " << aux_poly << "\n";); + TRACE(newton, tout << "vs[" << k << "]: " << aux_poly << "\n";); } else { m_inputs.push_back(input); @@ -3034,18 +3034,18 @@ namespace polynomial { u = m_vs.get(d); scoped_numeral c(m()); for (int k = d - 1; k >= 0; k--) { - TRACE("newton", tout << "u: " << u << "\n";); + TRACE(newton, tout << "u: " << u << "\n";); // create polynomial (x - inputs[k]) m().set(c, m_inputs[k]); m().neg(c); numeral one(1); aux_poly = pm.mk_linear(1, &one, &x, c); - TRACE("newton", tout << "(x - inputs[k]): " << aux_poly << "\n";); + TRACE(newton, tout << "(x - inputs[k]): " << aux_poly << "\n";); // u <- u * (x - inputs[k]) + vs[k] aux_poly = pm.mul(u, aux_poly); u = pm.add(aux_poly, m_vs.get(k)); } - TRACE("newton", tout << "result u: " << u << "\n";); + TRACE(newton, tout << "result u: " << u << "\n";); r = u; } }; @@ -3154,7 +3154,7 @@ namespace polynomial { m_orig_monomials.push_back(orig_m); m_powers.push_back(k); } - TRACE("skeleton", + TRACE(skeleton, tout << "x: x" << m_x << "\n"; tout << "max: " << m_max_powers << "\n"; tout << "p: "; p->display(tout, pm.m()); tout << "\n"; @@ -3299,14 +3299,14 @@ namespace polynomial { cs.push_back(aux); } unsigned output_idx = e.m_first_power_idx + i; - TRACE("sparse_interpolator", tout << "adding new equation:\n"; + TRACE(sparse_interpolator, tout << "adding new equation:\n"; for (unsigned i = 0; i < num_pws; i++) { tout << m.to_string(cs[i]) << " "; } tout << "\n";); solver.add(i, cs.data(), m_outputs[output_idx]); } - TRACE("sparse_interpolator", + TRACE(sparse_interpolator, tout << "find coefficients of:\n"; for (unsigned i = 0; i < num_pws; i++) { m_skeleton->ith_orig_monomial(e, i)->display(tout); tout << "\n"; @@ -3412,7 +3412,7 @@ namespace polynomial { polynomial * coeff(polynomial const * p, var x, unsigned k) { SASSERT(is_valid(x)); SASSERT(m_cheap_som_buffer.empty()); - TRACE("coeff_bug", tout << "p: "; p->display(tout, m_manager); tout << "\nx: " << x << ", k: " << k << "\n";); + TRACE(coeff_bug, tout << "p: "; p->display(tout, m_manager); tout << "\nx: " << x << ", k: " << k << "\n";); unsigned sz = p->size(); for (unsigned i = 0; i < sz; i++) { monomial * m = p->m(i); @@ -3599,7 +3599,7 @@ namespace polynomial { variable x. */ void iccp(polynomial const * p, var x, numeral & i, polynomial_ref & c, polynomial_ref & pp) { - TRACE("polynomial", tout << "iccp x" << x << "\n"; p->display(tout, m_manager); tout << "\n";); + TRACE(polynomial, tout << "iccp x" << x << "\n"; p->display(tout, m_manager); tout << "\n";); if (is_zero(p)) { m_manager.set(i, 0); c = mk_one(); @@ -3638,7 +3638,7 @@ namespace polynomial { for (unsigned j = 0; j < sz; j++) { monomial * m = p->m(j); unsigned k = m->degree_of(x); - TRACE("polynomial", tout << "degree of x" << x << " at "; m->display(tout); tout << " is " << k << "\n";); + TRACE(polynomial, tout << "degree of x" << x << " at "; m->display(tout); tout << " is " << k << "\n";); if (iccp_filter[k] == 0) iccp_powers.push_back(k); if (m->size() == (k > 0 ? 1 : 0)) @@ -3658,7 +3658,7 @@ namespace polynomial { } // Extract integer content ic(p, i, pp); - TRACE("polynomial", tout << "p: "; p->display(tout, m_manager); tout << "\ni: " << m_manager.to_string(i) << "\npp: " << pp << "\n";); + TRACE(polynomial, tout << "p: "; p->display(tout, m_manager); tout << "\ni: " << m_manager.to_string(i) << "\npp: " << pp << "\n";); // Compute c using the gcd of coeffs of x^k for k's in iccp_powers polynomial_ref ci(pm()); c = coeff(pp, x, iccp_powers[0]); @@ -3673,7 +3673,7 @@ namespace polynomial { SASSERT(!is_const(c)); // make sure the sign of the leading monomial is positive flip_sign_if_lm_neg(c); - TRACE("polynomial", tout << "pp: " << pp << "\nc: " << c << "\n";); + TRACE(polynomial, tout << "pp: " << pp << "\nc: " << c << "\n";); pp = exact_div(pp, c); } @@ -3701,7 +3701,7 @@ namespace polynomial { } void gcd_prs(polynomial const * u, polynomial const * v, var x, polynomial_ref & r) { - TRACE("polynomial_gcd", tout << "gcd prs with x" << x << " for\nu: "; + TRACE(polynomial_gcd, tout << "gcd prs with x" << x << " for\nu: "; u->display(tout, m_manager); tout << "\nv: "; v->display(tout, m_manager); tout << "\n";); if (degree(u, x) < degree(v, x)) std::swap(u, v); @@ -3717,7 +3717,7 @@ namespace polynomial { gcd(c_u, c_v, d_r); m_manager.gcd(i_u, i_v, d_a); - TRACE("polynomial_gcd_detail", + TRACE(polynomial_gcd_detail, tout << "After GCD of the content\n"; tout << "u: "; u->display(tout, m_manager); tout << "\n"; tout << "v: "; v->display(tout, m_manager); tout << "\n"; @@ -3737,20 +3737,20 @@ namespace polynomial { (void)counter; SASSERT(degree(pp_u, x) >= degree(pp_v, x)); unsigned delta = degree(pp_u, x) - degree(pp_v, x); - TRACE("polynomial_gcd_detail", + TRACE(polynomial_gcd_detail, tout << "iteration: " << counter << "\n"; tout << "gcd loop\npp_u: " << pp_u << "\npp_v: " << pp_v << "\ndelta: " << delta << "\n";); counter++; exact_pseudo_remainder(pp_u, pp_v, x, rem); if (is_zero(rem)) { - TRACE("polynomial", tout << "rem is zero...\npp_v: " << pp_v << "\n";); + TRACE(polynomial, tout << "rem is zero...\npp_v: " << pp_v << "\n";); flip_sign_if_lm_neg(pp_v); r = pp(pp_v, x); r = mul(d_a, d_r, r); return; } if (is_const(rem)) { - TRACE("polynomial", tout << "rem is a constant: " << rem << "\nr: " << d_r << "\nd_a: " << d_a << "\n";); + TRACE(polynomial, tout << "rem is a constant: " << rem << "\nr: " << d_r << "\nd_a: " << d_a << "\n";); r = mul(d_a, d_r); return; } @@ -3787,7 +3787,7 @@ namespace polynomial { // TODO: implement euclid algorithm when m_manager in Zp mode void euclid_gcd(polynomial const * u, polynomial const * v, polynomial_ref & r) { SASSERT(m().modular()); - CTRACE("mgcd", !is_univariate(u) || !is_univariate(v), + CTRACE(mgcd, !is_univariate(u) || !is_univariate(v), tout << "euclid_gcd, polynomials are not univariate\n"; u->display(tout, m()); tout << "\n"; v->display(tout, m()); tout << "\n";); SASSERT(is_univariate(u)); SASSERT(is_univariate(v)); @@ -3824,7 +3824,7 @@ namespace polynomial { void CRA_combine_images(polynomial const * C1, scoped_numeral const & b1, polynomial const * C2, scoped_numeral & b2, polynomial_ref & r) { lex_sort(C1); lex_sort(C2); - TRACE("CRA", tout << "C1: "; C1->display(tout, m()); tout << "\nC2: "; C2->display(tout, m()); tout << "\n";); + TRACE(CRA, tout << "C1: "; C1->display(tout, m()); tout << "\nC2: "; C2->display(tout, m()); tout << "\n";); SASSERT(m_cheap_som_buffer.empty()); SASSERT(!m().m().is_even(b1)); SASSERT(!m().m().is_even(b2)); @@ -3834,18 +3834,18 @@ namespace polynomial { scoped_numeral g(m()); m().gcd(b1, b2, inv1, inv2, g); SASSERT(m().is_one(g)); - TRACE("CRA", tout << "b1: " << b1 << ", b2: " << b2 << ", inv1: " << inv1 << ", inv2: " << inv2 << "\n";); + TRACE(CRA, tout << "b1: " << b1 << ", b2: " << b2 << ", inv1: " << inv1 << ", inv2: " << inv2 << "\n";); // b1*inv1 + b2.inv2 = 1 // inv1 is the inverse of b1 mod b2 // inv2 is the inverse of b2 mod b1 m().m().mod(inv1, b2, inv1); m().m().mod(inv2, b1, inv2); - TRACE("CRA", tout << "inv1: " << inv1 << ", inv2: " << inv2 << "\n";); + TRACE(CRA, tout << "inv1: " << inv1 << ", inv2: " << inv2 << "\n";); scoped_numeral a1(m()); scoped_numeral a2(m()); m().mul(b2, inv2, a1); // a1 is the multiplicator for coefficients of C1 m().mul(b1, inv1, a2); // a2 is the multiplicator for coefficients of C2 - TRACE("CRA", tout << "a1: " << a1 << ", a2: " << a2 << "\n";); + TRACE(CRA, tout << "a1: " << a1 << ", a2: " << a2 << "\n";); // new bound scoped_numeral new_bound(m()); m().mul(b1, b2, new_bound); @@ -3855,7 +3855,7 @@ namespace polynomial { m().div(new_bound, 2, upper); m().set(lower, upper); m().neg(lower); - TRACE("CRA", tout << "lower: " << lower << ", upper: " << upper << "\n";); + TRACE(CRA, tout << "lower: " << lower << ", upper: " << upper << "\n";); #define ADD(A1, A2, M) { \ m().mul(A1, a1, tmp1); \ @@ -3875,7 +3875,7 @@ namespace polynomial { while (true) { if (i1 == sz1) { while (i2 < sz2) { - TRACE("CRA", tout << "adding C2 rest\n";); + TRACE(CRA, tout << "adding C2 rest\n";); ADD(zero, C2->a(i2), C2->m(i2)); i2++; } @@ -3883,7 +3883,7 @@ namespace polynomial { } if (i2 == sz2) { while (i1 < sz1) { - TRACE("CRA", tout << "adding C1 rest\n";); + TRACE(CRA, tout << "adding C1 rest\n";); ADD(C1->a(i1), zero, C1->m(i1)); i1++; } @@ -3894,19 +3894,19 @@ namespace polynomial { int s = lex_compare(m1, m2); if (s == 0) { ADD(C1->a(i1), C2->a(i2), m1); - TRACE("CRA", + TRACE(CRA, tout << "C1->a(i1): " << m().to_string(C1->a(i1)) << ", C2->a(i2): " << m().to_string(C2->a(i2)) << ", new_a: " << new_a << "\n"; tout << "tmp1: " << tmp1 << ", tmp2: " << tmp2 << ", tmp3: " << tmp3 << "\n";); i1++; i2++; } else if (s > 0) { - TRACE("CRA", tout << "C1 mon biggerr, adding it...\n";); + TRACE(CRA, tout << "C1 mon biggerr, adding it...\n";); ADD(C1->a(i1), zero, m1); i1++; } else { - TRACE("CRA", tout << "C2 mon bigger, adding it...\n";); + TRACE(CRA, tout << "C2 mon bigger, adding it...\n";); ADD(zero, C2->a(i2), m2); i2++; } @@ -3916,7 +3916,7 @@ namespace polynomial { } void uni_mod_gcd(polynomial const * u, polynomial const * v, polynomial_ref & r) { - TRACE("mgcd", tout << "univ_modular_gcd\nu: "; u->display(tout, m_manager); tout << "\nv: "; v->display(tout, m_manager); tout << "\n";); + TRACE(mgcd, tout << "univ_modular_gcd\nu: "; u->display(tout, m_manager); tout << "\nv: "; v->display(tout, m_manager); tout << "\n";); SASSERT(!m().modular()); SASSERT(is_univariate(u)); SASSERT(!is_const(u) && !is_const(v)); @@ -3951,17 +3951,17 @@ namespace polynomial { scoped_numeral p(m()); for (unsigned i = 0; i < NUM_BIG_PRIMES; i++) { m().set(p, g_big_primes[i]); - TRACE("mgcd", tout << "trying prime: " << p << "\n";); + TRACE(mgcd, tout << "trying prime: " << p << "\n";); { scoped_set_zp setZp(m_wrapper, p); u_Zp = normalize(pp_u); v_Zp = normalize(pp_v); if (degree(u_Zp, x) < d_u) { - TRACE("mgcd", tout << "bad prime, leading coefficient vanished\n";); + TRACE(mgcd, tout << "bad prime, leading coefficient vanished\n";); continue; // bad prime } if (degree(v_Zp, x) < d_v) { - TRACE("mgcd", tout << "bad prime, leading coefficient vanished\n";); + TRACE(mgcd, tout << "bad prime, leading coefficient vanished\n";); continue; // bad prime } euclid_gcd(u_Zp, v_Zp, q); @@ -3971,9 +3971,9 @@ namespace polynomial { m().set(c, lc_g); q = mul(c, q); } - TRACE("mgcd", tout << "new q:\n" << q << "\n";); + TRACE(mgcd, tout << "new q:\n" << q << "\n";); if (is_const(q)) { - TRACE("mgcd", tout << "done, modular gcd is one\n";); + TRACE(mgcd, tout << "done, modular gcd is one\n";); if (m().is_one(d_a)) r = q; // GCD is one else @@ -3987,26 +3987,26 @@ namespace polynomial { else { if (degree(q, x) < degree(C_star, x)) { // discard accumulated image, it was affected by unlucky primes - TRACE("mgcd", tout << "discarding image\n";); + TRACE(mgcd, tout << "discarding image\n";); C_star = q; m().set(bound, p); } else { CRA_combine_images(q, p, C_star, bound, C_star); - TRACE("mgcd", tout << "new combined:\n" << C_star << "\n";); + TRACE(mgcd, tout << "new combined:\n" << C_star << "\n";); } } candidate = pp(C_star, x); - TRACE("mgcd", tout << "candidate:\n" << candidate << "\n";); + TRACE(mgcd, tout << "candidate:\n" << candidate << "\n";); scoped_numeral lc_candidate(m()); lc_candidate = univ_coeff(candidate, degree(candidate, x)); if (m().divides(lc_candidate, lc_g) && divides(candidate, pp_u) && divides(candidate, pp_v)) { - TRACE("mgcd", tout << "found GCD\n";); + TRACE(mgcd, tout << "found GCD\n";); r = mul(d_a, candidate); flip_sign_if_lm_neg(r); - TRACE("mgcd", tout << "r: " << r << "\n";); + TRACE(mgcd, tout << "r: " << r << "\n";); return; } } @@ -4024,16 +4024,16 @@ namespace polynomial { som_buffer_vector m_iccp_ZpX_buffers; void iccp_ZpX(polynomial const * p, var x, numeral & ci, polynomial_ref & c, polynomial_ref & pp) { SASSERT(m().modular()); - TRACE("mgcd_detail", tout << "iccp_ZpX, p: "; p->display(tout, m()); tout << "\nvar x" << x << "\n";); + TRACE(mgcd_detail, tout << "iccp_ZpX, p: "; p->display(tout, m()); tout << "\nvar x" << x << "\n";); if (is_zero(p)) { - TRACE("mgcd_detail", tout << "iccp_ZpX, p is zero\n";); + TRACE(mgcd_detail, tout << "iccp_ZpX, p is zero\n";); m_manager.set(ci, 0); c = mk_one(); pp = const_cast(p); return; } if (is_const(p)) { - TRACE("mgcd_detail", tout << "iccp_ZpX, p is constant\n";); + TRACE(mgcd_detail, tout << "iccp_ZpX, p is constant\n";); m_manager.set(ci, p->a(0)); c = mk_one(); pp = mk_one(); @@ -4041,7 +4041,7 @@ namespace polynomial { } unsigned d = degree(p, x); if (d == 0) { - TRACE("mgcd_detail", tout << "iccp_ZpX, degree(p, x) == 0\n";); + TRACE(mgcd_detail, tout << "iccp_ZpX, degree(p, x) == 0\n";); ic(p, ci, pp); c = mk_one(); return; @@ -4068,7 +4068,7 @@ namespace polynomial { SASSERT(no_x_ms.empty()); // nothing was marked. // divide by x^min_degree - TRACE("mgcd_detail", tout << "iccp_ZpX, all monomials contain x" << x << ", dividing by x" << x << "^" << min_degree << "\n";); + TRACE(mgcd_detail, tout << "iccp_ZpX, all monomials contain x" << x << ", dividing by x" << x << "^" << min_degree << "\n";); polynomial_ref xmin(m_wrapper); polynomial_ref new_p(m_wrapper); xmin = mk_polynomial(x, min_degree); @@ -4100,7 +4100,7 @@ namespace polynomial { // reset remaining marks for (unsigned i = 0; i < num_marked; i++) m_m2pos.reset(no_x_ms[i]); - TRACE("mgcd_detail", tout << "iccp_ZpX, cheap case... invoking ic\n";); + TRACE(mgcd_detail, tout << "iccp_ZpX, cheap case... invoking ic\n";); ic(p, ci, pp); c = mk_one(); return; @@ -4148,7 +4148,7 @@ namespace polynomial { break; } if (!is_const(g)) { - CTRACE("content_bug", !divides(g, pp), + CTRACE(content_bug, !divides(g, pp), tout << "GF(" << m().m().to_string(m().p()) << ")\n"; tout << "pp: "; pp->display(tout, m()); tout << "\n"; tout << "var: x" << x << "\n"; tout << "content: " << g << "\n";); @@ -4188,7 +4188,7 @@ namespace polynomial { } } SASSERT(!m_som_buffer.empty()); - TRACE("mgcd_detail", tout << "maximal monomial: "; max_m->display(tout); tout << "\n";); + TRACE(mgcd_detail, tout << "maximal monomial: "; max_m->display(tout); tout << "\n";); return m_som_buffer.mk(); } @@ -4224,14 +4224,14 @@ namespace polynomial { // Auxiliary recursive function used in multivariate modular GCD void mod_gcd_rec(polynomial const * u, polynomial const * v, unsigned p, unsigned idx, var_buffer const & vars, polynomial_ref & r) { - TRACE("mgcd", tout << "mod_gcd_rec\nu: "; u->display(tout, m_manager, true); tout << "\nv: "; v->display(tout, m_manager, true); tout << "\n";); + TRACE(mgcd, tout << "mod_gcd_rec\nu: "; u->display(tout, m_manager, true); tout << "\nv: "; v->display(tout, m_manager, true); tout << "\n";); unsigned num_vars = vars.size(); SASSERT(num_vars > 0); if (idx == num_vars - 1) { SASSERT(is_univariate(u)); SASSERT(is_univariate(v)); euclid_gcd(u, v, r); - TRACE("mgcd", tout << "mod_gcd_rec result: "; r->display(tout, m_manager, true); tout << "\n";); + TRACE(mgcd, tout << "mod_gcd_rec result: "; r->display(tout, m_manager, true); tout << "\n";); return; } @@ -4246,7 +4246,7 @@ namespace polynomial { scoped_numeral ci_g(m()); polynomial_ref c_g(m_wrapper); polynomial_ref lc_g(m_wrapper); - TRACE("mgcd_detail", + TRACE(mgcd_detail, tout << "idx: " << idx << "\n"; tout << "x" << x << "\n"; tout << "pp_u = "; pp_u->display(tout, m_manager, true); tout << "\n"; @@ -4260,7 +4260,7 @@ namespace polynomial { m().gcd(ci_u, ci_v, ci_g); euclid_gcd(c_u, c_v, c_g); euclid_gcd(lc_u, lc_v, lc_g); - TRACE("mgcd_detail", + TRACE(mgcd_detail, tout << "c_g = "; c_g->display(tout, m_manager, true); tout << "\n"; tout << "lc_g = "; lc_g->display(tout, m_manager, true); tout << "\n"; tout << "ci_g = " << ci_g << "\n";); @@ -4288,7 +4288,7 @@ namespace polynomial { if (!m().is_zero(lc_g_val)) break; } - TRACE("mgcd", tout << "x" << x << " -> " << val << "\n";); + TRACE(mgcd, tout << "x" << x << " -> " << val << "\n";); u1 = substitute(pp_u, 1, &x, &(val.get())); v1 = substitute(pp_v, 1, &x, &(val.get())); mod_gcd_rec(u1, v1, p, idx+1, vars, q); @@ -4296,10 +4296,10 @@ namespace polynomial { q = mul(lc_g_val, q); var q_var = max_var(q); unsigned deg_q = q_var == null_var ? 0 : degree(q, q_var); - TRACE("mgcd_detail", tout << "counter: " << counter << "\nidx: " << idx << "\nq: " << q << "\ndeg_q: " << deg_q << "\nmin_deg_q: " << + TRACE(mgcd_detail, tout << "counter: " << counter << "\nidx: " << idx << "\nq: " << q << "\ndeg_q: " << deg_q << "\nmin_deg_q: " << min_deg_q << "\nnext_x: x" << vars[idx+1] << "\nmax_var(q): " << q_var << "\n";); if (deg_q < min_deg_q) { - TRACE("mgcd_detail", tout << "resetting...\n";); + TRACE(mgcd_detail, tout << "resetting...\n";); counter = 0; min_deg_q = deg_q; // start from scratch @@ -4314,7 +4314,7 @@ namespace polynomial { } } else if (deg_q == min_deg_q) { - TRACE("mgcd_detail", tout << "adding sample point...\n";); + TRACE(mgcd_detail, tout << "adding sample point...\n";); if (sk == nullptr) { interpolator.add(val, q); } @@ -4324,16 +4324,16 @@ namespace polynomial { } } else { - TRACE("mgcd", tout << "skipping q...\n";); + TRACE(mgcd, tout << "skipping q...\n";); continue; } bool found_candidate = false; if (sk == nullptr) { SASSERT(interpolator.num_sample_points() > 0); interpolator.mk(x, H); - TRACE("mgcd_detail", tout << "idx: " << idx << "\ncandidate H: " << H << "\n";); + TRACE(mgcd_detail, tout << "idx: " << idx << "\ncandidate H: " << H << "\n";); lc_H = lc_glex_ZpX(H, x); - TRACE("mgcd_detail", tout << "idx: " << idx << "\nlc_H: " << lc_H << "\nlc_g: " << lc_g << "\n";); + TRACE(mgcd_detail, tout << "idx: " << idx << "\nlc_H: " << lc_H << "\nlc_g: " << lc_g << "\n";); if (eq(lc_H, lc_g)) { found_candidate = true; } @@ -4352,7 +4352,7 @@ namespace polynomial { primitive_ZpX(H, x, C); else C = normalize(H); - TRACE("mgcd_detail", tout << "C: " << C << "\npp_u: " << pp_u << "\npp_v: " << pp_v << "\ndivides(C, pp_u): " << + TRACE(mgcd_detail, tout << "C: " << C << "\npp_u: " << pp_u << "\npp_v: " << pp_v << "\ndivides(C, pp_u): " << divides(C, pp_u) << "\ndivides(C, pp_v): " << divides(C, pp_v) << "\n";); if (divides(C, pp_u) && divides(C, pp_v)) { r = mul(c_g, C); @@ -4370,7 +4370,7 @@ namespace polynomial { } if (done) { - TRACE("mgcd", tout << "idx: " << idx << "\nresult: " << r << "\n";); + TRACE(mgcd, tout << "idx: " << idx << "\nresult: " << r << "\n";); if (sk == nullptr && m_use_sparse_gcd) { // save skeleton skeleton * new_sk = alloc(skeleton, *this, H, x); @@ -4386,8 +4386,8 @@ namespace polynomial { power_buffer const & u_var_degrees, power_buffer const & v_var_degrees, polynomial_ref & r) { m_mgcd_iterpolators.set_owner(this); - TRACE("mgcd", tout << "mod_gcd\nu: "; u->display(tout, m_manager, true); tout << "\nv: "; v->display(tout, m_manager, true); tout << "\n";); - TRACE("mgcd_call", tout << "mod_gcd\nu: "; u->display(tout, m_manager, true); tout << "\nv: "; v->display(tout, m_manager, true); tout << "\n";); + TRACE(mgcd, tout << "mod_gcd\nu: "; u->display(tout, m_manager, true); tout << "\nv: "; v->display(tout, m_manager, true); tout << "\n";); + TRACE(mgcd_call, tout << "mod_gcd\nu: "; u->display(tout, m_manager, true); tout << "\nv: "; v->display(tout, m_manager, true); tout << "\n";); SASSERT(!m().modular()); // u and v contain the same set of variables SASSERT(u_var_degrees.size() == v_var_degrees.size()); @@ -4435,29 +4435,29 @@ namespace polynomial { for (unsigned i = 0; i < NUM_BIG_PRIMES; i++) { m().set(p, g_big_primes[i]); - TRACE("mgcd", tout << "trying prime: " << p << "\n";); + TRACE(mgcd, tout << "trying prime: " << p << "\n";); { scoped_set_zp setZp(m_wrapper, p); u_Zp = normalize(pp_u); if (u_Zp->size() != pp_u->size()) { - TRACE("mgcd", tout << "bad prime, coefficient(s) vanished\n";); + TRACE(mgcd, tout << "bad prime, coefficient(s) vanished\n";); continue; // bad prime some monomial vanished } v_Zp = normalize(pp_v); if (v_Zp->size() != pp_v->size()) { - TRACE("mgcd", tout << "bad prime, coefficient(s) vanished\n";); + TRACE(mgcd, tout << "bad prime, coefficient(s) vanished\n";); continue; // bad prime some monomial vanished } - TRACE("mgcd", tout << "u_Zp: " << u_Zp << "\nv_Zp: " << v_Zp << "\n";); + TRACE(mgcd, tout << "u_Zp: " << u_Zp << "\nv_Zp: " << v_Zp << "\n";); mod_gcd_rec(u_Zp, v_Zp, g_big_primes[i], 0, vars, q); q = mk_glex_monic(q); scoped_numeral c(m()); m().set(c, lc_g); q = mul(c, q); } - TRACE("mgcd", tout << "new q:\n" << q << "\n";); + TRACE(mgcd, tout << "new q:\n" << q << "\n";); if (is_const(q)) { - TRACE("mgcd", tout << "done, modular gcd is one\n";); + TRACE(mgcd, tout << "done, modular gcd is one\n";); r = mk_const(d_a); return; } @@ -4471,26 +4471,26 @@ namespace polynomial { if (graded_lex_compare(max_q, max_C_star) < 0) { // Discard accumulated image, it was affected by unlucky primes // maximal monomial of q is smaller than maximal monomial of C_star - TRACE("mgcd", tout << "discarding image\n";); + TRACE(mgcd, tout << "discarding image\n";); C_star = q; m().set(bound, p); } else { CRA_combine_images(q, p, C_star, bound, C_star); - TRACE("mgcd", tout << "new combined:\n" << C_star << "\n";); + TRACE(mgcd, tout << "new combined:\n" << C_star << "\n";); } } candidate = normalize(C_star); - TRACE("mgcd", tout << "candidate:\n" << candidate << "\n";); + TRACE(mgcd, tout << "candidate:\n" << candidate << "\n";); scoped_numeral lc_candidate(m()); lc_candidate = candidate->a(candidate->graded_lex_max_pos()); if (m().divides(lc_candidate, lc_g) && divides(candidate, pp_u) && divides(candidate, pp_v)) { - TRACE("mgcd", tout << "found GCD\n";); + TRACE(mgcd, tout << "found GCD\n";); r = mul(d_a, candidate); flip_sign_if_lm_neg(r); - TRACE("mgcd", tout << "r: " << r << "\n";); + TRACE(mgcd, tout << "r: " << r << "\n";); return; } } @@ -4502,8 +4502,8 @@ namespace polynomial { void gcd(polynomial const * u, polynomial const * v, polynomial_ref & r) { power_buffer u_var_degrees; power_buffer v_var_degrees; - TRACE("gcd_calls", tout << "gcd\nu: "; u->display(tout, m_manager); tout << "\nv: "; v->display(tout, m_manager); tout << "\n";); - TRACE("polynomial_gcd", + TRACE(gcd_calls, tout << "gcd\nu: "; u->display(tout, m_manager); tout << "\nv: "; v->display(tout, m_manager); tout << "\n";); + TRACE(polynomial_gcd, tout << "gcd\nu: "; u->display(tout, m_manager); tout << "\nv: "; v->display(tout, m_manager); tout << "\nis_zero(u): " << is_zero(u) << ", is_const(u): " << is_const(u) << "\n"; tout << "is_zero(v): " << is_zero(v) << ", is_const(v): " << is_const(v) << "\n"; @@ -4537,7 +4537,7 @@ namespace polynomial { var_max_degrees(u, u_var_degrees); std::sort(u_var_degrees.begin(), u_var_degrees.end(), power::lt_var()); var_max_degrees(v, v_var_degrees); std::sort(v_var_degrees.begin(), v_var_degrees.end(), power::lt_var()); - TRACE("polynomial_gcd", + TRACE(polynomial_gcd, tout << "u var info\n"; for (unsigned i = 0; i < u_var_degrees.size(); i++) tout << u_var_degrees[i] << " "; tout << "\n"; tout << "v var info\n"; for (unsigned i = 0; i < v_var_degrees.size(); i++) tout << v_var_degrees[i] << " "; tout << "\n";); var x = null_var; @@ -4638,7 +4638,7 @@ namespace polynomial { polynomial_ref r2(m_wrapper); flet use_prs(m_use_prs_gcd, false); gcd_prs(orig_u, orig_v, x, r2); - CTRACE("mgcd_bug", !eq(r, r2), tout << "u: " << orig_u << "\nv: " << orig_v << "\nr1: " << r << "\nr2: " << r2 << "\n";); + CTRACE(mgcd_bug, !eq(r, r2), tout << "u: " << orig_u << "\nv: " << orig_v << "\nr1: " << r << "\nr2: " << r2 << "\n";); SASSERT(eq(r, r2)); } #endif @@ -4665,7 +4665,7 @@ namespace polynomial { for (unsigned i = 0; i < sz; i++) { monomial * m = p->m(i); unsigned d = m->degree_of(x); - TRACE("polynomial", m->display(tout); tout << " degree_of x" << x << ": " << d << "\n";); + TRACE(polynomial, m->display(tout); tout << " degree_of x" << x << ": " << d << "\n";); if (d > 0) { scoped_numeral n(m_manager); m_manager.set(n, d); @@ -5012,7 +5012,7 @@ namespace polynomial { m_manager.set(as[1], 1); m_manager.neg(as[0]); polynomial * p = mk_univariate(x, 1, as); - TRACE("polynomial", tout << "x - c: "; p->display(tout, m_manager); tout << "\n";); + TRACE(polynomial, tout << "x - c: "; p->display(tout, m_manager); tout << "\n";); m_manager.del(as[0]); m_manager.del(as[1]); return p; @@ -5056,7 +5056,7 @@ namespace polynomial { var2degree const * x2d = nullptr) { SASSERT(is_valid(x)); SASSERT(!ModD || x2d != 0); - TRACE("polynomial", tout << "pseudo_division\np: "; p->display(tout, m_manager); + TRACE(polynomial, tout << "pseudo_division\np: "; p->display(tout, m_manager); tout << "\nq: "; q->display(tout, m_manager); tout << "\nx: " << x << "\n";); polynomial * A = const_cast(p); polynomial * B = const_cast(q); @@ -5102,7 +5102,7 @@ namespace polynomial { Q = m_zero; while (true) { checkpoint(); - TRACE("polynomial", + TRACE(polynomial, tout << "A: "; A->display(tout, m_manager); tout << "\n"; tout << "B: "; B->display(tout, m_manager); tout << "\n"; tout << "l_B: "; l_B->display(tout, m_manager); tout << "\n"; @@ -5120,7 +5120,7 @@ namespace polynomial { unsigned e = exact_d - d; polynomial_ref l_B_e(pm()); pw(l_B, e, l_B_e); - TRACE("polynomial", tout << "l_B_e: " << l_B_e << "\n";); + TRACE(polynomial, tout << "l_B_e: " << l_B_e << "\n";); if (Quotient) { Q = mul(l_B_e, Q); if (ModD) @@ -5158,7 +5158,7 @@ namespace polynomial { if (m->degree_of(x) == deg_R) { monomial_ref m_prime(pm()); m_prime = div_x_k(m, x, deg_B); - CTRACE("polynomial", m->degree_of(x) != deg_R - deg_B, + CTRACE(polynomial, m->degree_of(x) != deg_R - deg_B, tout << "deg_R: " << deg_R << ", deg_B: " << deg_B << ", x: " << x << "\n"; m->display(tout); tout << ", "; m_prime->display(tout); tout << "\n";); SASSERT(m->degree_of(x) == deg_R); @@ -5219,7 +5219,7 @@ namespace polynomial { rhs = mul(Q, old_q); rhs = add(rhs, R); bool is_eq = eq(lhs, rhs); - TRACE("pseudo_remainder", + TRACE(pseudo_remainder, tout << "pseudo_division bug\n"; tout << "p: "; old_p->display(tout, m_manager); tout << "\n"; tout << "q: "; old_q->display(tout, m_manager); tout << "\n"; @@ -5264,7 +5264,7 @@ namespace polynomial { } polynomial * exact_div(polynomial const * p, polynomial const * q) { - TRACE("polynomial", tout << "exact division\np: "; p->display(tout, m_manager); tout << "\nq: "; q->display(tout, m_manager); tout << "\n";); + TRACE(polynomial, tout << "exact division\np: "; p->display(tout, m_manager); tout << "\nq: "; q->display(tout, m_manager); tout << "\n";); if (is_zero(p)) return const_cast(p); SASSERT(!is_zero(q)); @@ -5290,7 +5290,7 @@ namespace polynomial { numeral const & a_r = R.a(max_R); monomial_ref m_r_q(pm()); VERIFY(div(m_r, m_q, m_r_q)); - TRACE("polynomial", tout << "m_r: "; m_r->display(tout); tout << "\nm_q: "; m_q->display(tout); tout << "\n"; + TRACE(polynomial, tout << "m_r: "; m_r->display(tout); tout << "\nm_q: "; m_q->display(tout); tout << "\n"; if (m_r_q) { tout << "m_r_q: "; m_r_q->display(tout); tout << "\n"; }); m_r_q_ref = m_r_q; m_manager.div(a_r, a_q, a_r_q); @@ -5302,8 +5302,8 @@ namespace polynomial { // Return true if q divides p. bool divides(polynomial const * q, polynomial const * p) { - TRACE("polynomial", tout << "divides\nq: "; q->display(tout, m_manager); tout << "\np: "; p->display(tout, m_manager); tout << "\n";); - TRACE("divides", tout << "divides\nq: "; q->display(tout, m_manager); tout << "\np: "; p->display(tout, m_manager); tout << "\n";); + TRACE(polynomial, tout << "divides\nq: "; q->display(tout, m_manager); tout << "\np: "; p->display(tout, m_manager); tout << "\n";); + TRACE(divides, tout << "divides\nq: "; q->display(tout, m_manager); tout << "\np: "; p->display(tout, m_manager); tout << "\n";); if (is_zero(p)) return true; SASSERT(!is_zero(q)); @@ -5328,7 +5328,7 @@ namespace polynomial { monomial_ref m_r_q(pm()); bool q_div_r = div(m_r, m_q, m_r_q); m_r_q_ref = m_r_q; - TRACE("polynomial", tout << "m_r: "; m_r->display(tout); tout << "\nm_q: "; m_q->display(tout); tout << "\n"; + TRACE(polynomial, tout << "m_r: "; m_r->display(tout); tout << "\nm_q: "; m_q->display(tout); tout << "\n"; if (m_r_q) { tout << "m_r_q: "; m_r_q->display(tout); tout << "\n"; }); if (!q_div_r) return false; @@ -5403,7 +5403,7 @@ namespace polynomial { while (true) { SASSERT(degree(h_1, x) <= degree(h_0, x)); pseudo_remainder(h_0, h_1, x, d, h_2); - TRACE("polynomial", tout << "h_0: " << h_0 << "\nh_1: " << h_1 << "\nh_2: " << h_2 << "\n";); + TRACE(polynomial, tout << "h_0: " << h_0 << "\nh_1: " << h_1 << "\nh_2: " << h_2 << "\n";); SASSERT(degree(h_2, x) < degree(h_1, x)); // We have that // l(h_1)^d h_0 = Q h_1 + h_2. @@ -5509,7 +5509,7 @@ namespace polynomial { polynomial_ref B(pm()); A = const_cast(p); B = const_cast(q); - TRACE("resultant", tout << "resultant(A, B, x)\nA: " << A << "\nB: " << B << "\nx: " << x << "\n";); + TRACE(resultant, tout << "resultant(A, B, x)\nA: " << A << "\nB: " << B << "\nx: " << x << "\n";); // Res(0, B) = Res(A, 0) = 0 if (is_zero(A) || is_zero(B)) { result = mk_zero(); @@ -5549,7 +5549,7 @@ namespace polynomial { A = ppA; B = ppB; // - TRACE("resultant", tout << "resultant(A, B, x) after normalization\nA: " << A << "\nB: " << B << "\nx: " << x << "\n"; + TRACE(resultant, tout << "resultant(A, B, x) after normalization\nA: " << A << "\nB: " << B << "\nx: " << x << "\n"; tout << "t: " << t << "\n";); int s = 1; @@ -5571,7 +5571,7 @@ namespace polynomial { h = mk_one(); while (true) { - TRACE("resultant", tout << "A: " << A << "\nB: " << B << "\n";); + TRACE(resultant, tout << "A: " << A << "\nB: " << B << "\n";); degA = degree(A, x); degB = degree(B, x); SASSERT(degA >= degB); @@ -5630,7 +5630,7 @@ namespace polynomial { p_prime = derivative(p, x); resultant(p, p_prime, x, r); bool sign = (static_cast(m) * static_cast(m-1))%4 != 0; - TRACE("resultant", tout << "discriminant sign: " << sign << "\n";); + TRACE(resultant, tout << "discriminant sign: " << sign << "\n";); scoped_numeral lc(m_manager); if (const_coeff(p, x, m, lc)) { if (sign) @@ -5677,7 +5677,7 @@ namespace polynomial { // sRes_j is regular exact_pseudo_remainder(sRes.get(j+1), sRes.get(j), x, prem); - TRACE("psc", tout << "j: " << j << "\nsRes_j+1: "; sRes.get(j+1)->display(tout, m_manager); + TRACE(psc, tout << "j: " << j << "\nsRes_j+1: "; sRes.get(j+1)->display(tout, m_manager); tout << "\nsRes_j: "; sRes.get(j)->display(tout, m_manager); tout << "\nprem: " << prem << "\n";); // sRes_{j-1} = prem/R_j_plus_1^2 @@ -5724,7 +5724,7 @@ namespace polynomial { // Optimized calculation of S_e using "Dichotomous Lazard" void Se_Lazard(unsigned d, polynomial const * lc_S_d, polynomial const * S_d_1, var x, polynomial_ref & S_e) { unsigned n = d - degree(S_d_1, x) - 1; - TRACE("Lazard", tout << "lc_S_d: "; lc_S_d->display(tout, m_manager); tout << "\nS_d_1: "; S_d_1->display(tout, m_manager); + TRACE(Lazard, tout << "lc_S_d: "; lc_S_d->display(tout, m_manager); tout << "\nS_d_1: "; S_d_1->display(tout, m_manager); tout << "\nn: " << n << "\n";); if (n == 0) { S_e = const_cast(S_d_1); @@ -5734,7 +5734,7 @@ namespace polynomial { X = lc(S_d_1, x); polynomial const * Y = lc_S_d; unsigned a = 1 << log2(n); - TRACE("Lazard", tout << "a: " << a << "\n";); + TRACE(Lazard, tout << "a: " << a << "\n";); SASSERT(a <= n); SASSERT(n < 2*a); polynomial_ref C(pm()); @@ -5745,16 +5745,16 @@ namespace polynomial { // C <- C^2/Y C = mul(C, C); C = exact_div(C, Y); - TRACE("Lazard", tout << "loop a: " << a << "\nC : " << C << "\n";); + TRACE(Lazard, tout << "loop a: " << a << "\nC : " << C << "\n";); if (n >= a) { // C <- C*X/Y C = mul(C, X); C = exact_div(C, Y); n = n - a; - TRACE("Lazard", tout << "if, C: " << C << "\n";); + TRACE(Lazard, tout << "if, C: " << C << "\n";); } } - TRACE("Lazard", tout << "C: " << C << "\nY: " << Y << "\n";); + TRACE(Lazard, tout << "C: " << C << "\nY: " << Y << "\n";); S_e = mul(C, S_d_1); S_e = exact_div(S_e, Y); } @@ -5815,7 +5815,7 @@ namespace polynomial { } void psc_chain_optimized_core(polynomial const * P, polynomial const * Q, var x, polynomial_ref_vector & S) { - TRACE("psc_chain_classic", tout << "P: "; P->display(tout, m_manager); tout << "\nQ: "; Q->display(tout, m_manager); tout << "\n";); + TRACE(psc_chain_classic, tout << "P: "; P->display(tout, m_manager); tout << "\nQ: "; Q->display(tout, m_manager); tout << "\n";); unsigned degP = degree(P, x); unsigned degQ = degree(Q, x); SASSERT(degP >= degQ); @@ -5835,7 +5835,7 @@ namespace polynomial { unsigned e = degree(B, x); if (is_zero(B)) return; - TRACE("psc_chain_classic", tout << "A: " << A << "\nB: " << B << "\ns: " << s << "\nd: " << d << ", e: " << e << "\n";); + TRACE(psc_chain_classic, tout << "A: " << A << "\nB: " << B << "\ns: " << s << "\nd: " << d << ", e: " << e << "\n";); // B is S_{d-1} ps = coeff(B, x, d-1); if (!is_zero(ps)) @@ -5952,7 +5952,7 @@ namespace polynomial { return true; } scoped_numeral a(m_manager); - TRACE("sqrt_bug", + TRACE(sqrt_bug, tout << "sqrt: "; p->display(tout, m_manager); tout << "\n"; tout << "min pos: " << p->graded_lex_min_pos() << "\n"; tout << "max pos: " << p->graded_lex_max_pos() << "\n";); @@ -6013,7 +6013,7 @@ namespace polynomial { monomial_ref m_aux(pm()); while (true) { checkpoint(); - TRACE("sqrt_bug", tout << "R: "; R.display(tout); tout << "C: "; C.display(tout);); + TRACE(sqrt_bug, tout << "R: "; R.display(tout); tout << "C: "; C.display(tout);); unsigned curr_max = C.graded_lex_max_pos(); if (curr_max == UINT_MAX) { // C is empty @@ -6053,7 +6053,7 @@ namespace polynomial { } void rename(unsigned sz, var const * xs) { - TRACE("rename", for (unsigned i = 0; i < sz; i++) tout << xs[i] << " "; tout << "\n"; + TRACE(rename, for (unsigned i = 0; i < sz; i++) tout << xs[i] << " "; tout << "\n"; tout << "polynomials before rename\n"; for (unsigned i = 0; i < m_polynomials.size(); i++) { if (m_polynomials[i] == 0) @@ -6069,7 +6069,7 @@ namespace polynomial { p->make_first_maximal(); SASSERT(!p || p->size() <= 1 || !p->lex_sorted()); } - TRACE("rename", + TRACE(rename, tout << "polynomials after rename\n"; for (unsigned i = 0; i < m_polynomials.size(); i++) { if (m_polynomials[i] == 0) @@ -6385,7 +6385,7 @@ namespace polynomial { } polynomial * substitute(polynomial const * p, unsigned xs_sz, var const * xs, numeral const * vs) { - TRACE("polynomial", tout << "substitute num_vars: " << xs_sz << "\n"; + TRACE(polynomial, tout << "substitute num_vars: " << xs_sz << "\n"; for (unsigned i = 0; i < xs_sz; i++) { tout << "x" << xs[i] << " -> " << m_manager.to_string(vs[i]) << "\n"; }); scoped_var_pos var2pos(m_var_pos, xs_sz, xs); scoped_numeral new_a(m_manager); @@ -6415,7 +6415,7 @@ namespace polynomial { } } new_m.set_size(new_msz); - TRACE("polynomial", tout << "processing " << m_manager.to_string(p->a(i)) << " "; m->display(tout); tout << "\n"; + TRACE(polynomial, tout << "processing " << m_manager.to_string(p->a(i)) << " "; m->display(tout); tout << "\n"; tout << "new_a: " << m_manager.to_string(new_a) << " "; mk_monomial(new_m)->display(tout); tout << "\n";); R.add(new_a, mk_monomial(new_m)); } @@ -6480,7 +6480,7 @@ namespace polynomial { template void t_eval_core(polynomial * p, ValManager & vm, var2value const & x2v, unsigned start, unsigned end, var x, typename ValManager::numeral & r) { - TRACE("eval_bug", tout << "p: "; p->display(tout, m()); tout << "\n"; + TRACE(eval_bug, tout << "p: "; p->display(tout, m()); tout << "\n"; tout << "start: " << start << ", end: " << end << ", x: " << x << "\n";); SASSERT(start < end); SASSERT(end <= p->size()); @@ -6546,7 +6546,7 @@ namespace polynomial { i = j; } } - TRACE("eval_bug", tout << "result for start: " << start << ", end: " << end << ", x: " << x << "\n"; + TRACE(eval_bug, tout << "result for start: " << start << ", end: " << end << ", x: " << x << "\n"; tout << "r: "; vm.display(tout, r); tout << "\n";); } @@ -6620,7 +6620,7 @@ namespace polynomial { } void acc_constant(factors & r, numeral const & c) { - TRACE("factor_bug", tout << "acc_constant, c: "; m_manager.display(tout, c); tout << "\n";); + TRACE(factor_bug, tout << "acc_constant, c: "; m_manager.display(tout, c); tout << "\n";); scoped_numeral new_c(m_manager); m_manager.mul(r.get_constant(), c, new_c); r.set_constant(new_c); @@ -6637,7 +6637,7 @@ namespace polynomial { SASSERT(degree(p, x) == 1); SASSERT(is_primitive(p, x)); SASSERT(is_square_free(p, x)); - TRACE("factor", tout << "factor square free (degree == 1):\n"; p->display(tout, m_manager); tout << "\n";); + TRACE(factor, tout << "factor square free (degree == 1):\n"; p->display(tout, m_manager); tout << "\n";); // easy case r.push_back(const_cast(p), k); } @@ -6646,7 +6646,7 @@ namespace polynomial { SASSERT(degree(p, x) == 2); SASSERT(is_primitive(p, x)); SASSERT(is_square_free(p, x)); - TRACE("factor", tout << "factor square free (degree == 2):\n"; p->display(tout, m_manager); tout << "\n";); + TRACE(factor, tout << "factor square free (degree == 2):\n"; p->display(tout, m_manager); tout << "\n";); polynomial_ref a(pm()); polynomial_ref b(pm()); @@ -6654,7 +6654,7 @@ namespace polynomial { a = coeff(p, x, 2); b = coeff(p, x, 1); c = coeff(p, x, 0); - TRACE("factor", tout << "a: " << a << "\nb: " << b << "\nc: " << c << "\n";); + TRACE(factor, tout << "a: " << a << "\nb: " << b << "\nc: " << c << "\n";); // make sure the leading monomoal of a is positive bool flipped_coeffs = false; SASSERT(!is_zero(a)); @@ -6678,7 +6678,7 @@ namespace polynomial { // discriminant must be different from 0, since p is square free SASSERT(!is_zero(disc)); polynomial_ref disc_sqrt(pm()); - TRACE("factor", tout << "disc: " << disc << "\n";); + TRACE(factor, tout << "disc: " << disc << "\n";); if (!sqrt(disc, disc_sqrt)) { // p is irreducible r.push_back(const_cast(p), k); @@ -6694,7 +6694,7 @@ namespace polynomial { tmp = mul(disc_sqrt, disc_sqrt); SASSERT(eq(disc, tmp)); }); - TRACE("factor", tout << "disc_sqrt: " << disc_sqrt << "\n";); + TRACE(factor, tout << "disc_sqrt: " << disc_sqrt << "\n";); // p = cont*(2*a*x + b - disc_sqrt)*(2*a*x + b + disc_sqrt) numeral two; m_manager.set(two, 2); @@ -6708,13 +6708,13 @@ namespace polynomial { f2 = f1; f1 = sub(f1, disc_sqrt); f2 = add(f2, disc_sqrt); - TRACE("factor", tout << "before pp\nf1: " << f1 << "\nf2: " << f2 << "\n"; + TRACE(factor, tout << "before pp\nf1: " << f1 << "\nf2: " << f2 << "\n"; polynomial_ref cf1(pm()); m_wrapper.content(f1, x, cf1); polynomial_ref cf2(pm()); m_wrapper.content(f2, x, cf2); tout << "content(f1): " << cf1 << "\ncontent(f2): " << cf2 << "\n";); f1 = pp(f1, x); f2 = pp(f2, x); - TRACE("factor", tout << "f1: " << f1 << "\nf2: " << f2 << "\n";); + TRACE(factor, tout << "f1: " << f1 << "\nf2: " << f2 << "\n";); DEBUG_CODE({ polynomial_ref f1f2(pm()); f1f2 = mul(f1, f2); @@ -6731,7 +6731,7 @@ namespace polynomial { SASSERT(is_square_free(p, max_var(p))); SASSERT(is_primitive(p, max_var(p))); SASSERT(!is_zero(p)); - TRACE("factor", tout << "factor square free univariate:\n"; p->display(tout, m_manager); tout << "\n";); + TRACE(factor, tout << "factor square free univariate:\n"; p->display(tout, m_manager); tout << "\n";); // Convert polynomial into a upolynomial, and execute univariate factorization. var x = max_var(p); @@ -6749,7 +6749,7 @@ namespace polynomial { } else { // Convert factors back into polynomial objects - TRACE("factor_bug", tout << "factoring fs constant: " << m().to_string(fs.get_constant()) << "\np:\n"; + TRACE(factor_bug, tout << "factoring fs constant: " << m().to_string(fs.get_constant()) << "\np:\n"; p->display(tout, m()); tout << "\n";); polynomial_ref f(pm()); unsigned num_factors = fs.distinct_factors(); @@ -6757,12 +6757,12 @@ namespace polynomial { numeral_vector const & f1 = fs[i]; unsigned k1 = fs.get_degree(i); f = to_polynomial(f1.size(), f1.data(), x); - TRACE("factor_bug", + TRACE(factor_bug, tout << "uni-factor:\n"; upm().display(tout, f1); tout << "\n"; tout << "factor:\n" << f << "\n";); r.push_back(f, k*k1); } - TRACE("factor_bug", tout << "end-factors...\n";); + TRACE(factor_bug, tout << "end-factors...\n";); SASSERT(m().is_one(fs.get_constant()) || m().is_minus_one(fs.get_constant())); if (m().is_minus_one(fs.get_constant()) && k % 2 == 1) flip_sign(r); @@ -6773,7 +6773,7 @@ namespace polynomial { SASSERT(degree(p, x) > 2); SASSERT(is_primitive(p, x)); SASSERT(is_square_free(p, x)); - TRACE("factor", tout << "factor square free (degree > 2):\n"; p->display(tout, m_manager); tout << "\n";); + TRACE(factor, tout << "factor square free (degree > 2):\n"; p->display(tout, m_manager); tout << "\n";); // TODO: invoke Dejan's procedure r.push_back(const_cast(p), k); @@ -6797,8 +6797,8 @@ namespace polynomial { } void factor_core(polynomial const * p, factors & r, factor_params const & params) { - TRACE("factor", tout << "factor_core\np: "; p->display(tout, m_manager); tout << "\n";); - TRACE("factor_bug", tout << "factors r.get_constant(): " << m_manager.to_string(r.get_constant()) << "\n";); + TRACE(factor, tout << "factor_core\np: "; p->display(tout, m_manager); tout << "\n";); + TRACE(factor_bug, tout << "factors r.get_constant(): " << m_manager.to_string(r.get_constant()) << "\n";); SASSERT(!is_zero(p)); if (is_const(p)) { SASSERT(!is_zero(p)); @@ -6811,7 +6811,7 @@ namespace polynomial { scoped_numeral i(m_manager); polynomial_ref c(pm()), pp(pm()); iccp(p, x, i, c, pp); - TRACE("factor", tout << "i: " << i << "\n";); + TRACE(factor, tout << "i: " << i << "\n";); acc_constant(r, i); factor_core(c, r, params); @@ -6837,7 +6837,7 @@ namespace polynomial { SASSERT(is_square_free(A, x)); SASSERT(degree(A, x) > 0); checkpoint(); - TRACE("factor", tout << "factor_core main loop j: " << j << "\nA: " << A << "\nB: " << B << "\n";); + TRACE(factor, tout << "factor_core main loop j: " << j << "\nA: " << A << "\nB: " << B << "\n";); // A is of the form P_j * P_{j+1} * P_{j+2} * ... * P_k // B is of the form P_{j+1} * P_{j+2}^2 * ... * P_k^{k - j - 2} gcd(A, B, D); @@ -6849,7 +6849,7 @@ namespace polynomial { factor_sqf_pp(C, r, x, j, params); } else { - TRACE("factor", tout << "const C: " << C << "\n";); + TRACE(factor, tout << "const C: " << C << "\n";); SASSERT(C->size() == 1); SASSERT(m_manager.is_one(C->a(0)) || m_manager.is_minus_one(C->a(0))); if (m_manager.is_minus_one(C->a(0)) && j % 2 == 1) @@ -6871,7 +6871,7 @@ namespace polynomial { return; } factor_core(p, r, params); - TRACE("factor_bug", tout << "[factor] end, r.get_constant(): " << m_manager.to_string(r.get_constant()) << "\n";); + TRACE(factor_bug, tout << "[factor] end, r.get_constant(): " << m_manager.to_string(r.get_constant()) << "\n";); } polynomial * to_polynomial(unsigned sz, numeral const * p, var x) { diff --git a/src/math/polynomial/upolynomial.cpp b/src/math/polynomial/upolynomial.cpp index a354ed295..a73d3e5fb 100644 --- a/src/math/polynomial/upolynomial.cpp +++ b/src/math/polynomial/upolynomial.cpp @@ -386,7 +386,7 @@ namespace upolynomial { #ifdef Z3DEBUG scoped_numeral tmp(m()); m().mul(g, p[i], tmp); - CTRACE("div_bug", !m().eq(tmp, old_p_i), tout << "old(p[i]): " << m().to_string(old_p_i) << ", g: " << m().to_string(g) << ", p[i]: " << + CTRACE(div_bug, !m().eq(tmp, old_p_i), tout << "old(p[i]): " << m().to_string(old_p_i) << ", g: " << m().to_string(g) << ", p[i]: " << m().to_string(p[i]) << ", tmp: " << m().to_string(tmp) << "\n";); SASSERT(tmp == old_p_i); #endif @@ -403,7 +403,7 @@ namespace upolynomial { if (m().is_one(b)) return; for (unsigned i = 0; i < sz; i++) { - CTRACE("upolynomial", !m().divides(b, p[i]), tout << "b: " << m().to_string(b) << ", p[i]: " << m().to_string(p[i]) << "\n";); + CTRACE(upolynomial, !m().divides(b, p[i]), tout << "b: " << m().to_string(b) << ", p[i]: " << m().to_string(p[i]) << "\n";); SASSERT(m().divides(b, p[i])); m().div(p[i], b, p[i]); } @@ -527,10 +527,10 @@ namespace upolynomial { SASSERT(!m().is_zero(b_n)); scoped_numeral a_m(m()); while (m_limit.inc()) { - TRACE("rem_bug", tout << "rem loop, p2:\n"; display(tout, sz2, p2); tout << "\nbuffer:\n"; display(tout, buffer); tout << "\n";); + TRACE(rem_bug, tout << "rem loop, p2:\n"; display(tout, sz2, p2); tout << "\nbuffer:\n"; display(tout, buffer); tout << "\n";); sz1 = buffer.size(); if (sz1 < sz2) { - TRACE("rem_bug", tout << "finished\n";); + TRACE(rem_bug, tout << "finished\n";); return; } unsigned m_n = sz1 - sz2; @@ -546,7 +546,7 @@ namespace upolynomial { // p2: b_n * x^n + b_{n-1} * x^{n-1} + ... + b_0 d++; m().set(a_m, buffer[sz1 - 1]); - TRACE("rem_bug", tout << "a_m: " << m().to_string(a_m) << ", b_n: " << m().to_string(b_n) << "\n";); + TRACE(rem_bug, tout << "a_m: " << m().to_string(a_m) << ", b_n: " << m().to_string(b_n) << "\n";); // don't need to update position sz1 - 1, since it will become 0 for (unsigned i = 0; i < sz1 - 1; i++) { m().mul(buffer[i], b_n, buffer[i]); @@ -619,11 +619,11 @@ namespace upolynomial { _r.reserve(deg+1); numeral_vector & _p1 = m_div_tmp1; // std::cerr << "dividing with "; display(std::cerr, _p1); std::cerr << std::endl; - TRACE("factor_bug", tout << "sz1: " << sz1 << " p1: " << p1 << ", _p1.c_ptr(): " << _p1.data() << ", _p1.size(): " << _p1.size() << "\n";); + TRACE(factor_bug, tout << "sz1: " << sz1 << " p1: " << p1 << ", _p1.c_ptr(): " << _p1.data() << ", _p1.size(): " << _p1.size() << "\n";); set(sz1, p1, _p1); SASSERT(_p1.size() == sz1); while (true) { - TRACE("upolynomial", tout << "exact_div loop...\n"; display(tout, _p1); tout << "\n"; display(tout, _r); tout << "\n";); + TRACE(upolynomial, tout << "exact_div loop...\n"; display(tout, _p1); tout << "\n"; display(tout, _r); tout << "\n";); // std::cerr << "dividing with "; display(std::cerr, _p1); std::cerr << std::endl; if (sz1 == 0) { set_size(deg+1, _r); @@ -672,12 +672,12 @@ namespace upolynomial { // inv2 is the inverse of b2 mod b1 m().m().mod(inv1, b2, inv1); m().m().mod(inv2, b1, inv2); - TRACE("CRA", tout << "inv1: " << inv1 << ", inv2: " << inv2 << "\n";); + TRACE(CRA, tout << "inv1: " << inv1 << ", inv2: " << inv2 << "\n";); scoped_numeral a1(m()); scoped_numeral a2(m()); m().mul(b2, inv2, a1); // a1 is the multiplicator for coefficients of C1 m().mul(b1, inv1, a2); // a2 is the multiplicator for coefficients of C2 - TRACE("CRA", tout << "a1: " << a1 << ", a2: " << a2 << "\n";); + TRACE(CRA, tout << "a1: " << a1 << ", a2: " << a2 << "\n";); // new bound scoped_numeral new_bound(m()); m().mul(b1, b2, new_bound); @@ -687,7 +687,7 @@ namespace upolynomial { m().div(new_bound, 2, upper); m().set(lower, upper); m().neg(lower); - TRACE("CRA", tout << "lower: " << lower << ", upper: " << upper << "\n";); + TRACE(CRA, tout << "lower: " << lower << ", upper: " << upper << "\n";); #define ADD(A1, A2) { \ m().mul(A1, a1, tmp1); \ @@ -721,7 +721,7 @@ namespace upolynomial { void core_manager::mod_gcd(unsigned sz_u, numeral const * u, unsigned sz_v, numeral const * v, numeral_vector & result) { - TRACE("mgcd", tout << "u: "; display_star(tout, sz_u, u); tout << "\nv: "; display_star(tout, sz_v, v); tout << "\n";); + TRACE(mgcd, tout << "u: "; display_star(tout, sz_u, u); tout << "\nv: "; display_star(tout, sz_v, v); tout << "\n";); SASSERT(sz_u > 0 && sz_v > 0); SASSERT(!m().modular()); scoped_numeral c_u(m()), c_v(m()); @@ -747,17 +747,17 @@ namespace upolynomial { for (unsigned i = 0; i < NUM_BIG_PRIMES; i++) { m().set(p, polynomial::g_big_primes[i]); - TRACE("mgcd", tout << "trying prime: " << p << "\n";); + TRACE(mgcd, tout << "trying prime: " << p << "\n";); { scoped_set_zp setZp(*this, p); set(pp_u.size(), pp_u.data(), u_Zp); set(pp_v.size(), pp_v.data(), v_Zp); if (degree(u_Zp) < d_u) { - TRACE("mgcd", tout << "bad prime, leading coefficient vanished\n";); + TRACE(mgcd, tout << "bad prime, leading coefficient vanished\n";); continue; // bad prime } if (degree(v_Zp) < d_v) { - TRACE("mgcd", tout << "bad prime, leading coefficient vanished\n";); + TRACE(mgcd, tout << "bad prime, leading coefficient vanished\n";); continue; // bad prime } euclid_gcd(u_Zp.size(), u_Zp.data(), v_Zp.size(), v_Zp.data(), q); @@ -767,9 +767,9 @@ namespace upolynomial { m().set(c, lc_g); mul(q, c); } - TRACE("mgcd", tout << "new q:\n"; display_star(tout, q); tout << "\n";); + TRACE(mgcd, tout << "new q:\n"; display_star(tout, q); tout << "\n";); if (is_const(q)) { - TRACE("mgcd", tout << "done, modular gcd is one\n";); + TRACE(mgcd, tout << "done, modular gcd is one\n";); reset(result); result.push_back(numeral()); m().set(result.back(), c_g); @@ -781,27 +781,27 @@ namespace upolynomial { } else if (q.size() < C.size() || m().m().is_even(p) || m().m().is_even(bound)) { // discard accumulated image, it was affected by unlucky primes - TRACE("mgcd", tout << "discarding image\n";); + TRACE(mgcd, tout << "discarding image\n";); set(q.size(), q.data(), C); m().set(bound, p); } else { CRA_combine_images(q, p, C, bound); - TRACE("mgcd", tout << "new combined:\n"; display_star(tout, C); tout << "\n";); + TRACE(mgcd, tout << "new combined:\n"; display_star(tout, C); tout << "\n";); } numeral_vector & candidate = q; get_primitive(C, candidate); - TRACE("mgcd", tout << "candidate:\n"; display_star(tout, candidate); tout << "\n";); + TRACE(mgcd, tout << "candidate:\n"; display_star(tout, candidate); tout << "\n";); SASSERT(candidate.size() > 0); numeral const & lc_candidate = candidate[candidate.size() - 1]; if (m().divides(lc_candidate, lc_g) && divides(pp_u, candidate) && divides(pp_v, candidate)) { - TRACE("mgcd", tout << "found GCD\n";); + TRACE(mgcd, tout << "found GCD\n";); mul(candidate, c_g); flip_sign_if_lm_neg(candidate); candidate.swap(result); - TRACE("mgcd", tout << "r: "; display_star(tout, result); tout << "\n";); + TRACE(mgcd, tout << "r: "; display_star(tout, result); tout << "\n";); return; } } @@ -828,10 +828,10 @@ namespace upolynomial { numeral_vector & R = buffer; set(sz1, p1, A); set(sz2, p2, B); - TRACE("upolynomial", tout << "sz1: " << sz1 << ", p1: " << p1 << ", sz2: " << sz2 << ", p2: " << p2 << "\nB.size(): " << B.size() << + TRACE(upolynomial, tout << "sz1: " << sz1 << ", p1: " << p1 << ", sz2: " << sz2 << ", p2: " << p2 << "\nB.size(): " << B.size() << ", B.c_ptr(): " << B.data() << "\n";); while (m_limit.inc()) { - TRACE("upolynomial", tout << "A: "; display(tout, A); tout <<"\nB: "; display(tout, B); tout << "\n";); + TRACE(upolynomial, tout << "A: "; display(tout, A); tout <<"\nB: "; display(tout, B); tout << "\n";); if (B.empty()) { normalize(A); buffer.swap(A); @@ -842,7 +842,7 @@ namespace upolynomial { else { flip_sign_if_lm_neg(buffer); } - TRACE("upolynomial", tout << "GCD\n"; display(tout, sz1, p1); tout << "\n"; display(tout, sz2, p2); tout << "\n--->\n"; + TRACE(upolynomial, tout << "GCD\n"; display(tout, sz1, p1); tout << "\n"; display(tout, sz2, p2); tout << "\n--->\n"; display(tout, buffer); tout << "\n";); return; } @@ -899,7 +899,7 @@ namespace upolynomial { A.swap(B); while (true) { SASSERT(A.size() >= B.size()); - TRACE("upolynomial", tout << "A: "; display(tout, A); tout <<"\nB: "; display(tout, B); tout << "\n"; + TRACE(upolynomial, tout << "A: "; display(tout, A); tout <<"\nB: "; display(tout, B); tout << "\n"; tout << "g: " << m().to_string(g) << ", h: " << m().to_string(h) << "\n";); if (B.empty()) { normalize(A); @@ -911,7 +911,7 @@ namespace upolynomial { else { flip_sign_if_lm_neg(buffer); } - TRACE("upolynomial", tout << "subresultant GCD\n"; display(tout, sz1, p1); tout << "\n"; display(tout, sz2, p2); tout << "\n--->\n"; + TRACE(upolynomial, tout << "subresultant GCD\n"; display(tout, sz1, p1); tout << "\n"; display(tout, sz2, p2); tout << "\n--->\n"; display(tout, buffer); tout << "\n";); return; } @@ -927,7 +927,7 @@ namespace upolynomial { mul(R, aux); } d = pseudo_div_d; - TRACE("upolynomial", tout << "R: "; display(tout, R); tout << "\nd: " << d << "\n";); + TRACE(upolynomial, tout << "R: "; display(tout, R); tout << "\nd: " << d << "\n";); // aux <- g*h^d m().power(h, d, aux); m().mul(g, aux, aux); @@ -1407,14 +1407,14 @@ namespace upolynomial { // Basic idea: apply descartes_bound_0_1 to p2(x) where // p1(x) = p(x+a) // p2(x) = p1((b-a)*x) - TRACE("upolynomial", tout << "pos interval... " << bqm.to_string(a) << ", " << bqm.to_string(b) << "\n"; display(tout, sz, p); tout << "\n";); + TRACE(upolynomial, tout << "pos interval... " << bqm.to_string(a) << ", " << bqm.to_string(b) << "\n"; display(tout, sz, p); tout << "\n";); numeral_vector & p_aux = m_dbab_tmp1; translate_bq(sz, p, a, p_aux); - TRACE("upolynomial", tout << "after translation\n"; display(tout, p_aux); tout << "\n";); + TRACE(upolynomial, tout << "after translation\n"; display(tout, p_aux); tout << "\n";); scoped_mpbq b_a(bqm); bqm.sub(b, a, b_a); compose_p_b_x(p_aux.size(), p_aux.data(), b_a); - TRACE("upolynomial", tout << "after composition: " << bqm.to_string(b_a) << "\n"; display(tout, p_aux); tout << "\n";); + TRACE(upolynomial, tout << "after composition: " << bqm.to_string(b_a) << "\n"; display(tout, p_aux); tout << "\n";); unsigned result = descartes_bound_0_1(p_aux.size(), p_aux.data()); return result; } @@ -1538,7 +1538,7 @@ namespace upolynomial { return; // Step 1 compose_2kn_p_x_div_2k(sz, p, b.k()); - TRACE("upolynomial", tout << "after compose 2kn_p_x_div_2k\n"; display(tout, sz, p); tout << "\n";); + TRACE(upolynomial, tout << "after compose 2kn_p_x_div_2k\n"; display(tout, sz, p); tout << "\n";); // Step 2 numeral const & c = b.numerator(); unsigned n = sz - 1; @@ -1551,7 +1551,7 @@ namespace upolynomial { } m().mul2k(p[n], b.k()); } - TRACE("upolynomial", tout << "after special translation\n"; display(tout, sz, p); tout << "\n";); + TRACE(upolynomial, tout << "after special translation\n"; display(tout, sz, p); tout << "\n";); } // Similar to translate_bq but for rationals @@ -1560,7 +1560,7 @@ namespace upolynomial { return; // Step 1 compose_an_p_x_div_a(sz, p, b.denominator()); - TRACE("upolynomial", tout << "after compose_an_p_x_div_a\n"; display(tout, sz, p); tout << "\n";); + TRACE(upolynomial, tout << "after compose_an_p_x_div_a\n"; display(tout, sz, p); tout << "\n";); // Step 2 numeral const & c = b.numerator(); unsigned n = sz - 1; @@ -1573,7 +1573,7 @@ namespace upolynomial { } m().mul(p[n], b.denominator(), p[n]); } - TRACE("upolynomial", tout << "after special translation\n"; display(tout, sz, p); tout << "\n";); + TRACE(upolynomial, tout << "after special translation\n"; display(tout, sz, p); tout << "\n";); } // p(x) := 2^n*p(x/2) where n = sz-1 @@ -2146,7 +2146,7 @@ namespace upolynomial { unsigned idx = frame_stack.size() - 1; while (idx != UINT_MAX) { drs_frame const & fr = frame_stack[idx]; - TRACE("upolynomial", + TRACE(upolynomial, tout << "normalizing...\n"; tout << "idx: " << idx << ", left: " << fr.m_left << ", l: " << bqm.to_string(l) << ", u: " << bqm.to_string(u) << "\n";); if (fr.m_left) { @@ -2161,7 +2161,7 @@ namespace upolynomial { } idx = fr.m_parent_idx; } - TRACE("upolynomial", tout << "adding normalized interval (" << bqm.to_string(l) << ", " << bqm.to_string(u) << ")\n";); + TRACE(upolynomial, tout << "adding normalized interval (" << bqm.to_string(l) << ", " << bqm.to_string(u) << ")\n";); lowers.push_back(mpbq()); uppers.push_back(mpbq()); swap(lowers.back(), l); @@ -2187,32 +2187,32 @@ namespace upolynomial { } idx = fr.m_parent_idx; } - TRACE("upolynomial", tout << "adding normalized root: " << bqm.to_string(u) << "\n";); + TRACE(upolynomial, tout << "adding normalized root: " << bqm.to_string(u) << "\n";); roots.push_back(mpbq()); swap(roots.back(), u); } // Isolate roots in the interval (0, 1) void manager::drs_isolate_0_1_roots(unsigned sz, numeral const * p, mpbq_manager & bqm, mpbq_vector & roots, mpbq_vector & lowers, mpbq_vector & uppers) { - TRACE("upolynomial", tout << "isolating (0,1) roots of:\n"; display(tout, sz, p); tout << "\n";); + TRACE(upolynomial, tout << "isolating (0,1) roots of:\n"; display(tout, sz, p); tout << "\n";); unsigned k = descartes_bound_0_1(sz, p); // easy cases... if (k == 0) { - TRACE("upolynomial", tout << "polynomial does not have any roots\n";); + TRACE(upolynomial, tout << "polynomial does not have any roots\n";); return; } if (k == 1) { - TRACE("upolynomial", tout << "polynomial has one root in (0, 1)\n";); + TRACE(upolynomial, tout << "polynomial has one root in (0, 1)\n";); lowers.push_back(mpbq(0)); uppers.push_back(mpbq(1)); return; } - TRACE("upolynomial", tout << "polynomial has more than one root in (0, 1), starting search...\n";); + TRACE(upolynomial, tout << "polynomial has more than one root in (0, 1), starting search...\n";); scoped_numeral_vector q(m()); scoped_numeral_vector p_stack(m()); svector frame_stack; if (has_one_half_root(sz, p)) { - TRACE("upolynomial", tout << "polynomial has a 1/2 root\n";); + TRACE(upolynomial, tout << "polynomial has a 1/2 root\n";); roots.push_back(mpbq(1, 1)); remove_one_half_root(sz, p, q); push_child_frames(q.size(), q.data(), p_stack, frame_stack); @@ -2227,7 +2227,7 @@ namespace upolynomial { unsigned sz = fr.m_size; SASSERT(sz <= p_stack.size()); numeral const * p = p_stack.data() + p_stack.size() - sz; - TRACE("upolynomial", tout << "processing frame #" << frame_stack.size() - 1 << "\n" + TRACE(upolynomial, tout << "processing frame #" << frame_stack.size() - 1 << "\n" << "first: " << fr.m_first << ", left: " << fr.m_left << ", sz: " << fr.m_size << ", parent_idx: "; if (fr.m_parent_idx == UINT_MAX) tout << ""; else tout << fr.m_parent_idx; tout << "\np: "; display(tout, sz, p); tout << "\n";); @@ -2238,19 +2238,19 @@ namespace upolynomial { fr.m_first = false; unsigned k = descartes_bound_0_1(sz, p); if (k == 0) { - TRACE("upolynomial", tout << "(0, 1) does not have roots\n";); + TRACE(upolynomial, tout << "(0, 1) does not have roots\n";); pop_top_frame(p_stack, frame_stack); continue; } if (k == 1) { - TRACE("upolynomial", tout << "(0, 1) is isolating interval\n";); + TRACE(upolynomial, tout << "(0, 1) is isolating interval\n";); add_isolating_interval(frame_stack, bqm, lowers, uppers); pop_top_frame(p_stack, frame_stack); continue; } - TRACE("upolynomial", tout << "polynomial has more than one root in (0, 1) creating child frames...\n";); + TRACE(upolynomial, tout << "polynomial has more than one root in (0, 1) creating child frames...\n";); if (has_one_half_root(sz, p)) { - TRACE("upolynomial", tout << "1/2 is a root\n";); + TRACE(upolynomial, tout << "1/2 is a root\n";); add_root(frame_stack, bqm, roots); remove_one_half_root(sz, p, q); push_child_frames(q.size(), q.data(), p_stack, frame_stack); @@ -2295,7 +2295,7 @@ namespace upolynomial { // p(x) := p(2^{pos_k} * x) // Since the desired positive roots of p(x) are in (0, 2^pos_k), - TRACE("upolynomial", tout << "searching at (0, 1)\n";); + TRACE(upolynomial, tout << "searching at (0, 1)\n";); unsigned old_roots_sz = roots.size(); unsigned old_lowers_sz = lowers.size(); drs_isolate_0_1_roots(sz, aux_p.data(), bqm, roots, lowers, uppers); @@ -2308,7 +2308,7 @@ namespace upolynomial { // p(x) := p(-x) p_minus_x(sz, p); compose_p_2k_x(sz, p, neg_k); - TRACE("upolynomial", tout << "searching at (-1, 0) using:\n"; display(tout, sz, p); tout << "\n";); + TRACE(upolynomial, tout << "searching at (-1, 0) using:\n"; display(tout, sz, p); tout << "\n";); old_roots_sz = roots.size(); old_lowers_sz = lowers.size(); drs_isolate_0_1_roots(sz, p, bqm, roots, lowers, uppers); @@ -2328,7 +2328,7 @@ namespace upolynomial { set(sz, p, p1); normalize(p1); - TRACE("upolynomial", + TRACE(upolynomial, scoped_numeral U(m()); root_upper_bound(p1.size(), p1.data(), U); unsigned U_k = m().log2(U) + 1; @@ -2395,7 +2395,7 @@ namespace upolynomial { scoped_mpbq curr_upper(bqm); sturm_seq(sz, p, seq); ss_frame_stack s(bqm); - TRACE("upolynomial", tout << "p: "; display(tout, sz, p); tout << "\nSturm seq:\n"; display(tout, seq); tout << "\n";); + TRACE(upolynomial, tout << "p: "; display(tout, sz, p); tout << "\nSturm seq:\n"; display(tout, seq); tout << "\n";); unsigned lower_sv = sign_variations_at_minus_inf(seq); unsigned zero_sv = sign_variations_at_zero(seq); @@ -2449,7 +2449,7 @@ namespace upolynomial { SASSERT(lower_sv > upper_sv + 1); bqm.add(curr_lower, curr_upper, mid); bqm.div2(mid); - TRACE("upolynomial", + TRACE(upolynomial, tout << "depth: " << s.size() << "\n"; tout << "lower_sv: " << lower_sv << "\n"; tout << "upper_sv: " << upper_sv << "\n"; @@ -2495,7 +2495,7 @@ namespace upolynomial { roots.push_back(mpbq(0)); scoped_numeral_vector nz_p(m()); remove_zero_roots(sz, p, nz_p); - TRACE("upolynomial", tout << "after removing zero root:\n"; display(tout, nz_p); tout << "\n";); + TRACE(upolynomial, tout << "after removing zero root:\n"; display(tout, nz_p); tout << "\n";); SASSERT(!has_zero_roots(nz_p.size(), nz_p.data())); sqf_nz_isolate_roots(nz_p.size(), nz_p.data(), bqm, roots, lowers, uppers); } @@ -2506,10 +2506,10 @@ namespace upolynomial { void manager::isolate_roots(unsigned sz, numeral const * p, mpbq_manager & bqm, mpbq_vector & roots, mpbq_vector & lowers, mpbq_vector & uppers) { SASSERT(sz > 0); - TRACE("upolynomial", tout << "isolating roots of:\n"; display(tout, sz, p); tout << "\n";); + TRACE(upolynomial, tout << "isolating roots of:\n"; display(tout, sz, p); tout << "\n";); scoped_numeral_vector sqf_p(m()); square_free(sz, p, sqf_p); - TRACE("upolynomial", tout << "square free part:\n"; display(tout, sqf_p); tout << "\n";); + TRACE(upolynomial, tout << "square free part:\n"; display(tout, sqf_p); tout << "\n";); sqf_isolate_roots(sqf_p.size(), sqf_p.data(), bqm, roots, lowers, uppers); } @@ -2596,7 +2596,7 @@ namespace upolynomial { bool manager::isolating2refinable(unsigned sz, numeral const * p, mpbq_manager & bqm, mpbq & a, mpbq & b) { int sign_a = eval_sign_at(sz, p, a); int sign_b = eval_sign_at(sz, p, b); - TRACE("upolynomial", tout << "sign_a: " << sign_a << ", sign_b: " << sign_b << "\n";); + TRACE(upolynomial, tout << "sign_a: " << sign_a << ", sign_b: " << sign_b << "\n";); if (sign_a != 0 && sign_b != 0) { // CASE 1 SASSERT(sign_a == -sign_b); // p is square free @@ -2609,7 +2609,7 @@ namespace upolynomial { bqm.add(a, b, new_a); bqm.div2(new_a); while (true) { - TRACE("upolynomial", tout << "CASE 2, a: " << bqm.to_string(a) << ", b: " << bqm.to_string(b) << ", new_a: " << bqm.to_string(new_a) << "\n";); + TRACE(upolynomial, tout << "CASE 2, a: " << bqm.to_string(a) << ", b: " << bqm.to_string(b) << ", new_a: " << bqm.to_string(new_a) << "\n";); int sign_new_a = eval_sign_at(sz, p, new_a); if (sign_new_a != sign_b) { swap(new_a, a); @@ -2634,7 +2634,7 @@ namespace upolynomial { bqm.add(a, b, new_b); bqm.div2(new_b); while (true) { - TRACE("upolynomial", tout << "CASE 3, a: " << bqm.to_string(a) << ", b: " << bqm.to_string(b) << ", new_b: " << bqm.to_string(new_b) << "\n";); + TRACE(upolynomial, tout << "CASE 3, a: " << bqm.to_string(a) << ", b: " << bqm.to_string(b) << ", new_b: " << bqm.to_string(new_b) << "\n";); int sign_new_b = eval_sign_at(sz, p, new_b); if (sign_new_b != sign_a) { SASSERT(sign_new_b == 0 || // found the actual root @@ -2687,7 +2687,7 @@ namespace upolynomial { bqm.div2(new_b2); while (true) { - TRACE("upolynomial", + TRACE(upolynomial, tout << "CASE 4\na1: " << bqm.to_string(a1) << ", b1: " << bqm.to_string(b1) << ", new_a1: " << bqm.to_string(new_a1) << "\n"; tout << "a2: " << bqm.to_string(a2) << ", b2: " << bqm.to_string(b2) << ", new_b2: " << bqm.to_string(new_b2) << "\n";); int sign_new_a1 = eval_sign_at(sz, p, new_a1); @@ -2814,14 +2814,14 @@ namespace upolynomial { SASSERT(!::is_zero(sign_a) && !::is_zero(sign_b)); SASSERT(sign_a == -sign_b); bool found_d = false; - TRACE("convert_bug", + TRACE(convert_bug, tout << "a: " << m().to_string(a.numerator()) << "/" << m().to_string(a.denominator()) << "\n"; tout << "b: " << m().to_string(b.numerator()) << "/" << m().to_string(b.denominator()) << "\n"; tout << "sign_a: " << sign_a << "\n"; tout << "sign_b: " << sign_b << "\n";); scoped_mpbq lower(bqm), upper(bqm); if (bqm.to_mpbq(a, lower)) { - TRACE("convert_bug", tout << "found c: " << lower << "\n";); + TRACE(convert_bug, tout << "found c: " << lower << "\n";); // found c swap(c, lower); SASSERT(bqm.eq(c, a)); @@ -2832,7 +2832,7 @@ namespace upolynomial { bqm.mul2(upper); if (m_manager.is_neg(a.numerator())) ::swap(lower, upper); - TRACE("convert_bug", + TRACE(convert_bug, tout << "a: "; m().display(tout, a.numerator()); tout << "/"; m().display(tout, a.denominator()); tout << "\n"; tout << "lower: "; bqm.display(tout, lower); tout << ", upper: "; bqm.display(tout, upper); tout << "\n";); SASSERT(bqm.lt(lower, a)); @@ -2958,12 +2958,12 @@ namespace upolynomial { void manager::factor_2_sqf_pp(numeral_vector & p, factors & r, unsigned k) { SASSERT(p.size() == 3); // p has degree 2 - TRACE("factor", tout << "factor square free (degree == 2):\n"; display(tout, p); tout << "\n";); + TRACE(factor, tout << "factor square free (degree == 2):\n"; display(tout, p); tout << "\n";); numeral const & a = p[2]; numeral const & b = p[1]; numeral const & c = p[0]; - TRACE("factor", tout << "a: " << m().to_string(a) << "\nb: " << m().to_string(b) << "\nc: " << m().to_string(c) << "\n";); + TRACE(factor, tout << "a: " << m().to_string(a) << "\nb: " << m().to_string(b) << "\nc: " << m().to_string(c) << "\n";); // Create the discriminant: b^2 - 4*a*c scoped_numeral b2(m()); scoped_numeral ac(m()); @@ -2979,7 +2979,7 @@ namespace upolynomial { r.push_back(p, k); return; } - TRACE("factor", tout << "disc_sqrt: " << m().to_string(disc_sqrt) << "\n";); + TRACE(factor, tout << "disc_sqrt: " << m().to_string(disc_sqrt) << "\n";); // p = cont*(2*a*x + b - disc_sqrt)*(2*a*x + b + disc_sqrt) scoped_numeral_vector f1(m()); scoped_numeral_vector f2(m()); @@ -2992,7 +2992,7 @@ namespace upolynomial { set_size(2, f2); normalize(f1); normalize(f2); - TRACE("factor", tout << "f1: "; display(tout, f1); tout << "\nf2: "; display(tout, f2); tout << "\n";); + TRACE(factor, tout << "f1: "; display(tout, f1); tout << "\nf2: "; display(tout, f2); tout << "\n";); DEBUG_CODE({ scoped_numeral_vector f1f2(m()); mul(f1, f2, f1f2); @@ -3064,12 +3064,12 @@ namespace upolynomial { else { // B is of the form P_2 * P_3^2 * ... * P_k^{k-1} VERIFY(exact_div(C, B, A)); - TRACE("factor_bug", tout << "C: "; display(tout, C); tout << "\nB: "; display(tout, B); tout << "\nA: "; display(tout, A); tout << "\n";); + TRACE(factor_bug, tout << "C: "; display(tout, C); tout << "\nB: "; display(tout, B); tout << "\nA: "; display(tout, A); tout << "\n";); // A is of the form P_1 * P_2 * ... * P_k unsigned j = 1; while (!is_const(A)) { checkpoint(); - TRACE("factor", tout << "factor_core main loop j: " << j << "\nA: "; display(tout, A); tout << "\nB: "; display(tout, B); tout << "\n";); + TRACE(factor, tout << "factor_core main loop j: " << j << "\nA: "; display(tout, A); tout << "\nB: "; display(tout, B); tout << "\n";); // A is of the form P_j * P_{j+1} * P_{j+2} * ... * P_k // B is of the form P_{j+1} * P_{j+2}^2 * ... * P_k^{k - j - 2} gcd(A, B, D); @@ -3082,20 +3082,20 @@ namespace upolynomial { result = false; } else { - TRACE("factor", tout << "const C: "; display(tout, C); tout << "\n";); + TRACE(factor, tout << "const C: "; display(tout, C); tout << "\n";); SASSERT(C.size() == 1); SASSERT(m().is_one(C[0]) || m().is_minus_one(C[0])); if (m().is_minus_one(C[0]) && j % 2 == 1) flip_sign(r); } - TRACE("factor_bug", tout << "B: "; display(tout, B); tout << "\nD: "; display(tout, D); tout << "\n";); + TRACE(factor_bug, tout << "B: "; display(tout, B); tout << "\nD: "; display(tout, D); tout << "\n";); VERIFY(exact_div(B, D, B)); // B is of the form P_{j+2} * ... * P_k^{k - j - 3} A.swap(D); // D is of the form P_{j+1} * P_{j+2} * ... * P_k j++; } - TRACE("factor_bug", tout << "A: "; display(tout, A); tout << "\n";); + TRACE(factor_bug, tout << "A: "; display(tout, A); tout << "\n";); SASSERT(A.size() == 1 && m().is_one(A[0])); } return result; diff --git a/src/math/polynomial/upolynomial_factorization.cpp b/src/math/polynomial/upolynomial_factorization.cpp index 310a11fd1..c4c06c237 100644 --- a/src/math/polynomial/upolynomial_factorization.cpp +++ b/src/math/polynomial/upolynomial_factorization.cpp @@ -94,7 +94,7 @@ public: m_row_pivot(m_size, -1) { unsigned p = get_p_from_manager(m_zpm); - TRACE("polynomial::factorization::bughunt", tout << "polynomial::berlekamp_matrix("; m_upm.display(tout, f); tout << ", " << p << ")" << endl;); + TRACE(polynomial_factorization__bughunt, tout << "polynomial::berlekamp_matrix("; m_upm.display(tout, f); tout << ", " << p << ")" << endl;); // the first row is always the vector [1, 0, ..., 0], since x^0 = 0 (modulo f) m_matrix.push_back(1); @@ -139,7 +139,7 @@ public: m_zpm.dec(get(i, i)); } - TRACE("polynomial::factorization::bughunt", tout << "polynomial::berlekamp_matrix():" << endl; display(tout); tout << endl;); + TRACE(polynomial_factorization__bughunt, tout << "polynomial::berlekamp_matrix():" << endl; display(tout); tout << endl;); } /** @@ -195,7 +195,7 @@ public: } } - TRACE("polynomial::factorization::bughunt", tout << "polynomial::diagonalize():" << endl; display(tout); tout << endl;); + TRACE(polynomial_factorization__bughunt, tout << "polynomial::diagonalize():" << endl; display(tout); tout << endl;); return null_rank; } @@ -253,7 +253,7 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor zp_numeral_manager & nm = upm.m(); unsigned p = get_p_from_manager(upm.m()); - TRACE("polynomial::factorization", tout << "polynomial::square_free_factor("; upm.display(tout, f); tout << ") over Z_" << p << endl;); + TRACE(polynomial_factorization, tout << "polynomial::square_free_factor("; upm.display(tout, f); tout << ") over Z_" << p << endl;); scoped_numeral_vector div_tmp(nm); @@ -265,7 +265,7 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor scoped_numeral constant(nm); upm.mk_monic(T_0.size(), T_0.data(), constant); sq_free_factors.set_constant(constant); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "Initial factors: " << sq_free_factors << endl; tout << "R. = GF(" << p << ")['x']" << endl; tout << "T_0 = "; upm.display(tout, T_0); tout << endl; @@ -282,25 +282,25 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor { // [initialize e-loop] T = gcd(T_0, T_0'), V / T_0/T, k = 0 unsigned k = 0; - TRACE("polynomial::factorization::bughunt", tout << "k = 0" << endl;); + TRACE(polynomial_factorization__bughunt, tout << "k = 0" << endl;); // T_0_d = T_0' upm.derivative(T_0.size(), T_0.data(), T_0_d); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "T_0_d = T_0.derivative(x)" << endl; tout << "T_0_d == "; upm.display(tout, T_0_d); tout << endl; ); // T = gcd(T_0, T_0') upm.gcd(T_0.size(), T_0.data(), T_0_d.size(), T_0_d.data(), T); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "T = T_0.gcd(T_0_d)" << endl; tout << "T == "; upm.display(tout, T); tout << endl; ); // V = T_0 / T upm.div(T_0.size(), T_0.data(), T.size(), T.data(), V); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "V = T_0.quo_rem(T)[0]" << endl; tout << "V == "; upm.display(tout, V); tout << endl; ); @@ -311,7 +311,7 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor ++ k; // T = T/V upm.div(T.size(), T.data(), V.size(), V.data(), T); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "T = T.quo_rem(V)[0]" << endl; tout << "T == "; upm.display(tout, T); tout << endl; ); @@ -321,35 +321,35 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor // W = gcd(T, V) upm.gcd(T.size(), T.data(), V.size(), V.data(), W); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "W = T.gcd(V)" << endl; upm.display(tout, W); tout << endl; ); // A_ek = V/W upm.div(V.size(), V.data(), W.size(), W.data(), A_ek); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "A_ek = V.quo_rem(W)[0]" << endl; tout << "A_ek == "; upm.display(tout, A_ek); tout << endl; ); // V = W V.swap(W); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "V = W" << endl; tout << "V == "; upm.display(tout, V); tout << endl; ); // T = T/V upm.div(T.size(), T.data(), V.size(), V.data(), T); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "T = T.quo_rem(V)[0]" << endl; tout << "T == "; upm.display(tout, T); tout << endl; ); // if not constant, we output it if (A_ek.size() > 1) { - TRACE("polynomial::factorization::bughunt", tout << "Factor: ("; upm.display(tout, A_ek); tout << ")^" << e*k << endl;); + TRACE(polynomial_factorization__bughunt, tout << "Factor: ("; upm.display(tout, A_ek); tout << ")^" << e*k << endl;); sq_free_factors.push_back(A_ek, e*k); } } @@ -361,18 +361,18 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor T_0.push_back(numeral()); nm.set(T_0.back(), T[deg_p]); } - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "T_0 = "; upm.display(tout, T_0); tout << endl; ); } - TRACE("polynomial::factorization", tout << "polynomial::square_free_factor("; upm.display(tout, f); tout << ") => " << sq_free_factors << endl;); + TRACE(polynomial_factorization, tout << "polynomial::square_free_factor("; upm.display(tout, f); tout << ") => " << sq_free_factors << endl;); } bool zp_factor(zp_manager & upm, numeral_vector const & f, zp_factors & factors) { - TRACE("polynomial::factorization", + TRACE(polynomial_factorization, unsigned p = get_p_from_manager(upm.m()); tout << "polynomial::factor("; upm.display(tout, f); tout << ") over Z_" << p << endl;); @@ -396,7 +396,7 @@ bool zp_factor(zp_manager & upm, numeral_vector const & f, zp_factors & factors) // add the constant factors.set_constant(sq_free_factors.get_constant()); - TRACE("polynomial::factorization", tout << "polynomial::factor("; upm.display(tout, f); tout << ") => " << factors << endl;); + TRACE(polynomial_factorization, tout << "polynomial::factor("; upm.display(tout, f); tout << ") => " << factors << endl;); return factors.total_factors() > 1; } @@ -411,7 +411,7 @@ bool zp_factor_square_free_berlekamp(zp_manager & upm, numeral_vector const & f, mpzzp_manager & zpm = upm.m(); unsigned p = get_p_from_manager(zpm); - TRACE("polynomial::factorization", tout << "upolynomial::factor_square_free_berlekamp("; upm.display(tout, f); tout << ", " << p << ")" << endl;); + TRACE(polynomial_factorization, tout << "upolynomial::factor_square_free_berlekamp("; upm.display(tout, f); tout << ", " << p << ")" << endl;); SASSERT(zpm.is_one(f.back())); // construct the berlekamp Q matrix to get the null space @@ -425,11 +425,11 @@ bool zp_factor_square_free_berlekamp(zp_manager & upm, numeral_vector const & f, unsigned r = Q_I.diagonalize(); if (r == 1) { // since r == 1 == number of factors, then f is irreducible - TRACE("polynomial::factorization", tout << "upolynomial::factor_square_free_berlekamp("; upm.display(tout, f); tout << ", " << p << ") => " << factors << endl;); + TRACE(polynomial_factorization, tout << "upolynomial::factor_square_free_berlekamp("; upm.display(tout, f); tout << ", " << p << ") => " << factors << endl;); return false; } - TRACE("polynomial::factorization::bughunt", tout << "upolynomial::factor_square_free_berlekamp(): computing factors, expecting " << r << endl;); + TRACE(polynomial_factorization__bughunt, tout << "upolynomial::factor_square_free_berlekamp(): computing factors, expecting " << r << endl;); scoped_numeral_vector gcd(zpm); scoped_numeral_vector div(zpm); @@ -440,7 +440,7 @@ bool zp_factor_square_free_berlekamp(zp_manager & upm, numeral_vector const & f, scoped_numeral_vector v_k(zpm); while (Q_I.next_null_space_vector(v_k)) { - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "null vector: "; for(unsigned j = 0; j < d; ++ j) { tout << zpm.to_string(v_k[j]) << " "; @@ -449,7 +449,7 @@ bool zp_factor_square_free_berlekamp(zp_manager & upm, numeral_vector const & f, ); upm.trim(v_k); - // TRACE("polynomial::factorization", tout << "v_k = "; upm.display(tout, v_k); tout << endl;); + // TRACE(polynomial_factorization, tout << "v_k = "; upm.display(tout, v_k); tout << endl;); unsigned current_factor_end = factors.distinct_factors(); for (unsigned current_factor_i = first_factor; current_factor_i < current_factor_end; ++ current_factor_i) { @@ -479,7 +479,7 @@ bool zp_factor_square_free_berlekamp(zp_manager & upm, numeral_vector const & f, // get the divisor also (no need to normalize the div, both are monic) upm.div(current_factor.size(), current_factor.data(), gcd.size(), gcd.data(), div); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "current_factor = "; upm.display(tout, current_factor); tout << endl; tout << "gcd_norm = "; upm.display(tout, gcd); tout << endl; tout << "div = "; upm.display(tout, div); tout << endl; @@ -495,7 +495,7 @@ bool zp_factor_square_free_berlekamp(zp_manager & upm, numeral_vector const & f, // at the point where we have all the factors, we are done if (factors.distinct_factors() - first_factor == r) { - TRACE("polynomial::factorization", tout << "polynomial::factor("; upm.display(tout, f); tout << ", " << p << ") => " << factors << " of degree " << factors.get_degree() << endl;); + TRACE(polynomial_factorization, tout << "polynomial::factor("; upm.display(tout, f); tout << ", " << p << ") => " << factors << " of degree " << factors.get_degree() << endl;); return true; } } @@ -533,7 +533,7 @@ bool check_hansel_lift(z_manager & upm, numeral_vector const & C, upm.sub(C.size(), C.data(), test1.size(), test1.data(), test1); to_zp_manager(br_upm, test1); if (!test1.empty()) { - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "sage: R. = ZZ['x']" << endl; tout << "sage: A = "; upm.display(tout, A); tout << endl; tout << "sage: B = "; upm.display(tout, B); tout << endl; @@ -586,7 +586,7 @@ void hensel_lift(z_manager & upm, numeral const & a, numeral const & b, numeral z_numeral_manager & nm = upm.zm(); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "polynomial::hensel_lift("; tout << "a = " << nm.to_string(a) << ", "; tout << "b = " << nm.to_string(b) << ", "; @@ -611,7 +611,7 @@ void hensel_lift(z_manager & upm, numeral const & a, numeral const & b, numeral upm.sub(C.size(), C.data(), f.size(), f.data(), f); upm.div(f, b); to_zp_manager(r_upm, f); - TRACE("polynomial::factorization", + TRACE(polynomial_factorization, tout << "f = "; upm.display(tout, f); tout << endl; ); @@ -634,33 +634,33 @@ void hensel_lift(z_manager & upm, numeral const & a, numeral const & b, numeral // compute the S, T (compute in Z_r[x]) scoped_numeral_vector Vf(r_upm.m()), t(r_upm.m()), S(r_upm.m()); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "V == "; upm.display(tout, V); tout << endl; ); r_upm.mul(V.size(), V.data(), f.size(), f.data(), Vf); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "Vf = V*f" << endl; tout << "Vf == "; upm.display(tout, Vf); tout << endl; ); r_upm.div_rem(Vf.size(), Vf.data(), A.size(), A.data(), t, S); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "[t, S] = Vf.quo_rem(A)" << endl; tout << "t == "; upm.display(tout, t); tout << endl; tout << "S == "; upm.display(tout, S); tout << endl; ); scoped_numeral_vector T(r_upm.m()), tmp(r_upm.m()); r_upm.mul(U.size(), U.data(), f.size(), f.data(), T); // T = fU - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "T == U*f" << endl; tout << "T == "; upm.display(tout, T); tout << endl; ); r_upm.mul(B.size(), B.data(), t.size(), t.data(), tmp); // tmp = Bt - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "tmp = B*t" << endl; tout << "tmp == "; upm.display(tout, tmp); tout << endl; ); r_upm.add(T.size(), T.data(), tmp.size(), tmp.data(), T); // T = Uf + Bt - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "T = B*tmp" << endl; tout << "T == "; upm.display(tout, T); tout << endl; ); @@ -685,7 +685,7 @@ bool check_quadratic_hensel(zp_manager & zpe_upm, numeral_vector const & U, nume scoped_mpz_vector one(nm); zpe_upm.add(tmp1.size(), tmp1.data(), tmp2.size(), tmp2.data(), one); if (one.size() != 1 || !nm.is_one(one[0])) { - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "sage: R. = Zmod(" << nm.to_string(zpe_upm.m().p()) << ")['x']" << endl; tout << "sage: A = "; zpe_upm.display(tout, A); tout << endl; tout << "sage: B = "; zpe_upm.display(tout, B); tout << endl; @@ -710,7 +710,7 @@ void hensel_lift_quadratic(z_manager& upm, numeral_vector const & C, zp_manager & zpe_upm, numeral_vector & A, numeral_vector & B, unsigned e) { z_numeral_manager & nm = upm.zm(); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "polynomial::hansel_lift_quadratic("; tout << "A = "; upm.display(tout, A); tout << ", "; tout << "B = "; upm.display(tout, B); tout << ", "; @@ -741,7 +741,7 @@ void hensel_lift_quadratic(z_manager& upm, numeral_vector const & C, hensel_lift(upm, pe, pe, pe, U, A, V, B, C, A_lifted, B_lifted); // now we have C = AB (mod b*r) - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "A_lifted = "; upm.display(tout, A_lifted); tout << endl; tout << "B_lifted = "; upm.display(tout, B_lifted); tout << endl; tout << "C = "; upm.display(tout, C); tout << endl; @@ -768,7 +768,7 @@ void hensel_lift_quadratic(z_manager& upm, numeral_vector const & C, upm.sub(g.size(), g.data(), tmp1.size(), tmp1.data(), g); // g = 1 - UA - VB upm.div(g, pe); to_zp_manager(zpe_upm, g); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "g = (1 - A_lifted*U - B_lifted*V)/" << nm.to_string(pe) << endl; tout << "g == "; upm.display(tout, g); tout << endl; ); @@ -823,7 +823,7 @@ bool check_hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors con to_zp_manager(zp_upm, f, f_zp); zp_upm.mul(mult_zp, f_zp.back()); if (!upm.eq(mult_zp, f_zp)) { - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "f = "; upm.display(tout, f); tout << endl; tout << "zp_fs = " << zp_fs << endl; tout << "sage: R. = Zmod(" << nm.to_string(p) << ")['x']" << endl; @@ -845,7 +845,7 @@ bool check_hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors con to_zp_manager(zpe_upm, f, f_zpe); zpe_upm.mul(mult_zpe, f_zpe.back()); if (!upm.eq(mult_zpe, f_zpe)) { - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "f = "; upm.display(tout, f); tout << endl; tout << "zpe_fs = " << zpe_fs << endl; tout << "sage: R. = Zmod(" << nm.to_string(pe) << ")['x']" << endl; @@ -883,7 +883,7 @@ void hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors const & z zp_manager & zpe_upm = zpe_fs.upm(); zpe_nm.set_zp(zp_nm.p()); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "polynomial::hansel_lift("; upm.display(tout, f); tout << ", " << zp_fs << ")" << endl; ); @@ -903,7 +903,7 @@ void hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors const & z // F_i = A (mod Z_p) zp_upm.set(zp_fs[i].size(), zp_fs[i].data(), A); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "A = "; upm.display(tout, A); tout << endl; ); @@ -918,13 +918,13 @@ void hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors const & z zp_nm.set(lc, f.back()); zp_upm.mul(C, lc); } - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "C = "; upm.display(tout, C); tout << endl; ); // we take B to be what's left from C and A zp_upm.div(C.size(), C.data(), A.size(), A.data(), B); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "B = "; upm.display(tout, B); tout << endl; ); @@ -932,7 +932,7 @@ void hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors const & z zpe_nm.set_zp(zp_nm.p()); hensel_lift_quadratic(upm, f_parts, zpe_upm, A, B, e); CASSERT("polynomial::factorizatio::bughunt", check_individual_lift(zp_upm, zp_fs[i], zpe_upm, A)); - TRACE("polynomial::factorization", + TRACE(polynomial_factorization, tout << "lifted to " << nm.to_string(zpe_upm.m().p()) << endl; tout << "A = "; upm.display(tout, A); tout << endl; tout << "B = "; upm.display(tout, B); tout << endl; @@ -957,7 +957,7 @@ void hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors const & z zpe_upm.mul(B, lc_inv); zpe_fs.push_back_swap(B, 1); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "polynomial::hansel_lift("; upm.display(tout, f); tout << ", " << zp_fs << ") => " << zpe_fs << endl; ); @@ -1017,7 +1017,7 @@ static unsigned mignotte_bound(z_manager & upm, numeral_vector const & f, numera This method also assumes f is primitive. */ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, unsigned k, factor_params const & params) { - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "sage: f = "; upm.display(tout, f); tout << endl; tout << "sage: if (not f.is_squarefree()): print 'Error, f is not square-free'" << endl; tout << "sage: print 'Factoring :', f" << endl; @@ -1049,7 +1049,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, } } - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "sage: f_pp = "; upm.display(tout, f_pp); tout << endl; tout << "sage: if (not (f_pp * 1 == f): print 'Error, content computation wrong'" << endl; ); @@ -1072,7 +1072,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, prime_iterator prime_it; scoped_numeral gcd_tmp(nm); unsigned trials = 0; - TRACE("polynomial::factorization::bughunt", tout << "trials: " << params.m_p_trials << "\n";); + TRACE(polynomial_factorization__bughunt, tout << "trials: " << params.m_p_trials << "\n";); while (trials <= params.m_p_trials) { upm.checkpoint(); // construct prime to check @@ -1086,7 +1086,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, // we need gcd(lc(f_pp), p) = 1 nm.gcd(p, f_pp.back(), gcd_tmp); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "sage: if (not (gcd(" << nm.to_string(p) << ", " << nm.to_string(f_pp.back()) << ")) == " << nm.to_string(gcd_tmp) << "): print 'Error, wrong gcd'" << endl; ); @@ -1098,7 +1098,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, scoped_numeral_vector f_pp_zp(nm); to_zp_manager(zp_upm, f_pp, f_pp_zp); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "sage: Rp. = GF(" << nm.to_string(p) << ")['x_p']"; tout << endl; tout << "sage: f_pp_zp = "; zp_upm.display(tout, f_pp_zp, "x_p"); tout << endl; ); @@ -1139,7 +1139,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, zp_fs.swap(current_fs); nm.set(zp_fs_p, p); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "best zp factorization (Z_" << nm.to_string(zp_fs_p) << "): "; tout << zp_fs << endl; tout << "best degree set: "; degree_set.display(tout); tout << endl; @@ -1153,7 +1153,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, // make sure to set the zp_manager back to modulo zp_fs_p zp_upm.set_zp(zp_fs_p); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "best zp factorization (Z_" << nm.to_string(zp_fs_p) << "): " << zp_fs << endl; tout << "best degree set: "; degree_set.display(tout); tout << endl; ); @@ -1161,7 +1161,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, // get a bound on B for the factors of f_pp with degree less or equal to deg(f)/2 // and then choose e to be smallest such that p^e > 2*lc(f)*B, we use the mignotte unsigned e = mignotte_bound(upm, f_pp, zp_fs_p); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "out p = " << nm.to_string(zp_fs_p) << ", and we'll work p^e for e = " << e << endl; ); @@ -1190,7 +1190,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, ufactorization_combination_iterator it(zpe_fs, degree_set); scoped_numeral_vector trial_factor(nm), trial_factor_quo(nm); scoped_numeral trial_factor_cont(nm); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "STARTING TRIAL DIVISION" << endl; tout << "zpe_fs" << zpe_fs << endl; tout << "degree_set = "; degree_set.display(tout); tout << endl; @@ -1237,14 +1237,14 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, // add the lc(f_pp) to the trial divisor zpe_upm.mul(trial_factor, f_pp_lc); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "f_pp*lc(f_pp) = "; upm.display(tout, f_pp); tout << endl; tout << "trial_factor = "; upm.display(tout, trial_factor); tout << endl; ); bool true_factor = upm.exact_div(f_pp, trial_factor, trial_factor_quo); - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "trial_factor = "; upm.display(tout, trial_factor); tout << endl; tout << "trial_factor_quo = "; upm.display(tout, trial_factor_quo); tout << endl; tout << "result = " << (true_factor ? "true" : "false") << endl; @@ -1272,7 +1272,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, // don't remove this combination remove = false; } - TRACE("polynomial::factorization::bughunt", + TRACE(polynomial_factorization__bughunt, tout << "factors = " << fs << endl; tout << "f_pp*lc(f_pp) = "; upm.display(tout, f_pp); tout << endl; tout << "lc(f_pp) = " << f_pp_lc << endl; diff --git a/src/math/realclosure/mpz_matrix.cpp b/src/math/realclosure/mpz_matrix.cpp index 701b3b26d..6d4c72773 100644 --- a/src/math/realclosure/mpz_matrix.cpp +++ b/src/math/realclosure/mpz_matrix.cpp @@ -218,7 +218,7 @@ bool mpz_matrix_manager::solve_core(mpz_matrix const & _A, mpz * b, bool int_sol scoped_mpz_matrix A(*this); set(A, _A); for (unsigned k = 0; k < A.m(); k++) { - TRACE("mpz_matrix", + TRACE(mpz_matrix, tout << "k: " << k << "\n" << A; tout << "b:"; for (unsigned i = 0; i < A.m(); i++) { @@ -359,7 +359,7 @@ unsigned mpz_matrix_manager::linear_independent_rows(mpz_matrix const & _A, unsi for (unsigned i = 0; i < A.m(); i++) rows[i] = i; for (unsigned k1 = 0, k2 = 0; k1 < A.m(); k1++) { - TRACE("mpz_matrix", tout << "k1: " << k1 << ", k2: " << k2 << "\n" << A;); + TRACE(mpz_matrix, tout << "k1: " << k1 << ", k2: " << k2 << "\n" << A;); // find pivot unsigned pivot = UINT_MAX; for (unsigned i = k1; i < A.m(); i++) { diff --git a/src/math/realclosure/realclosure.cpp b/src/math/realclosure/realclosure.cpp index 561d6a6d7..3e3ab2e0f 100644 --- a/src/math/realclosure/realclosure.cpp +++ b/src/math/realclosure/realclosure.cpp @@ -1300,7 +1300,7 @@ namespace realclosure { t->m_k++; t->m_proc(t->m_k, qim(), i); int m = magnitude(i); - TRACE("rcf_transcendental", + TRACE(rcf_transcendental, tout << "refine_transcendental_interval rational: " << m << "\nrational interval: "; qim().display(tout, i); tout << std::endl;); unsigned k; @@ -1318,7 +1318,7 @@ namespace realclosure { void refine_transcendental_interval(transcendental * t, unsigned prec) { while (!check_precision(t->interval(), prec)) { - TRACE("rcf_transcendental", tout << "refine_transcendental_interval: " << magnitude(t->interval()) << std::endl;); + TRACE(rcf_transcendental, tout << "refine_transcendental_interval: " << magnitude(t->interval()) << std::endl;); checkpoint(); save_interval_if_too_small(t, prec); refine_transcendental_interval(t); @@ -1675,7 +1675,7 @@ namespace realclosure { // Output values int & q_eq_0, int & q_gt_0, int & q_lt_0, value_ref_buffer & q2) { - TRACE("rcf_count_signs", + TRACE(rcf_count_signs, tout << "p: "; display_poly(tout, p_sz, p); tout << "\n"; tout << "q: "; display_poly(tout, q_sz, q); tout << "\n";); SASSERT(num_roots > 0); @@ -1989,7 +1989,7 @@ namespace realclosure { SASSERT(M_s.m() == M_s.n()); SASSERT(M_s.m() == taqrs.size()); SASSERT(M_s.m() == scs.size()); - TRACE("rcf_sign_det", + TRACE(rcf_sign_det, tout << M_s; for (unsigned j = 0; j < scs.size(); j++) { display_sign_conditions(tout, scs[j]); @@ -2007,7 +2007,7 @@ namespace realclosure { int q_eq_0, q_gt_0, q_lt_0; value_ref_buffer q2(*this); count_signs_at_zeros(p_sz, p, q_sz, q, iso_interval, num_roots, q_eq_0, q_gt_0, q_lt_0, q2); - TRACE("rcf_sign_det", + TRACE(rcf_sign_det, tout << "q: "; display_poly(tout, q_sz, q); tout << "\n"; tout << "#(q == 0): " << q_eq_0 << ", #(q > 0): " << q_gt_0 << ", #(q < 0): " << q_lt_0 << "\n";); scoped_mpz_matrix M(mm()); @@ -2028,7 +2028,7 @@ namespace realclosure { // Solve // new_M_s * sc_cardinalities = new_taqrs VERIFY(mm().solve(new_M_s, sc_cardinalities.data(), new_taqrs.data())); - TRACE("rcf_sign_det", tout << "solution: "; for (unsigned i = 0; i < sc_cardinalities.size(); i++) { tout << sc_cardinalities[i] << " "; } tout << "\n";); + TRACE(rcf_sign_det, tout << "solution: "; for (unsigned i = 0; i < sc_cardinalities.size(); i++) { tout << sc_cardinalities[i] << " "; } tout << "\n";); // The solution must contain only positive values <= num_roots DEBUG_CODE(for (unsigned j = 0; j < sc_cardinalities.size(); j++) { SASSERT(0 <= sc_cardinalities[j] && sc_cardinalities[j] <= num_roots); }); // We should keep q only if it discriminated something. @@ -2085,7 +2085,7 @@ namespace realclosure { break; } } - TRACE("rcf_sign_det", + TRACE(rcf_sign_det, tout << "Final state\n"; display_poly(tout, p_sz, p); tout << "\n"; tout << M_s; @@ -2284,7 +2284,7 @@ namespace realclosure { bool has_neg_upper = neg_root_upper_bound(n, p, neg_upper_N); bool has_pos_lower = pos_root_lower_bound(n, p, pos_lower_N); bool has_pos_upper = pos_root_upper_bound(n, p, pos_upper_N); - TRACE("rcf_isolate", + TRACE(rcf_isolate, display_poly(tout, n, p); tout << "\n"; if (has_neg_lower) tout << "-2^" << neg_lower_N; else tout << "-oo"; tout << " < neg-roots < "; @@ -2302,7 +2302,7 @@ namespace realclosure { int num_sv_plus_inf = sign_variations_at_plus_inf(seq); int num_neg_roots = num_sv_minus_inf - num_sv_zero; int num_pos_roots = num_sv_zero - num_sv_plus_inf; - TRACE("rcf_isolate", + TRACE(rcf_isolate, tout << "num_neg_roots: " << num_neg_roots << "\n"; tout << "num_pos_roots: " << num_pos_roots << "\n";); scoped_mpbqi pos_interval(bqim()); @@ -2392,7 +2392,7 @@ namespace realclosure { \brief Root isolation for polynomials where 0 is not a root. */ void nz_isolate_roots(unsigned n, value * const * p, numeral_vector & roots) { - TRACE("rcf_isolate", + TRACE(rcf_isolate, tout << "nz_isolate_roots\n"; display_poly(tout, n, p); tout << "\n";); if (m_clean_denominators) { @@ -2410,7 +2410,7 @@ namespace realclosure { \brief Root isolation entry point. */ void isolate_roots(unsigned n, numeral const * p, numeral_vector & roots) { - TRACE("rcf_isolate_bug", tout << "isolate_roots: "; for (unsigned i = 0; i < n; i++) { display(tout, p[i]); tout << " "; } tout << "\n";); + TRACE(rcf_isolate_bug, tout << "isolate_roots: "; for (unsigned i = 0; i < n; i++) { display(tout, p[i]); tout << " "; } tout << "\n";); SASSERT(n > 0); SASSERT(!is_zero(p[n-1])); if (n == 1) { @@ -2903,7 +2903,7 @@ namespace realclosure { void rem(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & r) { SASSERT(p1 != r.data()); SASSERT(p2 != r.data()); - TRACE("rcf_rem", + TRACE(rcf_rem, tout << "rem\n"; display_poly(tout, sz1, p1); tout << "\n"; display_poly(tout, sz2, p2); tout << "\n";); @@ -2922,7 +2922,7 @@ namespace realclosure { checkpoint(); sz1 = r.size(); if (sz1 < sz2) { - TRACE("rcf_rem", tout << "rem result\n"; display_poly(tout, r.size(), r.data()); tout << "\n";); + TRACE(rcf_rem, tout << "rem result\n"; display_poly(tout, r.size(), r.data()); tout << "\n";); return; } unsigned m_n = sz1 - sz2; @@ -2947,7 +2947,7 @@ namespace realclosure { void prem(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, unsigned & d, value_ref_buffer & r) { SASSERT(p1 != r.data()); SASSERT(p2 != r.data()); - TRACE("rcf_prem", + TRACE(rcf_prem, tout << "prem\n"; display_poly(tout, sz1, p1); tout << "\n"; display_poly(tout, sz2, p2); tout << "\n";); @@ -2967,7 +2967,7 @@ namespace realclosure { checkpoint(); sz1 = r.size(); if (sz1 < sz2) { - TRACE("rcf_prem", tout << "prem result\n"; display_poly(tout, r.size(), r.data()); tout << "\n";); + TRACE(rcf_prem, tout << "prem result\n"; display_poly(tout, r.size(), r.data()); tout << "\n";); return; } unsigned m_n = sz1 - sz2; @@ -3170,7 +3170,7 @@ namespace realclosure { */ void clean_denominators_core(value * a, value_ref & p, value_ref & q) { INC_DEPTH(); - TRACE("rcf_clean", tout << "clean_denominators_core [" << m_exec_depth << "]\na: "; display(tout, a, false); tout << "\n";); + TRACE(rcf_clean, tout << "clean_denominators_core [" << m_exec_depth << "]\na: "; display(tout, a, false); tout << "\n";); p.reset(); q.reset(); if (a == nullptr) { p = a; @@ -3298,7 +3298,7 @@ namespace realclosure { } bool found_lt_eq = false; for (unsigned j = 0; j < p_sz; j++) { - TRACE("rcf_clean_bug", tout << "j: " << j << " "; display(tout, m, false); tout << "\n";); + TRACE(rcf_clean_bug, tout << "j: " << j << " "; display(tout, m, false); tout << "\n";); if (!dens[j]) continue; if (i != j && !is_nz_rational(dens[j])) { @@ -3663,7 +3663,7 @@ namespace realclosure { */ void gcd(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & r) { INC_DEPTH(); - TRACE("rcf_gcd", tout << "GCD [" << m_exec_depth << "]\n"; + TRACE(rcf_gcd, tout << "GCD [" << m_exec_depth << "]\n"; display_poly(tout, sz1, p1); tout << "\n"; display_poly(tout, sz2, p2); tout << "\n";); if (sz1 == 0) { @@ -3681,13 +3681,13 @@ namespace realclosure { A.append(sz1, p1); B.append(sz2, p2); while (true) { - TRACE("rcf_gcd", + TRACE(rcf_gcd, tout << "A: "; display_poly(tout, A.size(), A.data()); tout << "\n"; tout << "B: "; display_poly(tout, B.size(), B.data()); tout << "\n";); if (B.empty()) { mk_monic(A); r = A; - TRACE("rcf_gcd", + TRACE(rcf_gcd, tout << "gcd result: "; display_poly(tout, r.size(), r.data()); tout << "\n";); return; } @@ -3708,7 +3708,7 @@ namespace realclosure { void prem_gcd(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & r) { INC_DEPTH(); - TRACE("rcf_gcd", tout << "prem-GCD [" << m_exec_depth << "]\n"; + TRACE(rcf_gcd, tout << "prem-GCD [" << m_exec_depth << "]\n"; display_poly(tout, sz1, p1); tout << "\n"; display_poly(tout, sz2, p2); tout << "\n";); SASSERT(p1 != r.data()); @@ -3728,14 +3728,14 @@ namespace realclosure { A.append(sz1, p1); B.append(sz2, p2); while (true) { - TRACE("rcf_gcd", + TRACE(rcf_gcd, tout << "A: "; display_poly(tout, A.size(), A.data()); tout << "\n"; tout << "B: "; display_poly(tout, B.size(), B.data()); tout << "\n";); if (B.empty()) { normalize_int_coeffs(A); flip_sign_if_lc_neg(A); r = A; - TRACE("rcf_gcd", + TRACE(rcf_gcd, tout << "gcd result: "; display_poly(tout, r.size(), r.data()); tout << "\n";); return; } @@ -3805,7 +3805,7 @@ namespace realclosure { flet set(m_in_aux_values, true); SASSERT(seq.size() >= 2); - TRACE("rcf_sturm_seq", + TRACE(rcf_sturm_seq, unsigned sz = seq.size(); tout << "sturm_seq_core [" << m_exec_depth << "]\n"; display_poly(tout, seq.size(sz-2), seq.coeffs(sz-2)); tout << "\n"; @@ -3820,7 +3820,7 @@ namespace realclosure { else { srem(seq.size(sz-2), seq.coeffs(sz-2), seq.size(sz-1), seq.coeffs(sz-1), r); } - TRACE("rcf_sturm_seq", + TRACE(rcf_sturm_seq, tout << "sturm_seq_core [" << m_exec_depth << "], new polynomial\n"; display_poly(tout, r.size(), r.data()); tout << "\n";); if (r.empty()) @@ -4208,7 +4208,7 @@ namespace realclosure { */ int TaQ(unsigned p_sz, value * const * p, unsigned q_sz, value * const * q, mpbqi const & interval) { INC_DEPTH(); - TRACE("rcf_TaQ", tout << "TaQ [" << m_exec_depth << "]\n"; + TRACE(rcf_TaQ, tout << "TaQ [" << m_exec_depth << "]\n"; display_poly(tout, p_sz, p); tout << "\n"; display_poly(tout, q_sz, q); tout << "\n";); scoped_polynomial_seq seq(*this); @@ -4224,7 +4224,7 @@ namespace realclosure { */ int TaQ_1(unsigned p_sz, value * const * p, mpbqi const & interval) { INC_DEPTH(); - TRACE("rcf_TaQ", tout << "TaQ_1 [" << m_exec_depth << "]\n"; + TRACE(rcf_TaQ, tout << "TaQ_1 [" << m_exec_depth << "]\n"; display_poly(tout, p_sz, p); tout << "\n";); scoped_polynomial_seq seq(*this); sturm_seq(p_sz, p, seq); @@ -4324,7 +4324,7 @@ namespace realclosure { refine_transcendental_interval(to_transcendental(v->ext()), _prec); update_rf_interval(v, prec); - TRACE("rcf_transcendental", tout << "after update_rf_interval: " << magnitude(v->interval()) << " "; + TRACE(rcf_transcendental, tout << "after update_rf_interval: " << magnitude(v->interval()) << " "; bqim().display(tout, v->interval()); tout << std::endl;); if (check_precision(v->interval(), prec)) @@ -4471,7 +4471,7 @@ namespace realclosure { return false; update_rf_interval(v, prec); - TRACE("rcf_algebraic", tout << "after update_rf_interval: " << magnitude(v->interval()) << " "; bqim().display(tout, v->interval()); tout << std::endl;); + TRACE(rcf_algebraic, tout << "after update_rf_interval: " << magnitude(v->interval()) << " "; bqim().display(tout, v->interval()); tout << std::endl;); if (check_precision(v->interval(), prec)) return true; _prec++; @@ -4913,7 +4913,7 @@ namespace realclosure { bool expensive_determine_algebraic_sign(rational_function_value * v) { SASSERT(contains_zero(v->interval())); SASSERT(v->ext()->is_algebraic()); - TRACE("rcf_algebraic_sign", + TRACE(rcf_algebraic_sign, tout << "expensive_determine_algebraic_sign\n"; display(tout, v, false); tout << "\ninterval: "; bqim().display(tout, v->interval()); tout << "\n";); algebraic * x = to_algebraic(v->ext()); @@ -4973,7 +4973,7 @@ namespace realclosure { UNREACHABLE(); r = false; } - TRACE("rcf_determine_sign_bug", + TRACE(rcf_determine_sign_bug, tout << "result: " << r << "\n"; display_compact(tout, v); tout << "\n"; tout << "sign: " << sign(v) << "\n";); @@ -4999,7 +4999,7 @@ namespace realclosure { */ void normalize_fraction(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & new_p1, value_ref_buffer & new_p2) { INC_DEPTH(); - TRACE("rcf_arith", tout << "normalize [" << m_exec_depth << "]\n"; + TRACE(rcf_arith, tout << "normalize [" << m_exec_depth << "]\n"; display_poly(tout, sz1, p1); tout << "\n"; display_poly(tout, sz2, p2); tout << "\n";); SASSERT(sz1 > 0 && sz2 > 0); @@ -5023,7 +5023,7 @@ namespace realclosure { normalize_num_monic_den(tmp1.size(), tmp1.data(), tmp2.size(), tmp2.data(), new_p1, new_p2); } } - TRACE("normalize_fraction_bug", + TRACE(normalize_fraction_bug, display_poly(tout, sz1, p1); tout << "\n"; display_poly(tout, sz2, p2); tout << "\n"; tout << "====>\n"; @@ -5232,7 +5232,7 @@ namespace realclosure { } else { INC_DEPTH(); - TRACE("rcf_arith", tout << "add [" << m_exec_depth << "]\n"; + TRACE(rcf_arith, tout << "add [" << m_exec_depth << "]\n"; display(tout, a, false); tout << "\n"; display(tout, b, false); tout << "\n";); switch (compare_rank(a, b)) { @@ -5440,7 +5440,7 @@ namespace realclosure { } else { INC_DEPTH(); - TRACE("rcf_arith", tout << "mul [" << m_exec_depth << "]\n"; + TRACE(rcf_arith, tout << "mul [" << m_exec_depth << "]\n"; display(tout, a, false); tout << "\n"; display(tout, b, false); tout << "\n";); switch (compare_rank(a, b)) { @@ -5497,7 +5497,7 @@ namespace realclosure { The following procedure is essentially a special case of the extended polynomial GCD algorithm. */ bool inv_algebraic(unsigned q_sz, value * const * q, unsigned p_sz, value * const * p, value_ref_buffer & g, value_ref_buffer & h) { - TRACE("inv_algebraic", + TRACE(inv_algebraic, tout << "q: "; display_poly(tout, q_sz, q); tout << "\n"; tout << "p: "; display_poly(tout, p_sz, p); tout << "\n";); SASSERT(q_sz > 0); @@ -5517,7 +5517,7 @@ namespace realclosure { while (true) { // In every iteration of the loop we have // Q(alpha) * h(alpha) = R(alpha) - TRACE("inv_algebraic", + TRACE(inv_algebraic, tout << "Q: "; display_poly(tout, Q.size(), Q.data()); tout << "\n"; tout << "R: "; display_poly(tout, R.size(), R.data()); tout << "\n";); if (Q.size() == 1) { @@ -5525,7 +5525,7 @@ namespace realclosure { // We just divide R by Q[0]. // h(alpha) = R(alpha) / Q[0] div(R.size(), R.data(), Q[0], h); - TRACE("inv_algebraic", tout << "h: "; display_poly(tout, h.size(), h.data()); tout << "\n";); + TRACE(inv_algebraic, tout << "h: "; display_poly(tout, h.size(), h.data()); tout << "\n";); // g <- 1 g.reset(); g.push_back(one()); return true; diff --git a/src/math/simplex/model_based_opt.cpp b/src/math/simplex/model_based_opt.cpp index 4e64bd4c6..a8ac93fde 100644 --- a/src/math/simplex/model_based_opt.cpp +++ b/src/math/simplex/model_based_opt.cpp @@ -203,7 +203,7 @@ namespace opt { return true; } -#define PASSERT(_e_) { CTRACE("qe", !(_e_), display(tout, r); display(tout);); SASSERT(_e_); } +#define PASSERT(_e_) { CTRACE(qe, !(_e_), display(tout, r); display(tout);); SASSERT(_e_); } bool model_based_opt::invariant(unsigned index, row const& r) { vector const& vars = r.m_vars; @@ -250,7 +250,7 @@ namespace opt { inf_eps model_based_opt::maximize() { SASSERT(invariant()); unsigned_vector bound_trail, bound_vars; - TRACE("opt", display(tout << "tableau\n");); + TRACE(opt, display(tout << "tableau\n");); while (!objective().m_vars.empty()) { var v = objective().m_vars.back(); unsigned x = v.m_id; @@ -259,7 +259,7 @@ namespace opt { rational bound_coeff; if (find_bound(x, bound_row_index, bound_coeff, coeff.is_pos())) { SASSERT(!bound_coeff.is_zero()); - TRACE("opt", display(tout << "update: " << v << " ", objective()); + TRACE(opt, display(tout << "update: " << v << " ", objective()); for (unsigned above : m_above) { display(tout << "resolve: ", m_rows[above]); }); @@ -280,7 +280,7 @@ namespace opt { bound_vars.push_back(x); } else { - TRACE("opt", display(tout << "unbound: " << v << " ", objective());); + TRACE(opt, display(tout << "unbound: " << v << " ", objective());); update_values(bound_vars, bound_trail); return inf_eps::infinity(); } @@ -364,7 +364,7 @@ namespace opt { new_x_val += eps; } } - TRACE("opt", display(tout << "v" << x + TRACE(opt, display(tout << "v" << x << " coeff_x: " << x_coeff << " old_x_val: " << old_x_val << " new_x_val: " << new_x_val @@ -558,7 +558,7 @@ namespace opt { if (m_rows[row_dst].m_alive) { rational a2 = get_coefficient(row_dst, x); if (is_int(x)) { - TRACE("opt", + TRACE(opt, tout << "v" << x << ": " << a1 << " " << a2 << ":\n"; display(tout, m_rows[row_dst]); display(tout, m_rows[row_src]);); @@ -569,7 +569,7 @@ namespace opt { mul(row_dst, abs(a1)); mul_add(false, row_dst, -abs(a2), row_src); } - TRACE("opt", display(tout << "result ", m_rows[row_dst]);); + TRACE(opt, display(tout << "result ", m_rows[row_dst]);); normalize(row_dst); } else { @@ -621,7 +621,7 @@ namespace opt { if (use_case1) { - TRACE("opt", tout << "slack: " << slack << " " << src_c << " " << dst_val << " " << dst_c << " " << src_val << "\n";); + TRACE(opt, tout << "slack: " << slack << " " << src_c << " " << dst_val << " " << dst_c << " " << src_val << "\n";); // dst <- abs_src_c*dst + abs_dst_c*src + slack mul(row_dst, abs_src_c); add(row_dst, slack); @@ -696,7 +696,7 @@ namespace opt { // exists z in [0 .. |b|-2] . |b| | (z + s) && a*n_sign(b)(s + z) + |b|t <= 0 // - TRACE("qe", tout << "finite disjunction " << distance << " " << src_c << " " << dst_c << "\n";); + TRACE(qe, tout << "finite disjunction " << distance << " " << src_c << " " << dst_c << "\n";); vector coeffs; if (abs_dst_c <= abs_src_c) { rational z = mod(dst_val, abs_dst_c); @@ -1174,7 +1174,7 @@ namespace opt { result = def::from_row(m_rows[lub_index], x); else result = def::from_row(m_rows[glb_index], x); - TRACE("opt1", display(tout << "resolution result:", *result) << "\n"); + TRACE(opt1, display(tout << "resolution result:", *result) << "\n"); } // The number of matching lower and upper bounds is small. @@ -1271,7 +1271,7 @@ namespace opt { def_ref result(nullptr); unsigned_vector div_rows(_div_rows), mod_rows(_mod_rows); SASSERT(!div_rows.empty() || !mod_rows.empty()); - TRACE("opt", display(tout << "solve_div v" << x << "\n")); + TRACE(opt, display(tout << "solve_div v" << x << "\n")); rational K(1); for (unsigned ri : div_rows) @@ -1494,11 +1494,11 @@ namespace opt { result = *(*y_def * K) + *z_def; m_var2value[x] = eval(*result); - TRACE("opt", tout << y << " := " << *y_def << "\n"; + TRACE(opt, tout << y << " := " << *y_def << "\n"; tout << z << " := " << *z_def << "\n"; tout << x << " := " << *result << "\n"); } - TRACE("opt", display(tout << "solve_div done v" << x << "\n")); + TRACE(opt, display(tout << "solve_div done v" << x << "\n")); return result; } @@ -1527,7 +1527,7 @@ namespace opt { throw default_exception("modulo 0 is not defined"); } if (D.is_neg()) D = abs(D); - TRACE("opt1", display(tout << "lcm: " << D << " x: v" << x << " tableau\n");); + TRACE(opt1, display(tout << "lcm: " << D << " x: v" << x << " tableau\n");); rational val_x = m_var2value[x]; rational u = mod(val_x, D); SASSERT(u.is_nonneg() && u < D); @@ -1536,7 +1536,7 @@ namespace opt { SASSERT(invariant(idx, m_rows[idx])); normalize(idx); } - TRACE("opt1", display(tout << "tableau after replace x under mod\n");); + TRACE(opt1, display(tout << "tableau after replace x under mod\n");); // // update inequalities such that u is added to t and // D is multiplied to coefficient of x. @@ -1559,13 +1559,13 @@ namespace opt { visited.insert(row_id); normalize(row_id); } - TRACE("opt1", display(tout << "tableau after replace v" << x << " := " << D << " * v" << y << "\n");); + TRACE(opt1, display(tout << "tableau after replace v" << x << " := " << D << " * v" << y << "\n");); def_ref result = project(y, compute_def); if (compute_def) { result = *(*result * D) + u; m_var2value[x] = eval(*result); } - TRACE("opt1", display(tout << "tableau after project v" << y << "\n");); + TRACE(opt1, display(tout << "tableau after project v" << y << "\n");); return result; } @@ -1631,7 +1631,7 @@ namespace opt { // 3 | -t & 21 | (-ct + 3s) & a-t <= 3u model_based_opt::def_ref model_based_opt::solve_for(unsigned row_id1, unsigned x, bool compute_def) { - TRACE("opt", tout << "v" << x << " := " << eval(x) << "\n" << m_rows[row_id1] << "\n"; + TRACE(opt, tout << "v" << x << " := " << eval(x) << "\n" << m_rows[row_id1] << "\n"; display(tout)); rational a = get_coefficient(row_id1, x), b; row& r1 = m_rows[row_id1]; @@ -1690,10 +1690,10 @@ namespace opt { if (compute_def) { result = def::from_row(m_rows[row_id1], x); m_var2value[x] = eval(*result); - TRACE("opt1", tout << "updated eval " << x << " := " << eval(x) << "\n";); + TRACE(opt1, tout << "updated eval " << x << " := " << eval(x) << "\n";); } retire_row(row_id1); - TRACE("opt", display(tout << "solved v" << x << "\n")); + TRACE(opt, display(tout << "solved v" << x << "\n")); return result; } @@ -1709,7 +1709,7 @@ namespace opt { m_result.push_back(project(vars[i], compute_def)); if (compute_def) eliminate(vars[i], *(m_result.back())); - TRACE("opt", display(tout << "After projecting: v" << vars[i] << "\n");); + TRACE(opt, display(tout << "After projecting: v" << vars[i] << "\n");); } return m_result; } diff --git a/src/math/simplex/network_flow_def.h b/src/math/simplex/network_flow_def.h index 391fe4cb2..e9462c653 100644 --- a/src/math/simplex/network_flow_def.h +++ b/src/math/simplex/network_flow_def.h @@ -129,7 +129,7 @@ namespace smt { m_graph.add_edge(e.get_target(), e.get_source(), e.get_weight(), explanation()); } } - TRACE("network_flow", { + TRACE(network_flow, { tout << "Difference logic optimization:" << std::endl; display_dual(tout); tout << "Minimum cost flow:" << std::endl; @@ -143,7 +143,7 @@ namespace smt { template void network_flow::initialize() { - TRACE("network_flow", tout << "initialize...\n";); + TRACE(network_flow, tout << "initialize...\n";); // Create an artificial root node to construct initial spanning tree unsigned num_nodes = m_graph.get_num_nodes(); unsigned num_edges = m_graph.get_num_edges(); @@ -180,7 +180,7 @@ namespace smt { m_tree->initialize(tree); - TRACE("network_flow", + TRACE(network_flow, tout << pp_vector("Potentials", m_potentials); tout << pp_vector("Flows", m_flows); tout << "Cost: " << get_cost() << "\n"; @@ -206,7 +206,7 @@ namespace smt { start = src; } SASSERT(m_tree->in_subtree_t2(start)); - TRACE("network_flow", tout << "update_potentials of T_" << start << " with change = " << change << "...\n";); + TRACE(network_flow, tout << "update_potentials of T_" << start << " with change = " << change << "...\n";); svector descendants; m_tree->get_descendants(start, descendants); SASSERT(descendants.size() >= 1); @@ -214,7 +214,7 @@ namespace smt { node u = descendants[i]; m_potentials[u] += change; } - TRACE("network_flow", tout << pp_vector("Potentials", m_potentials);); + TRACE(network_flow, tout << pp_vector("Potentials", m_potentials);); } template @@ -230,7 +230,7 @@ namespace smt { edge_id e_id = path[i]; m_flows[e_id] += against[i] ? - *m_delta : *m_delta; } - TRACE("network_flow", tout << pp_vector("Flows", m_flows);); + TRACE(network_flow, tout << pp_vector("Flows", m_flows);); } template @@ -288,7 +288,7 @@ namespace smt { bool bounded = choose_leaving_edge(); if (!bounded) return UNBOUNDED; vectorconst& es = m_graph.get_all_edges(); - TRACE("network_flow", + TRACE(network_flow, { edge const& e_in = es[m_enter_id]; edge const& e_out = es[m_leave_id]; @@ -310,7 +310,7 @@ namespace smt { m_states[m_leave_id] = LOWER; update_spanning_tree(); update_potentials(); - TRACE("network_flow", + TRACE(network_flow, tout << "Spanning tree:\n"; display_spanning_tree(tout); tout << "Cost: " << get_cost() << "\n"; @@ -319,14 +319,14 @@ namespace smt { SASSERT(check_well_formed()); } } - TRACE("network_flow", + TRACE(network_flow, tout << "Spanning tree:\n"; display_spanning_tree(tout); tout << "Cost: " << get_cost() << "\n"; display_primal(tout); ); if (is_infeasible()) return INFEASIBLE; - TRACE("network_flow", tout << "Found optimal solution.\n";); + TRACE(network_flow, tout << "Found optimal solution.\n";); SASSERT(check_optimal()); return OPTIMAL; } @@ -418,7 +418,7 @@ namespace smt { for (unsigned i = 0; i < m_potentials.size(); ++i) { total_balance += m_balances[i] * m_potentials[i]; } - TRACE("network_flow", tout << "Total balance: " << total_balance << ", total cost: " << total_cost << std::endl;); + TRACE(network_flow, tout << "Total balance: " << total_balance << ", total cost: " << total_cost << std::endl;); return total_cost == total_balance; } diff --git a/src/math/simplex/simplex_def.h b/src/math/simplex/simplex_def.h index bc02ce5ef..69ed434ce 100644 --- a/src/math/simplex/simplex_def.h +++ b/src/math/simplex/simplex_def.h @@ -51,7 +51,7 @@ namespace simplex { m.mul(coeffs[m_base_vars[i]], mul, a); m.set(b, m_vars[v].m_base_coeff); m.lcm(a, b, c); - TRACE("simplex", + TRACE(simplex, m.display(tout << " a: ", a); m.display(tout << " b v" << v << " : ", b); m.display(tout << " c: ", c); @@ -69,7 +69,7 @@ namespace simplex { M.mul(r, b); m.neg(a); M.add(r, a, row(m_vars[v].m_base2row)); - TRACE("simplex", M.display_row(tout, r);); + TRACE(simplex, M.display_row(tout, r);); } scoped_numeral base_coeff(m); @@ -87,7 +87,7 @@ namespace simplex { } } SASSERT(!m.is_zero(base_coeff)); - TRACE("simplex", + TRACE(simplex, for (unsigned i = 0; i < num_vars; ++i) { m.display(tout << "v" << vars[i] << " * ", coeffs[i]); tout << " "; if (i + 1 < num_vars) tout << " + "; @@ -132,7 +132,7 @@ namespace simplex { void simplex::add_patch(var_t v) { SASSERT(is_base(v)); if (outside_bounds(v)) { - TRACE("simplex", tout << "Add patch: v" << v << "\n";); + TRACE(simplex, tout << "Add patch: v" << v << "\n";); m_to_patch.insert(v); } } @@ -151,7 +151,7 @@ namespace simplex { template void simplex::del_row(var_t var) { - TRACE("simplex", tout << var << "\n";); + TRACE(simplex, tout << var << "\n";); row r; if (is_base(var)) { r = row(m_vars[var].m_base2row); @@ -182,7 +182,7 @@ namespace simplex { SASSERT(!below_lower(old_base) && !above_upper(old_base)); } del_row(r); - TRACE("simplex", display(tout);); + TRACE(simplex, display(tout);); SASSERT(well_formed()); } @@ -203,7 +203,7 @@ namespace simplex { var_info& vi = m_vars[var]; em.set(vi.m_lower, b); vi.m_lower_valid = true; - TRACE("simplex", em.display(tout << "v" << var << " lower: ", b); + TRACE(simplex, em.display(tout << "v" << var << " lower: ", b); em.display(tout << " value: ", vi.m_value);); SASSERT(!vi.m_upper_valid || em.le(b, vi.m_upper)); if (!vi.m_is_base && em.lt(vi.m_value, b)) { @@ -339,7 +339,7 @@ namespace simplex { m_bland = false; SASSERT(well_formed()); while ((v = select_var_to_fix()) != null_var) { - TRACE("simplex", display(tout << "v" << v << "\n");); + TRACE(simplex, display(tout << "v" << v << "\n");); if (!m_limit.inc() || num_iterations > m_max_iterations) { return l_undef; } @@ -686,7 +686,7 @@ namespace simplex { // optimal return l_true; } - TRACE("simplex", tout << "x_i: v" << x_i << " x_j: v" << x_j << "\n";); + TRACE(simplex, tout << "x_i: v" << x_i << " x_j: v" << x_j << "\n";); var_info& vj = m_vars[x_j]; if (x_i == null_var) { if (inc_x_j && vj.m_upper_valid) { @@ -714,10 +714,10 @@ namespace simplex { // pivot(x_i, x_j, a_ij); - TRACE("simplex", display(tout << "after pivot\n");); + TRACE(simplex, display(tout << "after pivot\n");); move_to_bound(x_i, !inc_x_i); SASSERT(well_formed_row(row(m_vars[x_j].m_base2row))); - TRACE("simplex", display(tout);); + TRACE(simplex, display(tout);); SASSERT(is_feasible()); } return l_true; @@ -733,7 +733,7 @@ namespace simplex { else { em.sub(vi.m_upper, vi.m_value, delta); } - TRACE("simplex", tout << "move " << (to_lower?"to_lower":"to_upper") + TRACE(simplex, tout << "move " << (to_lower?"to_lower":"to_upper") << " v" << x << " delta: " << em.to_string(delta) << "\n";); col_iterator it = M.col_begin(x), end = M.col_end(x); for (; it != end && is_pos(delta); ++it) { @@ -766,7 +766,7 @@ namespace simplex { em.mul(delta2, base_coeff, delta2); em.div(delta2, coeff, delta2); em.abs(delta2); - TRACE("simplex", tout << "Delta for v" << s << " " << delta2 << "\n";); + TRACE(simplex, tout << "Delta for v" << s << " " << delta2 << "\n";); if (delta2 < delta) { delta = delta2; } @@ -805,7 +805,7 @@ namespace simplex { if (x == v) continue; bool inc_x = m.is_pos(it->m_coeff) == m.is_pos(m_vars[v].m_base_coeff); if ((inc_x && at_upper(x)) || (!inc_x && at_lower(x))) { - TRACE("simplex", tout << "v" << x << " pos: " << inc_x + TRACE(simplex, tout << "v" << x << " pos: " << inc_x << " at upper: " << at_upper(x) << " at lower: " << at_lower(x) << "\n";); continue; // variable cannot be used for improving bounds. @@ -826,7 +826,7 @@ namespace simplex { ((is_zero(new_gain) && is_zero(gain) && (x_i == null_var || y < x_i))); if (better) { - TRACE("simplex", + TRACE(simplex, em.display(tout << "gain:", gain); em.display(tout << " new gain:", new_gain); tout << " base x_i: " << y << ", new base x_j: " << x << ", inc x_j: " << inc_x << "\n";); @@ -871,7 +871,7 @@ namespace simplex { numeral const& a_ii = vi.m_base_coeff; bool sign_eq = (m.is_pos(a_ii) == m.is_pos(a_ij)); bool inc_s = sign_eq != inc_x_j; - TRACE("simplex", tout << "x_j: v" << x_j << ", base x_i: v" << s + TRACE(simplex, tout << "x_j: v" << x_j << ", base x_i: v" << s << ", inc_x_i: " << inc_s << ", inc_x_j: " << inc_x_j << ", upper valid:" << vi.m_upper_valid @@ -896,7 +896,7 @@ namespace simplex { gain = curr_gain; new_a_ij = a_ij; inc_x_i = inc_s; - TRACE("simplex", tout << "x_j v" << x_j << " x_i v" << x_i << " gain: "; + TRACE(simplex, tout << "x_j v" << x_j << " x_i v" << x_i << " gain: "; tout << curr_gain << "\n";); } } @@ -910,7 +910,7 @@ namespace simplex { if (m_left_basis.contains(v)) { num_repeated++; if (num_repeated > m_blands_rule_threshold) { - TRACE("simplex", tout << "using blands rule, " << num_repeated << "\n";); + TRACE(simplex, tout << "using blands rule, " << num_repeated << "\n";); // std::cerr << "BLANDS RULE...\n"; m_bland = true; } @@ -1019,7 +1019,7 @@ namespace simplex { } if (!em.is_zero(sum)) { IF_VERBOSE(0, M.display_row(verbose_stream(), r);); - TRACE("pb", display(tout << "non-well formed row\n"); M.display_row(tout << "row: ", r);); + TRACE(pb, display(tout << "non-well formed row\n"); M.display_row(tout << "row: ", r);); throw default_exception("non-well formed row"); } diff --git a/src/math/subpaving/subpaving_t_def.h b/src/math/subpaving/subpaving_t_def.h index 89f6dad0f..1d78037c3 100644 --- a/src/math/subpaving/subpaving_t_def.h +++ b/src/math/subpaving/subpaving_t_def.h @@ -243,7 +243,7 @@ public: this->mk_decided_bound(x, mid, false, m_left_open, left); this->mk_decided_bound(x, mid, true, !m_left_open, right); - TRACE("subpaving_int_split", + TRACE(subpaving_int_split, tout << "LEFT:\n"; this->ctx()->display_bounds(tout, left); tout << "\nRIGHT:\n"; this->ctx()->display_bounds(tout, right);); } @@ -562,9 +562,9 @@ typename context_t::bound * context_t::mk_bound(var x, numeral const & val r->m_prev = n->trail_stack(); r->m_jst = jst; n->push(r); - TRACE("subpaving_mk_bound", tout << "mk_bound: "; display(tout, r); tout << "\ntimestamp: " << r->m_timestamp << "\n";); + TRACE(subpaving_mk_bound, tout << "mk_bound: "; display(tout, r); tout << "\ntimestamp: " << r->m_timestamp << "\n";); if (conflicting_bounds(x, n)) { - TRACE("subpaving_mk_bound", tout << "conflict\n"; display_bounds(tout, n);); + TRACE(subpaving_mk_bound, tout << "conflict\n"; display_bounds(tout, n);); set_conflict(x, n); } m_timestamp++; @@ -671,7 +671,7 @@ template bool context_t::is_int(polynomial const * p) const { for (unsigned i = 0; i < p->size(); i++) { if (!is_int(p->x(i)) || !nm().is_int(p->a(i))) { - TRACE("subpaving_is_int", tout << "polynomial is not integer due to monomial at i: " << i << "\n"; tout.flush(); + TRACE(subpaving_is_int, tout << "polynomial is not integer due to monomial at i: " << i << "\n"; tout.flush(); display(tout, p->x(i)); tout << " "; nm().display(tout, p->a(i)); tout << "\n";); return false; } @@ -761,7 +761,7 @@ var context_t::mk_sum(numeral const & c, unsigned sz, numeral const * as, var var x = p->m_xs[i]; nm().swap(m_num_buffer[x], *curr); } - TRACE("subpaving_mk_sum", tout << "new variable is integer: " << is_int(p) << "\n";); + TRACE(subpaving_mk_sum, tout << "new variable is integer: " << is_int(p) << "\n";); var new_var = mk_var(is_int(p)); for (unsigned i = 0; i < sz; i++) { var x = p->m_xs[i]; @@ -785,7 +785,7 @@ typename context_t::ineq * context_t::mk_ineq(var x, numeral const & k, bo template void context_t::inc_ref(ineq * a) { - TRACE("subpaving_ref_count", tout << "inc-ref: " << a << " " << a->m_ref_count << "\n";); + TRACE(subpaving_ref_count, tout << "inc-ref: " << a << " " << a->m_ref_count << "\n";); if (a) a->m_ref_count++; } @@ -793,7 +793,7 @@ void context_t::inc_ref(ineq * a) { template void context_t::dec_ref(ineq * a) { if (a) { - TRACE("subpaving_ref_count", + TRACE(subpaving_ref_count, tout << "dec-ref: " << a << " " << a->m_ref_count << "\n"; a->display(tout, nm()); tout << "\n";); @@ -840,7 +840,7 @@ void context_t::add_clause_core(unsigned sz, ineq * const * atoms, bool lemma else if (watch) { m_lemmas.push_back(c); } - TRACE("subpaving_clause", tout << "new clause:\n"; display(tout, c); tout << "\n";); + TRACE(subpaving_clause, tout << "new clause:\n"; display(tout, c); tout << "\n";); } template @@ -865,7 +865,7 @@ void context_t::del_clause(clause * c) { template void context_t::add_unit_clause(ineq * a, bool axiom) { - TRACE("subpaving", a->display(tout, nm(), *m_display_proc); tout << "\n";); + TRACE(subpaving, a->display(tout, nm(), *m_display_proc); tout << "\n";); inc_ref(a); m_unit_clauses.push_back(TAG(ineq*, a, axiom)); } @@ -1171,7 +1171,7 @@ void context_t::set_conflict(var x, node * n) { template bool context_t::may_propagate(bound * b, constraint * c, node * n) { SASSERT(b != 0 && c != 0); - TRACE("may_propagate_bug", display(tout, b); tout << " | "; display(tout, c); tout << "\nresult: " << (b->timestamp() > c->timestamp()) << ", " << b->timestamp() << ", " << c->timestamp() << "\n";); + TRACE(may_propagate_bug, display(tout, b); tout << " | "; display(tout, c); tout << "\nresult: " << (b->timestamp() > c->timestamp()) << ", " << b->timestamp() << ", " << c->timestamp() << "\n";); return b->timestamp() >= c->timestamp(); } @@ -1209,7 +1209,7 @@ bool context_t::relevant_new_bound(var x, numeral const & k, bool lower, bool bound * curr_upper = n->upper(x); SASSERT(curr_lower == 0 || curr_lower->x() == x); SASSERT(curr_upper == 0 || curr_upper->x() == x); - TRACE("subpaving_relevant_bound", + TRACE(subpaving_relevant_bound, display(tout, x); tout << " " << (lower ? ">" : "<") << (open ? "" : "=") << " "; nm().display(tout, k); tout << "\n"; tout << "existing bounds:\n"; if (curr_lower) { display(tout, curr_lower); tout << "\n"; } @@ -1217,18 +1217,18 @@ bool context_t::relevant_new_bound(var x, numeral const & k, bool lower, bool if (lower) { // If new bound triggers a conflict, then it is relevant. if (curr_upper && (nm().gt(k, curr_upper->value()) || ((open || curr_upper->is_open()) && nm().eq(k, curr_upper->value())))) { - TRACE("subpaving_relevant_bound", tout << "relevant because triggers conflict.\n";); + TRACE(subpaving_relevant_bound, tout << "relevant because triggers conflict.\n";); return true; } // If m_epsilon is zero, then bound is relevant only if it improves existing bound. if (m_zero_epsilon && curr_lower != nullptr && (nm().lt(k, curr_lower->value()) || ((curr_lower->is_open() || !open) && nm().eq(k, curr_lower->value())))) { // new lower bound does not improve existing bound - TRACE("subpaving_relevant_bound", tout << "irrelevant because does not improve existing bound.\n";); + TRACE(subpaving_relevant_bound, tout << "irrelevant because does not improve existing bound.\n";); return false; } if (curr_upper == nullptr && nm().lt(m_max_bound, k)) { // new lower bound exceeds the :max-bound threshold - TRACE("subpaving_relevant_bound", tout << "irrelevant because exceeds :max-bound threshold.\n";); + TRACE(subpaving_relevant_bound, tout << "irrelevant because exceeds :max-bound threshold.\n";); return false; } if (!m_zero_epsilon && curr_lower != nullptr) { @@ -1252,13 +1252,13 @@ bool context_t::relevant_new_bound(var x, numeral const & k, bool lower, bool nm().set(delta, min); nm().mul(delta, m_epsilon, delta); nm().add(curr_lower->value(), delta, delta); - TRACE("subpaving_relevant_bound_bug", + TRACE(subpaving_relevant_bound_bug, tout << "k: "; nm().display(tout, k); tout << ", delta: "; nm().display(tout, delta); tout << "\n"; tout << "curr_lower: "; nm().display(tout, curr_lower->value()); tout << ", min: "; nm().display(tout, min); tout << "\n";); if (nm().le(k, delta)) { - TRACE("subpaving_relevant_bound", tout << "irrelevant because does not improve existing bound to at least "; + TRACE(subpaving_relevant_bound, tout << "irrelevant because does not improve existing bound to at least "; nm().display(tout, delta); tout << "\n";); return false; } @@ -1267,18 +1267,18 @@ bool context_t::relevant_new_bound(var x, numeral const & k, bool lower, bool else { // If new bound triggers a conflict, then it is relevant. if (curr_lower && (nm().gt(curr_lower->value(), k) || ((open || curr_lower->is_open()) && nm().eq(k, curr_lower->value())))) { - TRACE("subpaving_relevant_bound", tout << "relevant because triggers conflict.\n";); + TRACE(subpaving_relevant_bound, tout << "relevant because triggers conflict.\n";); return true; } // If m_epsilon is zero, then bound is relevant only if it improves existing bound. if (m_zero_epsilon && curr_upper != nullptr && (nm().lt(curr_upper->value(), k) || ((curr_upper->is_open() || !open) && nm().eq(k, curr_upper->value())))) { // new upper bound does not improve existing bound - TRACE("subpaving_relevant_bound", tout << "irrelevant because does not improve existing bound.\n";); + TRACE(subpaving_relevant_bound, tout << "irrelevant because does not improve existing bound.\n";); return false; } if (curr_lower == nullptr && nm().lt(k, m_minus_max_bound)) { // new upper bound exceeds the -:max-bound threshold - TRACE("subpaving_relevant_bound", tout << "irrelevant because exceeds -:max-bound threshold.\n";); + TRACE(subpaving_relevant_bound, tout << "irrelevant because exceeds -:max-bound threshold.\n";); return false; } if (!m_zero_epsilon && curr_upper != nullptr) { @@ -1303,13 +1303,13 @@ bool context_t::relevant_new_bound(var x, numeral const & k, bool lower, bool nm().mul(delta, m_epsilon, delta); nm().sub(curr_upper->value(), delta, delta); if (nm().ge(k, delta)) { - TRACE("subpaving_relevant_bound", tout << "irrelevant because does not improve existing bound to at least "; + TRACE(subpaving_relevant_bound, tout << "irrelevant because does not improve existing bound to at least "; nm().display(tout, delta); tout << "\n";); return false; } } } - TRACE("subpaving_relevant_bound", tout << "new bound is relevant\n";); + TRACE(subpaving_relevant_bound, tout << "new bound is relevant\n";); return true; } catch (const typename C::exception &) { @@ -1375,7 +1375,7 @@ lbool context_t::value(ineq * t, node * n) { template void context_t::propagate_clause(clause * c, node * n) { - TRACE("propagate_clause", tout << "propagate using:\n"; display(tout, c); tout << "\n";); + TRACE(propagate_clause, tout << "propagate using:\n"; display(tout, c); tout << "\n";); m_num_visited++; c->set_visited(m_timestamp); unsigned sz = c->size(); @@ -1399,7 +1399,7 @@ void context_t::propagate_clause(clause * c, node * n) { j = 0; } ineq * a = (*c)[j]; - TRACE("propagate_clause", tout << "propagating inequality: "; display(tout, a); tout << "\n";); + TRACE(propagate_clause, tout << "propagating inequality: "; display(tout, a); tout << "\n";); propagate_bound(a->x(), a->value(), a->is_lower(), a->is_open(), n, justification(c)); // A clause can propagate only once. // So, we can safely set its timestamp again to avoid another useless visit. @@ -1440,12 +1440,12 @@ void context_t::propagate_polynomial(var x, node * n, var y) { } else { nm().set(a, p->a(i)); - TRACE("propagate_polynomial_bug", tout << "a: "; nm().display(tout, a); tout << "\n";); + TRACE(propagate_polynomial_bug, tout << "a: "; nm().display(tout, a); tout << "\n";); } } - TRACE("propagate_polynomial_bug", tout << "r before mul 1/a: "; im().display(tout, r); tout << "\n";); + TRACE(propagate_polynomial_bug, tout << "r before mul 1/a: "; im().display(tout, r); tout << "\n";); im().div(r, a, r); - TRACE("propagate_polynomial_bug", tout << "r after mul 1/a: "; im().display(tout, r); tout << "\n";); + TRACE(propagate_polynomial_bug, tout << "r after mul 1/a: "; im().display(tout, r); tout << "\n";); // r contains the deduced bounds for y. } // r contains the deduced bounds for y. @@ -1466,8 +1466,8 @@ void context_t::propagate_polynomial(var x, node * n, var y) { template void context_t::propagate_polynomial(var x, node * n) { - TRACE("propagate_polynomial", tout << "propagate_polynomial: "; display(tout, x); tout << "\n";); - TRACE("propagate_polynomial_detail", display_bounds(tout, n);); + TRACE(propagate_polynomial, tout << "propagate_polynomial: "; display(tout, x); tout << "\n";); + TRACE(propagate_polynomial_detail, display_bounds(tout, n);); SASSERT(is_polynomial(x)); polynomial * p = get_polynomial(x); p->set_visited(m_timestamp); @@ -1483,7 +1483,7 @@ void context_t::propagate_polynomial(var x, node * n) { unbounded_var = y; } } - TRACE("propagate_polynomial", tout << "unbounded_var: "; display(tout, unbounded_var); tout << "\n";); + TRACE(propagate_polynomial, tout << "unbounded_var: "; display(tout, unbounded_var); tout << "\n";); if (unbounded_var != null_var) { propagate_polynomial(x, n, unbounded_var); @@ -1500,7 +1500,7 @@ void context_t::propagate_polynomial(var x, node * n) { template void context_t::propagate_monomial(var x, node * n) { - TRACE("propagate_monomial", tout << "propagate_monomial: "; display(tout, x); tout << "\n";); + TRACE(propagate_monomial, tout << "propagate_monomial: "; display(tout, x); tout << "\n";); SASSERT(is_monomial(x)); SASSERT(!inconsistent(n)); monomial * m = get_monomial(x); @@ -1524,7 +1524,7 @@ void context_t::propagate_monomial(var x, node * n) { found_unbounded = true; } } - TRACE("propagate_monomial", tout << "found_zero: " << found_zero << ", found_unbounded: " << found_unbounded << "\n";); + TRACE(propagate_monomial, tout << "found_zero: " << found_zero << ", found_unbounded: " << found_unbounded << "\n";); if (found_zero) { if (!is_zero(x, n)) { // x must be zero @@ -1602,7 +1602,7 @@ void context_t::propagate_monomial_upward(var x, node * n) { template void context_t::propagate_monomial_downward(var x, node * n, unsigned j) { - TRACE("propagate_monomial", tout << "propagate_monomial_downward: "; display(tout, x); tout << ", j: " << j << "\n"; + TRACE(propagate_monomial, tout << "propagate_monomial_downward: "; display(tout, x); tout << ", j: " << j << "\n"; display(tout, get_monomial(x)); tout << "\n";); SASSERT(is_monomial(x)); monomial * m = get_monomial(x); @@ -1711,7 +1711,7 @@ void context_t::propagate_def(var x, node * n) { template void context_t::propagate(node * n, bound * b) { var x = b->x(); - TRACE("subpaving_propagate", tout << "propagate: "; display(tout, b); tout << ", timestamp: " << b->timestamp() << "\n";); + TRACE(subpaving_propagate, tout << "propagate: "; display(tout, b); tout << ", timestamp: " << b->timestamp() << "\n";); typename watch_list::const_iterator it = m_wlist[x].begin(); typename watch_list::const_iterator end = m_wlist[x].end(); for (; it != end; ++it) { @@ -1787,14 +1787,14 @@ void context_t::assert_units(node * n) { checkpoint(); ineq * a = UNTAG(ineq*, *it); bool axiom = GET_TAG(*it) != 0; - TRACE("subpaving_init", tout << "asserting: "; display(tout, a); tout << ", axiom: " << axiom << "\n";); + TRACE(subpaving_init, tout << "asserting: "; display(tout, a); tout << ", axiom: " << axiom << "\n";); if (a->x() == null_var) continue; propagate_bound(a->x(), a->value(), a->is_lower(), a->is_open(), n, justification(axiom)); if (inconsistent(n)) break; } - TRACE("subpaving_init", tout << "bounds after init\n"; display_bounds(tout, n);); + TRACE(subpaving_init, tout << "bounds after init\n"; display_bounds(tout, n);); } template @@ -1806,11 +1806,11 @@ void context_t::init() { m_root = mk_node(); SASSERT(m_leaf_head == m_root); SASSERT(m_leaf_tail == m_root); - TRACE("subpaving_init", display_constraints(tout);); + TRACE(subpaving_init, display_constraints(tout);); assert_units(m_root); propagate_all_definitions(m_root); propagate(m_root); - TRACE("subpaving_init", tout << "root bounds after propagation\n"; display_bounds(tout, m_root);); + TRACE(subpaving_init, tout << "root bounds after propagation\n"; display_bounds(tout, m_root);); SASSERT(check_invariant()); } @@ -1818,8 +1818,8 @@ template void context_t::operator()() { if (m_root == nullptr) init(); - TRACE("subpaving_stats", statistics st; collect_statistics(st); tout << "statistics:\n"; st.display_smt2(tout);); - TRACE("subpaving_main", display_params(tout);); + TRACE(subpaving_stats, statistics st; collect_statistics(st); tout << "statistics:\n"; st.display_smt2(tout);); + TRACE(subpaving_main, display_params(tout);); while (m_leaf_head != nullptr) { checkpoint(); SASSERT(m_queue.empty()); @@ -1828,32 +1828,32 @@ void context_t::operator()() { node * n = (*m_node_selector)(m_leaf_head, m_leaf_tail); if (n == nullptr) break; - TRACE("subpaving_main", tout << "selected node: #" << n->id() << ", depth: " << n->depth() << "\n";); + TRACE(subpaving_main, tout << "selected node: #" << n->id() << ", depth: " << n->depth() << "\n";); remove_from_leaf_dlist(n); if (n != m_root) { add_recent_bounds(n); propagate(n); } - TRACE("subpaving_main", tout << "node #" << n->id() << " after propagation\n"; + TRACE(subpaving_main, tout << "node #" << n->id() << " after propagation\n"; display_bounds(tout, n);); if (n->inconsistent()) { - TRACE("subpaving_main", tout << "node #" << n->id() << " is inconsistent.\n";); + TRACE(subpaving_main, tout << "node #" << n->id() << " is inconsistent.\n";); // TODO: conflict resolution continue; } if (n->depth() >= m_max_depth) { - TRACE("subpaving_main", tout << "maximum depth reached, skipping node #" << n->id() << "\n";); + TRACE(subpaving_main, tout << "maximum depth reached, skipping node #" << n->id() << "\n";); continue; } var x = (*m_var_selector)(n); - TRACE("subpaving_main", tout << "splitting variable: "; display(tout, x); tout << "\n";); + TRACE(subpaving_main, tout << "splitting variable: "; display(tout, x); tout << "\n";); if (x != null_var) { (*m_node_splitter)(n, x); m_num_splits++; // remove inconsistent children } } - TRACE("subpaving_stats", statistics st; collect_statistics(st); tout << "statistics:\n"; st.display_smt2(tout);); + TRACE(subpaving_stats, statistics st; collect_statistics(st); tout << "statistics:\n"; st.display_smt2(tout);); } template diff --git a/src/math/subpaving/tactic/subpaving_tactic.cpp b/src/math/subpaving/tactic/subpaving_tactic.cpp index f1b0e8854..e70d83ac4 100644 --- a/src/math/subpaving/tactic/subpaving_tactic.cpp +++ b/src/math/subpaving/tactic/subpaving_tactic.cpp @@ -154,7 +154,7 @@ class subpaving_tactic : public tactic { m_qm.div(k, n, k); if (is_neg(n)) lower = !lower; - TRACE("subpaving_tactic", tout << x << " " << k << " " << lower << " " << open << "\n";); + TRACE(subpaving_tactic, tout << x << " " << k << " " << lower << " " << open << "\n";); return m_ctx->mk_ineq(x, k, lower, open); } diff --git a/src/model/array_factory.cpp b/src/model/array_factory.cpp index 9c4aa816e..3030eeafd 100644 --- a/src/model/array_factory.cpp +++ b/src/model/array_factory.cpp @@ -61,7 +61,7 @@ void array_factory::get_some_args_for(sort * s, ptr_buffer & args) { } expr * array_factory::get_some_value(sort * s) { - TRACE("array_factory", tout << mk_pp(s, m_manager) << "\n";); + TRACE(array_factory, tout << mk_pp(s, m_manager) << "\n";); value_set * set = nullptr; if (m_sort2value_set.find(s, set) && !set->empty()) return *(set->begin()); @@ -72,7 +72,7 @@ expr * array_factory::get_some_value(sort * s) { } bool array_factory::mk_two_diff_values_for(sort * s) { - TRACE("array_factory", tout << mk_pp(s, m_manager) << "\n";); + TRACE(array_factory, tout << mk_pp(s, m_manager) << "\n";); DEBUG_CODE({ value_set * set = 0; SASSERT(!m_sort2value_set.find(s, set) || set->size() <= 1); @@ -101,7 +101,7 @@ bool array_factory::get_some_values(sort * s, expr_ref & v1, expr_ref & v2) { value_set * set = nullptr; if (!m_sort2value_set.find(s, set) || set->size() < 2) { if (!mk_two_diff_values_for(s)) { - TRACE("array_factory_bug", tout << "could not create diff values: " << mk_pp(s, m_manager) << "\n";); + TRACE(array_factory_bug, tout << "could not create diff values: " << mk_pp(s, m_manager) << "\n";); return false; } } @@ -113,7 +113,7 @@ bool array_factory::get_some_values(sort * s, expr_ref & v1, expr_ref & v2) { v1 = *it; ++it; v2 = *it; - TRACE("array_factory", tout << v1 << " " << v2 << "\n";); + TRACE(array_factory, tout << v1 << " " << v2 << "\n";); return true; } @@ -147,7 +147,7 @@ expr * array_factory::get_fresh_value(sort * s) { } } - TRACE("array_factory_bug", tout << "array fresh value: using fresh index, range: " << mk_pp(range, m_manager) << "\n";); + TRACE(array_factory_bug, tout << "array fresh value: using fresh index, range: " << mk_pp(range, m_manager) << "\n";); expr_ref v1(m_manager), v2(m_manager), w1(m_manager), w2(m_manager); if (m_model.get_some_values(range, v1, v2)) { // Claim: A is fresh if A[i1] = v1 and A[i2] = v2 where i1 and i2 are fresh values, @@ -157,7 +157,7 @@ expr * array_factory::get_fresh_value(sort * s) { // Then A[i1] == A'[i1] and A[i2] == A'[i2]. Since, i1 and i2 are fresh, // A' does not have an entry for i1 or i2, So A'[i1] == A'[i2] == A'.m_else. // Thus, A[i1] == A[i2] which is a contradiction since v1 != v2 and A[i1] = v1 and A[i2] = v2. - TRACE("array_factory_bug", tout << "v1: " << mk_pp(v1, m_manager) << " v2: " << mk_pp(v2, m_manager) << "\n";); + TRACE(array_factory_bug, tout << "v1: " << mk_pp(v1, m_manager) << " v2: " << mk_pp(v2, m_manager) << "\n";); ptr_buffer args1; ptr_buffer args2; bool found = false; @@ -196,7 +196,7 @@ expr * array_factory::get_fresh_value(sort * s) { // need to be used. // failed to create a fresh array value - TRACE("array_factory_bug", tout << "failed to build fresh array value\n";); + TRACE(array_factory_bug, tout << "failed to build fresh array value\n";); return nullptr; } diff --git a/src/model/datatype_factory.cpp b/src/model/datatype_factory.cpp index 480db2a81..39e4b6da3 100644 --- a/src/model/datatype_factory.cpp +++ b/src/model/datatype_factory.cpp @@ -39,7 +39,7 @@ expr * datatype_factory::get_some_value(sort * s) { args.push_back(m_model.get_some_value(c->get_domain(i))); expr * r = m_manager.mk_app(c, args); register_value(r); - TRACE("datatype", tout << mk_pp(r, m_util.get_manager()) << "\n";); + TRACE(datatype, tout << mk_pp(r, m_util.get_manager()) << "\n";); return r; } @@ -67,7 +67,7 @@ bool datatype_factory::is_subterm_of_last_value(app* e) { } contains_app contains(m_manager, e); bool result = contains(last); - TRACE("datatype", tout << mk_pp(e, m_manager) << " in " << mk_pp(last, m_manager) << " " << result << "\n";); + TRACE(datatype, tout << mk_pp(e, m_manager) << " in " << mk_pp(last, m_manager) << " " << result << "\n";); return result; } @@ -127,7 +127,7 @@ expr * datatype_factory::get_almost_fresh_value(sort * s) { m_last_fresh_value.insert(s, new_value); } } - TRACE("datatype", tout << "almost fresh: " << mk_pp(new_value, m_manager) << "\n";); + TRACE(datatype, tout << "almost fresh: " << mk_pp(new_value, m_manager) << "\n";); return new_value; } } @@ -139,7 +139,7 @@ expr * datatype_factory::get_almost_fresh_value(sort * s) { expr * datatype_factory::get_fresh_value(sort * s) { if (!m_util.is_datatype(s)) return m_model.get_fresh_value(s); - TRACE("datatype", tout << "generating fresh value for: " << s->get_name() << "\n";); + TRACE(datatype, tout << "generating fresh value for: " << s->get_name() << "\n";); value_set * set = get_value_set(s); // Approach 0) // if no value for s was generated so far, then used get_some_value @@ -147,7 +147,7 @@ expr * datatype_factory::get_fresh_value(sort * s) { expr * val = get_some_value(s); if (m_util.is_recursive(s)) m_last_fresh_value.insert(s, val); - TRACE("datatype", tout << "0. result: " << mk_pp(val, m_manager) << "\n";); + TRACE(datatype, tout << "0. result: " << mk_pp(val, m_manager) << "\n";); return val; } // Approach 1) @@ -180,14 +180,14 @@ expr * datatype_factory::get_fresh_value(sort * s) { } new_value = m_manager.mk_app(constructor, args); - CTRACE("datatype", found_fresh_arg && set->contains(new_value), tout << "seen: " << new_value << "\n";); + CTRACE(datatype, found_fresh_arg && set->contains(new_value), tout << "seen: " << new_value << "\n";); if (found_fresh_arg && set->contains(new_value)) goto retry_value; if (!set->contains(new_value)) { register_value(new_value); if (m_util.is_recursive(s)) m_last_fresh_value.insert(s, new_value); - TRACE("datatype", tout << "1. result: " << mk_pp(new_value, m_manager) << "\n";); + TRACE(datatype, tout << "1. result: " << mk_pp(new_value, m_manager) << "\n";); return new_value; } } @@ -198,16 +198,16 @@ expr * datatype_factory::get_fresh_value(sort * s) { if (m_util.is_recursive(s)) { while (true) { ++num_iterations; - TRACE("datatype", tout << num_iterations << " " << mk_pp(get_last_fresh_value(s), m_manager) << "\n";); + TRACE(datatype, tout << num_iterations << " " << mk_pp(get_last_fresh_value(s), m_manager) << "\n";); ptr_vector const & constructors = *m_util.get_datatype_constructors(s); for (func_decl * constructor : constructors) { expr_ref_vector args(m_manager); bool found_sibling = false; unsigned num = constructor->get_arity(); - TRACE("datatype", tout << "checking constructor: " << constructor->get_name() << "\n";); + TRACE(datatype, tout << "checking constructor: " << constructor->get_name() << "\n";); for (unsigned i = 0; i < num; i++) { sort * s_arg = constructor->get_domain(i); - TRACE("datatype", tout << mk_pp(s, m_manager) << " " + TRACE(datatype, tout << mk_pp(s, m_manager) << " " << mk_pp(s_arg, m_manager) << " are_siblings " << m_util.are_siblings(s, s_arg) << " is_datatype " << m_util.is_datatype(s_arg) << " found_sibling " @@ -222,7 +222,7 @@ expr * datatype_factory::get_fresh_value(sort * s) { else maybe_new_arg = get_fresh_value(s_arg); if (!maybe_new_arg) { - TRACE("datatype", + TRACE(datatype, tout << "no argument found for " << mk_pp(s_arg, m_manager) << "\n";); maybe_new_arg = m_model.get_some_value(s_arg); found_sibling = false; @@ -239,11 +239,11 @@ expr * datatype_factory::get_fresh_value(sort * s) { if (found_sibling) { expr_ref new_value(m_manager); new_value = m_manager.mk_app(constructor, args); - TRACE("datatype", tout << "potential new value: " << mk_pp(new_value, m_manager) << "\n";); + TRACE(datatype, tout << "potential new value: " << mk_pp(new_value, m_manager) << "\n";); m_last_fresh_value.insert(s, new_value); if (!set->contains(new_value)) { register_value(new_value); - TRACE("datatype", tout << "2. result: " << mk_pp(new_value, m_manager) << "\n";); + TRACE(datatype, tout << "2. result: " << mk_pp(new_value, m_manager) << "\n";); return new_value; } } diff --git a/src/model/func_interp.cpp b/src/model/func_interp.cpp index ebb22f079..0c87f97a7 100644 --- a/src/model/func_interp.cpp +++ b/src/model/func_interp.cpp @@ -142,7 +142,7 @@ void func_interp::set_else(expr * e) { reset_interp_cache(); - TRACE("func_interp", tout << "set_else: " << expr_ref(e, m()) << "\n";); + TRACE(func_interp, tout << "set_else: " << expr_ref(e, m()) << "\n";); ptr_vector args; while (e && is_fi_entry_expr(e, args)) { @@ -196,7 +196,7 @@ void func_interp::insert_entry(expr * const * args, expr * r) { void func_interp::insert_new_entry(expr * const * args, expr * r) { reset_interp_cache(); - CTRACE("func_interp_bug", get_entry(args) != 0, + CTRACE(func_interp_bug, get_entry(args) != 0, tout << "Old: " << mk_ismt2_pp(get_entry(args)->m_result, m()) << "\n"; tout << "Args:"; for (unsigned i = 0; i < m_arity; i++) { diff --git a/src/model/model.cpp b/src/model/model.cpp index f8ef6897d..b51b2af1c 100644 --- a/src/model/model.cpp +++ b/src/model/model.cpp @@ -95,7 +95,7 @@ bool model::eval_expr(expr * e, expr_ref & result, bool model_completion) { } catch (model_evaluator_exception & ex) { (void)ex; - TRACE("model_evaluator", tout << ex.what() << "\n";); + TRACE(model_evaluator, tout << ex.what() << "\n";); return false; } } @@ -278,7 +278,7 @@ void model::compress(bool force_inline) { std::swap(m_decls, sorted_decls); if (removed.empty()) break; - TRACE("model", tout << "remove\n"; for (func_decl* f : removed) tout << f->get_name() << "\n";); + TRACE(model, tout << "remove\n"; for (func_decl* f : removed) tout << f->get_name() << "\n";); remove_decls(m_func_decls, removed); remove_decls(m_const_decls, removed); } @@ -443,7 +443,7 @@ bool model::can_inline_def(top_sort& ts, func_decl* f, bool force_inline) { expr_ref model::cleanup_expr(top_sort& ts, expr* e, unsigned current_partition, bool force_inline) { if (!e) return expr_ref(nullptr, m); - TRACE("model", tout << "cleaning up:\n" << mk_pp(e, m) << "\n";); + TRACE(model, tout << "cleaning up:\n" << mk_pp(e, m) << "\n";); obj_map cache; expr_ref_vector trail(m); @@ -488,7 +488,7 @@ expr_ref model::cleanup_expr(top_sort& ts, expr* e, unsigned current_partition, fi = get_func_interp(f); if (fi) { new_t = fi->get_array_interp(f); - TRACE("model", tout << "array interpretation:" << new_t << "\n";); + TRACE(model, tout << "array interpretation:" << new_t << "\n";); } } } @@ -516,7 +516,7 @@ expr_ref model::cleanup_expr(top_sort& ts, expr* e, unsigned current_partition, } if (t != new_t.get()) trail.push_back(new_t); - CTRACE("model", (t != new_t.get()), tout << mk_bounded_pp(t, m) << " " << new_t << "\n";); + CTRACE(model, (t != new_t.get()), tout << mk_bounded_pp(t, m) << " " << new_t << "\n";); todo.pop_back(); cache.insert(t, new_t); break; @@ -640,5 +640,5 @@ void model::add_rec_funs() { fi->set_else(bodyr); register_decl(f, fi); } - TRACE("model", tout << *this << "\n";); + TRACE(model, tout << *this << "\n";); } diff --git a/src/model/model_core.cpp b/src/model/model_core.cpp index 222247c07..e8d6e91f2 100644 --- a/src/model/model_core.cpp +++ b/src/model/model_core.cpp @@ -53,7 +53,7 @@ void model_core::register_decl(func_decl * d, expr * v) { register_decl(d, fi); return; } - TRACE("model", tout << "register " << d->get_name() << "\n"; + TRACE(model, tout << "register " << d->get_name() << "\n"; if (v) tout << mk_pp(v, m) << "\n"; ); i_expr v0(0, nullptr); @@ -81,7 +81,7 @@ void model_core::register_decl(func_decl * d, func_interp * fi) { } func_interp* model_core::update_func_interp(func_decl* d, func_interp* fi) { - TRACE("model_verbose", tout << "register " << d->get_name() << "\n";); + TRACE(model_verbose, tout << "register " << d->get_name() << "\n";); SASSERT(d->get_arity() > 0); SASSERT(&fi->m() == &m); diff --git a/src/model/model_evaluator.cpp b/src/model/model_evaluator.cpp index 069acc4d9..d052efe51 100644 --- a/src/model/model_evaluator.cpp +++ b/src/model/model_evaluator.cpp @@ -112,7 +112,7 @@ struct evaluator_cfg : public default_rewriter_cfg { bool evaluate(func_decl * f, unsigned num, expr * const * args, expr_ref & result) { func_interp * fi = m_model.get_func_interp(f); bool r = (fi != nullptr) && eval_fi(fi, num, args, result); - CTRACE("model_evaluator", r, tout << "reduce_app " << f->get_name() << "\n"; + CTRACE(model_evaluator, r, tout << "reduce_app " << f->get_name() << "\n"; for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m) << "\n"; tout << "---->\n" << mk_ismt2_pp(result, m) << "\n";); return r; @@ -154,7 +154,7 @@ struct evaluator_cfg : public default_rewriter_cfg { br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) { auto st = reduce_app_core(f, num, args, result, result_pr); - CTRACE("model_evaluator", st != BR_FAILED, + CTRACE(model_evaluator, st != BR_FAILED, tout << st << " " << mk_pp(f, m) << " "; for (unsigned i = 0; i < num; ++i) tout << mk_pp(args[i], m) << " "; tout << "\n--> " << result << "\n";); @@ -205,7 +205,7 @@ struct evaluator_cfg : public default_rewriter_cfg { func_decl* f; expr_ref& r; pp(func_decl* f, expr_ref& r) :f(f), r(r) {} - ~pp() { TRACE("model_evaluator", tout << mk_pp(f, r.m()) << " " << r << "\n";); } + ~pp() { TRACE(model_evaluator, tout << mk_pp(f, r.m()) << " " << r << "\n";); } }; pp _pp(f, result); #endif @@ -222,7 +222,7 @@ struct evaluator_cfg : public default_rewriter_cfg { if (val != nullptr) { result = val; st = contains_redex(val) ? BR_REWRITE_FULL : BR_DONE; - TRACE("model_evaluator", tout << st << " " << result << "\n";); + TRACE(model_evaluator, tout << st << " " << result << "\n";); return st; } if (!m_model_completion) @@ -324,7 +324,7 @@ struct evaluator_cfg : public default_rewriter_cfg { expr* def = nullptr; if (m_def_cache.find(g, def)) { result = def; - TRACE("model_evaluator", tout << result << "\n";); + TRACE(model_evaluator, tout << result << "\n";); return true; } expr_ref tmp(m); @@ -338,11 +338,11 @@ struct evaluator_cfg : public default_rewriter_cfg { result = ev(tmp); m_pinned.push_back(result); m_def_cache.insert(g, result); - TRACE("model_evaluator", tout << mk_pp(g, m) << " " << result << "\n";); + TRACE(model_evaluator, tout << mk_pp(g, m) << " " << result << "\n";); return true; } - TRACE("model_evaluator", + TRACE(model_evaluator, tout << "could not get array interpretation " << mk_pp(g, m) << " " << fi << "\n"; tout << m_model << "\n";); @@ -350,7 +350,7 @@ struct evaluator_cfg : public default_rewriter_cfg { } void expand_stores(expr_ref& val) { - TRACE("model_evaluator", tout << val << "\n";); + TRACE(model_evaluator, tout << val << "\n";); vector stores; expr_ref else_case(m); bool _unused; @@ -365,7 +365,7 @@ struct evaluator_cfg : public default_rewriter_cfg { args.append(stores[i].size(), stores[i].data()); val = m_ar.mk_store(args); } - TRACE("model_evaluator", tout << val << "\n";); + TRACE(model_evaluator, tout << val << "\n";); } } @@ -417,7 +417,7 @@ struct evaluator_cfg : public default_rewriter_cfg { SASSERT(def != nullptr); } - CTRACE("model_evaluator", def != nullptr, tout << "get_macro for " << f->get_name() << " (model completion: " << m_model_completion << ") " << mk_pp(def, m) << "\n";); + CTRACE(model_evaluator, def != nullptr, tout << "get_macro for " << f->get_name() << " (model completion: " << m_model_completion << ") " << mk_pp(def, m) << "\n";); return def != nullptr; } @@ -516,7 +516,7 @@ struct evaluator_cfg : public default_rewriter_cfg { if (!m_array_equalities) { return m_ar_rw.mk_eq_core(a, b, result); } - TRACE("model_evaluator", tout << "mk_array_eq " << m_array_equalities << " " + TRACE(model_evaluator, tout << "mk_array_eq " << m_array_equalities << " " << mk_pp(a, m) << " " << mk_pp(b, m) << "\n";); vector stores1, stores2; @@ -536,7 +536,7 @@ struct evaluator_cfg : public default_rewriter_cfg { conj.push_back(m.mk_eq(else1, else2)); } if (args_are_unique1 && args_are_unique2 && !stores1.empty()) { - TRACE("model_evaluator", tout << "args are unique " << conj << "\n";); + TRACE(model_evaluator, tout << "args are unique " << conj << "\n";); return mk_array_eq_core(stores1, else1, stores2, else2, conj, result); } @@ -552,7 +552,7 @@ struct evaluator_cfg : public default_rewriter_cfg { conj.push_back(m.mk_eq(s1, s2)); } result = mk_and(conj); - TRACE("model_evaluator", tout << mk_pp(a, m) << " == " << mk_pp(b, m) << " -> " << conj << "\n"; + TRACE(model_evaluator, tout << mk_pp(a, m) << " == " << mk_pp(b, m) << " -> " << conj << "\n"; for (auto& s : stores1) tout << "store: " << s << "\n"; ); return BR_REWRITE_FULL; } @@ -593,7 +593,7 @@ struct evaluator_cfg : public default_rewriter_cfg { args_eq ae(arity); args_table table1(DEFAULT_HASHTABLE_INITIAL_CAPACITY, ah, ae); args_table table2(DEFAULT_HASHTABLE_INITIAL_CAPACITY, ah, ae); - TRACE("model_evaluator", + TRACE(model_evaluator, tout << "arity " << arity << "\n"; for (auto& v : stores1) tout << "stores1: " << v << "\n"; for (auto& v : stores2) tout << "stores2: " << v << "\n"; @@ -609,14 +609,14 @@ struct evaluator_cfg : public default_rewriter_cfg { for (unsigned i = 0, sz = stores2.size(); i < sz; ++i) { if (table2.contains(stores2[i].data())) { // first insertion takes precedence. - TRACE("model_evaluator", tout << "duplicate " << stores2[i] << "\n";); + TRACE(model_evaluator, tout << "duplicate " << stores2[i] << "\n";); continue; } table2.insert(stores2[i].data()); expr * const* args = nullptr; expr* val = stores2[i][arity]; if (table1.find(stores2[i].data(), args)) { - TRACE("model_evaluator", tout << "found value " << stores2[i] << "\n";); + TRACE(model_evaluator, tout << "found value " << stores2[i] << "\n";); table1.remove(args); switch (compare(args[arity], val)) { case l_true: break; @@ -625,7 +625,7 @@ struct evaluator_cfg : public default_rewriter_cfg { } } else { - TRACE("model_evaluator", tout << "not found value " << stores2[i] << "\n";); + TRACE(model_evaluator, tout << "not found value " << stores2[i] << "\n";); switch (compare(else1, val)) { case l_true: break; case l_false: result = m.mk_false(); return BR_DONE; @@ -665,7 +665,7 @@ struct evaluator_cfg : public default_rewriter_cfg { bool extract_array_func_interp(expr* a, vector& stores, expr_ref& else_case, bool& are_unique) { SASSERT(m_ar.is_array(a)); are_unique = true; - TRACE("model_evaluator", tout << mk_pp(a, m) << "\n";); + TRACE(model_evaluator, tout << mk_pp(a, m) << "\n";); while (m_ar.is_store(a)) { expr_ref_vector store(m); @@ -686,20 +686,20 @@ struct evaluator_cfg : public default_rewriter_cfg { return true; } if (!m_ar.is_as_array(a)) { - TRACE("model_evaluator", tout << "no translation: " << mk_pp(a, m) << "\n";); - TRACE("model_evaluator", tout << m_model << "\n";); + TRACE(model_evaluator, tout << "no translation: " << mk_pp(a, m) << "\n";); + TRACE(model_evaluator, tout << m_model << "\n";); return false; } func_decl* f = m_ar.get_as_array_func_decl(to_app(a)); func_interp* g = m_model.get_func_interp(f); if (!g) { - TRACE("model_evaluator", tout << "no interpretation for " << mk_pp(f, m) << "\n";); + TRACE(model_evaluator, tout << "no interpretation for " << mk_pp(f, m) << "\n";); return false; } else_case = g->get_else(); if (!else_case) { - TRACE("model_evaluator", tout << "no else case " << mk_pp(a, m) << "\n";); + TRACE(model_evaluator, tout << "no else case " << mk_pp(a, m) << "\n";); return false; } bool ground = is_ground(else_case); @@ -721,7 +721,7 @@ struct evaluator_cfg : public default_rewriter_cfg { stores.push_back(store); } if (!ground) { - TRACE("model_evaluator", tout << "could not extract ground array interpretation: " << mk_pp(a, m) << "\n";); + TRACE(model_evaluator, tout << "could not extract ground array interpretation: " << mk_pp(a, m) << "\n";); return false; } return true; @@ -802,10 +802,10 @@ void model_evaluator::reset(model_core &model, params_ref const& p) { void model_evaluator::operator()(expr * t, expr_ref & result) { - TRACE("model_evaluator", tout << mk_ismt2_pp(t, m()) << "\n";); + TRACE(model_evaluator, tout << mk_ismt2_pp(t, m()) << "\n";); m_imp->operator()(t, result); m_imp->expand_stores(result); - TRACE("model_evaluator", tout << "eval: " << mk_ismt2_pp(t, m()) << " --> " << result << "\n";); + TRACE(model_evaluator, tout << "eval: " << mk_ismt2_pp(t, m()) << " --> " << result << "\n";); } expr_ref model_evaluator::operator()(expr * t) { @@ -853,7 +853,7 @@ bool model_evaluator::eval(expr* t, expr_ref& r, bool model_completion) { } catch (model_evaluator_exception &ex) { (void)ex; - TRACE("model_evaluator", tout << ex.what () << "\n";); + TRACE(model_evaluator, tout << ex.what () << "\n";); return false; } } diff --git a/src/model/model_implicant.cpp b/src/model/model_implicant.cpp index eedd66601..bf9209f23 100644 --- a/src/model/model_implicant.cpp +++ b/src/model/model_implicant.cpp @@ -63,7 +63,7 @@ void model_implicant::assign_value(expr* e, expr* val) { } else { IF_VERBOSE(3, verbose_stream() << "Not evaluated " << mk_pp(e, m) << " := " << mk_pp(val, m) << "\n";); - TRACE("pdr", tout << "Variable is not tracked: " << mk_pp(e, m) << " := " << mk_pp(val, m) << "\n";); + TRACE(pdr, tout << "Variable is not tracked: " << mk_pp(e, m) << " := " << mk_pp(val, m) << "\n";); set_x(e); } } @@ -96,13 +96,13 @@ void model_implicant::reset() { expr_ref_vector model_implicant::minimize_model(ptr_vector const & formulas, model_ref& mdl) { setup_model(mdl); - TRACE("pdr_verbose", + TRACE(pdr_verbose, tout << "formulas:\n"; for (unsigned i = 0; i < formulas.size(); ++i) tout << mk_pp(formulas[i], m) << "\n"; ); expr_ref_vector model = prune_by_cone_of_influence(formulas); - TRACE("pdr_verbose", + TRACE(pdr_verbose, tout << "pruned model:\n"; for (unsigned i = 0; i < model.size(); ++i) tout << mk_pp(model[i].get(), m) << "\n";); @@ -118,7 +118,7 @@ expr_ref_vector model_implicant::minimize_model(ptr_vector const & formula expr_ref_vector model_implicant::minimize_literals(ptr_vector const& formulas, model_ref& mdl) { - TRACE("pdr", + TRACE(pdr, tout << "formulas:\n"; for (unsigned i = 0; i < formulas.size(); ++i) tout << mk_pp(formulas[i], m) << "\n"; ); @@ -151,7 +151,7 @@ expr_ref_vector model_implicant::minimize_literals(ptr_vector const& formu } } reset(); - TRACE("pdr", + TRACE(pdr, tout << "minimized model:\n"; for (unsigned i = 0; i < result.size(); ++i) tout << mk_pp(result[i].get(), m) << "\n"; ); @@ -288,7 +288,7 @@ expr_ref_vector model_implicant::prune_by_cone_of_influence(ptr_vector con m1.reset(); m2.reset(); for (unsigned i = 0; i < tocollect.size(); ++i) { - TRACE("pdr_verbose", tout << "collect: " << mk_pp(tocollect[i], m) << "\n";); + TRACE(pdr_verbose, tout << "collect: " << mk_pp(tocollect[i], m) << "\n";); for_each_expr(*this, m_visited, tocollect[i]); } unsigned sz = m_model->get_num_constants(); @@ -303,7 +303,7 @@ expr_ref_vector model_implicant::prune_by_cone_of_influence(ptr_vector con } } m_visited.reset(); - TRACE("pdr", tout << sz << " ==> " << model.size() << "\n";); + TRACE(pdr, tout << sz << " ==> " << model.size() << "\n";); return model; } @@ -445,7 +445,7 @@ void model_implicant::inherit_value(expr* e, expr* v) { if (is_true(v)) set_true(e); else if (is_false(v)) set_false(e); else { - TRACE("pdr", tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";); + TRACE(pdr, tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";); set_x(e); } } @@ -459,7 +459,7 @@ void model_implicant::inherit_value(expr* e, expr* v) { set_value(e, w); } else { - TRACE("pdr", tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";); + TRACE(pdr, tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";); set_x(e); } } @@ -476,7 +476,7 @@ void model_implicant::eval_exprs(expr_ref_vector& es) { bool model_implicant::extract_array_func_interp(expr* a, vector& stores, expr_ref& else_case) { SASSERT(m_array.is_array(a)); - TRACE("pdr", tout << mk_pp(a, m) << "\n";); + TRACE(pdr, tout << mk_pp(a, m) << "\n";); while (m_array.is_store(a)) { expr_ref_vector store(m); store.append(to_app(a)->get_num_args()-1, to_app(a)->get_args()+1); @@ -502,7 +502,7 @@ bool model_implicant::extract_array_func_interp(expr* a, vector store.push_back(fe->get_result()); for (unsigned j = 0; j < store.size(); ++j) { if (!is_ground(store[j].get())) { - TRACE("pdr", tout << "could not extract array interpretation: " << mk_pp(a, m) << "\n" << mk_pp(store[j].get(), m) << "\n";); + TRACE(pdr, tout << "could not extract array interpretation: " << mk_pp(a, m) << "\n" << mk_pp(store[j].get(), m) << "\n";); return false; } } @@ -511,21 +511,21 @@ bool model_implicant::extract_array_func_interp(expr* a, vector } else_case = g->get_else(); if (!else_case) { - TRACE("pdr", tout << "no else case " << mk_pp(a, m) << "\n";); + TRACE(pdr, tout << "no else case " << mk_pp(a, m) << "\n";); return false; } if (!is_ground(else_case)) { - TRACE("pdr", tout << "non-ground else case " << mk_pp(a, m) << "\n" << mk_pp(else_case, m) << "\n";); + TRACE(pdr, tout << "non-ground else case " << mk_pp(a, m) << "\n" << mk_pp(else_case, m) << "\n";); return false; } if (m_array.is_as_array(else_case)) { model_ref mr(m_model); else_case = eval(mr, else_case); } - TRACE("pdr", tout << "else case: " << mk_pp(else_case, m) << "\n";); + TRACE(pdr, tout << "else case: " << mk_pp(else_case, m) << "\n";); return true; } - TRACE("pdr", tout << "no translation: " << mk_pp(a, m) << "\n";); + TRACE(pdr, tout << "no translation: " << mk_pp(a, m) << "\n";); return false; } @@ -534,7 +534,7 @@ bool model_implicant::extract_array_func_interp(expr* a, vector best effort evaluator of extensional array equality. */ void model_implicant::eval_array_eq(app* e, expr* arg1, expr* arg2) { - TRACE("pdr", tout << "array equality: " << mk_pp(e, m) << "\n";); + TRACE(pdr, tout << "array equality: " << mk_pp(e, m) << "\n";); expr_ref v1 = (*m_model)(arg1); expr_ref v2 = (*m_model)(arg2); if (v1 == v2) { @@ -545,7 +545,7 @@ void model_implicant::eval_array_eq(app* e, expr* arg1, expr* arg2) { sort* r = get_array_range(s); // give up evaluating finite domain/range arrays if (!r->is_infinite() && !r->is_very_big() && !s->is_infinite() && !s->is_very_big()) { - TRACE("pdr", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(pdr, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); set_x(e); return; } @@ -553,14 +553,14 @@ void model_implicant::eval_array_eq(app* e, expr* arg1, expr* arg2) { expr_ref else1(m), else2(m); if (!extract_array_func_interp(v1, store, else1) || !extract_array_func_interp(v2, store, else2)) { - TRACE("pdr", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(pdr, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); set_x(e); return; } if (else1 != else2) { if (m.is_value(else1) && m.is_value(else2)) { - TRACE("pdr", tout + TRACE(pdr, tout << "defaults are different: " << mk_pp(e, m) << " " << mk_pp(else1, m) << " " << mk_pp(else2, m) << "\n";); set_false(e); @@ -569,7 +569,7 @@ void model_implicant::eval_array_eq(app* e, expr* arg1, expr* arg2) { eval_array_eq(e, else1, else2); } else { - TRACE("pdr", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(pdr, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); set_x(e); } return; @@ -592,7 +592,7 @@ void model_implicant::eval_array_eq(app* e, expr* arg1, expr* arg2) { continue; } if (m.is_value(w1) && m.is_value(w2)) { - TRACE("pdr", tout << "Equality evaluation: " << mk_pp(e, m) << "\n"; + TRACE(pdr, tout << "Equality evaluation: " << mk_pp(e, m) << "\n"; tout << mk_pp(s1, m) << " |-> " << mk_pp(w1, m) << "\n"; tout << mk_pp(s2, m) << " |-> " << mk_pp(w2, m) << "\n";); set_false(e); @@ -604,7 +604,7 @@ void model_implicant::eval_array_eq(app* e, expr* arg1, expr* arg2) { } } else { - TRACE("pdr", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(pdr, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); set_x(e); } return; @@ -630,7 +630,7 @@ void model_implicant::eval_eq(app* e, expr* arg1, expr* arg2) { set_bool(e, false); } else { - TRACE("pdr", tout << "cannot evaluate: " << mk_pp(vl, m) << "\n";); + TRACE(pdr, tout << "cannot evaluate: " << mk_pp(vl, m) << "\n";); set_x(e); } } @@ -657,7 +657,7 @@ void model_implicant::eval_eq(app* e, expr* arg1, expr* arg2) { set_bool(e, true); } else { - TRACE("pdr", tout << "not value equal:\n" << mk_pp(e1, m) << "\n" << mk_pp(e2, m) << "\n";); + TRACE(pdr, tout << "not value equal:\n" << mk_pp(e1, m) << "\n" << mk_pp(e2, m) << "\n";); set_x(e); } } @@ -849,7 +849,7 @@ bool model_implicant::check_model(ptr_vector const& formulas) { for (unsigned i = 0; i < formulas.size(); ++i) { expr * form = formulas[i]; SASSERT(!is_unknown(form)); - TRACE("pdr_verbose", + TRACE(pdr_verbose, tout << "formula is " << (is_true(form) ? "true" : is_false(form) ? "false" : "unknown") << "\n" < const& formulas) { } if (is_x(form)) { IF_VERBOSE(0, verbose_stream() << "formula undetermined in model: " << mk_pp(form, m) << "\n";); - TRACE("pdr", model_smt2_pp(tout, m, *m_model, 0);); + TRACE(pdr, model_smt2_pp(tout, m, *m_model, 0);); has_x = true; } } diff --git a/src/model/model_implicant.h b/src/model/model_implicant.h index 85684f9bc..fd2b447f4 100644 --- a/src/model/model_implicant.h +++ b/src/model/model_implicant.h @@ -73,7 +73,7 @@ class model_implicant { inline void set_bool(expr* x, bool v) { if (v) { set_true(x); } else { set_false(x); } } inline rational const& get_number(expr* x) const { return m_numbers.find(x); } inline void set_number(expr* x, rational const& v) { - set_v(x); TRACE("pdr_verbose", tout << mk_pp(x,m) << " " << v << "\n";); m_numbers.insert(x,v); + set_v(x); TRACE(pdr_verbose, tout << mk_pp(x,m) << " " << v << "\n";); m_numbers.insert(x,v); } inline expr* get_value(expr* x) { return m_values.find(x); } inline void set_value(expr* x, expr* v) { set_v(x); m_refs.push_back(v); m_values.insert(x, v); } diff --git a/src/model/model_macro_solver.cpp b/src/model/model_macro_solver.cpp index 1d95f12cd..64881482e 100644 --- a/src/model/model_macro_solver.cpp +++ b/src/model/model_macro_solver.cpp @@ -24,7 +24,7 @@ void base_macro_solver::set_else_interp(func_decl* f, expr* f_else) { m_model->register_decl(f, fi); } fi->set_else(f_else); - TRACE("model_finder", tout << f->get_name() << " " << mk_pp(f_else, m) << "\n";); + TRACE(model_finder, tout << f->get_name() << " " << mk_pp(f_else, m) << "\n";); } void base_macro_solver::operator()(model_core& m, ptr_vector& qs, ptr_vector& residue) { @@ -67,7 +67,7 @@ bool simple_macro_solver::process(quantifier* q, ptr_vector const& q // does not satisfy the quantifier. // In all other cases the "else" of f will satisfy the quantifier. set_else_interp(f, f_else); - TRACE("model_finder", tout << "satisfying the quantifier using simple macro:\n"; + TRACE(model_finder, tout << "satisfying the quantifier using simple macro:\n"; m->display(tout); tout << "\n";); return true; // satisfied quantifier } @@ -307,7 +307,7 @@ void hint_macro_solver::greedy(func_decl* f, unsigned depth) { if (depth >= GREEDY_MAX_DEPTH) return; // failed - TRACE("model_finder_hint", + TRACE(model_finder_hint, tout << "greedy depth: " << depth << ", f: " << f->get_name() << "\n"; display_search_state(tout);); @@ -318,7 +318,7 @@ void hint_macro_solver::greedy(func_decl* f, unsigned depth) { m_satisfied.push_scope(); m_residue.push_scope(); - TRACE("model_finder", tout << f->get_name() << " " << mk_pp(def, m) << "\n";); + TRACE(model_finder, tout << f->get_name() << " " << mk_pp(def, m) << "\n";); m_fs.insert(f, def); if (update_satisfied_residue(f, def)) { @@ -373,7 +373,7 @@ bool hint_macro_solver::is_acyclic(expr* def) { void hint_macro_solver::greedy(unsigned depth) { if (m_residue.empty()) { if (is_cyclic()) return; - TRACE("model_finder_hint", + TRACE(model_finder_hint, tout << "found subset that is satisfied by macros\n"; display_search_state(tout);); throw found_satisfied_subset(); @@ -381,7 +381,7 @@ void hint_macro_solver::greedy(unsigned depth) { func_decl_set candidates; get_candidates_from_residue(candidates); - TRACE("model_finder_hint", tout << "candidates from residue:\n"; + TRACE(model_finder_hint, tout << "candidates from residue:\n"; for (func_decl* f : candidates) { tout << f->get_name() << " "; } @@ -444,7 +444,7 @@ bool hint_macro_solver::process(ptr_vector const& qs, ptr_vectorget_name() << "\n" << mk_pp(f_else, m) << "\n";); + TRACE(model_finder, tout << "trying to add macro for " << f->get_name() << "\n" << mk_pp(f_else, m) << "\n";); func_decl_set* s = m_dependencies.mk_func_decl_set(); m_dependencies.collect_ng_func_decls(f_else, s); if (!m_dependencies.insert(f, s)) { - TRACE("model_finder", tout << "failed to add macro\n";); + TRACE(model_finder, tout << "failed to add macro\n";); return false; // cyclic dependency } set_else_interp(f, f_else); @@ -510,7 +510,7 @@ void non_auf_macro_solver::collect_candidates(ptr_vector const& qs, for (cond_macro* m : qi->macros()) { if (!m->is_hint()) { func_decl* f = m->get_f(); - TRACE("model_finder", tout << "considering macro for: " << f->get_name() << "\n"; + TRACE(model_finder, tout << "considering macro for: " << f->get_name() << "\n"; m->display(tout); tout << "\n";); if (m->is_unconditional() && (!qi->is_auf() || m->get_weight() >= m_mbqi_force_template)) { full_macros.insert(f, std::make_pair(m, q)); diff --git a/src/model/model_smt2_pp.cpp b/src/model/model_smt2_pp.cpp index 89ea98075..489209851 100644 --- a/src/model/model_smt2_pp.cpp +++ b/src/model/model_smt2_pp.cpp @@ -212,7 +212,7 @@ static void pp_funs(std::ostream & out, ast_printer_context & ctx, model_core co else { ctx.pp(f_i->get_else(), f->get_arity(), "x", body, var_names); } - TRACE("model_smt2_pp", for (unsigned i = 0; i < var_names.size(); i++) tout << var_names[i] << "\n";); + TRACE(model_smt2_pp, for (unsigned i = 0; i < var_names.size(); i++) tout << var_names[i] << "\n";); f_var_names.reset(); for (auto const& vn : var_names) f_var_names.push_back(mk_string(m, vn.bare_str())); diff --git a/src/muz/base/dl_context.cpp b/src/muz/base/dl_context.cpp index b1e74c1ef..9e154f9dc 100644 --- a/src/muz/base/dl_context.cpp +++ b/src/muz/base/dl_context.cpp @@ -344,7 +344,7 @@ namespace datalog { if (!is_predicate(decl)) { m_pinned.push_back(decl); m_preds.insert(decl); - TRACE("dl", tout << mk_pp(decl, m) << "\n";); + TRACE(dl, tout << mk_pp(decl, m) << "\n";); if (named) { m_preds_by_name.insert(decl->get_name(), decl); } @@ -354,7 +354,7 @@ namespace datalog { void context::restrict_predicates(func_decl_set const& preds) { m_preds.reset(); for (func_decl* p : preds) { - TRACE("dl", tout << mk_pp(p, m) << "\n";); + TRACE(dl, tout << mk_pp(p, m) << "\n";); m_preds.insert(p); } } @@ -569,7 +569,7 @@ namespace datalog { void context::check_rules(rule_set& r) { m_rule_properties.set_generate_proof(generate_proof_trace()); - TRACE("dl", m_rule_set.display(tout);); + TRACE(dl, m_rule_set.display(tout);); switch(get_engine()) { case DATALOG_ENGINE: m_rule_properties.collect(r); @@ -715,13 +715,13 @@ namespace datalog { void context::transform_rules(rule_transformer& transf) { SASSERT(m_closed); //we must finish adding rules before we start transforming them - TRACE("dl", display_rules(tout);); + TRACE(dl, display_rules(tout);); if (transf(m_rule_set)) { //we have already ensured the negation is stratified and transformations //should not break the stratification m_rule_set.ensure_closed(); - TRACE("dl", display_rules(tout);); - TRACE("dl_verbose", display(tout);); + TRACE(dl, display_rules(tout);); + TRACE(dl_verbose, display(tout);); } } @@ -759,7 +759,7 @@ namespace datalog { } void context::assert_expr(expr* e) { - TRACE("dl", tout << mk_ismt2_pp(e, m) << "\n";); + TRACE(dl, tout << mk_ismt2_pp(e, m) << "\n";); m_background.push_back(e); } @@ -808,7 +808,7 @@ namespace datalog { }; void context::configure_engine(expr* q) { - TRACE("dl", tout << mk_pp(q, m) << " " << m_engine_type << "\n";); + TRACE(dl, tout << mk_pp(q, m) << " " << m_engine_type << "\n";); if (m_engine_type != LAST_ENGINE) { return; } @@ -987,7 +987,7 @@ namespace datalog { const symbol& rule_name = r->name(); names.push_back (rule_name); - TRACE ("dl", + TRACE(dl, if (rule_name == symbol::null) { tout << "Encountered unnamed rule: "; r->display(*this, tout); diff --git a/src/muz/base/dl_rule.cpp b/src/muz/base/dl_rule.cpp index 4ef02c03c..bf08bd16b 100644 --- a/src/muz/base/dl_rule.cpp +++ b/src/muz/base/dl_rule.cpp @@ -188,7 +188,7 @@ namespace datalog { m_neg.reset(); unsigned index = extract_horn(fml, m_body, m_head); hoist_compound_predicates(index, m_head, m_body); - TRACE("dl_rule", + TRACE(dl_rule, tout << mk_pp(m_head, m) << " :- "; for (expr* b : m_body) tout << mk_pp(b, m) << " "; @@ -260,7 +260,7 @@ namespace datalog { func_decl* rule_manager::mk_query(expr* query, rule_set& rules) { - TRACE("dl", tout << mk_pp(query, m) << "\n";); + TRACE(dl, tout << mk_pp(query, m) << "\n";); ptr_vector vars; svector names; @@ -339,7 +339,7 @@ namespace datalog { if (!vars.empty()) { rule_expr = m.mk_forall(vars.size(), vars.data(), names.data(), impl); } - TRACE("dl", tout << rule_expr << "\n";); + TRACE(dl, tout << rule_expr << "\n";); scoped_proof_mode _sc(m, m_ctx.generate_proof_trace()?PGM_ENABLED:PGM_DISABLED); proof_ref pr(m); @@ -399,7 +399,7 @@ namespace datalog { } } fml = m.mk_app(fml->get_decl(), m_args.size(), m_args.data()); - TRACE("dl_rule", tout << mk_pp(fml.get(), m) << "\n";); + TRACE(dl_rule, tout << mk_pp(fml.get(), m) << "\n";); } class contains_predicate_proc { @@ -636,7 +636,7 @@ namespace datalog { } tail_neg.resize(tail.size(), false); r = mk(r->get_head(), tail.size(), tail.data(), tail_neg.data(), r->name()); - TRACE("dl", r->display(m_ctx, tout << "reduced rule\n");); + TRACE(dl, r->display(m_ctx, tout << "reduced rule\n");); } } @@ -745,7 +745,7 @@ namespace datalog { quant_tail = m.mk_exists(q_var_cnt, qsorts.data(), qnames.data(), unbound_tail_pre_quant); if (try_quantifier_elimination) { - TRACE("dl_rule_unbound_fix_pre_qe", + TRACE(dl_rule_unbound_fix_pre_qe, tout<<"rule: "; r->display(m_ctx, tout); tout<<"tail with unbound vars: "<display(m_ctx, tout); tout<<"tail with unbound vars: "<get_decl()->get_name() << "\n";); + TRACE(dl_verbose, tout << r->get_decl()->get_name() << "\n";); m_visited.reset(); func_decl * d = r->get_decl(); func_decl_set & s = ensure_key(d); @@ -316,7 +316,7 @@ namespace datalog { } void rule_set::add_rule(rule * r) { - TRACE("dl_verbose", r->display(m_context, tout << "add:");); + TRACE(dl_verbose, r->display(m_context, tout << "add:");); SASSERT(!is_closed()); m_rules.push_back(r); app * head = r->get_head(); @@ -328,7 +328,7 @@ namespace datalog { } void rule_set::del_rule(rule * r) { - TRACE("dl", r->display(m_context, tout << "del:");); + TRACE(dl, r->display(m_context, tout << "del:");); func_decl* d = r->get_decl(); rule_vector* rules = m_head2rules.find(d); #define DEL_VECTOR(_v) \ @@ -346,7 +346,7 @@ namespace datalog { } void rule_set::replace_rule(rule * r, rule * other) { - TRACE("dl", r->display(m_context, tout << "replace:");); + TRACE(dl, r->display(m_context, tout << "replace:");); func_decl* d = r->get_decl(); rule_vector* rules = m_head2rules.find(d); #define REPLACE_VECTOR(_v) \ diff --git a/src/muz/base/dl_rule_transformer.cpp b/src/muz/base/dl_rule_transformer.cpp index cc9269378..bcdcc6b5b 100644 --- a/src/muz/base/dl_rule_transformer.cpp +++ b/src/muz/base/dl_rule_transformer.cpp @@ -71,7 +71,7 @@ namespace datalog { bool modified = false; - TRACE("dl_rule_transf", + TRACE(dl_rule_transf, tout<<"init:\n"; rules.display(tout); ); @@ -107,7 +107,7 @@ namespace datalog { new_rules->ensure_closed(); IF_VERBOSE(1, verbose_stream() << new_rules->get_num_rules() << " rules " << sec << "s)\n";); - TRACE("dl_rule_transf", + TRACE(dl_rule_transf, tout << typeid(p).name()<<":\n"; new_rules->display(tout); ); diff --git a/src/muz/base/dl_util.cpp b/src/muz/base/dl_util.cpp index 7b01c2b3f..b1bfc0d7c 100644 --- a/src/muz/base/dl_util.cpp +++ b/src/muz/base/dl_util.cpp @@ -285,7 +285,7 @@ namespace datalog { if (mc) { ast_manager& m = mc->get_manager(); expr_ref_vector body(m); - TRACE("dl", tout << "unreachable: " << unreachable << " " << r.get_decl()->get_name() << "\n"); + TRACE(dl, tout << "unreachable: " << unreachable << " " << r.get_decl()->get_name() << "\n"); switch (unreachable) { case l_true: body.push_back(m.mk_true()); @@ -304,7 +304,7 @@ namespace datalog { } break; } - TRACE("dl", + TRACE(dl, tout << mk_pp(r.get_head(), m) << " :- \n"; for (unsigned i = 0; i < body.size(); ++i) { tout << mk_pp(body.get(i), m) << "\n"; @@ -336,7 +336,7 @@ namespace datalog { premises.push_back(m.mk_asserted(fml2)); positions.push_back(std::make_pair(idx+1, 0)); - TRACE("dl", + TRACE(dl, tout << premises[0]->get_id() << " " << mk_pp(premises[0].get(), m) << "\n"; for (unsigned i = 0; i < s1.size(); ++i) { tout << mk_pp(s1[i], m) << " "; @@ -374,7 +374,7 @@ namespace datalog { premises.push_back(r2.get_proof()); positions.push_back(std::make_pair(idx+1, 0)); - TRACE("dl", + TRACE(dl, tout << premises[0]->get_id() << " " << mk_pp(premises[0].get(), m) << "\n"; for (unsigned i = 0; i < s1.size(); ++i) { tout << mk_pp(s1[i], m) << " "; diff --git a/src/muz/base/hnf.cpp b/src/muz/base/hnf.cpp index 97b64983b..e335f2cf8 100644 --- a/src/muz/base/hnf.cpp +++ b/src/muz/base/hnf.cpp @@ -163,7 +163,7 @@ public: ps.push_back(pr); } } - TRACE("hnf", + TRACE(hnf, tout << mk_pp(n, m) << "\n==>\n" << result << "\n";); } @@ -334,7 +334,7 @@ private: if (!contains_predicate(b)) { return; } - TRACE("hnf", tout << mk_pp(b, m) << "\n";); + TRACE(hnf, tout << mk_pp(b, m) << "\n";); if (m.is_or(b)) { is_disj = true; negate_args = false; @@ -522,7 +522,7 @@ hnf::~hnf() { void hnf::operator()(expr * n, proof* p, expr_ref_vector & rs, proof_ref_vector& ps) { m_imp->operator()(n, p, rs, ps); - TRACE("hnf", + TRACE(hnf, ast_manager& m = rs.get_manager(); tout << mk_ismt2_pp(n, m) << "\nHNF result:\n"; for (unsigned i = 0; i < rs.size(); ++i) { diff --git a/src/muz/bmc/dl_bmc_engine.cpp b/src/muz/bmc/dl_bmc_engine.cpp index e83569e0e..b2feb4b92 100644 --- a/src/muz/bmc/dl_bmc_engine.cpp +++ b/src/muz/bmc/dl_bmc_engine.cpp @@ -263,18 +263,18 @@ namespace datalog { SASSERT(num.is_unsigned()); level = num.get_unsigned(); SASSERT(m.is_true(eval_q(md, b.m_query_pred, level))); - TRACE("bmc", model_smt2_pp(tout, m, *md, 0);); + TRACE(bmc, model_smt2_pp(tout, m, *md, 0);); rule_ref r0(rm), r1(rm), r2(rm); while (true) { - TRACE("bmc", tout << "Predicate: " << pred->get_name() << "\n";); + TRACE(bmc, tout << "Predicate: " << pred->get_name() << "\n";); expr_ref_vector sub(m); rule_vector const& rls = b.m_rules.get_predicate_rules(pred); rule* r = nullptr; unsigned i = 0; for (; i < rls.size(); ++i) { rule_i = m.mk_app(mk_q_rule(pred, i), mk_q_num(level).get()); - TRACE("bmc", rls[i]->display(b.m_ctx, tout << "Checking rule " << mk_pp(rule_i, m) << " ");); + TRACE(bmc, rls[i]->display(b.m_ctx, tout << "Checking rule " << mk_pp(rule_i, m) << " ");); if (m.is_true(eval_q(md, rule_i, level))) { r = rls[i]; break; @@ -490,7 +490,7 @@ namespace datalog { if (!m.inc()) { return proof_ref(nullptr, m); } - TRACE("bmc", tout << "Predicate: " << pred->get_name() << "\n";); + TRACE(bmc, tout << "Predicate: " << pred->get_name() << "\n";); rule_manager& rm = b.m_ctx.get_rule_manager(); expr_ref prop_r(m), prop_v(m), fml(m), prop_body(m), tmp(m), body(m); expr_ref_vector args(m); @@ -503,7 +503,7 @@ namespace datalog { for (unsigned i = 0; i < rls.size(); ++i) { func_decl_ref rule_i = mk_level_rule(pred, i, level); prop_r = m.mk_app(rule_i, prop->get_num_args(), prop->get_args()); - TRACE("bmc", rls[i]->display(b.m_ctx, tout << "Checking rule " << mk_pp(rule_i, m) << " "); + TRACE(bmc, rls[i]->display(b.m_ctx, tout << "Checking rule " << mk_pp(rule_i, m) << " "); tout << (*md)(prop_r) << "\n"; tout << *md << "\n"; ); @@ -998,7 +998,7 @@ namespace datalog { m_pinned.push_back(new_sorts[i].get()); } if (!new_sorts.empty()) { - TRACE("bmc", dtu.display_datatype(new_sorts[0].get(), tout);); + TRACE(bmc, dtu.display_datatype(new_sorts[0].get(), tout);); } del_datatype_decls(dts.size(), dts.data()); @@ -1196,18 +1196,18 @@ namespace datalog { func_decl* pred = b.m_query_pred; SASSERT(m.is_true(md->get_const_interp(to_app(level_query)->get_decl()))); - TRACE("bmc", model_smt2_pp(tout, m, *md, 0);); + TRACE(bmc, model_smt2_pp(tout, m, *md, 0);); rule_ref r0(rm), r1(rm), r2(rm); while (true) { - TRACE("bmc", tout << "Predicate: " << pred->get_name() << "\n";); + TRACE(bmc, tout << "Predicate: " << pred->get_name() << "\n";); expr_ref_vector sub(m); rule_vector const& rls = b.m_rules.get_predicate_rules(pred); rule* r = nullptr; unsigned i = 0; for (; i < rls.size(); ++i) { expr_ref rule_i = mk_level_rule(pred, i, level); - TRACE("bmc", rls[i]->display(b.m_ctx, tout << "Checking rule " << mk_pp(rule_i, m) << " ");); + TRACE(bmc, rls[i]->display(b.m_ctx, tout << "Checking rule " << mk_pp(rule_i, m) << " ");); if (m.is_true(md->get_const_interp(to_app(rule_i)->get_decl()))) { r = rls[i]; break; @@ -1511,7 +1511,7 @@ namespace datalog { } void bmc::assert_expr(expr* e) { - TRACE("bmc", tout << mk_pp(e, m) << "\n";); + TRACE(bmc, tout << mk_pp(e, m) << "\n";); m_solver->assert_expr(e); } diff --git a/src/muz/dataflow/dataflow.h b/src/muz/dataflow/dataflow.h index b4f2698ac..c6b606961 100644 --- a/src/muz/dataflow/dataflow.h +++ b/src/muz/dataflow/dataflow.h @@ -82,7 +82,7 @@ namespace datalog { void init_top_down() { for (func_decl* sym : m_rules.get_output_predicates()) { - TRACE("dl", tout << sym->get_name() << "\n";); + TRACE(dl, tout << sym->get_name() << "\n";); const rule_vector& output_rules = m_rules.get_predicate_rules(sym); for (rule* r : output_rules) { m_facts.insert_if_not_there(sym, Fact()).init_down(m_context, r); diff --git a/src/muz/fp/horn_tactic.cpp b/src/muz/fp/horn_tactic.cpp index c16523be0..fd27d0b34 100644 --- a/src/muz/fp/horn_tactic.cpp +++ b/src/muz/fp/horn_tactic.cpp @@ -210,7 +210,7 @@ class horn_tactic : public tactic { break; default: msg << "formula is not in Horn fragment: " << mk_pp(g->form(i), m) << "\n"; - TRACE("horn", tout << msg.str();); + TRACE(horn, tout << msg.str();); throw tactic_exception(msg.str()); } } @@ -287,7 +287,7 @@ class horn_tactic : public tactic { model_ref md = m_ctx.get_model(); model_converter_ref mc2 = model2model_converter(md.get()); mc = mc2.get(); - TRACE("dl", mc->display(tout << *md << "\n");); + TRACE(dl, mc->display(tout << *md << "\n");); } break; } diff --git a/src/muz/rel/check_relation.cpp b/src/muz/rel/check_relation.cpp index 454f6d8bc..e54714205 100644 --- a/src/muz/rel/check_relation.cpp +++ b/src/muz/rel/check_relation.cpp @@ -411,7 +411,7 @@ namespace datalog { } void check_relation_plugin::check_equiv(char const* objective, expr* fml1, expr* fml2) { - TRACE("doc", tout << mk_pp(fml1, m) << "\n"; + TRACE(doc, tout << mk_pp(fml1, m) << "\n"; tout << mk_pp(fml2, m) << "\n";); smt_params fp; smt::kernel solver(m, fp); @@ -486,7 +486,7 @@ namespace datalog { union_fn(relation_union_fn* m): m_union(m) {} void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override { - TRACE("doc", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); + TRACE(doc, _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); check_relation& r = get(_r); check_relation const& src = get(_src); check_relation* d = get(_delta); diff --git a/src/muz/rel/dl_bound_relation.cpp b/src/muz/rel/dl_bound_relation.cpp index 38112cb66..ad8419632 100644 --- a/src/muz/rel/dl_bound_relation.cpp +++ b/src/muz/rel/dl_bound_relation.cpp @@ -149,7 +149,7 @@ namespace datalog { m_is_widen(is_widen) { } void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override { - TRACE("bound_relation", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); + TRACE(bound_relation, _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); get(_r).mk_union(get(_src), get(_delta), m_is_widen); } }; @@ -161,9 +161,9 @@ namespace datalog { m_is_widen(is_widen) { } void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override { - TRACE("bound_relation", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); + TRACE(bound_relation, _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); get(_r).mk_union_i(get_interval_relation(_src), get(_delta), m_is_widen); - TRACE("bound_relation", _r.display(tout << "dst':\n");); + TRACE(bound_relation, _r.display(tout << "dst':\n");); } }; @@ -343,7 +343,7 @@ namespace datalog { // void operator()(relation_base& t) override { - TRACE("dl", tout << mk_pp(m_cond, m_cond.get_manager()) << "\n"; t.display(tout);); + TRACE(dl, tout << mk_pp(m_cond, m_cond.get_manager()) << "\n"; t.display(tout);); bound_relation& r = get(t); switch(m_kind) { case K_FALSE: @@ -367,7 +367,7 @@ namespace datalog { UNREACHABLE(); break; } - TRACE("dl", t.display(tout << "result\n");); + TRACE(dl, t.display(tout << "result\n");); } bool supports_attachment(relation_base& t) override { @@ -401,7 +401,7 @@ namespace datalog { for (; it != end; ++it) { lev.push_back(renaming[*it]); } - TRACE("dl", + TRACE(dl, tout << "project: "; for (unsigned i = 0; i < renaming.size(); ++i) if (renaming[i] == UINT_MAX) tout << i << " "; diff --git a/src/muz/rel/dl_compiler.cpp b/src/muz/rel/dl_compiler.cpp index a970c5904..079ad627c 100644 --- a/src/muz/rel/dl_compiler.cpp +++ b/src/muz/rel/dl_compiler.cpp @@ -189,7 +189,7 @@ namespace datalog { void compiler::make_add_unbound_column(rule* compiled_rule, unsigned col_idx, func_decl* pred, reg_idx src, const relation_sort& s, reg_idx & result, bool & dealloc, instruction_block & acc) { - TRACE("dl", tout << "Adding unbound column " << mk_pp(pred, m_context.get_manager()) + TRACE(dl, tout << "Adding unbound column " << mk_pp(pred, m_context.get_manager()) << " " << m_context.get_rel_context()->get_rmanager().to_nice_string(s) << "\n";); IF_VERBOSE(3, { expr_ref e(m_context.get_manager()); @@ -219,7 +219,7 @@ namespace datalog { void compiler::make_full_relation(func_decl* pred, const relation_signature & sig, reg_idx & result, instruction_block & acc) { SASSERT(sig.empty()); - TRACE("dl", tout << "Adding unbound column " << mk_pp(pred, m_context.get_manager()) << "\n";); + TRACE(dl, tout << "Adding unbound column " << mk_pp(pred, m_context.get_manager()) << "\n";); if (m_empty_tables_registers.find(pred, result)) return; @@ -271,7 +271,7 @@ namespace datalog { bool & dealloc, instruction_block & acc) { - TRACE("dl", tout << mk_pp(head_pred, m_context.get_manager()) << "\n";); + TRACE(dl, tout << mk_pp(head_pred, m_context.get_manager()) << "\n";); unsigned col_cnt = acis0.size(); reg_idx curr = src; @@ -337,7 +337,7 @@ namespace datalog { } else { SASSERT(acis[i].kind==ACK_UNBOUND_VAR); - TRACE("dl", tout << head_pred->get_name() << " index: " << i + TRACE(dl, tout << head_pred->get_name() << " index: " << i << " " << m_context.get_rel_context()->get_rmanager().to_nice_string(acis[i].domain) << "\n";); make_add_unbound_column(compiled_rule, i, head_pred, curr, acis[i].domain, curr, dealloc, acc); handled_unbound.insert(acis[i].var_index,bound_column_index); @@ -456,7 +456,7 @@ namespace datalog { unsigned head_len = h->get_num_args(); func_decl * head_pred = h->get_decl(); - TRACE("dl", r->display(m_context, tout); ); + TRACE(dl, r->display(m_context, tout); ); unsigned pt_len = r->get_positive_tail_size(); SASSERT(pt_len<=2); //we require rules to be processed by the mk_simple_joins rule transformer plugin @@ -625,7 +625,7 @@ namespace datalog { } else { // we have an unbound variable, so we add an unbound column for it relation_sort unbound_sort = m_free_vars[v]; - TRACE("dl", tout << "unbound: " << v << "\n" << filter_cond << " " << mk_pp(unbound_sort, m) << "\n";); + TRACE(dl, tout << "unbound: " << v << "\n" << filter_cond << " " << mk_pp(unbound_sort, m) << "\n";); make_add_unbound_column(r, 0, head_pred, filtered_res, unbound_sort, filtered_res, dealloc, acc); src_col = single_res_expr.size(); @@ -778,7 +778,7 @@ namespace datalog { relation_sort unbound_sort = m_free_vars[v]; reg_idx new_reg; - TRACE("dl", tout << mk_pp(head_pred, m_context.get_manager()) << "\n";); + TRACE(dl, tout << mk_pp(head_pred, m_context.get_manager()) << "\n";); bool new_dealloc; make_add_unbound_column(r, 0, head_pred, filtered_res, unbound_sort, new_reg, new_dealloc, acc); @@ -902,7 +902,7 @@ namespace datalog { if (!pos_vars.contains(v)) { single_res_expr.push_back(e); make_add_unbound_column(r, v, pred, single_res, e->get_sort(), single_res, dealloc, acc); - TRACE("dl", tout << "Adding unbound column: " << mk_pp(e, m_context.get_manager()) << "\n";); + TRACE(dl, tout << "Adding unbound column: " << mk_pp(e, m_context.get_manager()) << "\n";); } } } @@ -1268,7 +1268,7 @@ namespace datalog { continue; } - TRACE("dl", + TRACE(dl, tout << "Stratum: "; func_decl_set::iterator pit = strat_preds.begin(); func_decl_set::iterator pend = strat_preds.end(); @@ -1332,7 +1332,7 @@ namespace datalog { acc.set_observer(nullptr); - TRACE("dl", execution_code.display(execution_context(m_context), tout);); + TRACE(dl, execution_code.display(execution_context(m_context), tout);); } diff --git a/src/muz/rel/dl_instruction.cpp b/src/muz/rel/dl_instruction.cpp index 63846e7d5..770bbdb09 100644 --- a/src/muz/rel/dl_instruction.cpp +++ b/src/muz/rel/dl_instruction.cpp @@ -320,16 +320,16 @@ namespace datalog { } bool perform(execution_context & ctx) override { log_verbose(ctx); - TRACE("dl", tout << "loop entered\n";); + TRACE(dl, tout << "loop entered\n";); unsigned count = 0; while (!control_is_empty(ctx)) { IF_VERBOSE(10, verbose_stream() << "looping ... " << count++ << "\n";); if (!m_body->perform(ctx)) { - TRACE("dl", tout << "while loop terminated before completion\n";); + TRACE(dl, tout << "while loop terminated before completion\n";); return false; } } - TRACE("dl", tout << "while loop exited\n";); + TRACE(dl, tout << "while loop exited\n";); return true; } void make_annotations(execution_context & ctx) override { @@ -383,7 +383,7 @@ namespace datalog { store_fn(r1, r2, fn); } - TRACE("dl", + TRACE(dl, r1.get_signature().output(ctx.get_rel_context().get_manager(), tout); tout<<":"<get_signature().output(ctx.get_rel_context().get_manager(), tout); tout<<":"<get_size_estimate_rows()<<"\n";); @@ -531,7 +531,7 @@ namespace datalog { relation_mutator_fn * fn; relation_base & r = *ctx.reg(m_reg); - TRACE("dl_verbose", r.display(tout <<"pre-filter-interpreted:\n");); + TRACE(dl_verbose, r.display(tout <<"pre-filter-interpreted:\n");); if (!find_fn(r, fn)) { fn = r.get_manager().mk_filter_interpreted_fn(r, m_cond); if (!fn) { @@ -546,7 +546,7 @@ namespace datalog { if (r.fast_empty()) { ctx.make_empty(m_reg); } - //TRACE("dl_verbose", r.display(tout <<"post-filter-interpreted:\n");); + //TRACE(dl_verbose, r.display(tout <<"post-filter-interpreted:\n");); return true; } @@ -588,7 +588,7 @@ namespace datalog { relation_transformer_fn * fn; relation_base & reg = *ctx.reg(m_src); - TRACE("dl_verbose", reg.display(tout <<"pre-filter-interpreted-and-project:\n");); + TRACE(dl_verbose, reg.display(tout <<"pre-filter-interpreted-and-project:\n");); if (!find_fn(reg, fn)) { fn = reg.get_manager().mk_filter_interpreted_and_project_fn(reg, m_cond, m_cols.size(), m_cols.data()); if (!fn) { @@ -604,7 +604,7 @@ namespace datalog { if (ctx.reg(m_res)->fast_empty()) { ctx.make_empty(m_res); } - // TRACE("dl_verbose", reg.display(tout << "post-filter-interpreted-and-project:\n");); + // TRACE(dl_verbose, reg.display(tout << "post-filter-interpreted-and-project:\n");); return true; } @@ -640,7 +640,7 @@ namespace datalog { instr_union(reg_idx src, reg_idx tgt, reg_idx delta, bool widen) : m_src(src), m_tgt(tgt), m_delta(delta), m_widen(widen) {} bool perform(execution_context & ctx) override { - TRACE("dl", tout << "union " << m_src << " into " << m_tgt + TRACE(dl, tout << "union " << m_src << " into " << m_tgt << " " << ctx.reg(m_src) << " " << ctx.reg(m_tgt) << "\n";); if (!ctx.reg(m_src)) { return true; @@ -699,11 +699,11 @@ namespace datalog { } SASSERT(r_src.get_signature().size() == r_tgt.get_signature().size()); - TRACE("dl_verbose", r_tgt.display(tout <<"pre-union:");); + TRACE(dl_verbose, r_tgt.display(tout <<"pre-union:");); (*fn)(r_tgt, r_src, r_delta); - TRACE("dl_verbose", + TRACE(dl_verbose, r_src.display(tout <<"src:"); r_tgt.display(tout <<"post-union:"); if (r_delta) { @@ -841,9 +841,9 @@ namespace datalog { } store_fn(r1, r2, fn); } - TRACE("dl", tout<\n";); + TRACE(dl, tout<\n";); ctx.set_reg(m_res, (*fn)(r1, r2)); - TRACE("dl", tout<get_size_estimate_rows()<<"\n";); + TRACE(dl, tout<get_size_estimate_rows()<<"\n";); if (ctx.reg(m_res)->fast_empty()) { ctx.make_empty(m_res); } @@ -893,7 +893,7 @@ namespace datalog { unsigned col, reg_idx result) : m_src(src), m_result(result), m_value(value, m), m_col(col) { // [Leo]: does not compile on gcc - // TRACE("dl", tout << "src:" << m_src << " result: " << m_result << " value:" << m_value << " column:" << m_col << "\n";); + // TRACE(dl, tout << "src:" << m_src << " result: " << m_result << " value:" << m_value << " column:" << m_col << "\n";); } bool perform(execution_context & ctx) override { @@ -1140,7 +1140,7 @@ namespace datalog { for (instruction * instr : m_data) { crec.start(instr); //finish is performed by the next start() or by the destructor of crec - TRACE("dl", instr->display_head_impl(ctx, tout << "% ") << "\n";); + TRACE(dl, instr->display_head_impl(ctx, tout << "% ") << "\n";); if (ctx.should_terminate() || !instr->perform(ctx)) { return false; diff --git a/src/muz/rel/dl_interval_relation.cpp b/src/muz/rel/dl_interval_relation.cpp index 9bf399e73..81c630ec6 100644 --- a/src/muz/rel/dl_interval_relation.cpp +++ b/src/muz/rel/dl_interval_relation.cpp @@ -200,7 +200,7 @@ namespace datalog { void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override { - TRACE("interval_relation", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); + TRACE(interval_relation, _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); interval_relation& r = get(_r); interval_relation const& src = get(_src); @@ -270,7 +270,7 @@ namespace datalog { interval_relation & r = get(_r); interval_relation_plugin & p = r.get_plugin(); r.mk_intersect(m_col, interval(p.dep(), m_value)); - TRACE("interval_relation", tout << m_value << "\n"; r.display(tout);); + TRACE(interval_relation, tout << m_value << "\n"; r.display(tout);); } }; @@ -292,7 +292,7 @@ namespace datalog { void operator()(relation_base& t) override { get(t).filter_interpreted(m_cond); - TRACE("interval_relation", tout << mk_pp(m_cond, m_cond.get_manager()) << "\n"; t.display(tout);); + TRACE(interval_relation, tout << mk_pp(m_cond, m_cond.get_manager()) << "\n"; t.display(tout);); } }; @@ -317,7 +317,7 @@ namespace datalog { interval_relation::interval_relation(interval_relation_plugin& p, relation_signature const& s, bool is_empty): vector_relation(p, s, is_empty, interval(p.dep())) { - TRACE("interval_relation", tout << s.size() << "\n";); + TRACE(interval_relation, tout << s.size() << "\n";); } void interval_relation::add_fact(const relation_fact & f) { diff --git a/src/muz/rel/dl_mk_explanations.cpp b/src/muz/rel/dl_mk_explanations.cpp index 2d22e34a9..234a1d0bd 100644 --- a/src/muz/rel/dl_mk_explanations.cpp +++ b/src/muz/rel/dl_mk_explanations.cpp @@ -482,12 +482,12 @@ namespace datalog { relation_mutator_fn * explanation_relation_plugin::mk_filter_interpreted_fn(const relation_base & r, app * cond) { if (&r.get_plugin() != this) { - TRACE("dl", tout << "not same plugin\n";); + TRACE(dl, tout << "not same plugin\n";); return nullptr; } ast_manager & m = get_ast_manager(); if (!m.is_eq(cond)) { - TRACE("dl", tout << "not equality " << mk_pp(cond, m) << "\n";); + TRACE(dl, tout << "not equality " << mk_pp(cond, m) << "\n";); return nullptr; } expr * arg1 = cond->get_arg(0); @@ -498,13 +498,13 @@ namespace datalog { } if (!is_var(arg1) || !is_app(arg2)) { - TRACE("dl", tout << "not variable assignemnt\n";); + TRACE(dl, tout << "not variable assignemnt\n";); return nullptr; } var * col_var = to_var(arg1); app * new_rule = to_app(arg2); if (!get_context().get_decl_util().is_rule_sort(col_var->get_sort())) { - TRACE("dl", tout << "not rule sort\n";); + TRACE(dl, tout << "not rule sort\n";); return nullptr; } unsigned col_idx = col_var->get_idx(); @@ -839,7 +839,7 @@ namespace datalog { } func_decl_set predicates(m_context.get_predicates()); for (func_decl* orig_decl : predicates) { - TRACE("dl", tout << mk_pp(orig_decl, m_manager) << "\n";); + TRACE(dl, tout << mk_pp(orig_decl, m_manager) << "\n";); func_decl * e_decl = get_e_decl(orig_decl); if (!rmgr.try_get_relation(orig_decl) && @@ -861,10 +861,10 @@ namespace datalog { scoped_ptr product_fun = rmgr.mk_join_fn(orig_rel, *m_e_fact_relation, 0, nullptr, nullptr); SASSERT(product_fun); scoped_rel aux_extended_rel = (*product_fun)(orig_rel, *m_e_fact_relation); - TRACE("dl", tout << aux_extended_rel << " " << aux_extended_rel->get_plugin().get_name() << "\n"; + TRACE(dl, tout << aux_extended_rel << " " << aux_extended_rel->get_plugin().get_name() << "\n"; tout << e_rel.get_plugin().get_name() << "\n";); scoped_ptr union_fun = rmgr.mk_union_fn(e_rel, *aux_extended_rel); - TRACE("dl", tout << union_fun << "\n";); + TRACE(dl, tout << union_fun << "\n";); SASSERT(union_fun); (*union_fun)(e_rel, *aux_extended_rel); } diff --git a/src/muz/rel/dl_mk_simple_joins.cpp b/src/muz/rel/dl_mk_simple_joins.cpp index f60760fab..58cc083ce 100644 --- a/src/muz/rel/dl_mk_simple_joins.cpp +++ b/src/muz/rel/dl_mk_simple_joins.cpp @@ -93,7 +93,7 @@ namespace datalog { m_stratified = (head_stratum > m_src_stratum); } idx_set_union(m_all_nonlocal_vars, non_local_vars_normalized); - TRACE("dl", tout << "all-nonlocal: " << m_all_nonlocal_vars << "\n";); + TRACE(dl, tout << "all-nonlocal: " << m_all_nonlocal_vars << "\n";); } /** @@ -243,7 +243,7 @@ namespace datalog { m_pinned.push_back(t1n); m_pinned.push_back(t2n); - TRACE("dl_verbose", tout << mk_pp(t1, m) << " " << mk_pp(t2, m) << " |-> " << t1n_ref << " " << t2n_ref << "\n";); + TRACE(dl_verbose, tout << mk_pp(t1, m) << " " << mk_pp(t2, m) << " |-> " << t1n_ref << " " << t2n_ref << "\n";); return app_pair(t1n, t2n); } @@ -271,7 +271,7 @@ namespace datalog { } inf.add_rule(*this, t1, t2, r, normalized_vars, non_local_vars); - TRACE("dl", tout << mk_pp(t1, m) << " " << mk_pp(t2, m) << " "; + TRACE(dl, tout << mk_pp(t1, m) << " " << mk_pp(t2, m) << " "; tout << non_local_vars << "\n"; r->display(m_context, tout); if (inf.can_be_joined()) tout << "cost: " << inf.get_cost() << "\n";); @@ -290,11 +290,11 @@ namespace datalog { void register_rule(rule * r) { rule_counter counter; counter.count_rule_vars(r, 1); - TRACE("dl", tout << "counter: "; for (auto const& kv: counter) tout << kv.m_key << ": " << kv.m_value << " "; tout << "\n";); + TRACE(dl, tout << "counter: "; for (auto const& kv: counter) tout << kv.m_key << ": " << kv.m_value << " "; tout << "\n";); ptr_vector & rule_content = m_rules_content.insert_if_not_there(r, ptr_vector()); SASSERT(rule_content.empty()); - TRACE("dl", r->display(m_context, tout << "register ");); + TRACE(dl, r->display(m_context, tout << "register ");); unsigned pos_tail_size = r->get_positive_tail_size(); for (unsigned i = 0; i < pos_tail_size; i++) { @@ -319,7 +319,7 @@ namespace datalog { counter.collect_positive(non_local_vars); counter.count_vars(t2, 1); //restore t2 variables in counter set_intersection(non_local_vars, t2_vars); - TRACE("dl", tout << "non-local vars: " << non_local_vars << "\n";); + TRACE(dl, tout << "non-local vars: " << non_local_vars << "\n";); register_pair(t1, t2, r, non_local_vars); } counter.count_vars(t1, 1); //restore t1 variables in counter @@ -356,7 +356,7 @@ namespace datalog { } SASSERT(found); } - TRACE("dl", + TRACE(dl, tout << mk_pp(t1, m) << " " << mk_pp(t2, m) << " arity: " << arity << "\n"; tout << "output: " << output_vars << "\n"; tout << "args: " << args << "\n";); @@ -412,7 +412,7 @@ namespace datalog { unsigned len = rule_content.size(); unsigned original_len = len+removed_tails.size()-added_tails0.size(); app_ref_vector added_tails(added_tails0); //we need a copy since we'll be modifying it - TRACE("dl", tout << added_tails << "\n";); + TRACE(dl, tout << added_tails << "\n";); unsigned rt_sz = removed_tails.size(); //remove edges between removed tails @@ -456,7 +456,7 @@ namespace datalog { while (!added_tails.empty()) { app * a_tail = added_tails.back(); //added tail - TRACE("dl", tout << "replace edges " << mk_pp(a_tail, m) << "\n";); + TRACE(dl, tout << "replace edges " << mk_pp(a_tail, m) << "\n";); var_idx_set a_tail_vars = rm.collect_vars(a_tail); counter.count_vars(a_tail, -1); //temporarily remove a_tail variables from counter @@ -491,7 +491,7 @@ namespace datalog { if (len == 1) { return; } - TRACE("dl", + TRACE(dl, tout << "pair: " << mk_pp(t1, m) << " " << mk_pp(t2, m) << "\n"; tout << mk_pp(t_new, m) << "\n"; tout << "all-non-local: " << m_costs[pair_key]->m_all_nonlocal_vars << "\n"; @@ -531,7 +531,7 @@ namespace datalog { reverse_renaming(normalizer, denormalizer); expr_ref new_transf(m); new_transf = m_var_subst(t_new, denormalizer); - TRACE("dl", tout << mk_pp(rt1, m) << " " << mk_pp(rt2, m) << " -> " << new_transf << "\n";); + TRACE(dl, tout << mk_pp(rt1, m) << " " << mk_pp(rt2, m) << " -> " << new_transf << "\n";); counter.count_vars(rt2, -1); var_idx_set rt2_vars = rm.collect_vars(rt2); var_idx_set tr_vars = rm.collect_vars(new_transf); @@ -541,14 +541,14 @@ namespace datalog { set_intersection(non_local_vars, rt2_vars); counter.count_vars(rt2, +1); // require that tr_vars contains non_local_vars - TRACE("dl", tout << "non-local : " << non_local_vars << " tr_vars " << tr_vars << " rt12_vars " << rt2_vars << "\n";); + TRACE(dl, tout << "non-local : " << non_local_vars << " tr_vars " << tr_vars << " rt12_vars " << rt2_vars << "\n";); if (!non_local_vars.subset_of(tr_vars)) { var_ref_vector normalizer2 = get_normalizer(rt2, rt1); - TRACE("dl", tout << normalizer << "\nnorm\n" << normalizer2 << "\n";); + TRACE(dl, tout << normalizer << "\nnorm\n" << normalizer2 << "\n";); denormalizer.reset(); reverse_renaming(normalizer2, denormalizer); new_transf = m_var_subst(t_new, denormalizer); - TRACE("dl", tout << mk_pp(rt2, m) << " " << mk_pp(rt1, m) << " -> " << new_transf << "\n";); + TRACE(dl, tout << mk_pp(rt2, m) << " " << mk_pp(rt1, m) << " -> " << new_transf << "\n";); SASSERT(non_local_vars.subset_of(rm.collect_vars(new_transf))); } app * new_lit = to_app(new_transf); @@ -585,7 +585,7 @@ namespace datalog { SASSERT(!removed_tails.empty()); SASSERT(!added_tails.empty()); m_modified_rules = true; - TRACE("dl", tout << "replace rule content\n";); + TRACE(dl, tout << "replace rule content\n";); replace_edges(r, removed_tails, added_tails, rule_content); } @@ -661,7 +661,7 @@ namespace datalog { cost res = (estimate_size(t1) * estimate_size(t2)) / inters_size; - TRACE("report_costs", + TRACE(report_costs, display_predicate(m_context, t1, tout); display_predicate(m_context, t2, tout); tout << res << "\n";); diff --git a/src/muz/rel/dl_product_relation.cpp b/src/muz/rel/dl_product_relation.cpp index 701bad3cc..83879acde 100644 --- a/src/muz/rel/dl_product_relation.cpp +++ b/src/muz/rel/dl_product_relation.cpp @@ -450,7 +450,7 @@ namespace datalog { } relation_base * operator()(const relation_base & _r1, const relation_base & _r2) override { - TRACE("dl", _r1.display(tout); _r2.display(tout);); + TRACE(dl, _r1.display(tout); _r2.display(tout);); ptr_vector relations; unsigned sz = m_joins.size(); relation_base* result = nullptr; @@ -460,7 +460,7 @@ namespace datalog { relations.push_back((*m_joins[i])(r1, r2)); } result = alloc(product_relation, m_plugin, get_result_signature(), sz, relations.data()); - TRACE("dl",result->display(tout);); + TRACE(dl,result->display(tout);); return result; } }; @@ -502,7 +502,7 @@ namespace datalog { relations.push_back((*m_transforms[i])(r[i])); } relation_base* result = alloc(product_relation, p, m_sig, relations.size(), relations.data()); - TRACE("dl", _r.display(tout); result->display(tout);); + TRACE(dl, _r.display(tout); result->display(tout);); return result; } }; @@ -556,7 +556,7 @@ namespace datalog { else { u = rmgr.mk_union_fn(r1, r2, delta); } - TRACE("dl_verbose", tout << r1.get_plugin().get_name() << " " << r2.get_plugin().get_name() << " " << (u?"found":"not found") << "\n";); + TRACE(dl_verbose, tout << r1.get_plugin().get_name() << " " << r2.get_plugin().get_name() << " " << (u?"found":"not found") << "\n";); m_unions.back().push_back(u); } @@ -603,7 +603,7 @@ namespace datalog { scoped_ptr intersect_fun = m_rmgr.mk_filter_by_intersection_fn(tgt, src); if (!intersect_fun) { - TRACE("dl", tgt.display(tout << "tgt\n"); src.display(tout << "src\n");); + TRACE(dl, tgt.display(tout << "tgt\n"); src.display(tout << "src\n");); warning_msg("intersection does not exist"); return; } @@ -636,7 +636,7 @@ namespace datalog { } void operator()(relation_base& _tgt, const relation_base& _src, relation_base* _delta) override { - TRACE("dl", _tgt.display(tout << "dst:\n"); _src.display(tout << "src:\n");); + TRACE(dl, _tgt.display(tout << "dst:\n"); _src.display(tout << "src:\n");); SASSERT(m_plugin.check_kind(_tgt)); SASSERT(m_plugin.check_kind(_src)); SASSERT(!_delta || m_plugin.check_kind(*_delta)); @@ -662,15 +662,15 @@ namespace datalog { continue; //this is the basic union which we will perform later } if (can_do_inner_union(i, j) && can_do_inner_union(j, i)) { - TRACE("dl", itgt.display(tout << "tgt:\n"); src[j].display(tout << "src:\n");); + TRACE(dl, itgt.display(tout << "tgt:\n"); src[j].display(tout << "src:\n");); // union[i][j] scoped_rel one_side_union = itgt.clone(); scoped_rel one_side_delta = fresh_delta ? fresh_delta->clone() : nullptr; - TRACE("dl", one_side_union->display(tout << "union 1:\n"); src[j].display(tout);); + TRACE(dl, one_side_union->display(tout << "union 1:\n"); src[j].display(tout);); do_inner_union(i, j, *one_side_union, src[j], one_side_delta.get()); - TRACE("dl", one_side_union->display(tout << "union:\n");); + TRACE(dl, one_side_union->display(tout << "union:\n");); do_destructive_intersection(side_result, one_side_union); - TRACE("dl", + TRACE(dl, side_result->display(tout << "inner-union: " << i << " " << j << "\n"); itgt.display(tout << "tgt:\n");); if (one_side_delta) { @@ -680,11 +680,11 @@ namespace datalog { // union[j][i] one_side_union = src[i].clone(); one_side_delta = fresh_delta ? fresh_delta->clone() : nullptr; - TRACE("dl", one_side_union->display(tout << "union 2:\n"); tgt[j].display(tout);); + TRACE(dl, one_side_union->display(tout << "union 2:\n"); tgt[j].display(tout);); do_inner_union(i, j, *one_side_union, tgt[j], one_side_delta.get()); - TRACE("dl", one_side_union->display(tout << "union:\n");); + TRACE(dl, one_side_union->display(tout << "union:\n");); do_destructive_intersection(side_result, one_side_union); - TRACE("dl", + TRACE(dl, side_result->display(tout << "inner-union: " << i << " " << j << "\n"); itgt.display(tout << "tgt:\n");); if (one_side_delta) { @@ -709,7 +709,7 @@ namespace datalog { if (side_result) { do_intersection(itgt, *side_result); - TRACE("dl", side_result->display(tout << "inner-union-end: " << i << "\n");); + TRACE(dl, side_result->display(tout << "inner-union-end: " << i << "\n");); } if (fresh_delta) { do_destructive_intersection(fresh_delta,side_delta); @@ -726,7 +726,7 @@ namespace datalog { } } } - TRACE("dl", _tgt.display(tout << "dst':\n"); + TRACE(dl, _tgt.display(tout << "dst':\n"); if (_delta) _delta->display(tout << "delta:\n"); ;); } }; @@ -749,7 +749,7 @@ namespace datalog { void operator()(relation_base& _tgt, const relation_base& _src, relation_base* _delta) override { - TRACE("dl_verbose", _tgt.display(tout << "dst:\n"); _src.display(tout << "src:\n");); + TRACE(dl_verbose, _tgt.display(tout << "dst:\n"); _src.display(tout << "src:\n");); product_relation& tgt = get(_tgt); product_relation const& src0 = get(_src); product_relation* delta = _delta ? get(_delta) : nullptr; @@ -770,7 +770,7 @@ namespace datalog { SASSERT(m_aligned_union_fun); } (*m_aligned_union_fun)(tgt, src, delta); - TRACE("dl", _tgt.display(tout << "dst':\n"); + TRACE(dl, _tgt.display(tout << "dst':\n"); if (_delta) _delta->display(tout << "delta:\n");); } }; @@ -784,7 +784,7 @@ namespace datalog { m_inner_union_fun(inner_union_fun) {} void operator()(relation_base& tgt, const relation_base& _src, relation_base* delta) override { - TRACE("dl", tgt.display(tout); _src.display(tout); ); + TRACE(dl, tgt.display(tout); _src.display(tout); ); product_relation const& src = get(_src); (*m_inner_union_fun)(tgt, src[m_single_rel_idx], delta); } @@ -799,7 +799,7 @@ namespace datalog { return alloc(unaligned_union_fn, get(tgt), get(src), get(delta), is_widen); } if (check_kind(src)) { - TRACE("dl", tgt.display(tout << "different kinds"); src.display(tout);); + TRACE(dl, tgt.display(tout << "different kinds"); src.display(tout);); const product_relation & p_src = get(src); unsigned single_idx; if(p_src.try_get_single_non_transparent(single_idx)) { @@ -837,7 +837,7 @@ namespace datalog { ~mutator_fn() override { dealloc_ptr_vector_content(m_mutators); } void operator()(relation_base & _r) override { - TRACE("dl", _r.display(tout);); + TRACE(dl, _r.display(tout);); product_relation& r = get(_r); SASSERT(m_mutators.size() == r.size()); for (unsigned i = 0; i < r.size(); ++i) { @@ -846,7 +846,7 @@ namespace datalog { (*m)(r[i]); } } - TRACE("dl", _r.display(tout);); + TRACE(dl, _r.display(tout);); } }; @@ -914,7 +914,7 @@ namespace datalog { ~filter_interpreted_fn() override { dealloc_ptr_vector_content(m_mutators); } void operator()(relation_base& _r) override { - TRACE("dl", _r.display(tout);); + TRACE(dl, _r.display(tout);); product_relation const& r = get(_r); for (unsigned i = 0; i < m_attach.size(); ++i) { m_mutators[m_attach[i].first]->attach(r[m_attach[i].second]); @@ -922,7 +922,7 @@ namespace datalog { for (unsigned i = 0; i < m_mutators.size(); ++i) { (*m_mutators[i])(r[i]); } - TRACE("dl", _r.display(tout);); + TRACE(dl, _r.display(tout);); } }; @@ -990,7 +990,7 @@ namespace datalog { return; } - TRACE("dl", { + TRACE(dl, { ast_manager& m = get_ast_manager_from_rel_manager(get_manager()); sig.output(m, tout); tout << "\n"; for (unsigned i = 0; i < spec.size(); ++i) { diff --git a/src/muz/rel/dl_relation_manager.cpp b/src/muz/rel/dl_relation_manager.cpp index 5e96dc487..5555f87fb 100644 --- a/src/muz/rel/dl_relation_manager.cpp +++ b/src/muz/rel/dl_relation_manager.cpp @@ -201,7 +201,7 @@ namespace datalog { } void relation_manager::register_relation_plugin_impl(relation_plugin * plugin) { - TRACE("dl", tout << "register: " << plugin->get_name() << "\n";); + TRACE(dl, tout << "register: " << plugin->get_name() << "\n";); m_relation_plugins.push_back(plugin); plugin->initialize(get_next_relation_fid(*plugin)); if (plugin->get_name() == get_context().default_relation()) { @@ -336,7 +336,7 @@ namespace datalog { //If there is no plugin to handle the signature, we just create an empty product relation and //stuff will be added to it by later operations. - TRACE("dl", s.output(get_context().get_manager(), tout << "empty product relation"); tout << "\n";); + TRACE(dl, s.output(get_context().get_manager(), tout << "empty product relation"); tout << "\n";); return product_relation_plugin::get_plugin(*this).mk_empty(s); } @@ -532,7 +532,7 @@ namespace datalog { class relation_manager::empty_signature_relation_join_fn : public relation_join_fn { public: relation_base * operator()(const relation_base & r1, const relation_base & r2) override { - TRACE("dl", tout << r1.get_plugin().get_name() << " " << r2.get_plugin().get_name() << "\n";); + TRACE(dl, tout << r1.get_plugin().get_name() << " " << r2.get_plugin().get_name() << "\n";); if(r1.get_signature().empty()) { if(r1.empty()) { return r2.get_manager().mk_empty_relation(r2.get_signature(), r2.get_kind()); @@ -739,7 +739,7 @@ namespace datalog { if(!res && delta && &tgt.get_plugin()!=&delta->get_plugin() && &src.get_plugin()!=&delta->get_plugin()) { res = delta->get_plugin().mk_union_fn(tgt, src, delta); } - // TRACE("dl", tout << src.get_plugin().get_name() << " " << tgt.get_plugin().get_name() << " " << (res?"created":"not created") << "\n";); + // TRACE(dl, tout << src.get_plugin().get_name() << " " << tgt.get_plugin().get_name() << " " << (res?"created":"not created") << "\n";); return res; } @@ -781,7 +781,7 @@ namespace datalog { : m_filter(filter), m_project(project) {} relation_base * operator()(const relation_base & t1) override { - TRACE("dl", tout << t1.get_plugin().get_name() << "\n";); + TRACE(dl, tout << t1.get_plugin().get_name() << "\n";); scoped_rel aux = t1.clone(); (*m_filter)(*aux); relation_base * res = (*m_project)(*aux); @@ -818,7 +818,7 @@ namespace datalog { void operator()(relation_base & tgt, const relation_base & intersected_obj) override { scoped_rel filtered_rel = (*m_join_fun)(tgt, intersected_obj); - TRACE("dl", + TRACE(dl, tgt.display(tout << "tgt:\n"); intersected_obj.display(tout << "intersected:\n"); filtered_rel->display(tout << "filtered:\n"); @@ -828,9 +828,9 @@ namespace datalog { tgt.swap(*filtered_rel); } tgt.reset(); - TRACE("dl", tgt.display(tout << "target reset:\n"); ); + TRACE(dl, tgt.display(tout << "target reset:\n"); ); (*m_union_fun)(tgt, *filtered_rel); - TRACE("dl", tgt.display(tout << "intersected target:\n"); ); + TRACE(dl, tgt.display(tout << "intersected target:\n"); ); } }; @@ -838,7 +838,7 @@ namespace datalog { relation_intersection_filter_fn * relation_manager::try_mk_default_filter_by_intersection_fn( const relation_base & tgt, const relation_base & src, unsigned joined_col_cnt, const unsigned * tgt_cols, const unsigned * src_cols) { - TRACE("dl_verbose", tout << tgt.get_plugin().get_name() << "\n";); + TRACE(dl_verbose, tout << tgt.get_plugin().get_name() << "\n";); unsigned_vector join_removed_cols; add_sequence(tgt.get_signature().size(), src.get_signature().size(), join_removed_cols); scoped_rel join_fun = mk_join_project_fn(tgt, src, joined_col_cnt, tgt_cols, src_cols, @@ -866,7 +866,7 @@ namespace datalog { relation_intersection_filter_fn * relation_manager::mk_filter_by_intersection_fn(const relation_base & t, const relation_base & src, unsigned joined_col_cnt, const unsigned * t_cols, const unsigned * src_cols) { - TRACE("dl_verbose", tout << t.get_plugin().get_name() << "\n";); + TRACE(dl_verbose, tout << t.get_plugin().get_name() << "\n";); relation_intersection_filter_fn * res = t.get_plugin().mk_filter_by_intersection_fn(t, src, joined_col_cnt, t_cols, src_cols); if(!res && &t.get_plugin()!=&src.get_plugin()) { @@ -880,7 +880,7 @@ namespace datalog { relation_intersection_filter_fn * relation_manager::mk_filter_by_intersection_fn(const relation_base & tgt, const relation_base & src) { - TRACE("dl_verbose", tout << tgt.get_plugin().get_name() << "\n";); + TRACE(dl_verbose, tout << tgt.get_plugin().get_name() << "\n";); SASSERT(tgt.get_signature()==src.get_signature()); unsigned sz = tgt.get_signature().size(); unsigned_vector cols; @@ -892,7 +892,7 @@ namespace datalog { relation_intersection_filter_fn * relation_manager::mk_filter_by_negation_fn(const relation_base & t, const relation_base & negated_obj, unsigned joined_col_cnt, const unsigned * t_cols, const unsigned * negated_cols) { - TRACE("dl", tout << t.get_plugin().get_name() << "\n";); + TRACE(dl, tout << t.get_plugin().get_name() << "\n";); relation_intersection_filter_fn * res = t.get_plugin().mk_filter_by_negation_fn(t, negated_obj, joined_col_cnt, t_cols, negated_cols); if(!res && &t.get_plugin()!=&negated_obj.get_plugin()) { @@ -1552,7 +1552,7 @@ namespace datalog { : m_filter(filter), m_project(project) {} table_base * operator()(const table_base & t1) override { - TRACE("dl", tout << t1.get_plugin().get_name() << "\n";); + TRACE(dl, tout << t1.get_plugin().get_name() << "\n";); scoped_rel aux = t1.clone(); (*m_filter)(*aux); return (*m_project)(*aux); diff --git a/src/muz/rel/dl_sparse_table.cpp b/src/muz/rel/dl_sparse_table.cpp index 6c2373d54..ecc18dbd6 100644 --- a/src/muz/rel/dl_sparse_table.cpp +++ b/src/muz/rel/dl_sparse_table.cpp @@ -301,7 +301,7 @@ namespace datalog { store_offset ofs = m_keys.insert_or_get_reserve_content(); index_map::entry * e = m_map.find_core(ofs); if (!e) { - TRACE("dl_table_relation", tout << "inserting\n";); + TRACE(dl_table_relation, tout << "inserting\n";); e = m_map.insert_if_not_there3(ofs, offset_vector()); } return e->get_data().m_value; @@ -495,7 +495,7 @@ namespace datalog { } void sparse_table::write_into_reserve(const table_element* f) { - TRACE("dl_table_relation", tout << "\n";); + TRACE(dl_table_relation, tout << "\n";); m_data.ensure_reserve(); char * reserve = m_data.get_reserve_ptr(); unsigned col_cnt = m_column_layout.size(); @@ -650,7 +650,7 @@ namespace datalog { size_t t1idx = 0; size_t t1end = t1.m_data.after_last_offset(); - TRACE("dl_table_relation", + TRACE(dl_table_relation, tout << "joined_col_cnt: " << joined_col_cnt << "\n"; tout << "t1_entry_size: " << t1_entry_size << "\n"; tout << "t2_entry_size: " << t2_entry_size << "\n"; @@ -693,7 +693,7 @@ namespace datalog { for (; t1idx != t1end; t1idx += t1_entry_size) { for (unsigned i = 0; i < joined_col_cnt; i++) { table_element val = t1.m_column_layout.get(t1.get_at_offset(t1idx), t1_joined_cols[i]); - TRACE("dl_table_relation", tout << "val: " << val << " " << t1idx << " " << t1_joined_cols[i] << "\n";); + TRACE(dl_table_relation, tout << "val: " << val << " " << t1idx << " " << t1_joined_cols[i] << "\n";); if (t1_key[i] != val) { t1_key[i] = val; key_modified = true; @@ -844,7 +844,7 @@ namespace datalog { sparse_table::self_agnostic_join_project(t1, t2, m_cols1.size(), m_cols1.data(), m_cols2.data(), m_removed_cols.data(), false, *res); } - TRACE("dl_table_relation", tb1.display(tout); tb2.display(tout); res->display(tout); ); + TRACE(dl_table_relation, tb1.display(tout); tb2.display(tout); res->display(tout); ); return res; } }; diff --git a/src/muz/rel/dl_table_relation.cpp b/src/muz/rel/dl_table_relation.cpp index 8a69f8f85..1ac3cce2d 100644 --- a/src/muz/rel/dl_table_relation.cpp +++ b/src/muz/rel/dl_table_relation.cpp @@ -92,7 +92,7 @@ namespace datalog { table_base * tres = (*m_tfun)(tr1.get_table(), tr2.get_table()); - TRACE("dl_table_relation", tout << "# join => "; tres->display(tout);); + TRACE(dl_table_relation, tout << "# join => "; tres->display(tout);); if(&tres->get_plugin()!=&plugin.m_table_plugin) { IF_VERBOSE(1, verbose_stream() << "new type returned\n";); //Operation returned a table of different type than the one which is associated with @@ -154,7 +154,7 @@ namespace datalog { table_base * tres = (*m_tfun)(tr.get_table()); - TRACE("dl_table_relation", tout << "# transform => "; tres->display(tout);); + TRACE(dl_table_relation, tout << "# transform => "; tres->display(tout);); if(&tres->get_plugin()!=&plugin.m_table_plugin) { //Transformation returned a table of different type than the one which is associated with this plugin. //We need to get a correct table_relation_plugin and create the relation using it. @@ -262,7 +262,7 @@ namespace datalog { tgt.add_fact(rfact); } } - TRACE("dl_table_relation", tout << "# universal union => "; tgt.display(tout);); + TRACE(dl_table_relation, tout << "# universal union => "; tgt.display(tout);); } }; @@ -282,7 +282,7 @@ namespace datalog { (*m_tfun)(tr_tgt.get_table(), tr_src.get_table(), tr_delta ? &tr_delta->get_table() : nullptr); - TRACE("dl_table_relation", tout << "# union => "; tr_tgt.get_table().display(tout);); + TRACE(dl_table_relation, tout << "# union => "; tr_tgt.get_table().display(tout);); } }; @@ -315,7 +315,7 @@ namespace datalog { SASSERT(r.from_table()); table_relation & tr = static_cast(r); (*m_tfun)(tr.get_table()); - TRACE("dl_table_relation", tout << "# mutator => "; tr.get_table().display(tout);); + TRACE(dl_table_relation, tout << "# mutator => "; tr.get_table().display(tout);); } }; @@ -385,7 +385,7 @@ namespace datalog { const table_relation & tr_src = static_cast(src); (*m_tfun)(tr.get_table(), tr_src.get_table()); - TRACE("dl_table_relation", tout << "# negation_filter => "; tr.get_table().display(tout);); + TRACE(dl_table_relation, tout << "# negation_filter => "; tr.get_table().display(tout);); } }; @@ -437,7 +437,7 @@ namespace datalog { table_fact vals; get_manager().relation_fact_to_table(get_signature(), f, vals); get_table().add_fact(vals); - TRACE("dl_table_relation", tout << "# add fact => "; get_table().display(tout);); + TRACE(dl_table_relation, tout << "# add fact => "; get_table().display(tout);); } bool table_relation::contains_fact(const relation_fact & f) const { diff --git a/src/muz/rel/dl_vector_relation.h b/src/muz/rel/dl_vector_relation.h index e61fc5a2a..f659831fb 100644 --- a/src/muz/rel/dl_vector_relation.h +++ b/src/muz/rel/dl_vector_relation.h @@ -196,7 +196,7 @@ namespace datalog { equate(col1, sz1 + col2); } - TRACE("dl_relation", + TRACE(dl_relation, r1.display(tout << "r1:\n"); r2.display(tout << "r2:\n"); display(tout << "dst:\n"); @@ -250,7 +250,7 @@ namespace datalog { } - TRACE("dl_relation", + TRACE(dl_relation, ast_manager& m = r.get_plugin().get_ast_manager(); tout << "Signature: "; for (unsigned i = 0; i < r.get_signature().size(); ++i) { @@ -302,7 +302,7 @@ namespace datalog { mk_rename_elem((*m_elems)[i], col_cnt, cycle); } - TRACE("dl_relation", + TRACE(dl_relation, ast_manager& m = r.get_plugin().get_ast_manager(); tout << "cycle: "; for (unsigned i = 0; i < col_cnt; ++i) { @@ -322,7 +322,7 @@ namespace datalog { } void mk_union(vector_relation const& src, vector_relation* delta, bool is_widen) { - TRACE("dl_relation", display(tout << "dst:\n"); src.display(tout << "src:\n");); + TRACE(dl_relation, display(tout << "dst:\n"); src.display(tout << "src:\n");); if (src.empty()) { if (delta) { @@ -374,7 +374,7 @@ namespace datalog { else { elems->push_back(mk_unite(t1, t2)); } - TRACE("dl_relation", tout << t1 << " u " << t2 << " = " << elems->back() << "\n";); + TRACE(dl_relation, tout << t1 << " u " << t2 << " = " << elems->back() << "\n";); change = delta && (change || !((*elems)[i] == (*this)[i])); } dealloc(m_eqs); @@ -384,7 +384,7 @@ namespace datalog { if (delta && change) { delta->copy(*this); } - TRACE("dl_relation", display(tout << "dst':\n");); + TRACE(dl_relation, display(tout << "dst':\n");); } unsigned find(unsigned i) const { diff --git a/src/muz/rel/doc.cpp b/src/muz/rel/doc.cpp index fbe6b1f61..ce1b4f638 100644 --- a/src/muz/rel/doc.cpp +++ b/src/muz/rel/doc.cpp @@ -249,7 +249,7 @@ bool doc_manager::merge(doc& d, unsigned idx, subset_ints const& equalities, } while (idx != root); - TRACE("doc", tout << "num_x: " << num_x << " value: " << value << "\n";); + TRACE(doc, tout << "num_x: " << num_x << " value: " << value << "\n";); if (num_x == 0) { // nothing to do. } @@ -365,7 +365,7 @@ doc* doc_manager::project(doc_manager& dstm, bit_vector const& to_delete, doc co default: UNREACHABLE(); break; } } - TRACE("doc", + TRACE(doc, tout << "pos: "; for (unsigned i = 0; i < pos.size(); ++i) { tbvm().display(tout, pos[i]) << " "; @@ -685,7 +685,7 @@ void doc_manager::check_equiv(ast_manager& m, expr* fml1, expr* fml2) { solver.assert_expr(fml); lbool res = solver.check(); if (res != l_false) { - TRACE("doc", + TRACE(doc, tout << mk_pp(fml1, m) << "\n"; tout << mk_pp(fml2, m) << "\n"; ); diff --git a/src/muz/rel/karr_relation.cpp b/src/muz/rel/karr_relation.cpp index 7a2ba5179..c4b6a65b2 100644 --- a/src/muz/rel/karr_relation.cpp +++ b/src/muz/rel/karr_relation.cpp @@ -174,11 +174,11 @@ namespace datalog { processed = false; } (void)processed; - TRACE("dl", tout << (processed?"+ ":"- ") << mk_pp(e, m) << "\n"; + TRACE(dl, tout << (processed?"+ ":"- ") << mk_pp(e, m) << "\n"; if (processed) matrix::display_ineq(tout, row, M.b.back(), M.eq.back()); ); } - TRACE("dl", display(tout);); + TRACE(dl, display(tout);); } void mk_join(karr_relation const& r1, karr_relation const& r2, @@ -259,7 +259,7 @@ namespace datalog { m_empty = false; m_fn = r.m_fn; - TRACE("dl", + TRACE(dl, for (unsigned i = 0; i < cnt; ++i) { tout << cols[i] << " "; } @@ -286,7 +286,7 @@ namespace datalog { mk_rename(m_basis, col_cnt, cols); } m_fn = r.m_fn; - TRACE("dl", r.display(tout); display(tout);); + TRACE(dl, r.display(tout); display(tout);); } void mk_union(karr_relation const& src, karr_relation* delta) { @@ -598,7 +598,7 @@ namespace datalog { catch (...) { is_sat = l_undef; } - TRACE("dl_verbose", m_hb.display(tout);); + TRACE(dl_verbose, m_hb.display(tout);); if (is_sat == l_false) { return false; } @@ -655,7 +655,7 @@ namespace datalog { if (is_sat != l_true) { return; } - TRACE("dl_verbose", m_hb.display(tout);); + TRACE(dl_verbose, m_hb.display(tout);); SASSERT(is_sat == l_true); unsigned basis_size = m_hb.get_basis_size(); for (unsigned i = 0; i < basis_size; ++i) { @@ -678,7 +678,7 @@ namespace datalog { karr_relation& r = get(_r); karr_relation const& src = get(_src); - TRACE("dl", r.display(tout << "dst:\n"); src.display(tout << "src:\n");); + TRACE(dl, r.display(tout << "dst:\n"); src.display(tout << "src:\n");); if (_delta) { karr_relation& d = get(*_delta); @@ -687,7 +687,7 @@ namespace datalog { else { r.mk_union(src, nullptr); } - TRACE("dl", r.display(tout << "result:\n");); + TRACE(dl, r.display(tout << "result:\n");); } }; @@ -707,7 +707,7 @@ namespace datalog { void operator()(relation_base & _r) override { karr_relation & r = get(_r); - TRACE("dl", r.display(tout << "src:\n");); + TRACE(dl, r.display(tout << "src:\n");); r.get_ineqs(); for (unsigned i = 1; i < m_identical_cols.size(); ++i) { unsigned c1 = m_identical_cols[0]; @@ -721,7 +721,7 @@ namespace datalog { r.m_ineqs.eq.push_back(true); r.m_basis_valid = false; } - TRACE("dl", r.display(tout << "result:\n");); + TRACE(dl, r.display(tout << "result:\n");); } }; @@ -757,7 +757,7 @@ namespace datalog { r.m_ineqs.eq.push_back(true); r.m_basis_valid = false; } - TRACE("dl", tout << m_value << "\n"; r.display(tout);); + TRACE(dl, tout << m_value << "\n"; r.display(tout);); } }; @@ -779,7 +779,7 @@ namespace datalog { void operator()(relation_base& t) override { get(t).filter_interpreted(m_cond); - TRACE("dl", tout << mk_pp(m_cond, m_cond.get_manager()) << "\n"; t.display(tout);); + TRACE(dl, tout << mk_pp(m_cond, m_cond.get_manager()) << "\n"; t.display(tout);); } }; diff --git a/src/muz/rel/rel_context.cpp b/src/muz/rel/rel_context.cpp index 76411a290..1ca168939 100644 --- a/src/muz/rel/rel_context.cpp +++ b/src/muz/rel/rel_context.cpp @@ -140,7 +140,7 @@ namespace datalog { lbool result; - TRACE("dl", m_context.display(tout);); + TRACE(dl, m_context.display(tout);); while (true) { m_ectx.reset(); @@ -149,11 +149,11 @@ namespace datalog { m_context.ensure_closed(); transform_rules(); if (m_context.canceled()) { - TRACE("dl", tout << "canceled\n";); + TRACE(dl, tout << "canceled\n";); result = l_undef; break; } - TRACE("dl", m_context.display(tout);); + TRACE(dl, m_context.display(tout);); //IF_VERBOSE(3, m_context.display_smt2(0,0,verbose_stream());); if (m_context.print_aig().is_non_empty_string()) { @@ -190,7 +190,7 @@ namespace datalog { IF_VERBOSE(10, m_ectx.report_big_relations(1000, verbose_stream());); if (m_context.canceled()) { - TRACE("dl", tout << "canceled\n";); + TRACE(dl, tout << "canceled\n";); result = l_undef; break; } @@ -206,7 +206,7 @@ namespace datalog { } if (timeout_after_this_round) { m_context.set_status(TIMEOUT); - TRACE("dl", tout << "timeout\n";); + TRACE(dl, tout << "timeout\n";); result = l_undef; break; } @@ -225,7 +225,7 @@ namespace datalog { sq.reset(); } m_context.record_transformed_rules(); - TRACE("dl", display_profile(tout);); + TRACE(dl, display_profile(tout);); return result; } @@ -263,7 +263,7 @@ namespace datalog { if (some_non_empty) { m_answer = mk_and(m, ans.size(), ans.data()); if (is_approx) { - TRACE("dl", tout << "approx\n";); + TRACE(dl, tout << "approx\n";); res = l_undef; m_context.set_status(APPROX); } @@ -278,7 +278,7 @@ namespace datalog { m_answer = m.mk_false(); break; case l_undef: - TRACE("dl", tout << "saturation in undef\n";); + TRACE(dl, tout << "saturation in undef\n";); break; } return res; @@ -372,7 +372,7 @@ namespace datalog { m_last_result_relation->to_formula(m_answer); if (!m_last_result_relation->is_precise()) { m_context.set_status(APPROX); - TRACE("dl", tout << "approx\n";); + TRACE(dl, tout << "approx\n";); res = l_undef; } } @@ -440,7 +440,7 @@ namespace datalog { relation_base & rel = get_relation(pred); if (!rel.empty()) { - TRACE("dl", tout << "Resetting: " << mk_ismt2_pp(pred, m) << "\n";); + TRACE(dl, tout << "Resetting: " << mk_ismt2_pp(pred, m) << "\n";); rel.reset(); } } @@ -477,7 +477,7 @@ namespace datalog { void rel_context::set_predicate_representation(func_decl * pred, unsigned relation_name_cnt, symbol const * relation_names) { - TRACE("dl", + TRACE(dl, tout << pred->get_name() << ": "; for (unsigned i = 0; i < relation_name_cnt; ++i) { tout << relation_names[i] << " "; diff --git a/src/muz/rel/udoc_relation.cpp b/src/muz/rel/udoc_relation.cpp index 8240f7f9e..e9f4b20af 100644 --- a/src/muz/rel/udoc_relation.cpp +++ b/src/muz/rel/udoc_relation.cpp @@ -330,7 +330,7 @@ namespace datalog { relation_base * operator()(const relation_base & _r1, const relation_base & _r2) override { udoc_relation const& r1 = get(_r1); udoc_relation const& r2 = get(_r2); - TRACE("doc", r1.display(tout << "r1:\n"); r2.display(tout << "r2:\n");); + TRACE(doc, r1.display(tout << "r1:\n"); r2.display(tout << "r2:\n");); udoc_plugin& p = r1.get_plugin(); relation_signature const& sig = get_result_signature(); udoc_relation * result = alloc(udoc_relation, p, sig); @@ -338,7 +338,7 @@ namespace datalog { udoc const& d2 = r2.get_udoc(); udoc& r = result->get_udoc(); r.join(d1, d2, dm, dm1, m_cols1, m_cols2); - TRACE("doc", result->display(tout << "result:\n");); + TRACE(doc, result->display(tout << "result:\n");); IF_VERBOSE(3, result->display(verbose_stream() << "join result:\n");); SASSERT(r.well_formed(result->get_dm())); return result; @@ -369,7 +369,7 @@ namespace datalog { } relation_base * operator()(const relation_base & tb) override { - TRACE("doc", tb.display(tout << "src:\n");); + TRACE(doc, tb.display(tout << "src:\n");); udoc_relation const& t = get(tb); udoc_plugin& p = t.get_plugin(); udoc_relation* r = udoc_plugin::get(p.mk_empty(get_result_signature())); @@ -382,7 +382,7 @@ namespace datalog { d2 = dm1.project(dm2, m_to_delete, ud1[i]); ud2.push_back(d2.detach()); } - TRACE("doc", tout << "final size: " << r->get_size_estimate_rows() << '\n';); + TRACE(doc, tout << "final size: " << r->get_size_estimate_rows() << '\n';); SASSERT(ud2.well_formed(dm2)); return r; } @@ -427,7 +427,7 @@ namespace datalog { column_info.push_back(column); SASSERT(column == t.get_num_bits()); - TRACE("doc", + TRACE(doc, ast_manager& m = p.get_ast_manager(); sig1.output(m, tout << "sig1: "); tout << "\n"; sig2.output(m, tout << "sig2: "); tout << "\n"; @@ -463,7 +463,7 @@ namespace datalog { relation_base * operator()(const relation_base & _r) override { udoc_relation const& r = get(_r); - TRACE("doc", r.display(tout << "r:\n");); + TRACE(doc, r.display(tout << "r:\n");); udoc_plugin& p = r.get_plugin(); relation_signature const& sig = get_result_signature(); udoc_relation* result = alloc(udoc_relation, p, sig); @@ -474,7 +474,7 @@ namespace datalog { for (unsigned i = 0; i < src.size(); ++i) { dst.push_back(dm.allocate(src[i], m_permutation.data())); } - TRACE("doc", result->display(tout << "result:\n");); + TRACE(doc, result->display(tout << "result:\n");); SASSERT(dst.well_formed(dm)); return result; } @@ -492,7 +492,7 @@ namespace datalog { class udoc_plugin::union_fn : public relation_union_fn { public: void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override { - TRACE("doc", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); + TRACE(doc, _r.display(tout << "dst:\n"); _src.display(tout << "src:\n");); udoc_relation& r = get(_r); udoc_relation const& src = get(_src); udoc_relation* d = get(_delta); @@ -503,7 +503,7 @@ namespace datalog { r.get_plugin().mk_union(dm, r.get_udoc(), src.get_udoc(), d1); SASSERT(r.get_udoc().well_formed(dm)); SASSERT(!d1 || d1->well_formed(dm)); - TRACE("doc", _r.display(tout << "dst':\n"); ); + TRACE(doc, _r.display(tout << "dst':\n"); ); IF_VERBOSE(3, r.display(verbose_stream() << "union: ");); IF_VERBOSE(3, if (d) d->display(verbose_stream() << "delta: ");); } @@ -577,7 +577,7 @@ namespace datalog { doc_manager& dm = r.get_dm(); d.merge(dm, m_cols[0], m_size, m_equalities, m_empty_bv); SASSERT(d.well_formed(dm)); - TRACE("doc", tout << "final size: " << r.get_size_estimate_rows() << '\n';); + TRACE(doc, tout << "final size: " << r.get_size_estimate_rows() << '\n';); } }; relation_mutator_fn * udoc_plugin::mk_filter_identical_fn( @@ -836,11 +836,11 @@ namespace datalog { apply_guard(e1, sub, equalities, empty); result.subtract(dm, sub); result.simplify(dm); - TRACE("doc", + TRACE(doc, result.display(dm, tout << "result0:") << "\n"; sub.display(dm, tout << "sub:") << "\n";); sub.reset(dm); - TRACE("doc", result.display(dm, tout << "result:") << "\n";); + TRACE(doc, result.display(dm, tout << "result:") << "\n";); } else if (m.is_or(g)) { udoc sub; @@ -850,9 +850,9 @@ namespace datalog { arg = mk_not(m, to_app(g)->get_arg(i)); apply_guard(arg, sub, equalities, discard_cols); } - TRACE("doc", result.display(dm, tout << "result0:") << "\n";); + TRACE(doc, result.display(dm, tout << "result0:") << "\n";); result.subtract(dm, sub); - TRACE("doc", + TRACE(doc, sub.display(dm, tout << "sub:") << "\n"; result.display(dm, tout << "result:") << "\n";); sub.reset(dm); @@ -923,7 +923,7 @@ namespace datalog { m_udoc.push_back(dm.allocateX()); t.apply_guard(guard, m_udoc, m_equalities, m_empty_bv); - TRACE("doc", + TRACE(doc, tout << "original condition: " << mk_pp(condition, m) << "\n"; tout << "remaining condition: " << m_reduced_condition << "\n"; m_udoc.display(dm, tout) << "\n";); @@ -943,7 +943,7 @@ namespace datalog { SASSERT(u.well_formed(dm)); u.simplify(dm); SASSERT(u.well_formed(dm)); - TRACE("doc", tout << "final size: " << t.get_size_estimate_rows() << '\n';); + TRACE(doc, tout << "final size: " << t.get_size_estimate_rows() << '\n';); IF_VERBOSE(3, t.display(verbose_stream());); } }; @@ -1030,7 +1030,7 @@ namespace datalog { } } } - TRACE("doc", result->display(tout);); + TRACE(doc, result->display(tout);); return result; } }; @@ -1168,7 +1168,7 @@ namespace datalog { if (!jp->fast_empty()) { t.get_udoc().subtract(dmt, jp->get_udoc()); } - TRACE("doc", t.display(tout); tout << "\n"; jp->display(tout); tout << "\n";); + TRACE(doc, t.display(tout); tout << "\n"; jp->display(tout); tout << "\n";); jp->deallocate(); } }; diff --git a/src/muz/spacer/spacer_arith_generalizers.cpp b/src/muz/spacer/spacer_arith_generalizers.cpp index 6c09d454e..946bd608b 100644 --- a/src/muz/spacer/spacer_arith_generalizers.cpp +++ b/src/muz/spacer/spacer_arith_generalizers.cpp @@ -120,7 +120,7 @@ void limit_num_generalizer::operator()(lemma_ref &lemma) { // good } else { failed = true; - TRACE("spacer.limnum", tout << "Failed to generalize: " + TRACE(spacer_limnum, tout << "Failed to generalize: " << lemma->get_cube() << "\ninto\n" << cube << "\n";); @@ -130,7 +130,7 @@ void limit_num_generalizer::operator()(lemma_ref &lemma) { // check that !cube & F & Tr ==> !cube' if (!failed && pt.check_inductive(lemma->level(), cube, uses_level, weakness)) { - TRACE("spacer", + TRACE(spacer, tout << "Reduced fractions from:\n" << lemma->get_cube() << "\n\nto\n" << cube << "\n";); diff --git a/src/muz/spacer/spacer_arith_kernel.cpp b/src/muz/spacer/spacer_arith_kernel.cpp index 25aff0273..3e1fe9a4f 100644 --- a/src/muz/spacer/spacer_arith_kernel.cpp +++ b/src/muz/spacer/spacer_arith_kernel.cpp @@ -62,7 +62,7 @@ class simplex_arith_kernel_plugin : public spacer_arith_kernel::plugin { } qmat.add_var(row_id, rational::one().to_mpq(), n_cols); } - TRACE("gg", qmat.display(tout);); + TRACE(gg, qmat.display(tout);); qmatrix kern(m); simplex::sparse_matrix_ops::kernel_ffe(qmat, kern, @@ -79,7 +79,7 @@ class simplex_arith_kernel_plugin : public spacer_arith_kernel::plugin { out.add_row(vec); } - TRACE("gg", { + TRACE(gg, { tout << "Computed kernel\n"; qmat.display(tout); tout << "\n"; diff --git a/src/muz/spacer/spacer_cluster.cpp b/src/muz/spacer/spacer_cluster.cpp index fac3a920f..dc85f8f88 100644 --- a/src/muz/spacer/spacer_cluster.cpp +++ b/src/muz/spacer/spacer_cluster.cpp @@ -153,14 +153,14 @@ void lemma_cluster::rm_subsumed(lemma_info_vector &removed_lemmas) { if (lem.get_lemma()->get_expr() == r->form(i)) { found = true; keep.push_back(lem); - TRACE("cluster_stats_verb", tout << "Keeping lemma " + TRACE(cluster_stats_verb, tout << "Keeping lemma " << lem.get_lemma()->get_cube() << "\n";); break; } } if (!found) { - TRACE("cluster_stats_verb", tout << "Removing subsumed lemma " + TRACE(cluster_stats_verb, tout << "Removing subsumed lemma " << lem.get_lemma()->get_cube() << "\n";); removed_lemmas.push_back(lem); @@ -191,7 +191,7 @@ bool lemma_cluster::add_lemma(const lemma_ref &lemma, bool subsume) { // cluster already contains the lemma if (contains(lemma)) return false; - TRACE("cluster_stats_verb", + TRACE(cluster_stats_verb, tout << "Trying to add lemma " << lemma->get_cube() << "\n";); lemma_cluster::lemma_info li(lemma, sub); @@ -206,7 +206,7 @@ bool lemma_cluster::add_lemma(const lemma_ref &lemma, bool subsume) { if (rm.get_lemma() == li.get_lemma()) return false; } } - TRACE("cluster_stats", tout << "Added lemma\n" << mk_and(lemma->get_cube()) << "\n" + TRACE(cluster_stats, tout << "Added lemma\n" << mk_and(lemma->get_cube()) << "\n" << "to existing cluster\n" << m_pattern << "\n";); return true; } @@ -246,7 +246,7 @@ bool lemma_cluster_finder::anti_unify_n_intrp(const expr_ref &cube, anti_unifier antiunify(m); substitution sub1(m), sub2(m); - TRACE("cluster_stats_verb", + TRACE(cluster_stats_verb, tout << "Trying to generate a general pattern for " << cube << " neighbours are " << fmls << "\n";); @@ -267,7 +267,7 @@ bool lemma_cluster_finder::anti_unify_n_intrp(const expr_ref &cube, sem_matcher matcher(m); unsigned n_vars_pat = 0; for (expr *e : patterns) { - TRACE("cluster_stats_verb", + TRACE(cluster_stats_verb, tout << "Checking pattern " << mk_pp(e, m) << "\n";); is_general_pattern = true; n_vars_pat = get_num_vars(e); @@ -284,7 +284,7 @@ bool lemma_cluster_finder::anti_unify_n_intrp(const expr_ref &cube, } if (is_general_pattern) { SASSERT(e != nullptr); - TRACE("cluster_stats", + TRACE(cluster_stats, tout << "Found a general pattern\n" << mk_pp(e, m) << "\n";); // found a good pattern res = expr_ref(e, m); @@ -292,7 +292,7 @@ bool lemma_cluster_finder::anti_unify_n_intrp(const expr_ref &cube, } } - CTRACE("cluster_stats", !all_same, + CTRACE(cluster_stats, !all_same, tout << "Failed to find a general pattern for cluster. Cube is: " << cube << " Patterns are " << patterns << "\n";); return false; @@ -311,7 +311,7 @@ void lemma_cluster_finder::cluster(lemma_ref &lemma) { /// Add the lemma to a cluster it is matched against lemma_cluster *clstr = pt.clstr_match(lemma); if (clstr && clstr->get_size() <= MAX_CLUSTER_SIZE) { - TRACE("cluster_stats_verb", { + TRACE(cluster_stats_verb, { tout << "Trying to add lemma\n" << lemma->get_cube() << " to an existing cluster\n"; for (auto lem : clstr->get_lemmas()) @@ -370,7 +370,7 @@ void lemma_cluster_finder::cluster(lemma_ref &lemma) { // subsumption check we do is based on unit propagation, it is not complete. lemma_cluster *cluster = pt.mk_cluster(pattern); - TRACE("cluster_stats", + TRACE(cluster_stats, tout << "created new cluster with pattern:\n" << pattern << "\n" << " and lemma cube:\n" << lcube << "\n";); @@ -382,7 +382,7 @@ void lemma_cluster_finder::cluster(lemma_ref &lemma) { SASSERT(cluster->can_contain(l)); bool added = cluster->add_lemma(l, false); (void)added; - CTRACE("cluster_stats", added, + CTRACE(cluster_stats, added, tout << "Added neighbour lemma\n" << mk_and(l->get_cube()) << "\n";); } diff --git a/src/muz/spacer/spacer_cluster_util.cpp b/src/muz/spacer/spacer_cluster_util.cpp index 72d1d2269..eecf90176 100644 --- a/src/muz/spacer/spacer_cluster_util.cpp +++ b/src/muz/spacer/spacer_cluster_util.cpp @@ -200,13 +200,13 @@ void normalize_order(expr *e, expr_ref &out) { th_rewriter rw1(out.m(), params); rw1(e, out); - STRACE("spacer_normalize_order'", + STRACE(spacer_normalize_order, tout << "OUT Before:" << mk_pp(out, out.m()) << "\n";); // apply term ordering term_ordered_rpp t_ordered(out.m()); rewriter_tpl rw2(out.m(), false, t_ordered); rw2(out.get(), out); - STRACE("spacer_normalize_order'", + STRACE(spacer_normalize_order, tout << "OUT After :" << mk_pp(out, out.m()) << "\n";); } diff --git a/src/muz/spacer/spacer_conjecture.cpp b/src/muz/spacer/spacer_conjecture.cpp index e95f0c7b3..c08a9005d 100644 --- a/src/muz/spacer/spacer_conjecture.cpp +++ b/src/muz/spacer/spacer_conjecture.cpp @@ -91,7 +91,7 @@ bool filter_out_lit(const expr_ref_vector &vec, const expr_ref &lit, expr_ref_ve out.push_back(c); } - CTRACE("global", dirty, + CTRACE(global, dirty, tout << "Filtered " << lit << " from " << vec << "\n got " << out << "\n";); return dirty; } diff --git a/src/muz/spacer/spacer_context.cpp b/src/muz/spacer/spacer_context.cpp index 0ef8c7992..6917244ca 100644 --- a/src/muz/spacer/spacer_context.cpp +++ b/src/muz/spacer/spacer_context.cpp @@ -192,7 +192,7 @@ void pob_queue::reset() { void pob_queue::push(pob &n) { if (!n.is_in_queue()) { - TRACE("pob_queue", + TRACE(pob_queue, tout << "pob_queue::push(" << n.post()->get_id() << ")\n";); n.set_in_queue(true); m_data.push (&n); @@ -245,7 +245,7 @@ void derivation::exist_skolemize(expr* fml, app_ref_vector& vars, expr_ref& res) vars[j++] = vars.get(i); vars.shrink(j); - TRACE("spacer", tout << "Skolemizing: " << vars << "\n"; + TRACE(spacer, tout << "Skolemizing: " << vars << "\n"; tout << "from " << mk_pp(fml, m) << "\n";); expr_safe_replace sub(m); @@ -257,7 +257,7 @@ void derivation::exist_skolemize(expr* fml, app_ref_vector& vars, expr_ref& res) } pob *derivation::create_next_child(model &mdl) { - timeit _timer (is_trace_enabled("spacer_timeit"), + timeit _timer (is_trace_enabled(TraceTag::spacer_timeit), "spacer::derivation::create_next_child", verbose_stream ()); @@ -279,14 +279,14 @@ pob *derivation::create_next_child(model &mdl) { summaries.reset (); if (!vars.empty()) { - timeit _timer1 (is_trace_enabled("spacer_timeit"), + timeit _timer1 (is_trace_enabled(TraceTag::spacer_timeit), "create_next_child::qproject1", verbose_stream ()); vars.append(m_evars); m_evars.reset(); pt().mbp(vars, m_trans, mdl, true, pt().get_context().use_ground_pob()); - CTRACE("spacer", !vars.empty(), + CTRACE(spacer, !vars.empty(), tout << "Failed to eliminate: " << vars << "\n";); m_evars.append (vars); vars.reset(); @@ -310,14 +310,14 @@ pob *derivation::create_next_child(model &mdl) { summaries.reset (); if (!vars.empty()) { - timeit _timer2(is_trace_enabled("spacer_timeit"), + timeit _timer2(is_trace_enabled(TraceTag::spacer_timeit), "create_next_child::qproject2", verbose_stream ()); // include m_evars in case they can eliminated now as well vars.append(m_evars); pt().mbp(vars, post, mdl, true, pt().get_context().use_ground_pob()); - CTRACE("spacer", !vars.empty(), + CTRACE(spacer, !vars.empty(), tout << "Failed to eliminate: " << vars << "\n";); //qe::reduce_array_selects (*mev.get_model (), post); } @@ -421,7 +421,7 @@ pob *derivation::create_next_child () this->pt().mbp(vars, m_trans, *mdl, true, this->pt().get_context().use_ground_pob()); // keep track of implicitly quantified variables - CTRACE("spacer", !vars.empty(), + CTRACE(spacer, !vars.empty(), tout << "Failed to eliminate: " << vars << "\n";); m_evars.append (vars); vars.reset(); @@ -652,7 +652,7 @@ void lemma::add_binding(app_ref_vector const &binding) { if (!has_binding(binding)) { m_bindings.append(binding); - TRACE("spacer", + TRACE(spacer, tout << "new binding: "; for (unsigned i = 0; i < binding.size(); i++) tout << mk_pp(binding.get(i), m) << " "; @@ -961,7 +961,7 @@ void pred_transformer::add_lemma_core(lemma* lemma, bool ground_only) SASSERT(!lemma->is_background()); unsigned lvl = lemma->level(); expr* l = lemma->get_expr(); - CTRACE("spacer", !spacer::is_clause(m, l), + CTRACE(spacer, !spacer::is_clause(m, l), tout << "Lemma not a clause: " << mk_pp(l, m) << "\n";); SASSERT(!lemma->is_ground() || spacer::is_clause(m, l)); SASSERT(!is_quantifier(l) || spacer::is_clause(m, to_quantifier(l)->get_expr())); @@ -1018,7 +1018,7 @@ void pred_transformer::add_lemma_from_child (pred_transformer& child, } SASSERT (!inst.empty ()); for (unsigned j = 0; j < inst.size(); ++j) { - TRACE("spacer_detail", tout << "child property: " + TRACE(spacer_detail, tout << "child property: " << mk_pp(inst.get (j), m) << "\n";); if (is_infty_level(lvl)) { m_solver->assert_expr(inst.get(j)); @@ -1044,12 +1044,12 @@ app_ref pred_transformer::mk_fresh_rf_tag () void pred_transformer::add_rf (reach_fact *rf, bool force) { - timeit _timer (is_trace_enabled("spacer_timeit"), + timeit _timer (is_trace_enabled(TraceTag::spacer_timeit), "spacer::pred_transformer::add_rf", verbose_stream ()); if (!rf) return; - TRACE("spacer", tout << "add_rf: " << head()->get_name() << " " + TRACE(spacer, tout << "add_rf: " << head()->get_name() << " " << (rf->is_init() ? "INIT " : "") << mk_pp(rf->get(), m) << "\n";); @@ -1081,7 +1081,7 @@ void pred_transformer::add_rf (reach_fact *rf, bool force) if (last_tag) {fml = m.mk_or(m.mk_not(last_tag), rf->get(), rf->tag());} else {fml = m.mk_or(rf->get(), rf->tag());} m_reach_solver->assert_expr (fml); - TRACE ("spacer", tout << "updating reach ctx: " << fml << "\n";); + TRACE(spacer, tout << "updating reach ctx: " << fml << "\n";); // update solvers of other pred_transformers // XXX wrap rf into a lemma to fit the API @@ -1208,7 +1208,7 @@ expr_ref pred_transformer::get_origin_summary (model &mdl, for (auto* s : summary) { if (!is_quantifier(s) && !mdl.is_true(s)) { - TRACE("spacer", tout << "Summary not true in the model: " << mk_pp(s, m) << "\n";); + TRACE(spacer, tout << "Summary not true in the model: " << mk_pp(s, m) << "\n";); return expr_ref(m); } } @@ -1233,7 +1233,7 @@ void pred_transformer::add_cover(unsigned level, expr* property, bool bg) scoped_ptr rep = mk_default_expr_replacer(m, false); rep->set_substitution(&sub); (*rep)(result); - TRACE("spacer", tout << "cover:\n" << mk_pp(result, m) << "\n";); + TRACE(spacer, tout << "cover:\n" << mk_pp(result, m) << "\n";); // add the property. expr_ref_vector lemmas(m); @@ -1260,14 +1260,14 @@ void pred_transformer::get_pred_bg_invs(expr_ref_vector& out) { func_decl* pre = preds[i]; pred_transformer &pt = ctx.get_pred_transformer(pre); const lemma_ref_vector &invs = pt.get_bg_invs(); - CTRACE("spacer", !invs.empty(), + CTRACE(spacer, !invs.empty(), tout << "add-bg-invariant: " << mk_pp (pre, m) << "\n";); for (auto inv : invs) { // tag -> inv1 ... tag -> invn tmp1 = m.mk_implies(tag, inv->get_expr()); pm.formula_n2o(tmp1, tmp2, i); out.push_back(tmp2); - TRACE("spacer", tout << tmp2 << "\n";); + TRACE(spacer, tout << tmp2 << "\n";); } } } @@ -1329,7 +1329,7 @@ bool pred_transformer::is_qblocked (pob &n) { // solver->get_itp_core(core); // expr_ref c(m); // c = mk_and(core); - // STRACE("spacer_progress", tout << "core: " << mk_epp(c,m) << "\n";); + // STRACE(spacer_progress, tout << "core: " << mk_epp(c,m) << "\n";); // } return res == l_false; } @@ -1353,11 +1353,11 @@ lbool pred_transformer::is_reachable(pob& n, expr_ref_vector* core, bool_vector& reach_pred_used, unsigned& num_reuse_reach, bool use_iuc) { - TRACE("spacer", + TRACE(spacer, tout << "is-reachable: " << head()->get_name() << " level: " << n.level() << " depth: " << n.depth () << "\n"; tout << mk_pp(n.post(), m) << "\n";); - timeit _timer (is_trace_enabled("spacer_timeit"), + timeit _timer (is_trace_enabled(TraceTag::spacer_timeit), "spacer::pred_transformer::is_reachable", verbose_stream ()); @@ -1404,7 +1404,7 @@ lbool pred_transformer::is_reachable(pob& n, expr_ref_vector* core, } } - CTRACE("spacer", !reach_assumps.empty(), + CTRACE(spacer, !reach_assumps.empty(), tout << "reach assumptions\n" << reach_assumps << "\n";); // check local reachability; @@ -1414,27 +1414,27 @@ lbool pred_transformer::is_reachable(pob& n, expr_ref_vector* core, lbool is_sat = m_solver->check_assumptions (post, reach_assumps, m_transition_clause, 1, &bg, 0); - CTRACE("spacer", !reach_assumps.empty(), + CTRACE(spacer, !reach_assumps.empty(), tout << "reach assumptions\n" << reach_assumps << "\n";); if (is_sat == l_true || is_sat == l_undef) { if (core) { core->reset(); } if (model && model->get()) { r = find_rule(**model, is_concrete, reach_pred_used, num_reuse_reach); - TRACE("spacer", + TRACE(spacer, tout << "reachable is_sat: " << is_sat << " " << r << " is_concrete " << is_concrete << " rused: " << reach_pred_used << "\n";); - CTRACE("spacer", r, + CTRACE(spacer, r, ctx.get_datalog_context().get_rule_manager().display_smt2(*r, tout); tout << "\n";); - TRACE("spacer_sat", tout << "model is:\n" << **model << "\n";); + TRACE(spacer_sat, tout << "model is:\n" << **model << "\n";); } return is_sat; } if (is_sat == l_false) { SASSERT (reach_assumps.empty ()); - TRACE ("spacer", tout << "unreachable with lemmas\n"; + TRACE(spacer, tout << "unreachable with lemmas\n"; if (core) tout << "Core:\n" << *core << "\n";); uses_level = m_solver->uses_level(); return l_false; @@ -1562,7 +1562,7 @@ bool pred_transformer::check_inductive(unsigned level, expr_ref_vector& state, state.append(core); uses_level = m_solver->uses_level(); } - TRACE ("core_array_eq", + TRACE(core_array_eq, tout << "check_inductive: " << "states: " << mk_pp (states, m) << " is: " << res << "\n" @@ -1600,7 +1600,7 @@ void pred_transformer::initialize(decl2rel const& pts) m_solver->assert_expr (m_transition); m_solver->assert_expr (m_init, 0); - TRACE("spacer", + TRACE(spacer, tout << "Initial state: " << mk_pp(m_init, m) << "\n"; tout << "Transition: " << mk_pp(m_transition, m) << "\n";); SASSERT(is_app(m_init)); @@ -1713,10 +1713,10 @@ void pred_transformer::init_rule(decl2rel const& pts, datalog::rule const& rule) blast_term_ite(trans, ctx.blast_term_ite_inflation()); rw(trans); } - TRACE("spacer_init_rule", tout << mk_pp(trans, m) << "\n";); + TRACE(spacer_init_rule, tout << mk_pp(trans, m) << "\n";); // no (universal) quantifiers in recursive rules - CTRACE("spacer", ut_size > 0 && !is_ground(trans), + CTRACE(spacer, ut_size > 0 && !is_ground(trans), tout << "Warning: quantifier in recursive rule: " << trans << "\n";); if (ut_size > 0 && !is_ground(trans)) { @@ -1733,7 +1733,7 @@ void pred_transformer::init_rule(decl2rel const& pts, datalog::rule const& rule) ptr.set_reps(var_reprs); } - // TRACE("spacer", + // TRACE(spacer, // tout << rule.get_decl()->get_name() << "\n"; // tout << var_reprs << "\n";); } @@ -1981,7 +1981,7 @@ void pred_transformer::update_solver_with_rfs(prop_solver *solver, /// pred_transformer::frames bool pred_transformer::frames::add_lemma(lemma *new_lemma) { - TRACE("spacer", tout << "add-lemma: " << pp_level(new_lemma->level()) << " " + TRACE(spacer, tout << "add-lemma: " << pp_level(new_lemma->level()) << " " << m_pt.head()->get_name() << " " << mk_pp(new_lemma->get_expr(), m_pt.get_ast_manager()) << "\n";); @@ -1991,7 +1991,7 @@ bool pred_transformer::frames::add_lemma(lemma *new_lemma) for (auto &l : m_bg_invs) { if (l->get_expr() == new_lemma->get_expr()) return false; } - TRACE("spacer", tout << "add-external-lemma: " + TRACE(spacer, tout << "add-external-lemma: " << pp_level(new_lemma->level()) << " " << m_pt.head()->get_name() << " " << mk_pp(new_lemma->get_expr(), m_pt.get_ast_manager()) << "\n";); @@ -2018,7 +2018,7 @@ bool pred_transformer::frames::add_lemma(lemma *new_lemma) } // if the lemma is at a higher level, skip it, if (old_lemma->level() >= new_lemma->level()) { - TRACE("spacer", tout << "Already at a higher level: " + TRACE(spacer, tout << "Already at a higher level: " << pp_level(old_lemma->level()) << "\n";); // but, since the instances might be new, assert the // instances that have been copied into m_lemmas[i] @@ -2389,7 +2389,7 @@ void context::updt_params() { void context::reset() { - TRACE("spacer", tout << "\n";); + TRACE(spacer, tout << "\n";); m_pob_queue.reset(); for (auto &entry: m_rels) {dealloc(entry.m_value);} m_rels.reset(); @@ -2407,7 +2407,7 @@ void context::init_rules(datalog::rule_set& rules, decl2rel& rels) for (auto dit = rules.begin_grouped_rules(), dend = rules.end_grouped_rules(); dit != dend; ++dit) { func_decl* pred = dit->m_key; - TRACE("spacer", tout << mk_pp(pred, m) << "\n";); + TRACE(spacer, tout << mk_pp(pred, m) << "\n";); SASSERT(!rels.contains(pred)); auto* pt = rels.insert_if_not_there(pred, alloc(pred_transformer, *this, get_manager(), pred)); @@ -2434,7 +2434,7 @@ void context::init_rules(datalog::rule_set& rules, decl2rel& rels) func_decl* pred = entry.m_key; pred_transformer* pt = entry.m_value, *pt_user = nullptr; for (auto dep : rules.get_dependencies().get_deps(pred)) { - TRACE("spacer", tout << mk_pp(pred, m) << " " << mk_pp(dep, m) << "\n";); + TRACE(spacer, tout << mk_pp(pred, m) << " " << mk_pp(dep, m) << "\n";); rels.find(dep, pt_user); pt_user->add_use(pt); } @@ -2444,7 +2444,7 @@ void context::init_rules(datalog::rule_set& rules, decl2rel& rels) for (auto &entry : rels) { pred_transformer* rel = entry.m_value; rel->initialize(rels); - TRACE("spacer", rel->display(tout); ); + TRACE(spacer, rel->display(tout); ); } // initialize reach facts @@ -2570,12 +2570,12 @@ bool context::validate() { var_subst vs(m, false); for (auto& kv : m_rels) { ptr_vector const& rules = kv.m_value->rules(); - TRACE ("spacer", tout << "PT: " << kv.m_value->head ()->get_name ().str () + TRACE(spacer, tout << "PT: " << kv.m_value->head ()->get_name ().str () << "\n";); for (auto* rp : rules) { datalog::rule& r = *rp; - TRACE ("spacer", + TRACE(spacer, get_datalog_context (). get_rule_manager (). display_smt2(r, tout) << "\n";); @@ -2618,7 +2618,7 @@ bool context::validate() { } } } - TRACE ("spacer", tout << "Validation Succeeded\n";); + TRACE(spacer, tout << "Validation Succeeded\n";); break; } default: @@ -2853,7 +2853,7 @@ unsigned context::get_cex_depth() fact = facts.get (curr - cex_depth); // discount the number of markers // get rule justifying the derivation of fact at pt r = &fact->get_rule (); - TRACE ("spacer", + TRACE(spacer, tout << "next rule: " << r->name ().str () << "\n"; ); // add child facts and pts @@ -2894,7 +2894,7 @@ void context::get_rules_along_trace(datalog::rule_ref_vector& rules) fact = m_query->get_last_rf (); r = &fact->get_rule (); rules.push_back (const_cast (r)); - TRACE ("spacer", + TRACE(spacer, tout << "Initial rule: " << r->name().str() << "\n"; ); @@ -2922,7 +2922,7 @@ void context::get_rules_along_trace(datalog::rule_ref_vector& rules) // get rule justifying the derivation of fact at pt r = &fact->get_rule (); rules.push_back (const_cast (r)); - TRACE ("spacer", + TRACE(spacer, tout << "next rule: " << r->name ().str () << "\n"; ); // add child facts and pts @@ -3016,7 +3016,7 @@ expr_ref context::get_ground_sat_answer() const { cex.push_back(m.get_fact(pf)); } - TRACE ("spacer", tout << "ground cex\n" << cex << "\n";); + TRACE(spacer, tout << "ground cex\n" << cex << "\n";); return mk_and(cex); } @@ -3083,7 +3083,7 @@ void context::log_enter_level(unsigned lvl) { if (m_trace_stream) { *m_trace_stream << "\n* LEVEL " << lvl << "\n\n"; } IF_VERBOSE(1, verbose_stream() << "Entering level " << lvl << "\n";); - STRACE("spacer_progress", tout << "\n* LEVEL " << lvl << "\n";); + STRACE(spacer_progress, tout << "\n* LEVEL " << lvl << "\n";); IF_VERBOSE( 1, if (m_params.print_statistics()) { @@ -3095,7 +3095,7 @@ void context::log_enter_level(unsigned lvl) { void context::log_propagate() { if (m_trace_stream) *m_trace_stream << "Propagating\n\n"; - STRACE("spacer_progress", tout << "Propagating\n";); + STRACE(spacer_progress, tout << "Propagating\n";); IF_VERBOSE(1, verbose_stream() << "Propagating: " << std::flush;); } @@ -3113,7 +3113,7 @@ void context::log_expand_pob(pob &n) { << mk_epp(n.post(), m) << "\n\n"; } - TRACE("spacer", tout << "expand-pob: " << n.pt().head()->get_name() + TRACE(spacer, tout << "expand-pob: " << n.pt().head()->get_name() << (n.is_conjecture() ? " CONJ" : "") << (n.is_subsume() ? " SUBS" : "") << " level: " << n.level() @@ -3122,7 +3122,7 @@ void context::log_expand_pob(pob &n) { << " gas: " << n.get_gas() << "\n" << mk_pp(n.post(), m) << "\n";); - STRACE("spacer_progress", + STRACE(spacer_progress, tout << "** expand-pob: " << n.pt().head()->get_name() << (n.is_conjecture() ? " CONJ" : "") << (n.is_subsume() ? " SUBS" : "") @@ -3151,10 +3151,10 @@ void context::log_add_lemma(pred_transformer &pt, lemma &new_lemma) { *m_trace_stream << "\n"; } - TRACE("spacer", tout << "add-lemma-core: " << pp_level(lvl) << " " + TRACE(spacer, tout << "add-lemma-core: " << pp_level(lvl) << " " << pt.head()->get_name() << " " << mk_pp(fml, m) << "\n";); - STRACE("spacer_progress", + STRACE(spacer_progress, tout << "** add-lemma: " << pp_level(lvl) << " " << pt.head()->get_name() << " " << mk_epp(fml, m) << "\n"; @@ -3260,13 +3260,13 @@ bool context::check_reachability () SASSERT(m_pob_queue.size() == old_sz); // re-queue all pobs introduced by global gen and any pobs that can be blocked at a higher level for (auto pob : new_pobs) { - TRACE("gg", tout << "pob: is_may_pob " << pob->is_may_pob() + TRACE(gg, tout << "pob: is_may_pob " << pob->is_may_pob() << " with post:\n" << mk_pp(pob->post(), m) << "\n";); //if ((pob->is_may_pob() && pob->post() != node->post()) || is_requeue(*pob)) { if (is_requeue(*pob)) { - TRACE("gg", + TRACE(gg, tout << "Adding back blocked pob at level " << pob->level() << " and depth " << pob->depth() << "\n"); @@ -3311,7 +3311,7 @@ bool context::is_reachable(pob &n) // XXX Should convert is_reachable() to accept pob_ref as argument pob_ref nref(&n); - TRACE ("spacer", + TRACE(spacer, tout << "is-reachable: " << n.pt().head()->get_name() << " level: " << n.level() << " depth: " << (n.depth () - m_pob_queue.min_depth ()) << "\n" @@ -3436,7 +3436,7 @@ bool pred_transformer::mk_mdl_rf_consistent(const datalog::rule *r, atleast_one_true = true; } if (used_rfs.size() > 0 && !atleast_one_true) { - TRACE("spacer_detail", + TRACE(spacer_detail, tout << "model does not satisfy any reachable fact\n";); return false; } @@ -3467,7 +3467,7 @@ bool context::mk_mdl_rf_consistent(model &mdl) { atleast_one_true = true; } if (used_rfs.size() > 0 && !atleast_one_true) { - TRACE("spacer_detail", + TRACE(spacer_detail, tout << "model does not satisfy any reachable fact\n";); return false; } @@ -3540,12 +3540,12 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) } if (/* XXX noop */ n.pt().is_qblocked(n)) { - STRACE("spacer_progress", + STRACE(spacer_progress, tout << "This pob can be blocked by instantiation\n";); } if ((n.is_may_pob()) && n.get_gas() == 0) { - TRACE("global", tout << "Cant prove may pob. Collapsing " + TRACE(global, tout << "Cant prove may pob. Collapsing " << mk_pp(n.post(), m) << "\n";); m_stats.m_num_pob_ofg++; return l_undef; @@ -3555,7 +3555,7 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) // TODO: if push_pob is enabled, avoid calling is_blocked twice if (m_gg_concretize && n.is_concretize_enabled() && !n.pt().is_blocked(n, uses_level, &model)) { - TRACE("global", + TRACE(global, tout << "Concretizing: " << mk_pp(n.post(), m) << "\n" << "\t" << n.get_gas() << " attempts left\n";); @@ -3596,7 +3596,7 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) // must-reachable if (is_concrete) { // -- update must summary - CTRACE("spacer_sat", r, + CTRACE(spacer_sat, r, tout << "Concrete reachable with a rule:\n"; get_datalog_context().get_rule_manager().display_smt2(*r, tout) << "\n"; ); @@ -3634,11 +3634,11 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) if(n.is_conjecture()) m_stats.m_num_conj_failed++; - CTRACE("global", n.is_conjecture(), + CTRACE(global, n.is_conjecture(), tout << "Failed to block conjecture " << n.post()->get_id() << "\n";); - CTRACE("global", n.is_subsume(), + CTRACE(global, n.is_subsume(), tout << "Failed to block subsume generalization " << mk_pp(n.post(), m) << "\n";); @@ -3667,19 +3667,19 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) // Recursion bounded by weakness (atmost 10 right now) return expand_pob(n, out); } - TRACE("spacer", tout << "unknown state: " << mk_and(cube) << "\n";); + TRACE(spacer, tout << "unknown state: " << mk_and(cube) << "\n";); throw unknown_exception(); } case l_false: { // n is unreachable, create a new lemma - timeit _timer (is_trace_enabled("spacer_timeit"), + timeit _timer (is_trace_enabled(TraceTag::spacer_timeit), "spacer::expand_pob::false", verbose_stream ()); // -- only update expanded level when new lemmas are generated at it. if (n.level() < m_expanded_lvl) { m_expanded_lvl = n.level(); } - TRACE("spacer", tout << "cube:\n" << cube << "\n";); + TRACE(spacer, tout << "cube:\n" << cube << "\n";); if(n.is_conjecture()) m_stats.m_num_conj_success++; if(n.is_subsume()) m_stats.m_num_subsume_pob_blckd++; @@ -3706,7 +3706,7 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) n.get_post_simplified(pob_cube); lemma_pob = alloc(class lemma, nref, pob_cube, n.level()); - TRACE("global", tout << "Disabled local gen on pob (id: " + TRACE(global, tout << "Disabled local gen on pob (id: " << n.post()->get_id() << ")\n" << mk_pp(n.post(), m) << "\n" << "Lemma:\n" @@ -3717,7 +3717,7 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) lemma_pob = alloc(class lemma, nref, cube, uses_level); } - CTRACE("global", n.is_conjecture() || n.is_subsume(), + CTRACE(global, n.is_conjecture() || n.is_subsume(), tout << "Blocked " << (n.is_conjecture() ? "conjecture " : "subsume ") << n.post()->get_id() << " at level " << n.level() @@ -3726,7 +3726,7 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) DEBUG_CODE(lemma_sanity_checker sanity_checker(*this); sanity_checker(lemma_pob);); - TRACE("spacer", + TRACE(spacer, tout << "invariant state: " << (is_infty_level(lemma_pob->level()) ? "(inductive)" : "") << mk_pp(lemma_pob->get_expr(), m) << "\n";); @@ -3764,7 +3764,7 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) out.push_back(new_pob); m_stats.m_num_subsume_pobs++; - TRACE("global_verbose", + TRACE(global_verbose, tout << "New subsume pob\n" << mk_pp(new_pob->post(), m) << "\n" << "gas:" << new_pob->get_gas() << "\n";); } else if (pob* new_pob = m_gg_conjecture ? m_global_gen->mk_conjecture_pob(n) : nullptr) { @@ -3773,7 +3773,7 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) out.push_back(new_pob); m_stats.m_num_conj++; - TRACE("global", + TRACE(global, tout << "New conjecture pob\n" << mk_pp(new_pob->post(), m) << "\n";); } } @@ -3836,7 +3836,7 @@ lbool context::expand_pob(pob& n, pob_ref_buffer &out) n.bump_weakness(); return expand_pob(n, out); } - TRACE("spacer", tout << "unknown state: " << mk_and(cube) << "\n";); + TRACE(spacer, tout << "unknown state: " << mk_and(cube) << "\n";); throw unknown_exception(); } UNREACHABLE(); @@ -3878,7 +3878,7 @@ bool context::propagate(unsigned min_prop_lvl, verbose_stream () << lvl << " " << std::flush;); checkpoint(); - CTRACE ("spacer", lvl > max_prop_lvl && lvl == max_prop_lvl + 1, + CTRACE(spacer, lvl > max_prop_lvl && lvl == max_prop_lvl + 1, tout << "In full propagation\n";); bool all_propagated = true; @@ -3919,7 +3919,7 @@ bool context::propagate(unsigned min_prop_lvl, reach_fact *pred_transformer::mk_rf(pob& n, model &mdl, const datalog::rule& r) { SASSERT(&n.pt() == this); - timeit _timer1 (is_trace_enabled("spacer_timeit"), + timeit _timer1 (is_trace_enabled(TraceTag::spacer_timeit), "mk_rf", verbose_stream ()); expr_ref res(m); @@ -3964,20 +3964,20 @@ reach_fact *pred_transformer::mk_rf(pob& n, model &mdl, const datalog::rule& r) } - TRACE ("spacer", + TRACE(spacer, tout << "Reach fact, before QE:\n"; tout << res << "\n"; tout << "Vars:\n" << vars << "\n";); { - timeit _timer1 (is_trace_enabled("spacer_timeit"), + timeit _timer1 (is_trace_enabled(TraceTag::spacer_timeit), "mk_rf::qe_project", verbose_stream ()); mbp(vars, res, mdl, false, true /* force or skolemize */); } - TRACE ("spacer", + TRACE(spacer, tout << "Reach fact, after QE project:\n"; tout << res << "\n"; tout << "Vars:\n" << vars << "\n"; @@ -4005,7 +4005,7 @@ bool context::create_children(pob& n, datalog::rule const& r, scoped_watch _w_ (m_create_children_watch); pred_transformer& pt = n.pt(); - TRACE("spacer", + TRACE(spacer, tout << "Model:\n"; model_smt2_pp(tout, m, mdl, 0); tout << "\n"; @@ -4042,7 +4042,7 @@ bool context::create_children(pob& n, datalog::rule const& r, //qe::reduce_array_selects (*mev.get_model (), phi1); SASSERT (!m_ground_pob || vars.empty ()); - TRACE ("spacer", + TRACE(spacer, tout << "Implicant:\n"; tout << lits << "\n"; tout << "After MBP:\n" << phi << "\n"; @@ -4230,7 +4230,7 @@ bool context::check_invariant(unsigned lvl, func_decl* fn) expr_ref fml(m.mk_and(conj.size(), conj.data()), m); ctx->assert_expr(fml); lbool result = ctx->check_sat(0, nullptr); - TRACE("spacer", tout << "Check invariant level: " << lvl << " " << result + TRACE(spacer, tout << "Check invariant level: " << lvl << " " << result << "\n" << mk_pp(fml, m) << "\n";); return result == l_false; } diff --git a/src/muz/spacer/spacer_convex_closure.cpp b/src/muz/spacer/spacer_convex_closure.cpp index e313c972b..88a592162 100644 --- a/src/muz/spacer/spacer_convex_closure.cpp +++ b/src/muz/spacer/spacer_convex_closure.cpp @@ -97,7 +97,7 @@ unsigned convex_closure::reduce() { bool has_kernel = m_kernel.compute_kernel(); if (!has_kernel) { - TRACE("cvx_dbg", + TRACE(cvx_dbg, tout << "No linear dependencies between pattern vars\n";); return m_dim; } @@ -164,7 +164,7 @@ void convex_closure::kernel2fmls(expr_ref_vector &out) { const spacer_matrix &kern = m_kernel.get_kernel(); SASSERT(kern.num_rows() > 0); - TRACE("cvx_dbg", kern.display(tout);); + TRACE(cvx_dbg, kern.display(tout);); expr_ref eq(m); for (unsigned i = kern.num_rows(); i > 0; i--) { auto &row = kern.get_row(i - 1); @@ -256,7 +256,7 @@ void convex_closure::cc2fmls(expr_ref_vector &out) { // TODO: improve efficiency bool convex_closure::infer_div_pred(const vector &data, rational &m, rational &d) { - TRACE("cvx_dbg_verb", { + TRACE(cvx_dbg_verb, { tout << "computing div constraints for "; for (rational r : data) tout << r << " "; tout << "\n"; @@ -285,7 +285,7 @@ bool convex_closure::infer_div_pred(const vector &data, rational &m, mod(data[0], m, d); SASSERT(d >= rational::zero()); - TRACE("cvx_dbg_verb", tout << "div constraint generated. cf " << m + TRACE(cvx_dbg_verb, tout << "div constraint generated. cf " << m << " and off " << d << "\n";); return true; } @@ -300,7 +300,7 @@ bool convex_closure::compute() { if (rank < dims()) { m_st.m_num_reductions++; kernel2fmls(m_explicit_cc); - TRACE("cvx_dbg", tout << "Linear equalities true of the matrix " + TRACE(cvx_dbg, tout << "Linear equalities true of the matrix " << mk_and(m_explicit_cc) << "\n";); } @@ -311,7 +311,7 @@ bool convex_closure::compute() { return false; } else if (rank > 1) { if (m_enable_implicit) { - TRACE("subsume", tout << "Computing syntactic convex closure\n";); + TRACE(subsume, tout << "Computing syntactic convex closure\n";); cc2fmls(m_implicit_cc); } else { return false; diff --git a/src/muz/spacer/spacer_dl_interface.cpp b/src/muz/spacer/spacer_dl_interface.cpp index 807e9b751..aa675374f 100644 --- a/src/muz/spacer/spacer_dl_interface.cpp +++ b/src/muz/spacer/spacer_dl_interface.cpp @@ -73,7 +73,7 @@ void dl_interface::check_reset() } } if (!is_subsumed) { - TRACE("spacer", new_rules.get_rule(i)->display(m_ctx, tout << "Fresh rule ");); + TRACE(spacer, new_rules.get_rule(i)->display(m_ctx, tout << "Fresh rule ");); m_context->reset(); } } @@ -96,7 +96,7 @@ lbool dl_interface::query(expr * query) check_reset(); - TRACE("spacer", + TRACE(spacer, tout << "query: " << mk_pp(query, m) << "\n"; tout << "rules:\n"; m_ctx.display_rules(tout); @@ -184,7 +184,7 @@ lbool dl_interface::query_from_lvl(expr * query, unsigned lvl) check_reset(); - TRACE("spacer", + TRACE(spacer, if (!m.is_true(bg_assertion)) { tout << "axioms:\n"; tout << mk_pp(bg_assertion, m) << "\n"; diff --git a/src/muz/spacer/spacer_expand_bnd_generalizer.cpp b/src/muz/spacer/spacer_expand_bnd_generalizer.cpp index 4f80be706..6db50f3f1 100644 --- a/src/muz/spacer/spacer_expand_bnd_generalizer.cpp +++ b/src/muz/spacer/spacer_expand_bnd_generalizer.cpp @@ -123,14 +123,14 @@ void lemma_expand_bnd_generalizer::operator()(lemma_ref &lemma) { if (m.is_true(lit)) continue; if (!is_arith_comp(lit, bnd, m)) continue; - TRACE("expand_bnd", tout << "Attempting to expand " << lit << " inside " + TRACE(expand_bnd, tout << "Attempting to expand " << lit << " inside " << cube << "\n";); // for every value for (rational n : m_values) { if (!is_interesting(lit, bnd, n)) continue; m_st.atmpts++; - TRACE("expand_bnd", tout << "Attempting to expand " << lit + TRACE(expand_bnd, tout << "Attempting to expand " << lit << " with numeral " << n << "\n";); // -- update bound on lit @@ -166,7 +166,7 @@ void lemma_expand_bnd_generalizer::operator()(lemma_ref &lemma) { /// Side-effect: update \p lemma with the new candidate bool lemma_expand_bnd_generalizer::check_inductive(lemma_ref &lemma, expr_ref_vector &candidate) { - TRACE("expand_bnd_verb", + TRACE(expand_bnd_verb, tout << "Attempting to update lemma with " << candidate << "\n";); unsigned uses_level = 0; @@ -177,7 +177,7 @@ bool lemma_expand_bnd_generalizer::check_inductive(lemma_ref &lemma, m_st.success++; lemma->update_cube(lemma->get_pob(), candidate); lemma->set_level(uses_level); - TRACE("expand_bnd", tout << "expand_bnd succeeded with " + TRACE(expand_bnd, tout << "expand_bnd succeeded with " << mk_and(candidate) << " at level " << uses_level << "\n";); } diff --git a/src/muz/spacer/spacer_farkas_learner.cpp b/src/muz/spacer/spacer_farkas_learner.cpp index 2a07e96a3..06680b5e1 100644 --- a/src/muz/spacer/spacer_farkas_learner.cpp +++ b/src/muz/spacer/spacer_farkas_learner.cpp @@ -194,7 +194,7 @@ void farkas_learner::get_lemmas(proof* root, expr_set const& bs, expr_ref_vector expr_set* empty_set = alloc(expr_set); hyprefs.push_back(empty_set); ptr_vector todo; - TRACE("spacer_verbose", tout << mk_pp(pr, m) << "\n";); + TRACE(spacer_verbose, tout << mk_pp(pr, m) << "\n";); todo.push_back(pr); while (!todo.empty()) { proof* p = todo.back(); @@ -253,7 +253,7 @@ void farkas_learner::get_lemmas(proof* root, expr_set const& bs, expr_ref_vector if (IS_B_PURE(arg)) { expr* fact = m.get_fact(arg); if (is_pure_expr(Bsymbs, fact, m)) { - TRACE("farkas_learner2", + TRACE(farkas_learner2, tout << "Add: " << mk_pp(m.get_fact(arg), m) << "\n"; tout << mk_pp(arg, m) << "\n"; ); @@ -323,7 +323,7 @@ void farkas_learner::get_lemmas(proof* root, expr_set const& bs, expr_ref_vector rational coef; vector coeffs; - TRACE("farkas_learner2", + TRACE(farkas_learner2, for (unsigned i = 0; i < prem_cnt; ++i) { VERIFY(params[i].is_rational(coef)); proof* prem = to_app(p->get_arg(i)); @@ -375,7 +375,7 @@ void farkas_learner::get_lemmas(proof* root, expr_set const& bs, expr_ref_vector if (num_b_pures > 0) { expr_ref res(m); combine_constraints(coeffs.size(), lits.data(), coeffs.data(), res); - TRACE("farkas_learner2", tout << "Add: " << mk_pp(res, m) << "\n";); + TRACE(farkas_learner2, tout << "Add: " << mk_pp(res, m) << "\n";); INSERT(res); b_closed.mark(p, true); } @@ -412,7 +412,7 @@ void farkas_learner::get_asserted(proof* p0, expr_set const& bs, ast_mark& b_clo if (p->get_decl_kind() == PR_ASSERTED && bs.contains(m.get_fact(p))) { expr* fact = m.get_fact(p); - TRACE("farkas_learner2", + TRACE(farkas_learner2, tout << mk_ll_pp(p0, m) << "\n"; tout << "Add: " << mk_pp(p, m) << "\n";); INSERT(fact); diff --git a/src/muz/spacer/spacer_generalizers.cpp b/src/muz/spacer/spacer_generalizers.cpp index d3f083904..0fa8ae932 100644 --- a/src/muz/spacer/spacer_generalizers.cpp +++ b/src/muz/spacer/spacer_generalizers.cpp @@ -131,7 +131,7 @@ void lemma_bool_inductive_generalizer::operator()(lemma_ref &lemma) { } if (dirty) { - TRACE("spacer", + TRACE(spacer, tout << "Generalized from:\n" << mk_and(lemma->get_cube()) << "\ninto\n" << mk_and(cube) << "\n";); @@ -164,10 +164,10 @@ void unsat_core_generalizer::operator()(lemma_ref &lemma) expr_ref_vector core(m); VERIFY(pt.is_invariant(lemma->level(), lemma.get(), uses_level, &core)); - CTRACE("spacer", old_sz > core.size(), + CTRACE(spacer, old_sz > core.size(), tout << "unsat core reduced lemma from: " << old_sz << " to " << core.size() << "\n";); - CTRACE("spacer", old_level < uses_level, + CTRACE(spacer, old_level < uses_level, tout << "unsat core moved lemma up from: " << old_level << " to " << uses_level << "\n";); if (old_sz > core.size()) { @@ -233,7 +233,7 @@ void lemma_array_eq_generalizer::operator() (lemma_ref &lemma) v = mk_and(core); for_each_expr(cap, v); - CTRACE("core_array_eq", symb.size() > 1 && symb.size() <= 8, + CTRACE(core_array_eq, symb.size() > 1 && symb.size() <= 8, tout << "found " << symb.size() << " array variables in: \n" << v << "\n";); @@ -276,7 +276,7 @@ void lemma_array_eq_generalizer::operator() (lemma_ref &lemma) lbool res = sol->check_sat(0, nullptr); if (res == l_false) { - TRACE("core_array_eq", + TRACE(core_array_eq, tout << "strengthened " << mk_pp(lits.get(i), m) << " with " << mk_pp(mk_not(m, e), m) << "\n";); lits[i] = mk_not(m, e); @@ -289,7 +289,7 @@ void lemma_array_eq_generalizer::operator() (lemma_ref &lemma) // nothing changed if (!dirty) return; - TRACE("core_array_eq", + TRACE(core_array_eq, tout << "new possible core " << mk_and(lits) << "\n";); @@ -297,16 +297,16 @@ void lemma_array_eq_generalizer::operator() (lemma_ref &lemma) // -- check if the generalized result is consistent with trans unsigned uses_level1; if (pt.check_inductive(lemma->level(), lits, uses_level1, lemma->weakness())) { - TRACE("core_array_eq", tout << "Inductive!\n";); + TRACE(core_array_eq, tout << "Inductive!\n";); lemma->update_cube(lemma->get_pob(), lits); lemma->set_level(uses_level1); } else - {TRACE("core_array_eq", tout << "Not-Inductive!\n";);} + {TRACE(core_array_eq, tout << "Not-Inductive!\n";);} } void lemma_eq_generalizer::operator() (lemma_ref &lemma) { - TRACE("core_eq", tout << "Transforming equivalence classes\n";); + TRACE(core_eq, tout << "Transforming equivalence classes\n";); if (lemma->get_cube().empty()) return; diff --git a/src/muz/spacer/spacer_global_generalizer.cpp b/src/muz/spacer/spacer_global_generalizer.cpp index e4b16cfbb..58ef0c4ca 100644 --- a/src/muz/spacer/spacer_global_generalizer.cpp +++ b/src/muz/spacer/spacer_global_generalizer.cpp @@ -289,7 +289,7 @@ void lemma_global_generalizer::subsumer::skolemize_for_quic3( sub.insert(c, sk); } sub(f.get(), f); - TRACE("subsume", tout << "skolemized into " << f << "\n";); + TRACE(subsume, tout << "skolemized into " << f << "\n";); m_col_names.reset(); } @@ -349,7 +349,7 @@ bool lemma_global_generalizer::subsumer::is_handled(const lemma_cluster &lc) { // TODO: put restriction on Arrays, non linear arithmetic etc if (!bv_clus) return true; if (!all_same_sz(m, lc.get_lemmas()[0].get_sub(), sz)) { - TRACE("subsume", + TRACE(subsume, tout << "cannot compute cvx cls of different size variables\n";); return false; } @@ -376,7 +376,7 @@ bool lemma_global_generalizer::subsumer::subsume(const lemma_cluster &lc, bool is_syntactic = cvx_closure.has_implicit(); if (is_syntactic) { m_st.m_num_syn_cls++; } - CTRACE("subsume_verb", is_syntactic, + CTRACE(subsume_verb, is_syntactic, tout << "Convex closure introduced new variables. Implicit part of " "closure is: " << mk_and(cvx_closure.get_implicit()) << "\n";); @@ -461,7 +461,7 @@ bool lemma_global_generalizer::subsumer::over_approximate(expr_ref_vector &a, tagged_a.push_back(m.mk_implies(tags.back(), lit)); } - TRACE("subsume_verb", tout << "weakening " << mk_and(a) + TRACE(subsume_verb, tout << "weakening " << mk_and(a) << " to over approximate " << b << "\n";); solver::scoped_push _sp(*m_solver); m_solver->assert_expr(b); @@ -496,13 +496,13 @@ bool lemma_global_generalizer::subsumer::over_approximate(expr_ref_vector &a, if (a.empty()) { // could not find an over approximation - TRACE("subsume", + TRACE(subsume, tout << "mbp did not over-approximate convex closure\n";); m_st.m_num_no_ovr_approx++; return false; } - TRACE("subsume", + TRACE(subsume, tout << "over approximate produced " << mk_and(a) << "\n";); return true; } @@ -549,13 +549,13 @@ bool lemma_global_generalizer::do_conjecture(pob_ref &n, lemma_ref &lemma, if (conj.empty()) { // If the pob cannot be abstracted, stop using generalization on // it - TRACE("global", tout << "stop local generalization on pob " << n_post + TRACE(global, tout << "stop local generalization on pob " << n_post << " id is " << n_post->get_id() << "\n";); n->disable_local_gen(); return false; } else if (!is_filtered) { // The literal to be abstracted is not in the pob - TRACE("global", tout << "Conjecture failed:\n" + TRACE(global, tout << "Conjecture failed:\n" << lit << "\n" << n_post << "\n" << "conj:" << conj << "\n";); @@ -581,7 +581,7 @@ bool lemma_global_generalizer::do_conjecture(pob_ref &n, lemma_ref &lemma, n->set_expand_bnd(); n->set_gas(gas); n->disable_local_gen(); - TRACE("global", tout << "set conjecture " << mk_pp(n->get_data()->post(), m) + TRACE(global, tout << "set conjecture " << mk_pp(n->get_data()->post(), m) << " at level " << n->get_data()->level() << "\n";); return true; } @@ -601,7 +601,7 @@ void lemma_global_generalizer::generalize(lemma_ref &lemma) { if (cluster->get_gas() == 0) { m_st.m_num_cls_ofg++; pob->disable_local_gen(); - TRACE("global", tout << "stop local generalization on pob " + TRACE(global, tout << "stop local generalization on pob " << mk_pp(pob->post(), m) << " id is " << pob->post()->get_id() << "\n";); return; @@ -617,7 +617,7 @@ void lemma_global_generalizer::generalize(lemma_ref &lemma) { const expr_ref &pat = lc.get_pattern(); - TRACE("global", { + TRACE(global, { tout << "Global generalization of:\n" << mk_and(lemma->get_cube()) << "\n" << "at lvl: " << lemma->level() << "\n" @@ -635,7 +635,7 @@ void lemma_global_generalizer::generalize(lemma_ref &lemma) { if (has_nonlinear_var_mul(pat, m)) { m_st.m_num_non_lin++; - TRACE("global", + TRACE(global, tout << "Found non linear pattern. Marked to concretize \n";); // not constructing the concrete pob here since we need a model for // n->post() @@ -650,7 +650,7 @@ void lemma_global_generalizer::generalize(lemma_ref &lemma) { expr_ref lit(m); if (find_unique_mono_var_lit(pat, lit)) { // Create a conjecture by dropping literal from pob. - TRACE("global", tout << "Conjecture with pattern\n" + TRACE(global, tout << "Conjecture with pattern\n" << mk_pp(pat, m) << "\n" << "with gas " << cluster->get_gas() << "\n";); unsigned gas = cluster->get_pob_gas(); @@ -703,7 +703,7 @@ void lemma_global_generalizer::generalize(lemma_ref &lemma) { pob->disable_local_gen(); cluster->dec_gas(); - TRACE("global", tout << "Create subsume pob at level " << new_lvl + TRACE(global, tout << "Create subsume pob at level " << new_lvl << "\n" << mk_and(new_post) << "\n";); } @@ -730,7 +730,7 @@ pob *lemma_global_generalizer::mk_concretize_pob(pob &n, model_ref &model) { pob *new_pob = n.pt().mk_pob(n.parent(), n.level(), n.depth(), mk_and(new_post), n.get_binding()); - TRACE("concretize", tout << "pob:\n" + TRACE(concretize, tout << "pob:\n" << mk_pp(n.post(), m) << " is concretized into:\n" << mk_pp(new_pob->post(), m) << "\n";); @@ -751,7 +751,7 @@ pob *lemma_global_generalizer::mk_subsume_pob(pob &n) { return nullptr; } - TRACE("global", tout << "mk_subsume_pob at level " << data->level() + TRACE(global, tout << "mk_subsume_pob at level " << data->level() << " with post state:\n" << mk_pp(data->post(), m) << "\n";); f = n.pt().mk_pob(data->parent(), data->level(), data->depth(), diff --git a/src/muz/spacer/spacer_ind_lemma_generalizer.cpp b/src/muz/spacer/spacer_ind_lemma_generalizer.cpp index e139e743e..df0c7033b 100644 --- a/src/muz/spacer/spacer_ind_lemma_generalizer.cpp +++ b/src/muz/spacer/spacer_ind_lemma_generalizer.cpp @@ -260,7 +260,7 @@ class lemma_inductive_generalizer : public lemma_generalizer { // if there is at least one generalization, update lemma if (num_gens > 0) { - TRACE("indgen", + TRACE(indgen, tout << "Generalized " << num_gens << " literals\n";); // reuse m_core since it is not needed for anything else @@ -269,7 +269,7 @@ class lemma_inductive_generalizer : public lemma_generalizer { if (lit != m_true) m_core.push_back(lit); } - TRACE("indgen", tout << "Original: " << lemma->get_cube() << "\n" + TRACE(indgen, tout << "Original: " << lemma->get_cube() << "\n" << "Generalized: " << m_core << "\n";); lemma->update_cube(lemma->get_pob(), m_core); diff --git a/src/muz/spacer/spacer_iuc_solver.cpp b/src/muz/spacer/spacer_iuc_solver.cpp index b8b51c0c6..0bc72190b 100644 --- a/src/muz/spacer/spacer_iuc_solver.cpp +++ b/src/muz/spacer/spacer_iuc_solver.cpp @@ -310,7 +310,7 @@ namespace spacer { static unsigned bcnt = 0; { bcnt++; - TRACE("spacer", tout << "Dumping pf bcnt: " << bcnt << "\n";); + TRACE(spacer, tout << "Dumping pf bcnt: " << bcnt << "\n";); if (bcnt == 123) { std::ofstream ofs; ofs.open("/tmp/bpf_" + std::to_string(bcnt) + ".dot"); @@ -362,7 +362,7 @@ namespace spacer { static unsigned cnt = 0; { cnt++; - TRACE("spacer", tout << "Dumping pf cnt: " << cnt << "\n";); + TRACE(spacer, tout << "Dumping pf cnt: " << cnt << "\n";); if (cnt == 123) { std::ofstream ofs; ofs.open("/tmp/pf_" + std::to_string(cnt) + ".dot"); diff --git a/src/muz/spacer/spacer_legacy_frames.cpp b/src/muz/spacer/spacer_legacy_frames.cpp index 15b37b127..a1bf06bde 100644 --- a/src/muz/spacer/spacer_legacy_frames.cpp +++ b/src/muz/spacer/spacer_legacy_frames.cpp @@ -83,7 +83,7 @@ bool pred_transformer::legacy_frames::propagate_to_next_level(unsigned src_level unsigned tgt_level = next_level(src_level); m_pt.ensure_level(next_level(tgt_level)); - TRACE("spacer", + TRACE(spacer, tout << "propagating " << src_level << " to " << tgt_level; tout << " for relation " << m_pt.head()->get_name() << "\n";); @@ -95,25 +95,25 @@ bool pred_transformer::legacy_frames::propagate_to_next_level(unsigned src_level SASSERT(stored_lvl >= src_level); unsigned solver_level = 0; if (stored_lvl > src_level) { - TRACE("spacer", tout << "at level: " << stored_lvl << " " << mk_pp(curr, m) << "\n";); + TRACE(spacer, tout << "at level: " << stored_lvl << " " << mk_pp(curr, m) << "\n";); src[i] = src.back(); src.pop_back(); } else if (m_pt.is_invariant(tgt_level, curr, solver_level)) { // -- might invalidate src reference add_lemma(curr, solver_level); - TRACE("spacer", tout << "is invariant: " << pp_level(solver_level) << " " << mk_pp(curr, m) << "\n";); + TRACE(spacer, tout << "is invariant: " << pp_level(solver_level) << " " << mk_pp(curr, m) << "\n";); // shadow higher-level src expr_ref_vector &src = m_levels[src_level]; src[i] = src.back(); src.pop_back(); ++m_pt.m_stats.m_num_propagations; } else { - TRACE("spacer", tout << "not propagated: " << mk_pp(curr, m) << "\n";); + TRACE(spacer, tout << "not propagated: " << mk_pp(curr, m) << "\n";); ++i; } } - CTRACE("spacer", m_levels[src_level].empty(), + CTRACE(spacer, m_levels[src_level].empty(), tout << "Fully propagated level " << src_level << " of " << m_pt.head()->get_name() << "\n";); @@ -144,7 +144,7 @@ bool pred_transformer::legacy_frames::add_lemma(expr * lemma, unsigned lvl) void pred_transformer::legacy_frames::propagate_to_infinity(unsigned level) { - TRACE("spacer", tout << "propagating to oo from lvl " << level + TRACE(spacer, tout << "propagating to oo from lvl " << level << " of " << m_pt.m_head->get_name() << "\n";); if (m_levels.empty()) { return; } diff --git a/src/muz/spacer/spacer_legacy_mbp.cpp b/src/muz/spacer/spacer_legacy_mbp.cpp index 0f49381c1..31614ed91 100644 --- a/src/muz/spacer/spacer_legacy_mbp.cpp +++ b/src/muz/spacer/spacer_legacy_mbp.cpp @@ -55,7 +55,7 @@ void qe_project(ast_manager& m, app_ref_vector& vars, expr_ref& fml, model_ref& qe(vars, fml); rw(fml); - TRACE("spacer", + TRACE(spacer, tout << "After qe_lite:\n"; tout << mk_pp(fml, m) << "\n"; tout << "Vars:\n"; @@ -86,13 +86,13 @@ void qe_project(ast_manager& m, app_ref_vector& vars, expr_ref& fml, model_ref& rep->set_substitution(&sub); (*rep)(fml); rw(fml); - TRACE("spacer", + TRACE(spacer, tout << "Projected Boolean vars:\n" << mk_pp(fml, m) << "\n"; ); } // model based projection if (!arith_vars.empty()) { - TRACE("spacer", + TRACE(spacer, tout << "Arith vars:\n"; for (unsigned i = 0; i < arith_vars.size(); ++i) { tout << mk_pp(arith_vars.get(i), m) << "\n"; @@ -103,7 +103,7 @@ void qe_project(ast_manager& m, app_ref_vector& vars, expr_ref& fml, model_ref& spacer_qe::arith_project(*M, arith_vars, fml, map); } SASSERT(arith_vars.empty()); - TRACE("spacer", + TRACE(spacer, tout << "Projected arith vars:\n" << mk_pp(fml, m) << "\n"; ); } diff --git a/src/muz/spacer/spacer_legacy_mev.cpp b/src/muz/spacer/spacer_legacy_mev.cpp index 57f249274..ce6198f0f 100644 --- a/src/muz/spacer/spacer_legacy_mev.cpp +++ b/src/muz/spacer/spacer_legacy_mev.cpp @@ -51,7 +51,7 @@ void model_evaluator::assign_value(expr* e, expr* val) set_value(e, val); } else { IF_VERBOSE(3, verbose_stream() << "Not evaluated " << mk_pp(e, m) << "\n";); - TRACE("old_spacer", tout << "Variable is not tracked: " << mk_pp(e, m) << "\n";); + TRACE(old_spacer, tout << "Variable is not tracked: " << mk_pp(e, m) << "\n";); set_x(e); } } @@ -88,7 +88,7 @@ void model_evaluator::minimize_literals(ptr_vector const& formulas, const model_ref& mdl, expr_ref_vector& result) { - TRACE("old_spacer", + TRACE(old_spacer, tout << "formulas:\n"; for (unsigned i = 0; i < formulas.size(); ++i) tout << mk_pp(formulas[i], m) << "\n"; ); @@ -118,7 +118,7 @@ void model_evaluator::minimize_literals(ptr_vector const& formulas, } } reset(); - TRACE("old_spacer", + TRACE(old_spacer, tout << "minimized model:\n"; for (unsigned i = 0; i < result.size(); ++i) tout << mk_pp(result[i].get(), m) << "\n"; ); @@ -371,7 +371,7 @@ void model_evaluator::inherit_value(expr* e, expr* v) if (is_true(v)) { set_true(e); } else if (is_false(v)) { set_false(e); } else { - TRACE("old_spacer", tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";); + TRACE(old_spacer, tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";); set_x(e); } } else if (m_arith.is_int_real(e)) { @@ -381,7 +381,7 @@ void model_evaluator::inherit_value(expr* e, expr* v) } else if (m_values.find(v, w)) { set_value(e, w); } else { - TRACE("old_spacer", tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";); + TRACE(old_spacer, tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";); set_x(e); } } @@ -400,7 +400,7 @@ bool model_evaluator::extract_array_func_interp(expr* a, vector { SASSERT(m_array.is_array(a)); - TRACE("old_spacer", tout << mk_pp(a, m) << "\n";); + TRACE(old_spacer, tout << mk_pp(a, m) << "\n";); while (m_array.is_store(a)) { expr_ref_vector store(m); store.append(to_app(a)->get_num_args() - 1, to_app(a)->get_args() + 1); @@ -426,7 +426,7 @@ bool model_evaluator::extract_array_func_interp(expr* a, vector store.push_back(fe->get_result()); for (unsigned j = 0; j < store.size(); ++j) { if (!is_ground(store[j].get())) { - TRACE("old_spacer", tout << "could not extract array interpretation: " << mk_pp(a, m) << "\n" << mk_pp(store[j].get(), m) << "\n";); + TRACE(old_spacer, tout << "could not extract array interpretation: " << mk_pp(a, m) << "\n" << mk_pp(store[j].get(), m) << "\n";); return false; } } @@ -435,21 +435,21 @@ bool model_evaluator::extract_array_func_interp(expr* a, vector } else_case = g->get_else(); if (!else_case) { - TRACE("old_spacer", tout << "no else case " << mk_pp(a, m) << "\n";); + TRACE(old_spacer, tout << "no else case " << mk_pp(a, m) << "\n";); return false; } if (!is_ground(else_case)) { - TRACE("old_spacer", tout << "non-ground else case " << mk_pp(a, m) << "\n" << mk_pp(else_case, m) << "\n";); + TRACE(old_spacer, tout << "non-ground else case " << mk_pp(a, m) << "\n" << mk_pp(else_case, m) << "\n";); return false; } if (m_array.is_as_array(else_case)) { model_ref mr(m_model); else_case = eval(mr, else_case); } - TRACE("old_spacer", tout << "else case: " << mk_pp(else_case, m) << "\n";); + TRACE(old_spacer, tout << "else case: " << mk_pp(else_case, m) << "\n";); return true; } - TRACE("old_spacer", tout << "no translation: " << mk_pp(a, m) << "\n";); + TRACE(old_spacer, tout << "no translation: " << mk_pp(a, m) << "\n";); return false; } @@ -459,7 +459,7 @@ bool model_evaluator::extract_array_func_interp(expr* a, vector */ void model_evaluator::eval_array_eq(app* e, expr* arg1, expr* arg2) { - TRACE("old_spacer", tout << "array equality: " << mk_pp(e, m) << "\n";); + TRACE(old_spacer, tout << "array equality: " << mk_pp(e, m) << "\n";); expr_ref v1(m), v2(m); v1 = (*m_model)(arg1); v2 = (*m_model)(arg2); @@ -471,7 +471,7 @@ void model_evaluator::eval_array_eq(app* e, expr* arg1, expr* arg2) sort* r = get_array_range(s); // give up evaluating finite domain/range arrays if (!r->is_infinite() && !r->is_very_big() && !s->is_infinite() && !s->is_very_big()) { - TRACE("old_spacer", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(old_spacer, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); set_x(e); return; } @@ -479,21 +479,21 @@ void model_evaluator::eval_array_eq(app* e, expr* arg1, expr* arg2) expr_ref else1(m), else2(m); if (!extract_array_func_interp(v1, store, else1) || !extract_array_func_interp(v2, store, else2)) { - TRACE("old_spacer", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(old_spacer, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); set_x(e); return; } if (else1 != else2) { if (m.is_value(else1) && m.is_value(else2)) { - TRACE("old_spacer", tout + TRACE(old_spacer, tout << "defaults are different: " << mk_pp(e, m) << " " << mk_pp(else1, m) << " " << mk_pp(else2, m) << "\n";); set_false(e); } else if (m_array.is_array(else1)) { eval_array_eq(e, else1, else2); } else { - TRACE("old_spacer", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(old_spacer, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); set_x(e); } return; @@ -516,7 +516,7 @@ void model_evaluator::eval_array_eq(app* e, expr* arg1, expr* arg2) continue; } if (m.is_value(w1) && m.is_value(w2)) { - TRACE("old_spacer", tout << "Equality evaluation: " << mk_pp(e, m) << "\n"; + TRACE(old_spacer, tout << "Equality evaluation: " << mk_pp(e, m) << "\n"; tout << mk_pp(s1, m) << " |-> " << mk_pp(w1, m) << "\n"; tout << mk_pp(s2, m) << " |-> " << mk_pp(w2, m) << "\n";); set_false(e); @@ -526,7 +526,7 @@ void model_evaluator::eval_array_eq(app* e, expr* arg1, expr* arg2) continue; } } else { - TRACE("old_spacer", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(old_spacer, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); set_x(e); } return; @@ -560,7 +560,7 @@ void model_evaluator::eval_eq(app* e, expr* arg1, expr* arg2) } else if (e1 == e2) { set_bool(e, true); } else { - TRACE("old_spacer", tout << "not value equal:\n" << mk_pp(e1, m) << "\n" << mk_pp(e2, m) << "\n";); + TRACE(old_spacer, tout << "not value equal:\n" << mk_pp(e1, m) << "\n" << mk_pp(e2, m) << "\n";); set_x(e); } } @@ -746,7 +746,7 @@ bool model_evaluator::check_model(ptr_vector const& formulas) for (unsigned i = 0; i < formulas.size(); ++i) { expr * form = formulas[i]; SASSERT(!is_unknown(form)); - TRACE("spacer_verbose", + TRACE(spacer_verbose, tout << "formula is " << (is_true(form) ? "true" : is_false(form) ? "false" : "unknown") << "\n" << mk_pp(form, m) << "\n";); if (is_false(form)) { @@ -755,7 +755,7 @@ bool model_evaluator::check_model(ptr_vector const& formulas) } if (is_x(form)) { IF_VERBOSE(0, verbose_stream() << "formula undetermined in model: " << mk_pp(form, m) << "\n";); - TRACE("old_spacer", model_smt2_pp(tout, m, *m_model, 0);); + TRACE(old_spacer, model_smt2_pp(tout, m, *m_model, 0);); has_x = true; } } diff --git a/src/muz/spacer/spacer_legacy_mev.h b/src/muz/spacer/spacer_legacy_mev.h index 9f4fc909e..1587466c3 100644 --- a/src/muz/spacer/spacer_legacy_mev.h +++ b/src/muz/spacer/spacer_legacy_mev.h @@ -71,7 +71,7 @@ class model_evaluator { { set_v(x); m_numbers.insert(x, v); - TRACE("spacer_verbose", tout << mk_pp(x, m) << " " << v << "\n";); + TRACE(spacer_verbose, tout << mk_pp(x, m) << " " << v << "\n";); } expr* get_value(expr* x) { return m_values.find(x); } void set_value(expr* x, expr* v) diff --git a/src/muz/spacer/spacer_manager.cpp b/src/muz/spacer/spacer_manager.cpp index 470901a96..e1facfb27 100644 --- a/src/muz/spacer/spacer_manager.cpp +++ b/src/muz/spacer/spacer_manager.cpp @@ -97,7 +97,7 @@ void inductive_property::to_model(model_ref& md) const { expr_ref q = expr_abstract(sig_vars, prop); md->register_decl(ri.m_pred, q); } - TRACE("spacer", tout << *md;); + TRACE(spacer, tout << *md;); apply(const_cast(m_mc), md); } diff --git a/src/muz/spacer/spacer_matrix.cpp b/src/muz/spacer/spacer_matrix.cpp index 02d411950..241db59db 100644 --- a/src/muz/spacer/spacer_matrix.cpp +++ b/src/muz/spacer/spacer_matrix.cpp @@ -131,7 +131,7 @@ bool spacer_matrix::is_lin_reltd(unsigned i, unsigned j, rational &coeff1, for (unsigned k = 0; k < m_num_rows; k++) { if (((coeff1 * m_matrix[k][i]) + (coeff2 * m_matrix[k][j]) + off) != rational::zero()) { - TRACE("cvx_dbg_verb", + TRACE(cvx_dbg_verb, tout << "Didn't work for " << m_matrix[k][i] << " and " << m_matrix[k][j] << " with coefficients " << coeff1 << " , " << coeff2 << " and offset " << off << "\n";); @@ -165,7 +165,7 @@ bool spacer_matrix::compute_linear_deps(spacer_matrix &eq) const { lin_dep[m_num_cols] = off; eq.add_row(lin_dep); - TRACE("cvx_dbg_verb", { + TRACE(cvx_dbg_verb, { tout << "Adding row "; for (rational r : lin_dep) tout << r << " "; tout << "\n"; diff --git a/src/muz/spacer/spacer_mbc.cpp b/src/muz/spacer/spacer_mbc.cpp index df0ce1cb4..78c2799ec 100644 --- a/src/muz/spacer/spacer_mbc.cpp +++ b/src/muz/spacer/spacer_mbc.cpp @@ -94,7 +94,7 @@ void mbc::operator()(const partition_map &pmap, expr_ref_vector &lits, } } - TRACE("mbc", tout << "Input: " << lits << "\n" + TRACE(mbc, tout << "Input: " << lits << "\n" << "Output: \n"; for (auto &vec : res) tout << vec << "\n==================\n";); } diff --git a/src/muz/spacer/spacer_mev_array.cpp b/src/muz/spacer/spacer_mev_array.cpp index aef528359..92949130b 100644 --- a/src/muz/spacer/spacer_mev_array.cpp +++ b/src/muz/spacer/spacer_mev_array.cpp @@ -46,7 +46,7 @@ void model_evaluator_array_util::eval_exprs(model& mdl, expr_ref_vector& es) { bool model_evaluator_array_util::extract_array_func_interp(model& mdl, expr* a, vector& stores, expr_ref& else_case) { SASSERT(m_array.is_array(a)); - TRACE("model_evaluator", tout << mk_pp(a, m) << "\n";); + TRACE(model_evaluator, tout << mk_pp(a, m) << "\n";); while (m_array.is_store(a)) { expr_ref_vector store(m); store.append(to_app(a)->get_num_args()-1, to_app(a)->get_args()+1); @@ -72,7 +72,7 @@ bool model_evaluator_array_util::extract_array_func_interp(model& mdl, expr* a, store.push_back(fe->get_result()); for (unsigned j = 0; j < store.size(); ++j) { if (!is_ground(store[j].get())) { - TRACE("model_evaluator", tout << "could not extract array interpretation: " << mk_pp(a, m) << "\n" << mk_pp(store[j].get(), m) << "\n";); + TRACE(model_evaluator, tout << "could not extract array interpretation: " << mk_pp(a, m) << "\n" << mk_pp(store[j].get(), m) << "\n";); return false; } } @@ -81,11 +81,11 @@ bool model_evaluator_array_util::extract_array_func_interp(model& mdl, expr* a, } else_case = g->get_else(); if (!else_case) { - TRACE("model_evaluator", tout << "no else case " << mk_pp(a, m) << "\n";); + TRACE(model_evaluator, tout << "no else case " << mk_pp(a, m) << "\n";); return false; } if (!is_ground(else_case)) { - TRACE("model_evaluator", tout << "non-ground else case " << mk_pp(a, m) << "\n" << mk_pp(else_case, m) << "\n";); + TRACE(model_evaluator, tout << "non-ground else case " << mk_pp(a, m) << "\n" << mk_pp(else_case, m) << "\n";); return false; } if (m_array.is_as_array(else_case)) { @@ -93,16 +93,16 @@ bool model_evaluator_array_util::extract_array_func_interp(model& mdl, expr* a, eval(mdl, else_case, r); else_case = r; } - TRACE("model_evaluator", tout << "else case: " << mk_pp(else_case, m) << "\n";); + TRACE(model_evaluator, tout << "else case: " << mk_pp(else_case, m) << "\n";); return true; } - TRACE("model_evaluator", tout << "no translation: " << mk_pp(a, m) << "\n";); + TRACE(model_evaluator, tout << "no translation: " << mk_pp(a, m) << "\n";); return false; } void model_evaluator_array_util::eval_array_eq(model& mdl, app* e, expr* arg1, expr* arg2, expr_ref& res) { - TRACE("model_evaluator", tout << "array equality: " << mk_pp(e, m) << "\n";); + TRACE(model_evaluator, tout << "array equality: " << mk_pp(e, m) << "\n";); expr_ref v1(m), v2(m); eval (mdl, arg1, v1); eval (mdl, arg2, v2); @@ -114,7 +114,7 @@ void model_evaluator_array_util::eval_array_eq(model& mdl, app* e, expr* arg1, e sort* r = get_array_range(s); // give up evaluating finite domain/range arrays if (!r->is_infinite() && !r->is_very_big() && !s->is_infinite() && !s->is_very_big()) { - TRACE("model_evaluator", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(model_evaluator, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); res.reset (); return; } @@ -122,14 +122,14 @@ void model_evaluator_array_util::eval_array_eq(model& mdl, app* e, expr* arg1, e expr_ref else1(m), else2(m); if (!extract_array_func_interp(mdl, v1, store, else1) || !extract_array_func_interp(mdl, v2, store, else2)) { - TRACE("model_evaluator", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(model_evaluator, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); res.reset (); return; } if (else1 != else2) { if (m.is_value(else1) && m.is_value(else2)) { - TRACE("model_evaluator", tout + TRACE(model_evaluator, tout << "defaults are different: " << mk_pp(e, m) << " " << mk_pp(else1, m) << " " << mk_pp(else2, m) << "\n";); res = m.mk_false (); @@ -138,7 +138,7 @@ void model_evaluator_array_util::eval_array_eq(model& mdl, app* e, expr* arg1, e eval_array_eq(mdl, e, else1, else2, res); } else { - TRACE("model_evaluator", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(model_evaluator, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); res.reset (); } return; @@ -161,7 +161,7 @@ void model_evaluator_array_util::eval_array_eq(model& mdl, app* e, expr* arg1, e continue; } if (m.is_value(w1) && m.is_value(w2)) { - TRACE("model_evaluator", tout << "Equality evaluation: " << mk_pp(e, m) << "\n"; + TRACE(model_evaluator, tout << "Equality evaluation: " << mk_pp(e, m) << "\n"; tout << mk_pp(s1, m) << " |-> " << mk_pp(w1, m) << "\n"; tout << mk_pp(s2, m) << " |-> " << mk_pp(w2, m) << "\n";); res = m.mk_false (); @@ -173,7 +173,7 @@ void model_evaluator_array_util::eval_array_eq(model& mdl, app* e, expr* arg1, e } } else { - TRACE("model_evaluator", tout << "equality is unknown: " << mk_pp(e, m) << "\n";); + TRACE(model_evaluator, tout << "equality is unknown: " << mk_pp(e, m) << "\n";); res.reset (); } return; diff --git a/src/muz/spacer/spacer_pdr.cpp b/src/muz/spacer/spacer_pdr.cpp index 7de091aa7..655112670 100644 --- a/src/muz/spacer/spacer_pdr.cpp +++ b/src/muz/spacer/spacer_pdr.cpp @@ -236,7 +236,7 @@ lbool context::gpdr_solve_core() { for (lvl = 0; lvl < max_level; ++lvl) { checkpoint(); IF_VERBOSE(1,verbose_stream() << "GPDR Entering level "<< lvl << "\n";); - STRACE("spacer_progress", tout << "\n* LEVEL " << lvl << "\n";); + STRACE(spacer_progress, tout << "\n* LEVEL " << lvl << "\n";); m_expanded_lvl = infty_level(); m_stats.m_max_query_lvl = lvl; if (gpdr_check_reachability(lvl, ms)) {return l_true;} @@ -268,7 +268,7 @@ bool context::gpdr_check_reachability(unsigned lvl, model_search &ms) { // check reachable cache if (pt.is_must_reachable(node->pob()->post(), nullptr)) { - TRACE("spacer", + TRACE(spacer, tout << "must-reachable: " << pt.head()->get_name() << " level: " << node->level() << " depth: " << node->depth () << "\n"; tout << mk_pp(node->pob()->post(), m) << "\n";); @@ -290,7 +290,7 @@ bool context::gpdr_check_reachability(unsigned lvl, model_search &ms) { case l_undef: SASSERT(!new_pobs.empty()); for (auto pob : new_pobs) { - TRACE("spacer_pdr", + TRACE(spacer_pdr, tout << "looking at pob at level " << pob->level() << " " << mk_pp(pob->post(), m) << "\n";); if (pob != node->pob()) @@ -358,7 +358,7 @@ bool context::gpdr_create_split_children(pob &n, const datalog::rule &r, << (k->use_farkas_generalizer() ? "FAR " : "SUB ") << k->post()->get_id(); verbose_stream().flush();); - TRACE ("spacer", + TRACE(spacer, tout << "create-pob: " << k->pt().head()->get_name() << " level: " << k->level() << " depth: " << k->depth () diff --git a/src/muz/spacer/spacer_proof_utils.cpp b/src/muz/spacer/spacer_proof_utils.cpp index 114dfc885..568f2e872 100644 --- a/src/muz/spacer/spacer_proof_utils.cpp +++ b/src/muz/spacer/spacer_proof_utils.cpp @@ -282,7 +282,7 @@ namespace spacer { parameter const *params) { if(num_params != parents.size() + 1) { //TODO: fix bug - TRACE("spacer.fkab", tout << "UNEXPECTED INPUT TO FUNCTION. Bailing out\n";); + TRACE(spacer_fkab, tout << "UNEXPECTED INPUT TO FUNCTION. Bailing out\n";); return proof_ref(m); } SASSERT(num_params == parents.size() + 1 /* one param is missing */); @@ -294,7 +294,7 @@ namespace spacer { for (unsigned i = 1, sz = parents.size(); i < sz; ++i) { app *p = to_app(m.get_fact(parents.get(i))); rational const &r = params[i+1].get_rational(); - TRACE("spacer.fkab", tout << "Adding to LCB: " << mk_pp(p, m) << "\n";); + TRACE(spacer_fkab, tout << "Adding to LCB: " << mk_pp(p, m) << "\n";); lcb.add_lit(p, r); } @@ -305,30 +305,30 @@ namespace spacer { // XXX this might simplify a coefficient of a variable leading to unsoundness. // XXX For example, it will simplify 4*x >= 0 into x >= 0 //rw(lit0); - TRACE("spacer.fkab", + TRACE(spacer_fkab, tout << "lit0 is: " << lit0 << "\n" << "LCB is: " << lcb() << "\n";); expr_ref var(m), val1(m), val2(m); val1 = get_coeff(lit0, var); val2 = get_coeff(lcb(), var); - TRACE("spacer.fkab", + TRACE(spacer_fkab, tout << "var: " << var << " val1: " << val1 << " val2: " << val2 << "\n";); rational rat1, rat2, coeff0; - CTRACE("spacer.fkab", !(val1 && val2), + CTRACE(spacer_fkab, !(val1 && val2), tout << "Failed to match variables\n";); if (val1 && val2 && a.is_numeral(val1, rat1) && a.is_numeral(val2, rat2)) { coeff0 = abs(rat2/rat1); coeff0 = coeff0 / lcb.lc(); - TRACE("spacer.fkab", tout << "coeff0: " << coeff0 << "\n";); + TRACE(spacer_fkab, tout << "coeff0: " << coeff0 << "\n";); } else { IF_VERBOSE(1, verbose_stream() << "\n\n\nFAILED TO FIND COEFFICIENT\n\n\n";); - TRACE("spacer.fkab", tout << "FAILED TO FIND COEFFICIENT\n";); + TRACE(spacer_fkab, tout << "FAILED TO FIND COEFFICIENT\n";); // failed to find a coefficient return proof_ref(m); } @@ -350,7 +350,7 @@ namespace spacer { v.size(), v.data()); SASSERT(is_arith_lemma(m, pf)); - TRACE("spacer.fkab", tout << mk_pp(pf, m) << "\n";); + TRACE(spacer_fkab, tout << mk_pp(pf, m) << "\n";); DEBUG_CODE( proof_checker pc(m); @@ -403,7 +403,7 @@ namespace spacer { func_decl *d = p->get_decl(); if (is_assign_bounds_lemma(m, p)) { - TRACE("spacer.fkab", tout << mk_pp(p, m) << "\n";); + TRACE(spacer_fkab, tout << mk_pp(p, m) << "\n";); th_lemma = mk_fk_from_ab(m, hyps, d->get_num_parameters(), d->get_parameters()); diff --git a/src/muz/spacer/spacer_prop_solver.cpp b/src/muz/spacer/spacer_prop_solver.cpp index a543f5c86..76f480078 100644 --- a/src/muz/spacer/spacer_prop_solver.cpp +++ b/src/muz/spacer/spacer_prop_solver.cpp @@ -123,7 +123,7 @@ void prop_solver::assert_expr(expr * form) m_contexts[0]->assert_expr(form); m_contexts[1]->assert_expr(form); IF_VERBOSE(21, verbose_stream() << "$ asserted " << mk_pp(form, m) << "\n";); - TRACE("spacer", tout << "add_formula: " << mk_pp(form, m) << "\n";); + TRACE(spacer, tout << "add_formula: " << mk_pp(form, m) << "\n";); } void prop_solver::assert_expr(expr * form, unsigned level) @@ -332,7 +332,7 @@ lbool prop_solver::internal_check_assumptions(expr_ref_vector &hard_atoms, } if (result == l_false && m_core && m.proofs_enabled() && !m_subset_based_core) { - TRACE("spacer", tout << "Using IUC core\n";); + TRACE(spacer, tout << "Using IUC core\n";); m_core->reset(); m_ctx->get_iuc(*m_core); } else if (result == l_false && m_core) { @@ -386,13 +386,13 @@ lbool prop_solver::check_assumptions(const expr_ref_vector & _hard, lbool res = internal_check_assumptions(hard, soft, clauses); if (!m_use_push_bg) { m_ctx->pop(1); } - TRACE("psolve_verbose", + TRACE(psolve_verbose, tout << "sat: " << mk_pp(mk_and(hard), m) << "\n" << mk_pp(mk_and(soft), m) << "\n"; for (unsigned i = 0; i < num_bg; ++i) tout << "bg" << i << ": " << mk_pp(bg[i], m) << "\n"; tout << "res: " << res << "\n";); - CTRACE("psolve", m_core, + CTRACE(psolve, m_core, tout << "core is: " << mk_pp(mk_and(*m_core), m) << "\n";); SASSERT(soft_sz >= soft.size()); diff --git a/src/muz/spacer/spacer_qe_project.cpp b/src/muz/spacer/spacer_qe_project.cpp index 124563057..609703fb2 100644 --- a/src/muz/spacer/spacer_qe_project.cpp +++ b/src/muz/spacer/spacer_qe_project.cpp @@ -225,7 +225,7 @@ class arith_project_util { else if ((*m_var)(t)) { IF_VERBOSE(2, verbose_stream() << "can't project:" << mk_pp(t, m) << "\n";); - TRACE("qe", tout << "Failed to project: " << mk_pp(t, m) << "\n";); + TRACE(qe, tout << "Failed to project: " << mk_pp(t, m) << "\n";); res = false; } else if (mul.is_one()) { @@ -303,7 +303,7 @@ class arith_project_util { } else { IF_VERBOSE(2, verbose_stream() << "can't project:" << mk_pp(lit, m) << "\n";); - TRACE("qe", + TRACE(qe, tout << "Failed to project: " << mk_pp(lit, m) << "\n";); return false; } @@ -391,7 +391,7 @@ class arith_project_util { return false; } if (use_eq) { - TRACE("qe", tout << "Using equality term: " << mk_pp(eq_term, m) + TRACE(qe, tout << "Using equality term: " << mk_pp(eq_term, m) << "\n";); // substitute eq_term for x everywhere for (unsigned i = 0; i < m_lits.size(); ++i) { @@ -428,7 +428,7 @@ class arith_project_util { new_lit = mk_lt(i, max_t); } lits.push_back(new_lit); - TRACE("qe", tout << "Old literal: " << mk_pp(m_lits.get(i), m) + TRACE(qe, tout << "Old literal: " << mk_pp(m_lits.get(i), m) << "\n"; tout << "New literal: " << mk_pp(new_lit, m) << "\n";); } @@ -459,11 +459,11 @@ class arith_project_util { bool is_diseq = false; if (!(*m_var)(lits.get(i))) continue; if (is_linear(lits.get(i), c, t, d, is_strict, is_eq, is_diseq)) { - TRACE("qe", + TRACE(qe, tout << "Literal: " << mk_pp(lits.get(i), m) << "\n";); if (c.is_zero()) { - TRACE("qe", tout << "independent of variable\n";); + TRACE(qe, tout << "independent of variable\n";); continue; } @@ -476,7 +476,7 @@ class arith_project_util { VERIFY(a.is_numeral(val, r)); if (is_eq) { - TRACE("qe", tout << "equality term\n";); + TRACE(qe, tout << "equality term\n";); // check if the equality is true in the mdl if (eq_idx == lits.size() && r == rational::zero()) { eq_idx = m_lits.size(); @@ -489,7 +489,7 @@ class arith_project_util { m_divs.push_back(d); } else { - TRACE("qe", tout << "not an equality term\n";); + TRACE(qe, tout << "not an equality term\n";); if (is_diseq) { // c*x + t != 0 // find out whether c*x + t < 0, or c*x + t > 0 @@ -520,7 +520,7 @@ class arith_project_util { } } } - TRACE("qe", tout << "c: " << c << "\n"; + TRACE(qe, tout << "c: " << c << "\n"; tout << "t: " << mk_pp(t, m) << "\n"; tout << "d: " << d << "\n";); } @@ -546,7 +546,7 @@ class arith_project_util { m_divs[i] *= factor; lcm_divs = lcm(lcm_divs, m_divs[i]); } - TRACE("qe", tout << "normalized coeff: " << m_coeffs[i] << "\n"; + TRACE(qe, tout << "normalized coeff: " << m_coeffs[i] << "\n"; tout << "normalized term: " << mk_pp(m_terms.get(i), m) << "\n"; tout << "normalized div: " << m_divs[i] << "\n";); @@ -555,7 +555,7 @@ class arith_project_util { // consider new divisibility literal (lcm_coeffs | (lcm_coeffs * x)) lcm_divs = lcm(lcm_divs, lcm_coeffs); - TRACE("qe", tout << "lcm of coeffs: " << lcm_coeffs << "\n"; + TRACE(qe, tout << "lcm of coeffs: " << lcm_coeffs << "\n"; tout << "lcm of divs: " << lcm_divs << "\n";); } @@ -571,7 +571,7 @@ class arith_project_util { m); m_rw(eq_term); map.insert(m_var->x(), eq_term, nullptr); - TRACE("qe", tout << "Using equality term: " << mk_pp(eq_term, m) + TRACE(qe, tout << "Using equality term: " << mk_pp(eq_term, m) << "\n";); } else { @@ -582,7 +582,7 @@ class arith_project_util { x_term_val = m_terms.get(eq_idx); m_rw(x_term_val); - TRACE("qe", tout << "Using equality literal: " + TRACE(qe, tout << "Using equality literal: " << mk_pp(m_lits.get(eq_idx), m) << "\n"; tout << "substitution for (lcm_coeffs * x): " << mk_pp(x_term_val, m) << "\n";); @@ -606,7 +606,7 @@ class arith_project_util { if (num_pos == 0 || num_neg == 0) { TRACE( - "qe", + qe, if (num_pos == 0) { tout << "virtual substitution with +infinity\n"; } else { tout << "virtual substitution with -infinity\n"; }); @@ -628,7 +628,7 @@ class arith_project_util { VERIFY(a.is_numeral(var_val, var_val_num)); x_term_val = a.mk_numeral( mod(lcm_coeffs * var_val_num, lcm_divs), a.mk_int()); - TRACE("qe", tout << "Substitution for (lcm_coeffs * x): " + TRACE(qe, tout << "Substitution for (lcm_coeffs * x): " << mk_pp(x_term_val, m) << "\n";); } for (unsigned i = 0; i < m_lits.size(); i++) { @@ -657,7 +657,7 @@ class arith_project_util { new_lit = m.mk_true(); } map.insert(m_lits.get(i), new_lit, nullptr); - TRACE("qe", tout << "Old literal: " << mk_pp(m_lits.get(i), m) + TRACE(qe, tout << "Old literal: " << mk_pp(m_lits.get(i), m) << "\n"; tout << "New literal: " << mk_pp(new_lit, m) << "\n";); } @@ -669,7 +669,7 @@ class arith_project_util { unsigned max_t = find_max(mdl, use_pos); TRACE( - "qe", + qe, if (use_pos) { tout << "virtual substitution with upper bound:\n"; } else { tout << "virtual substitution with lower bound:\n"; } tout @@ -696,7 +696,7 @@ class arith_project_util { new_lit = m.mk_true(); } map.insert(m_lits.get(i), new_lit, nullptr); - TRACE("qe", tout << "Old literal: " << mk_pp(m_lits.get(i), m) + TRACE(qe, tout << "Old literal: " << mk_pp(m_lits.get(i), m) << "\n"; tout << "New literal: " << mk_pp(new_lit, m) << "\n";); } @@ -745,7 +745,7 @@ class arith_project_util { } m_rw(x_term_val); - TRACE("qe", tout << "substitution for (lcm_coeffs * x): " + TRACE(qe, tout << "substitution for (lcm_coeffs * x): " << mk_pp(x_term_val, m) << "\n";); // obtain substitutions for all literals in map @@ -1105,7 +1105,7 @@ class arith_project_util { } } map.insert(m_lits.get(i), new_lit, nullptr); - TRACE("qe", + TRACE(qe, tout << "Old literal: " << mk_pp(m_lits.get(i), m) << "\n"; tout << "New literal: " << mk_pp(new_lit, m) << "\n";); } @@ -1121,7 +1121,7 @@ class arith_project_util { map.get(old_lit, new_lit, pr); if (new_lit) { sub.insert(old_lit, new_lit); - TRACE("qe", tout << "old lit " << mk_pp(old_lit, m) << "\n"; + TRACE(qe, tout << "old lit " << mk_pp(old_lit, m) << "\n"; tout << "new lit " << mk_pp(new_lit, m) << "\n";); } } @@ -1131,7 +1131,7 @@ class arith_project_util { map.get(m_var->x(), x_term, pr); if (x_term) { sub.insert(m_var->x(), x_term); - TRACE("qe", tout << "substituting " << mk_pp(m_var->x(), m) + TRACE(qe, tout << "substituting " << mk_pp(m_var->x(), m) << " by " << mk_pp(x_term, m) << "\n";); } scoped_ptr rep = mk_default_expr_replacer(m, false); @@ -1159,7 +1159,7 @@ class arith_project_util { verbose_stream() << "can't project:" << mk_pp(v, m) << "\n"; }); TRACE( - "qe", + qe, if (!fail) { tout << "projected: " << mk_pp(v, m) << "\n"; for (unsigned i = 0; i < result.size(); ++i) { @@ -1184,13 +1184,13 @@ class arith_project_util { app_ref_vector new_vars(m); // factor out mod terms by introducing new variables - TRACE("qe", tout << "before factoring out mod terms:" << "\n"; + TRACE(qe, tout << "before factoring out mod terms:" << "\n"; tout << mk_pp(fml, m) << "\n"; tout << "mdl:\n"; model_pp(tout, mdl); tout << "\n";); factor_mod_terms(fml, vars, mdl); - TRACE("qe", tout << "after factoring out mod terms:" << "\n"; + TRACE(qe, tout << "after factoring out mod terms:" << "\n"; tout << mk_pp(fml, m) << "\n"; tout << "updated mdl:\n"; model_pp(tout, mdl); tout << "\n";); @@ -1198,7 +1198,7 @@ class arith_project_util { // expr_map map (m); for (unsigned i = 0; i < vars.size(); ++i) { app *v = vars.get(i); - TRACE("qe", + TRACE(qe, tout << "projecting variable: " << mk_pp(v, m) << "\n";); m_var = alloc(contains_app, m, v); map.reset(); @@ -1207,7 +1207,7 @@ class arith_project_util { // factor out mod terms using div terms expr_map mod_map(m); mod2div(fml, mod_map); - TRACE("qe", tout << "after mod2div:" << "\n"; + TRACE(qe, tout << "after mod2div:" << "\n"; tout << mk_pp(fml, m) << "\n";); } collect_lits(fml, lits); @@ -1215,12 +1215,12 @@ class arith_project_util { if (project(mdl, lits, map, div_lit)) { substitute(fml, lits, map); if (div_lit) { fml = m.mk_and(fml, div_lit); } - TRACE("qe", tout << "projected: " << mk_pp(v, m) << " " + TRACE(qe, tout << "projected: " << mk_pp(v, m) << " " << mk_pp(fml, m) << "\n";); } else { IF_VERBOSE(2, verbose_stream() << "can't project:" << mk_pp(v, m) << "\n";); - TRACE("qe", + TRACE(qe, tout << "Failed to project: " << mk_pp(v, m) << "\n";); new_vars.push_back(v); } @@ -1296,7 +1296,7 @@ class array_project_eqs_util { (m_arr_u.is_store(a) && (a->get_arg(0) == m_v))) { m_has_stores_v.mark(a, true); - TRACE("qe", tout << "has stores:\n" << mk_pp(a, m) << "\n"); + TRACE(qe, tout << "has stores:\n" << mk_pp(a, m) << "\n"); } // check if a is a relevant array equality @@ -1429,7 +1429,7 @@ class array_project_eqs_util { mk_peq(eq->get_arg(0), eq->get_arg(1), 0, nullptr, p_exp); bool subst_eq_found = false; while (true) { - TRACE("qe", tout << "processing peq:\n"; + TRACE(qe, tout << "processing peq:\n"; tout << mk_pp(p_exp, m) << "\n";); peq p(p_exp, m); @@ -1476,13 +1476,13 @@ class array_project_eqs_util { } } if (idx_in_I) { - TRACE("qe", tout << "store index in diff indices:\n"; + TRACE(qe, tout << "store index in diff indices:\n"; tout << mk_pp(m_idx_lits_v.back(), m) << "\n";); // arr0 ==I arr1 mk_peq(arr0, arr1, I.size(), I.data(), p_exp); - TRACE("qe", tout << "new peq:\n"; + TRACE(qe, tout << "new peq:\n"; tout << mk_pp(p_exp, m) << "\n";); } else { m_idx_lits_v.append(idx_diseq); @@ -1490,7 +1490,7 @@ class array_project_eqs_util { I.push_back(idx); mk_peq(arr0, arr1, I.size(), I.data(), p_exp); - TRACE("qe", tout << "new peq:\n"; + TRACE(qe, tout << "new peq:\n"; tout << mk_pp(p_exp, m) << "\n";); // arr1[idx] == x @@ -1502,14 +1502,14 @@ class array_project_eqs_util { expr_ref eq(m.mk_eq(arr1_idx, x), m); m_aux_lits_v.push_back(eq); - TRACE("qe", tout << "new eq:\n"; + TRACE(qe, tout << "new eq:\n"; tout << mk_pp(eq, m) << "\n";); } } else if (lhs == rhs) { // trivial peq (a ==I a) break; } else if (lhs == m_v || rhs == m_v) { subst_eq_found = true; - TRACE("qe", tout << "subst eq found!\n";); + TRACE(qe, tout << "subst eq found!\n";); break; } else { UNREACHABLE(); @@ -1521,7 +1521,7 @@ class array_project_eqs_util { factor_selects(p_exp); TRACE( - "qe", tout << "after factoring selects:\n"; + qe, tout << "after factoring selects:\n"; tout << mk_pp(p_exp, m) << "\n"; for (unsigned i = m_aux_lits_v.size() - m_aux_vars.size(); i < m_aux_lits_v.size(); @@ -1535,7 +1535,7 @@ class array_project_eqs_util { convert_peq_to_eq(p_exp, eq, stores_on_rhs); m_subst_term_v = eq->get_arg(1); - TRACE("qe", tout << "subst term found:\n"; + TRACE(qe, tout << "subst term found:\n"; tout << mk_pp(m_subst_term_v, m) << "\n";); } } @@ -1551,13 +1551,13 @@ class array_project_eqs_util { find_arr_eqs(fml, eqs); TRACE( - "qe", tout << "array equalities:\n"; + qe, tout << "array equalities:\n"; for (unsigned i = 0; i < eqs.size(); i++) { tout << mk_pp(eqs.get(i), m) << "\n"; }); // evaluate eqs in M for (unsigned i = 0; i < eqs.size(); i++) { - TRACE("qe", tout << "array equality:\n"; + TRACE(qe, tout << "array equality:\n"; tout << mk_pp(eqs.get(i), m) << "\n";); expr *eq = eqs.get(i); @@ -1630,7 +1630,7 @@ class array_project_eqs_util { if (j < i) { true_eqs.set(j, eq); nds.set(j, nd); - TRACE("qe", tout << "changing eq order!\n";); + TRACE(qe, tout << "changing eq order!\n";); } } @@ -1685,12 +1685,12 @@ class array_project_eqs_util { reset_v(); m_v = arr_vars.get(i); if (!m_arr_u.is_array(m_v)) { - TRACE("qe", tout << "not an array variable: " << mk_pp(m_v, m) + TRACE(qe, tout << "not an array variable: " << mk_pp(m_v, m) << "\n";); aux_vars.push_back(m_v); continue; } - TRACE("qe", tout << "projecting equalities on variable: " + TRACE(qe, tout << "projecting equalities on variable: " << mk_pp(m_v, m) << "\n";); if (project(fml)) { @@ -1700,12 +1700,12 @@ class array_project_eqs_util { if (!m_subst_term_v || contains_v(m_subst_term_v)) { rem_arr_vars.push_back(m_v); } - TRACE("qe", tout << "after projection: \n"; + TRACE(qe, tout << "after projection: \n"; tout << mk_pp(fml, m) << "\n";); } else { IF_VERBOSE(2, verbose_stream() << "can't project:" << mk_pp(m_v, m) << "\n";); - TRACE("qe", + TRACE(qe, tout << "Failed to project: " << mk_pp(m_v, m) << "\n";); rem_arr_vars.push_back(m_v); } @@ -1863,7 +1863,7 @@ class array_select_reducer { // simplify all trivial expressions introduced m_rw(fml); - TRACE("qe", tout << "after reducing selects:\n"; + TRACE(qe, tout << "after reducing selects:\n"; tout << mk_pp(fml, m) << "\n";); } @@ -1891,7 +1891,7 @@ class array_select_reducer { mk_result(fml); } else { IF_VERBOSE(2, verbose_stream() << "can't project arrays:" << "\n";); - TRACE("qe", tout << "Failed to project arrays\n";); + TRACE(qe, tout << "Failed to project arrays\n";); } } }; @@ -2079,7 +2079,7 @@ class array_project_selects_util { // substitute for sel terms m_sub(fml); - TRACE("qe", tout << "after projection of selects:\n"; + TRACE(qe, tout << "after projection of selects:\n"; tout << mk_pp(fml, m) << "\n";); } @@ -2093,13 +2093,13 @@ class array_project_selects_util { // model based ackermannization for (auto const &[key, value] : m_sel_terms) { - TRACE("qe", + TRACE(qe, tout << "ackermann for var: " << mk_pp(key, m) << "\n";); ackermann(*value); } TRACE( - "qe", tout << "idx lits:\n"; + qe, tout << "idx lits:\n"; for (unsigned i = 0; i < m_idx_lits.size(); i++) { tout << mk_pp(m_idx_lits.get(i), m) << "\n"; }); @@ -2135,7 +2135,7 @@ class array_project_selects_util { arr_vars.reset(); } else { IF_VERBOSE(2, verbose_stream() << "can't project arrays:" << "\n";); - TRACE("qe", tout << "Failed to project arrays\n";); + TRACE(qe, tout << "Failed to project arrays\n";); } // dealloc @@ -2206,7 +2206,7 @@ void array_project(model &mdl, app_ref_vector &arr_vars, expr_ref &fml, app_ref_vector &aux_vars, bool reduce_all_selects) { // 1. project array equalities array_project_eqs(mdl, arr_vars, fml, aux_vars); - TRACE("qe", + TRACE(qe, tout << "Projected array eqs:\n" << fml << "\n"; tout << "Remaining array vars:\n" << arr_vars; tout << "Aux vars:\n" << aux_vars;); @@ -2217,12 +2217,12 @@ void array_project(model &mdl, app_ref_vector &arr_vars, expr_ref &fml, } else { reduce_array_selects(mdl, arr_vars, fml); } - TRACE("qe", tout << "Reduced selects:\n" << fml << "\n";); + TRACE(qe, tout << "Reduced selects:\n" << fml << "\n";); // 3. project selects using model based ackermannization array_project_selects(mdl, arr_vars, fml, aux_vars); TRACE( - "qe", + qe, tout << "Projected array selects:\n"; tout << fml << "\n"; tout << "All aux vars:\n" << aux_vars;); diff --git a/src/muz/spacer/spacer_quant_generalizer.cpp b/src/muz/spacer/spacer_quant_generalizer.cpp index ea56cb8f4..c3dde50aa 100644 --- a/src/muz/spacer/spacer_quant_generalizer.cpp +++ b/src/muz/spacer/spacer_quant_generalizer.cpp @@ -172,7 +172,7 @@ void lemma_quantifier_generalizer::find_candidates(expr *e, } app *index = indices.get(idx); - TRACE ("spacer_qgen", tout << "Candidate: "<< mk_pp(index, m) + TRACE(spacer_qgen, tout << "Candidate: "<< mk_pp(index, m) << " in " << mk_pp(e, m) << "\n";); extra.push_back(index); if (m_arith.is_add(index)) { @@ -254,7 +254,7 @@ void lemma_quantifier_generalizer::cleanup(expr_ref_vector &cube, for (expr *e : cube) { if (match_sk_idx(e, zks, idx, sk)) { - CTRACE("spacer_qgen", idx != sk, + CTRACE(spacer_qgen, idx != sk, tout << "Possible cleanup of " << mk_pp(idx, m) << " in " << mk_pp(e, m) << " on " << mk_pp(sk, m) << "\n";); @@ -278,7 +278,7 @@ void lemma_quantifier_generalizer::cleanup(expr_ref_vector &cube, rep = arith.mk_add(kids.size(), kids.data()); bind = arith.mk_add(kids_bind.size(), kids_bind.data()); - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "replace " << mk_pp(idx, m) << " with " << mk_pp(rep, m) << "\n" << "bind is: " << bind << "\n";); break; @@ -290,7 +290,7 @@ void lemma_quantifier_generalizer::cleanup(expr_ref_vector &cube, rw.insert(sk, rep); rw.insert(idx, sk); rw(cube); - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "Cleaned cube to: " << mk_and(cube) << "\n";); } } @@ -507,12 +507,12 @@ bool lemma_quantifier_generalizer::generalize (lemma_ref &lemma, app *term) { mk_abs_cube(lemma, term, var, gnd_cube, abs_cube, lb, ub, stride); if (abs_cube.empty()) {return false;} if (has_nlira(abs_cube)) { - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "non-linear expression: " << abs_cube << "\n";); return false; } - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "abs_cube is: " << mk_and(abs_cube) << "\n"; tout << "term: " << mk_pp(term, m) << "\n"; tout << "lb = "; @@ -544,7 +544,7 @@ bool lemma_quantifier_generalizer::generalize (lemma_ref &lemma, app *term) { if (stride > 1 && m_arith.is_numeral(constant, init)) { unsigned mod = init.get_unsigned() % stride; - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "mod=" << mod << " init=" << init << " stride=" << stride << "\n"; tout.flush();); abs_cube.push_back @@ -558,14 +558,14 @@ bool lemma_quantifier_generalizer::generalize (lemma_ref &lemma, app *term) { ground_expr(mk_and(abs_cube), gnd, zks); flatten_and(gnd, gnd_cube); - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "New CUBE is: " << gnd_cube << "\n";); // check if the result is a true lemma unsigned uses_level = 0; pred_transformer &pt = lemma->get_pob()->pt(); if (pt.check_inductive(lemma->level(), gnd_cube, uses_level, lemma->weakness())) { - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "Quantifier Generalization Succeeded!\n" << "New CUBE is: " << gnd_cube << "\n";); SASSERT(zks.size() >= static_cast(m_offset)); @@ -612,7 +612,7 @@ bool lemma_quantifier_generalizer::find_stride(expr_ref_vector &cube, app_ref_vector indices(m); get_select_indices(pattern, indices); - CTRACE("spacer_qgen", indices.empty(), + CTRACE(spacer_qgen, indices.empty(), tout << "Found no select indices in: " << pattern << "\n";); // TBD: handle multi-dimensional arrays and literals with multiple @@ -664,7 +664,7 @@ bool lemma_quantifier_generalizer::find_stride(expr_ref_vector &cube, if (candidate->get_num_args() == matched) instances.push_back(0); - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "Match succeeded!\n";); } @@ -674,7 +674,7 @@ bool lemma_quantifier_generalizer::find_stride(expr_ref_vector &cube, std::sort(instances.begin(), instances.end()); stride = instances[1]-instances[0]; - TRACE("spacer_qgen", tout << "Index Stride is: " << stride << "\n";); + TRACE(spacer_qgen, tout << "Index Stride is: " << stride << "\n";); return true; } @@ -686,7 +686,7 @@ void lemma_quantifier_generalizer::operator()(lemma_ref &lemma) { m_st.count++; scoped_watch _w_(m_st.watch); - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "initial cube: " << mk_and(lemma->get_cube()) << "\n";); // setup the cube @@ -700,7 +700,7 @@ void lemma_quantifier_generalizer::operator()(lemma_ref &lemma) { normalize(c, c, false, true); m_cube.reset(); flatten_and(c, m_cube); - TRACE("spacer_qgen", + TRACE(spacer_qgen, tout << "normalized cube:\n" << mk_and(m_cube) << "\n";); } diff --git a/src/muz/spacer/spacer_sat_answer.cpp b/src/muz/spacer/spacer_sat_answer.cpp index 0def79abd..81205ac3e 100644 --- a/src/muz/spacer/spacer_sat_answer.cpp +++ b/src/muz/spacer/spacer_sat_answer.cpp @@ -64,7 +64,7 @@ proof_ref ground_sat_answer_op::operator()(pred_transformer &query) { solver::scoped_push _s_(*m_solver); m_solver->assert_expr(query.get_last_rf()->get()); lbool res = m_solver->check_sat(0, nullptr); - CTRACE("spacer_sat", res != l_true, tout << "solver at check:\n"; + CTRACE(spacer_sat, res != l_true, tout << "solver at check:\n"; m_solver->display(tout) << "res: " << res << "\n";); if (res != l_true) throw default_exception("spacer: could not validate first proof step"); model_ref mdl; @@ -133,12 +133,12 @@ void ground_sat_answer_op::mk_children(frame &fr, vector &todo) { m_solver->assert_expr(fr.pt().transition()); m_solver->assert_expr(fr.pt().rule2tag(&r)); - TRACE("spacer_sat", + TRACE(spacer_sat, tout << "Solver in mk_children\n"; m_solver->display(tout) << "\n";); lbool res = m_solver->check_sat(0, nullptr); - CTRACE("spacer_sat", res != l_true, + CTRACE(spacer_sat, res != l_true, m_solver->display(tout) << "\n" "Result: " << res << "\n";); if(res != l_true) throw default_exception("spacer: could not validate a proof step"); @@ -154,7 +154,7 @@ void ground_sat_answer_op::mk_children(frame &fr, vector &todo) { m_ctx.get_pred_transformer(preds.get(i)), subst)); fr.m_kids.push_back(todo.back().fact()); } - TRACE("spacer_sat", tout << "Children for fact: " << fr.m_fact << " are " << fr.m_kids << "\n"; + TRACE(spacer_sat, tout << "Children for fact: " << fr.m_fact << " are " << fr.m_kids << "\n"; tout << "gnd_eq for fact are: " << fr.m_gnd_eq << "\n"; ); } @@ -196,7 +196,7 @@ proof *ground_sat_answer_op::mk_proof_step(frame &fr) { premises.data(), fr.fact(), positions, substs)); - TRACE("spacer_sat", tout << "pf step:\n" + TRACE(spacer_sat, tout << "pf step:\n" << "premises: " << premises << "\n" << "fact: " << mk_pp(fr.fact(), m) << "\n";); return to_app(m_pinned.back()); diff --git a/src/muz/spacer/spacer_sym_mux.cpp b/src/muz/spacer/spacer_sym_mux.cpp index 451a2b3dc..49ec09eb3 100644 --- a/src/muz/spacer/spacer_sym_mux.cpp +++ b/src/muz/spacer/spacer_sym_mux.cpp @@ -149,7 +149,7 @@ public: app * a = to_app(s); func_decl * sym = a->get_decl(); if (!m_parent.has_index(sym, m_from_idx)) { - CTRACE("spacer", m_homogenous && m_parent.is_muxed(sym), tout << "not found " << mk_pp(a, m) << "\n"); + CTRACE(spacer, m_homogenous && m_parent.is_muxed(sym), tout << "not found " << mk_pp(a, m) << "\n"); SASSERT(!m_homogenous || !m_parent.is_muxed(sym)); return false; } diff --git a/src/muz/spacer/spacer_unsat_core_plugin.cpp b/src/muz/spacer/spacer_unsat_core_plugin.cpp index f0cfcbcd2..40060629d 100644 --- a/src/muz/spacer/spacer_unsat_core_plugin.cpp +++ b/src/muz/spacer/spacer_unsat_core_plugin.cpp @@ -97,7 +97,7 @@ namespace spacer { // XXX this assertion should be true so there is no need to check for it SASSERT (!m_ctx.is_closed (step)); func_decl* d = step->get_decl(); - TRACE("spacer.farkas", + TRACE(spacer_farkas, tout << "looking at: " << mk_pp(step, m) << "\n";); if (!m_ctx.is_closed(step) && is_farkas_lemma(m, step)) { // weaker check : d->get_num_parameters() >= m.get_num_parents(step) + 2 @@ -133,7 +133,7 @@ namespace spacer { */ parameter const* params = d->get_parameters() + 2; // point to the first Farkas coefficient - TRACE("spacer.farkas", + TRACE(spacer_farkas, tout << "Farkas input: "<< "\n"; for (unsigned i = 0; i < m.get_num_parents(step); ++i) { proof * prem = m.get_parent(step, i); @@ -209,7 +209,7 @@ namespace spacer { // AG: it will go into the core. However, it does not mean that this literal should/could not be added. m_ctx.set_closed(step, done); expr_ref res = compute_linear_combination(coeff_lits); - TRACE("spacer.farkas", tout << "Farkas core: " << res << "\n";); + TRACE(spacer_farkas, tout << "Farkas core: " << res << "\n";); m_ctx.add_lemma_to_core(res); } } @@ -247,7 +247,7 @@ namespace spacer { parameter const* params = d->get_parameters() + 2; // point to the first Farkas coefficient - TRACE("spacer.farkas", + TRACE(spacer_farkas, tout << "Farkas input: "<< "\n"; for (unsigned i = 0; i < m.get_num_parents(step); ++i) { proof * prem = m.get_parent(step, i); diff --git a/src/muz/spacer/spacer_util.cpp b/src/muz/spacer/spacer_util.cpp index e2f888e83..53f0384d2 100644 --- a/src/muz/spacer/spacer_util.cpp +++ b/src/muz/spacer/spacer_util.cpp @@ -152,7 +152,7 @@ void qe_project_z3(ast_manager &m, app_ref_vector &vars, expr_ref &fml, params_ref p; p.set_bool("reduce_all_selects", reduce_all_selects); p.set_bool("dont_sub", dont_sub); - TRACE("qe", tout << "qe-project-z3\n"); + TRACE(qe, tout << "qe-project-z3\n"); qe::mbproj mbp(m, p); mbp.spacer(vars, mdl, fml); @@ -167,7 +167,7 @@ void qe_project_spacer(ast_manager &m, app_ref_vector &vars, expr_ref &fml, model &mdl, bool reduce_all_selects, bool use_native_mbp, bool dont_sub) { th_rewriter rw(m); - TRACE("spacer_mbp", tout << "Before projection:\n"; tout << fml << "\n"; + TRACE(spacer_mbp, tout << "Before projection:\n"; tout << fml << "\n"; tout << "Vars:" << vars << "\n";); { @@ -194,7 +194,7 @@ void qe_project_spacer(ast_manager &m, app_ref_vector &vars, expr_ref &fml, qe(vars, fml); rw(fml); - TRACE("spacer_mbp", tout << "After qe_lite:\n"; + TRACE(spacer_mbp, tout << "After qe_lite:\n"; tout << mk_pp(fml, m) << "\nVars:" << vars << "\n";); SASSERT(!m.is_false(fml)); @@ -221,11 +221,11 @@ void qe_project_spacer(ast_manager &m, app_ref_vector &vars, expr_ref &fml, // -- bool_sub is not simplifying rw(fml); SASSERT(!m.is_false(fml)); - TRACE("spacer_mbp", tout << "Projected Booleans:\n" << fml << "\n";); + TRACE(spacer_mbp, tout << "Projected Booleans:\n" << fml << "\n";); bool_sub.reset(); } - TRACE("spacer_mbp", tout << "Array vars:\n"; tout << array_vars;); + TRACE(spacer_mbp, tout << "Array vars:\n"; tout << array_vars;); vars.reset(); @@ -241,7 +241,7 @@ void qe_project_spacer(ast_manager &m, app_ref_vector &vars, expr_ref &fml, SASSERT(!m.is_false(fml)); } - TRACE("spacer_mbp", tout << "extended model:\n"; model_pp(tout, mdl); + TRACE(spacer_mbp, tout << "extended model:\n"; model_pp(tout, mdl); tout << "Auxiliary variables of index and value sorts:\n"; tout << vars << "\n";); @@ -251,7 +251,7 @@ void qe_project_spacer(ast_manager &m, app_ref_vector &vars, expr_ref &fml, // project reals and ints if (!arith_vars.empty()) { - TRACE("spacer_mbp", tout << "Arith vars:" << arith_vars << "\n";); + TRACE(spacer_mbp, tout << "Arith vars:" << arith_vars << "\n";); if (use_native_mbp) { qe::mbproj mbp(m); @@ -267,7 +267,7 @@ void qe_project_spacer(ast_manager &m, app_ref_vector &vars, expr_ref &fml, spacer_qe::arith_project(mdl, arith_vars, fml); } - TRACE("spacer_mbp", tout << "Projected arith vars: "<< fml << "\n"; + TRACE(spacer_mbp, tout << "Projected arith vars: "<< fml << "\n"; tout << "Remaining arith vars:" << arith_vars << "\n";); SASSERT(!m.is_false(fml)); } @@ -278,7 +278,7 @@ void qe_project_spacer(ast_manager &m, app_ref_vector &vars, expr_ref &fml, // substitute any remaining arith vars if (!dont_sub && !arith_vars.empty()) { subst_vars(m, arith_vars, mdl, fml); - TRACE("spacer_mbp", + TRACE(spacer_mbp, tout << "After substituting remaining arith vars:\n"; tout << mk_pp(fml, m) << "\n";); // an extra round of simplification because subst_vars is not @@ -293,7 +293,7 @@ void qe_project_spacer(ast_manager &m, app_ref_vector &vars, expr_ref &fml, vars.append(other_vars); if (dont_sub && !arith_vars.empty()) vars.append(arith_vars); - TRACE("qe", tout << "after projection: " << fml << ": " << vars << "\n"); + TRACE(qe, tout << "after projection: " << fml << ": " << vars << "\n"); } static expr *apply_accessor(ast_manager &m, ptr_vector const &acc, @@ -325,7 +325,7 @@ void expand_literals(ast_manager &m, expr_ref_vector &conjs) { rational r; unsigned bv_size; - TRACE("spacer_expand", tout << "begin expand\n" << conjs << "\n";); + TRACE(spacer_expand, tout << "begin expand\n" << conjs << "\n";); for (unsigned i = 0; i < conjs.size(); ++i) { expr *e = conjs[i].get(); @@ -370,7 +370,7 @@ void expand_literals(ast_manager &m, expr_ref_vector &conjs) { } } } - TRACE("spacer_expand", tout << "end expand\n" << conjs << "\n";); + TRACE(spacer_expand, tout << "end expand\n" << conjs << "\n";); } namespace { @@ -662,7 +662,7 @@ bool is_normalized(expr_ref e, bool use_simplify_bounds, bool use_factor_eqs) { expr_ref out0 = out; if (e != out) { normalize(out, out, use_simplify_bounds, use_factor_eqs); } - CTRACE("inherit_bug", e != out, + CTRACE(inherit_bug, e != out, tout << "e==out0: " << (e == out0) << " e==out: " << (e == out) << " out0==out: " << (out0 == out) << "\n"; tout << "e: " << e << "\n" @@ -711,11 +711,11 @@ void normalize(expr *e, expr_ref &out, bool use_simplify_bounds, // sort arguments of the top-level and std::stable_sort(v.data(), v.data() + v.size(), ast_lt_proc()); - TRACE("spacer_normalize", tout << "Normalized:\n" + TRACE(spacer_normalize, tout << "Normalized:\n" << out << "\n" << "to\n" << mk_and(v) << "\n";); - TRACE("spacer_normalize", { + TRACE(spacer_normalize, { mbp::term_graph egraph(m); for (expr *e : v) egraph.add_lit(to_app(e)); tout << "Reduced app:\n" << mk_pp(egraph.to_expr(), m) << "\n"; @@ -858,26 +858,26 @@ bool mbqi_project_var(model &mdl, app *var, expr_ref &fml) { expr_ref val(m); val = mdl(var); - TRACE("mbqi_project_verbose", tout << "MBQI: var: " << mk_pp(var, m) << "\n" + TRACE(mbqi_project_verbose, tout << "MBQI: var: " << mk_pp(var, m) << "\n" << "fml: " << fml << "\n";); expr_ref_vector terms(m); index_term_finder finder(m, var, terms); for_each_expr(finder, fml); - TRACE("mbqi_project_verbose", tout << "terms:\n" << terms << "\n";); + TRACE(mbqi_project_verbose, tout << "terms:\n" << terms << "\n";); for (expr *term : terms) { expr_ref tval(m); tval = mdl(term); - TRACE("mbqi_project_verbose", tout << "term: " << mk_pp(term, m) + TRACE(mbqi_project_verbose, tout << "term: " << mk_pp(term, m) << " tval: " << tval << " val: " << val << "\n";); // -- if the term does not contain an occurrence of var // -- and is in the same equivalence class in the model if (tval == val && !occurs(var, term)) { - TRACE("mbqi_project", tout << "MBQI: replacing " << mk_pp(var, m) + TRACE(mbqi_project, tout << "MBQI: replacing " << mk_pp(var, m) << " with " << mk_pp(term, m) << "\n";); expr_safe_replace sub(m); sub.insert(var, term); @@ -886,7 +886,7 @@ bool mbqi_project_var(model &mdl, app *var, expr_ref &fml) { } } - TRACE("mbqi_project", tout << "MBQI: failed to eliminate " << mk_pp(var, m) + TRACE(mbqi_project, tout << "MBQI: failed to eliminate " << mk_pp(var, m) << " from " << fml << "\n";); return false; diff --git a/src/muz/tab/tab_context.cpp b/src/muz/tab/tab_context.cpp index 175c8aeb8..cdf7388e2 100644 --- a/src/muz/tab/tab_context.cpp +++ b/src/muz/tab/tab_context.cpp @@ -1526,7 +1526,7 @@ namespace datalog { lbool is_sat = m_solver.check(); m_solver.pop(1); - TRACE("dl", tout << is_sat << ":\n" << mk_pp(fml, m) << "\n";); + TRACE(dl, tout << is_sat << ":\n" << mk_pp(fml, m) << "\n";); return l_false == is_sat; diff --git a/src/muz/transforms/dl_mk_array_blast.cpp b/src/muz/transforms/dl_mk_array_blast.cpp index 824b298b4..16f09f24c 100644 --- a/src/muz/transforms/dl_mk_array_blast.cpp +++ b/src/muz/transforms/dl_mk_array_blast.cpp @@ -216,7 +216,7 @@ namespace datalog { for (; it2 != end; ++it2) { app* a2 = it2->m_key; var* v2 = it2->m_value; - TRACE("dl", tout << mk_pp(a1, m) << " " << mk_pp(a2, m) << "\n";); + TRACE(dl, tout << mk_pp(a1, m) << " " << mk_pp(a2, m) << "\n";); if (get_select(a1) != get_select(a2)) { continue; } @@ -260,7 +260,7 @@ namespace datalog { uint_set rhs_vars = rm.collect_vars(y); lhs &= rhs_vars; if (!lhs.empty()) { - TRACE("dl", tout << "unusable equality " << mk_pp(e, m) << "\n";); + TRACE(dl, tout << "unusable equality " << mk_pp(e, m) << "\n";); new_conjs.push_back(e); } else { @@ -284,7 +284,7 @@ namespace datalog { m_rewriter(body); sub(head); m_rewriter(head); - TRACE("dl", tout << body << " => " << head << "\n";); + TRACE(dl, tout << body << " => " << head << "\n";); change = ackermanize(r, body, head); if (!change) { rules.add_rule(&r); @@ -294,7 +294,7 @@ namespace datalog { fml2 = m.mk_implies(body, head); proof_ref p(m); rule_set new_rules(m_ctx); - TRACE("dl", tout << fml2 << "\n";); + TRACE(dl, tout << fml2 << "\n";); rm.mk_rule(fml2, p, new_rules, r.name()); @@ -309,7 +309,7 @@ namespace datalog { } rules.add_rule(new_rule.get()); rm.mk_rule_rewrite_proof(r, *new_rule.get()); - TRACE("dl", new_rule->display(m_ctx, tout << "new rule\n");); + TRACE(dl, new_rule->display(m_ctx, tout << "new rule\n");); } return true; } diff --git a/src/muz/transforms/dl_mk_backwards.cpp b/src/muz/transforms/dl_mk_backwards.cpp index 5024d4631..a47d0aeeb 100644 --- a/src/muz/transforms/dl_mk_backwards.cpp +++ b/src/muz/transforms/dl_mk_backwards.cpp @@ -69,7 +69,7 @@ namespace datalog { result->add_rule(new_rule); } } - TRACE("dl", result->display(tout);); + TRACE(dl, result->display(tout);); return result.detach(); } diff --git a/src/muz/transforms/dl_mk_bit_blast.cpp b/src/muz/transforms/dl_mk_bit_blast.cpp index 0072f0078..9ca982776 100644 --- a/src/muz/transforms/dl_mk_bit_blast.cpp +++ b/src/muz/transforms/dl_mk_bit_blast.cpp @@ -75,7 +75,7 @@ namespace datalog { if (!f) continue; expr_ref body(m); unsigned arity_q = q->get_arity(); - TRACE("dl", + TRACE(dl, model_v2_pp(tout, *model); tout << mk_pp(p, m) << "\n"; tout << mk_pp(q, m) << "\n";); @@ -242,7 +242,7 @@ namespace datalog { m_context.get_rule_manager().to_formula(*r2.get(), fml1); m_blaster(fml1, fml2, pr); m_rewriter(fml2, fml3); - TRACE("dl", tout << fml << "\n-> " << fml1 << "\n-> " << fml2 << "\n-> " << fml3 << "\n";); + TRACE(dl, tout << fml << "\n-> " << fml1 << "\n-> " << fml2 << "\n-> " << fml3 << "\n";); if (fml3 != fml) { fml = fml3; return true; @@ -281,9 +281,9 @@ namespace datalog { for (unsigned i = 0; !m_context.canceled() && i < sz; ++i) { rule * r = source.get_rule(i); rm.to_formula(*r, fml); - TRACE("dl", tout << fml << "\n";); + TRACE(dl, tout << fml << "\n";); if (blast(r, fml)) { - TRACE("dl", tout << "blasted: " << fml << "\n";); + TRACE(dl, tout << "blasted: " << fml << "\n";); proof_ref pr(m); if (r->get_proof()) { scoped_proof _sc(m); @@ -317,7 +317,7 @@ namespace datalog { } m_context.add_model_converter(concat(bvmc, fmc)); } - CTRACE("dl", result, result->display(tout);); + CTRACE(dl, result, result->display(tout);); return result.detach(); } }; diff --git a/src/muz/transforms/dl_mk_coi_filter.cpp b/src/muz/transforms/dl_mk_coi_filter.cpp index d59aa66dc..58ee0d7e7 100644 --- a/src/muz/transforms/dl_mk_coi_filter.cpp +++ b/src/muz/transforms/dl_mk_coi_filter.cpp @@ -92,7 +92,7 @@ namespace datalog { } } if (res->get_num_rules() == source.get_num_rules()) { - TRACE("dl", tout << "No transformation\n";); + TRACE(dl, tout << "No transformation\n";); res = nullptr; } else { @@ -108,9 +108,9 @@ namespace datalog { for (func_decl* f : unreachable) mc0->add(f, m.mk_false()); m_context.add_model_converter(mc0); - TRACE("dl", m_context.get_model_converter()->display(tout);); + TRACE(dl, m_context.get_model_converter()->display(tout);); } - CTRACE("dl", res, res->display(tout);); + CTRACE(dl, res, res->display(tout);); return res.detach(); } @@ -147,7 +147,7 @@ namespace datalog { } if (res->get_num_rules() == source.get_num_rules()) { - TRACE("dl", tout << "No transformation\n";); + TRACE(dl, tout << "No transformation\n";); res = nullptr; } if (res && m_context.get_model_converter() && !pruned_preds.empty()) { @@ -171,7 +171,7 @@ namespace datalog { } m_context.add_model_converter(mc0); } - CTRACE("dl", 0 != res, res->display(tout);); + CTRACE(dl, 0 != res, res->display(tout);); return res.detach(); } } diff --git a/src/muz/transforms/dl_mk_elim_term_ite.cpp b/src/muz/transforms/dl_mk_elim_term_ite.cpp index 98bd3c41a..239c86ae3 100644 --- a/src/muz/transforms/dl_mk_elim_term_ite.cpp +++ b/src/muz/transforms/dl_mk_elim_term_ite.cpp @@ -136,11 +136,11 @@ namespace datalog { rule_ref new_rule(rm.mk(r.get_head(), tail.size(), tail.data(), nullptr, r.name(), false), rm); rm.mk_rule_rewrite_proof(r, *new_rule.get()); new_rules.add_rule(new_rule); - TRACE("dl", tout << "No term-ite after blast_term_ite\n";); + TRACE(dl, tout << "No term-ite after blast_term_ite\n";); return true; } - TRACE("dl", tout << "Rule has term-ite after blasting, starting elimination\n";); + TRACE(dl, tout << "Rule has term-ite after blasting, starting elimination\n";); body = ground(body); // elim ite tactic_ref elim_term_ite = mk_elim_term_ite_tactic(m); @@ -170,7 +170,7 @@ namespace datalog { rw(body); fml2 = m.mk_implies(body, ground(r.get_head())); - CTRACE("dl", has_term_ite(fml2), tout << "Rule has term-ite after elimination. Giving up\n";); + CTRACE(dl, has_term_ite(fml2), tout << "Rule has term-ite after elimination. Giving up\n";); if (has_term_ite(fml2)) return false; app_ref_vector consts(m); @@ -183,7 +183,7 @@ namespace datalog { // NSB code review: breaks abstraction barrier: mk_rule could convert a single formula // into multiple rules rm.mk_rule_rewrite_proof(r, *new_rules.last()); - TRACE("dl", tout << "New rule: " << fml2 << "\n";); + TRACE(dl, tout << "New rule: " << fml2 << "\n";); return true; } diff --git a/src/muz/transforms/dl_mk_filter_rules.cpp b/src/muz/transforms/dl_mk_filter_rules.cpp index a5cd057cd..9356b269e 100644 --- a/src/muz/transforms/dl_mk_filter_rules.cpp +++ b/src/muz/transforms/dl_mk_filter_rules.cpp @@ -53,7 +53,7 @@ namespace datalog { */ bool mk_filter_rules::is_candidate(app * pred) { if (!m_context.is_predicate(pred)) { - TRACE("mk_filter_rules", tout << mk_pp(pred, m) << "\nis not a candidate because it is interpreted.\n";); + TRACE(mk_filter_rules, tout << mk_pp(pred, m) << "\nis not a candidate because it is interpreted.\n";); return false; } var_idx_set used_vars; @@ -111,7 +111,7 @@ namespace datalog { for (unsigned i = 0; i < sz; i++) { app * tail = r->get_tail(i); if (is_candidate(tail) && !r->is_neg_tail(i)) { - TRACE("mk_filter_rules", tout << "is_candidate: " << mk_pp(tail, m) << "\n";); + TRACE(mk_filter_rules, tout << "is_candidate: " << mk_pp(tail, m) << "\n";); var_idx_set non_local_vars = rm.collect_rule_vars_ex(r, tail); func_decl * filter_decl = mk_filter_decl(tail, non_local_vars); ptr_buffer new_args; diff --git a/src/muz/transforms/dl_mk_interp_tail_simplifier.cpp b/src/muz/transforms/dl_mk_interp_tail_simplifier.cpp index 343eb3b7d..bf7f75451 100644 --- a/src/muz/transforms/dl_mk_interp_tail_simplifier.cpp +++ b/src/muz/transforms/dl_mk_interp_tail_simplifier.cpp @@ -474,12 +474,12 @@ namespace datalog { if (!found_something) { return false; } - TRACE("dl_interp_tail_simplifier_propagation_pre", + TRACE(dl_interp_tail_simplifier_propagation_pre, tout << "will propagate rule:\n"; r->display(m_context, tout); ); m_rule_subst.get_result(res); - TRACE("dl_interp_tail_simplifier_propagation", + TRACE(dl_interp_tail_simplifier_propagation, tout << "propagated equivalences of:\n"; r->display(m_context, tout); tout << "into:\n"; @@ -539,7 +539,7 @@ namespace datalog { modified |= itail.get() != simp_res.get(); if (m.is_false(simp_res)) { - TRACE("dl", r->display(m_context, tout << "rule is infeasible\n");); + TRACE(dl, r->display(m_context, tout << "rule is infeasible\n");); return false; } SASSERT(m.is_bool(simp_res)); @@ -574,7 +574,7 @@ namespace datalog { goto start; } - CTRACE("dl", (res != r0), r0->display(m_context, tout << "old:\n"); res->display(m_context, tout << "new:\n");); + CTRACE(dl, (res != r0), r0->display(m_context, tout << "old:\n"); res->display(m_context, tout << "new:\n");); return true; } @@ -605,7 +605,7 @@ namespace datalog { scoped_ptr res = alloc(rule_set, m_context); if (transform_rules(source, *res)) { res->inherit_predicates(source); - TRACE("dl", + TRACE(dl, source.display(tout); res->display(tout);); } diff --git a/src/muz/transforms/dl_mk_karr_invariants.cpp b/src/muz/transforms/dl_mk_karr_invariants.cpp index 955c3ca92..a794926c3 100644 --- a/src/muz/transforms/dl_mk_karr_invariants.cpp +++ b/src/muz/transforms/dl_mk_karr_invariants.cpp @@ -200,7 +200,7 @@ namespace datalog { mk_backwards bwd(m_ctx); scoped_ptr src_loop = lc(source); - TRACE("dl", src_loop->display(tout << "source loop\n");); + TRACE(dl, src_loop->display(tout << "source loop\n");); get_invariants(*src_loop); @@ -214,7 +214,7 @@ namespace datalog { scoped_ptr src_annot = update_rules(*src_loop); rule_set* rules = lc.revert(*src_annot); rules->inherit_predicates(source); - TRACE("dl", rules->display(tout);); + TRACE(dl, rules->display(tout);); m_pinned.reset(); m_fun2inv.reset(); return rules; diff --git a/src/muz/transforms/dl_mk_magic_sets.cpp b/src/muz/transforms/dl_mk_magic_sets.cpp index bbf6e9508..f5d9d92ca 100644 --- a/src/muz/transforms/dl_mk_magic_sets.cpp +++ b/src/muz/transforms/dl_mk_magic_sets.cpp @@ -195,7 +195,7 @@ namespace datalog { } app * mag_head = create_magic_literal(tail[i]); rule * r = m_context.get_rule_manager().mk(mag_head, i+1, new_tail.data(), negations.data()); - TRACE("dl", r->display(m_context,tout); ); + TRACE(dl, r->display(m_context,tout); ); result.add_rule(r); } } diff --git a/src/muz/transforms/dl_mk_magic_symbolic.cpp b/src/muz/transforms/dl_mk_magic_symbolic.cpp index afadfd6c3..ed05d2247 100644 --- a/src/muz/transforms/dl_mk_magic_symbolic.cpp +++ b/src/muz/transforms/dl_mk_magic_symbolic.cpp @@ -106,7 +106,7 @@ namespace datalog { } } - TRACE("dl", result->display(tout);); + TRACE(dl, result->display(tout);); return result.detach(); } diff --git a/src/muz/transforms/dl_mk_quantifier_abstraction.cpp b/src/muz/transforms/dl_mk_quantifier_abstraction.cpp index 6b321bc75..75422cbf2 100644 --- a/src/muz/transforms/dl_mk_quantifier_abstraction.cpp +++ b/src/muz/transforms/dl_mk_quantifier_abstraction.cpp @@ -88,7 +88,7 @@ namespace datalog { } // Create quantifier wrapper around body. - TRACE("dl", tout << body << "\n";); + TRACE(dl, tout << body << "\n";); // 1. replace variables by the compound terms from // the original predicate. expr_safe_replace rep(m); @@ -98,7 +98,7 @@ namespace datalog { rep(body); rep.reset(); - TRACE("dl", tout << body << "\n";); + TRACE(dl, tout << body << "\n";); // 2. replace bound variables by constants. expr_ref_vector consts(m), bound(m), _free(m); svector names; @@ -119,12 +119,12 @@ namespace datalog { rep(body); rep.reset(); - TRACE("dl", tout << body << "\n";); + TRACE(dl, tout << body << "\n";); // 3. abstract and quantify those variables that should be bound. body = expr_abstract(bound, body); body = m.mk_forall(names.size(), bound_sorts.data(), names.data(), body); - TRACE("dl", tout << body << "\n";); + TRACE(dl, tout << body << "\n";); // 4. replace remaining constants by variables. unsigned j = 0; for (expr* f : _free) { @@ -133,7 +133,7 @@ namespace datalog { rep(body); new_model->register_decl(q, body); - TRACE("dl", tout << body << "\n";); + TRACE(dl, tout << body << "\n";); } old_model = new_model; } @@ -234,7 +234,7 @@ namespace datalog { } args.push_back(arg); } - TRACE("dl", + TRACE(dl, tout << mk_pp(new_p, m) << "\n"; for (unsigned i = 0; i < args.size(); ++i) { tout << mk_pp(args[i].get(), m) << "\n"; @@ -329,7 +329,7 @@ namespace datalog { for (unsigned i = 0; i < sz; ++i) { tail.reset(); rule & r = *source.get_rule(i); - TRACE("dl", r.display(m_ctx, tout); ); + TRACE(dl, r.display(m_ctx, tout); ); unsigned cnt = vc.get_max_rule_var(r)+1; unsigned utsz = r.get_uninterpreted_tail_size(); unsigned tsz = r.get_tail_size(); @@ -343,7 +343,7 @@ namespace datalog { fml = m.mk_implies(m.mk_and(tail.size(), tail.data()), head); proof_ref pr(m); rm.mk_rule(fml, pr, *result, r.name()); - TRACE("dl", result->last()->display(m_ctx, tout);); + TRACE(dl, result->last()->display(m_ctx, tout);); } // proof converter: proofs are not necessarily preserved using this transformation. diff --git a/src/muz/transforms/dl_mk_quantifier_instantiation.cpp b/src/muz/transforms/dl_mk_quantifier_instantiation.cpp index d1fb6400c..e7c6c58e6 100644 --- a/src/muz/transforms/dl_mk_quantifier_instantiation.cpp +++ b/src/muz/transforms/dl_mk_quantifier_instantiation.cpp @@ -90,7 +90,7 @@ namespace datalog { } void mk_quantifier_instantiation::match(unsigned i, app* pat, unsigned j, term_pairs& todo, quantifier* q, expr_ref_vector& conjs) { - TRACE("dl", tout << "match" << mk_pp(pat, m) << "\n";); + TRACE(dl, tout << "match" << mk_pp(pat, m) << "\n";); while (j < todo.size()) { expr* p = todo[j].first; expr* t = todo[j].second; @@ -157,7 +157,7 @@ namespace datalog { m_binding.reverse(); m_cnst2var(res); conjs.push_back(res); - TRACE("dl", tout << mk_pp(q, m) << "\n==>\n" << mk_pp(res, m) << "\n";); + TRACE(dl, tout << mk_pp(q, m) << "\n==>\n" << mk_pp(res, m) << "\n";); } void mk_quantifier_instantiation::collect_egraph(expr* e) { @@ -223,7 +223,7 @@ namespace datalog { fml = m.mk_and(conjs.size(), conjs.data()); fml = m.mk_implies(fml, r.get_head()); - TRACE("dl", r.display(m_ctx, tout); tout << mk_pp(fml, m) << "\n";); + TRACE(dl, r.display(m_ctx, tout); tout << mk_pp(fml, m) << "\n";); rule_set added_rules(m_ctx); proof_ref pr(m); diff --git a/src/muz/transforms/dl_mk_rule_inliner.cpp b/src/muz/transforms/dl_mk_rule_inliner.cpp index 518a63a0a..382ab5517 100644 --- a/src/muz/transforms/dl_mk_rule_inliner.cpp +++ b/src/muz/transforms/dl_mk_rule_inliner.cpp @@ -78,7 +78,7 @@ namespace datalog { if (m_ready) { m_deltas[0] = 0; m_deltas[1] = var_cnt; - TRACE("dl", + TRACE(dl, output_predicate(m_context, src.get_head(), tout << "unify rules "); output_predicate(m_context, tgt.get_head(), tout << "\n"); tout << "\n";); @@ -88,7 +88,7 @@ namespace datalog { void rule_unifier::apply(app * a, bool is_tgt, app_ref& res) { expr_ref res_e(m); - TRACE("dl", output_predicate(m_context, a, tout); tout << "\n";); + TRACE(dl, output_predicate(m_context, a, tout); tout << "\n";); m_subst.apply(2, m_deltas, expr_offset(a, is_tgt ? 0 : 1), res_e); SASSERT(is_app(res_e.get())); res = to_app(res_e.get()); @@ -124,7 +124,7 @@ namespace datalog { symbol combined_rule_name(comb_name.str()); res = m_rm.mk(new_head, tail.size(), tail.data(), tail_neg.data(), combined_rule_name, m_normalize); res->set_accounting_parent_object(m_context, const_cast(&tgt)); - TRACE("dl", + TRACE(dl, tgt.display(m_context, tout << "tgt (" << tail_index << "): \n"); src.display(m_context, tout << "src:\n"); res->display(m_context, tout << "res\n"); @@ -193,7 +193,7 @@ namespace datalog { return true; } else { - TRACE("dl", res->display(m_context, tout << "interpreted tail is unsat\n");); + TRACE(dl, res->display(m_context, tout << "interpreted tail is unsat\n");); //the interpreted part is unsatisfiable return false; } @@ -392,7 +392,7 @@ namespace datalog { if (forbid_multiple_multipliers(orig, *candidate_inlined_set)) candidate_inlined_set = create_allowed_rule_set(orig); - TRACE("dl", tout<<"rules to be inlined:\n" << (*candidate_inlined_set); ); + TRACE(dl, tout<<"rules to be inlined:\n" << (*candidate_inlined_set); ); // now we start filling in the set of the inlined rules in a topological order, // so that we inline rules into other rules @@ -407,7 +407,7 @@ namespace datalog { for (rule * r : candidate_inlined_set->get_predicate_rules(pred)) transform_rule(orig, r, m_inlined_rules); } - TRACE("dl", tout << "inlined rules after mutual inlining:\n" << m_inlined_rules; ); + TRACE(dl, tout << "inlined rules after mutual inlining:\n" << m_inlined_rules; ); for (rule * r : m_inlined_rules) datalog::del_rule(m_mc, *r, l_undef); @@ -425,7 +425,7 @@ namespace datalog { unsigned i = 0; for (; i < pt_len && !inlining_allowed(orig, r->get_decl(i)); ++i) {}; - CTRACE("dl", has_quantifier(*r.get()), r->display(m_context, tout);); + CTRACE(dl, has_quantifier(*r.get()), r->display(m_context, tout);); if (has_quantifier(*r.get())) { tgt.add_rule(r); continue; @@ -618,7 +618,7 @@ namespace datalog { */ bool mk_rule_inliner::visitor::operator()(expr* e) { m_unifiers.append(m_positions.find(e)); - TRACE("dl", + TRACE(dl, tout << "unifier: " << (m_unifiers.empty()?0:m_unifiers.back()); tout << " num unifiers: " << m_unifiers.size(); tout << " num positions: " << m_positions.find(e).size() << "\n"; @@ -661,7 +661,7 @@ namespace datalog { if (source.is_output_predicate(headd) || m_preds_with_facts.contains(headd)) { can_remove.set(i, false); - TRACE("dl", output_predicate(m_context, head, tout << "cannot remove: " << i << " "); tout << "\n";); + TRACE(dl, output_predicate(m_context, head, tout << "cannot remove: " << i << " "); tout << "\n";); } unsigned tl_sz = r->get_uninterpreted_tail_size(); @@ -700,7 +700,7 @@ namespace datalog { m_head_index.reset(); m_tail_index.reset(); - TRACE("dl", rules->display(tout);); + TRACE(dl, rules->display(tout);); rule_ref_vector acc(m_rm); for (unsigned i = 0; i < sz; ++i) { @@ -742,14 +742,14 @@ namespace datalog { rule_ref r(acc[i].get(), m_rm); - TRACE("dl", r->display(m_context, tout << "processing: " << i << "\n");); + TRACE(dl, r->display(m_context, tout << "processing: " << i << "\n");); if (!valid.get(i)) { - TRACE("dl", tout << "invalid: " << i << "\n";); + TRACE(dl, tout << "invalid: " << i << "\n";); break; } if (!can_expand.get(i)) { - TRACE("dl", tout << "cannot expand: " << i << "\n";); + TRACE(dl, tout << "cannot expand: " << i << "\n";); break; } @@ -757,36 +757,36 @@ namespace datalog { m_head_index.unify(r->get_tail(0), m_head_visitor); unsigned num_head_unifiers = m_head_visitor.get_unifiers().size(); if (num_head_unifiers != 1) { - TRACE("dl", tout << "no unique unifier " << num_head_unifiers << "\n";); + TRACE(dl, tout << "no unique unifier " << num_head_unifiers << "\n";); break; } unsigned j = m_head_visitor.get_unifiers()[0]; if (!can_remove.get(j) || !valid.get(j) || i == j) { - TRACE("dl", tout << PRT(can_remove.get(j)) << " " << PRT(valid.get(j)) << " " << PRT(i != j) << "\n";); + TRACE(dl, tout << PRT(can_remove.get(j)) << " " << PRT(valid.get(j)) << " " << PRT(i != j) << "\n";); break; } rule* r2 = acc.get(j); // check that the head of r2 only unifies with this single body position. - TRACE("dl", output_predicate(m_context, r2->get_head(), tout << "unify head: "); tout << "\n";); + TRACE(dl, output_predicate(m_context, r2->get_head(), tout << "unify head: "); tout << "\n";); m_tail_visitor.reset(); m_tail_index.unify(r2->get_head(), m_tail_visitor); unsigned_vector const& tail_unifiers = m_tail_visitor.get_unifiers(); unsigned num_tail_unifiers = tail_unifiers.size(); SASSERT(!tail_unifiers.empty()); if (!allow_branching && num_tail_unifiers != 1) { - TRACE("dl", tout << "too many tails " << num_tail_unifiers << "\n";); + TRACE(dl, tout << "too many tails " << num_tail_unifiers << "\n";); break; } rule_ref rl_res(m_rm); if (!try_to_inline_rule(*r.get(), *r2, 0, rl_res)) { - TRACE("dl", r->display(m_context, tout << "inlining failed\n"); r2->display(m_context, tout); ); + TRACE(dl, r->display(m_context, tout << "inlining failed\n"); r2->display(m_context, tout); ); break; } done_something = true; - TRACE("dl", r->display(m_context, tout); r2->display(m_context, tout); rl_res->display(m_context, tout); ); + TRACE(dl, r->display(m_context, tout); r2->display(m_context, tout); rl_res->display(m_context, tout); ); del_rule(r, i); add_rule(*rules, rl_res.get(), i); @@ -797,7 +797,7 @@ namespace datalog { can_expand.set(i, can_expand.get(j)); if (num_tail_unifiers == 1) { - TRACE("dl", tout << "setting invalid: " << j << "\n";); + TRACE(dl, tout << "setting invalid: " << j << "\n";); valid.set(j, false); datalog::del_rule(m_mc, *r2, l_undef); del_rule(r2, j); @@ -816,7 +816,7 @@ namespace datalog { } } res->inherit_predicates(*rules); - TRACE("dl", res->display(tout);); + TRACE(dl, res->display(tout);); rules = res.detach(); } return done_something; @@ -843,7 +843,7 @@ namespace datalog { scoped_ptr res = alloc(rule_set, m_context); if (m_context.get_params().xform_inline_eager()) { - TRACE("dl", source.display(tout << "before eager inlining\n");); + TRACE(dl, source.display(tout << "before eager inlining\n");); plan_inlining(source); try { something_done = transform_rules(source, *res); @@ -856,7 +856,7 @@ namespace datalog { if (do_eager_inlining(res)) { something_done = true; } - TRACE("dl", res->display(tout << "after eager inlining\n");); + TRACE(dl, res->display(tout << "after eager inlining\n");); } if (something_done) { res->inherit_predicates(source); diff --git a/src/muz/transforms/dl_mk_scale.cpp b/src/muz/transforms/dl_mk_scale.cpp index 54cf22ea8..b6178bb81 100644 --- a/src/muz/transforms/dl_mk_scale.cpp +++ b/src/muz/transforms/dl_mk_scale.cpp @@ -49,7 +49,7 @@ namespace datalog { expr_ref tmp(m); if (!new_fi) { - TRACE("dl", tout << new_p->get_name() << " has no value in the current model\n";); + TRACE(dl, tout << new_p->get_name() << " has no value in the current model\n";); continue; } for (unsigned i = 0; i < old_p->get_arity(); ++i) { @@ -88,7 +88,7 @@ namespace datalog { } } md = old_model; - //TRACE("dl", model_smt2_pp(tout, m, *md, 0); ); + //TRACE(dl, model_smt2_pp(tout, m, *md, 0); ); } model_converter * translate(ast_translation & translator) override { @@ -155,7 +155,7 @@ namespace datalog { result->set_output_predicate(new_rule->get_decl()); } } - TRACE("dl", result->display(tout);); + TRACE(dl, result->display(tout);); if (m_mc) { m_ctx.add_model_converter(m_mc); } diff --git a/src/muz/transforms/dl_mk_slice.cpp b/src/muz/transforms/dl_mk_slice.cpp index f1064e6b2..ec83cfcd9 100644 --- a/src/muz/transforms/dl_mk_slice.cpp +++ b/src/muz/transforms/dl_mk_slice.cpp @@ -121,7 +121,7 @@ namespace datalog { for (; it != end; ++it) { rm.to_formula(*it->m_value, fml); m_pinned_exprs.push_back(fml); - TRACE("dl", + TRACE(dl, tout << "orig: " << mk_pp(fml, m) << "\n"; it->m_value->display(m_ctx, tout << "new:\n");); m_sliceform2rule.insert(fml, it->m_key); @@ -146,7 +146,7 @@ namespace datalog { else { m_new_proof.insert(p, p); m_todo.pop_back(); - TRACE("dl", tout << "unhandled proof term\n" << mk_pp(p, m) << "\n";); + TRACE(dl, tout << "unhandled proof term\n" << mk_pp(p, m) << "\n";); } } pr = m_new_proof.find(pr); @@ -159,7 +159,7 @@ namespace datalog { return false; } if (!m_sliceform2rule.find(fact, r)) { - TRACE("dl", tout << "does not have fact\n" << mk_pp(fact, m) << "\n";); + TRACE(dl, tout << "does not have fact\n" << mk_pp(fact, m) << "\n";); return false; } proof_ref new_p(m); @@ -199,7 +199,7 @@ namespace datalog { proof* p0 = to_app(p->get_arg(0)); proof* p0_new = m_new_proof.find(p0); expr* fact0 = m.get_fact(p0); - TRACE("dl", tout << "fact0: " << mk_pp(fact0, m) << "\n";); + TRACE(dl, tout << "fact0: " << mk_pp(fact0, m) << "\n";); rule* orig0; if (!m_sliceform2rule.find(fact0, orig0)) { return false; @@ -212,7 +212,7 @@ namespace datalog { proof* p1 = to_app(p->get_arg(i)); proof* p1_new = m_new_proof.find(p1); expr* fact1 = m.get_fact(p1); - TRACE("dl", tout << "fact1: " << mk_pp(fact1, m) << "\n";); + TRACE(dl, tout << "fact1: " << mk_pp(fact1, m) << "\n";); rule* orig1 = nullptr; if (!m_sliceform2rule.find(fact1, orig1)) { return false; @@ -231,7 +231,7 @@ namespace datalog { // size of substitutions may have grown...substs[j].resize(num_args[j]); } substs.push_back(m_unifier.get_rule_subst(*r2.get(), false)); - TRACE("dl", + TRACE(dl, r1->display(m_ctx, tout << "rule1:"); r2->display(m_ctx, tout << "rule2:"); r3->display(m_ctx, tout << "res:");); @@ -241,7 +241,7 @@ namespace datalog { proof* new_p = m.mk_hyper_resolve(premises.size(), premises.data(), concl, positions, substs); m_pinned_exprs.push_back(new_p); m_pinned_rules.push_back(r1.get()); - TRACE("dl", + TRACE(dl, tout << "orig: " << mk_pp(slice_concl, m) << "\n"; r1->display(m_ctx, tout << "new:");); m_sliceform2rule.insert(slice_concl, r1.get()); @@ -249,7 +249,7 @@ namespace datalog { m_renaming.insert(r1.get(), unsigned_vector()); m_new_proof.insert(p, new_p); m_todo.pop_back(); - TRACE("dl", tout << "translated:\n" << mk_pp(p, m) << "\nto\n" << mk_pp(new_p, m) << "\n";); + TRACE(dl, tout << "translated:\n" << mk_pp(p, m) << "\nto\n" << mk_pp(new_p, m) << "\n";); return true; } @@ -316,7 +316,7 @@ namespace datalog { if (m_slice2old.empty()) { return; } - TRACE("dl", model_smt2_pp(tout, m, *md, 0); ); + TRACE(dl, model_smt2_pp(tout, m, *md, 0); ); model_ref old_model = alloc(model, m); for (auto [new_p, old_p] : m_slice2old) { bit_vector const& is_sliced = m_sliceable.find(old_p); @@ -324,7 +324,7 @@ namespace datalog { SASSERT(is_sliced.size() > new_p->get_arity()); func_interp* old_fi = alloc(func_interp, m, is_sliced.size()); - TRACE("dl", tout << mk_pp(old_p, m) << " " << mk_pp(new_p, m) << "\n"; + TRACE(dl, tout << mk_pp(old_p, m) << " " << mk_pp(new_p, m) << "\n"; for (unsigned j = 0; j < is_sliced.size(); ++j) { tout << (is_sliced.get(j)?"1":"0"); } @@ -344,12 +344,12 @@ namespace datalog { } func_interp* new_fi = md->get_func_interp(new_p); if (!new_fi) { - TRACE("dl", tout << new_p->get_name() << " has no value in the current model\n";); + TRACE(dl, tout << new_p->get_name() << " has no value in the current model\n";); dealloc(old_fi); continue; } if (!new_fi->is_partial()) { - TRACE("dl", tout << mk_pp(new_fi->get_else(), m) << "\n";); + TRACE(dl, tout << mk_pp(new_fi->get_else(), m) << "\n";); tmp = vs(new_fi->get_else(), subst.size(), subst.data()); old_fi->set_else(tmp); } @@ -391,7 +391,7 @@ namespace datalog { } } md = old_model; - TRACE("dl", model_smt2_pp(tout, m, *md, 0); ); + TRACE(dl, model_smt2_pp(tout, m, *md, 0); ); } model_converter * translate(ast_translation & translator) override { @@ -466,15 +466,15 @@ namespace datalog { expr_ref rhs(m); unsigned v = 0; if (is_eq(e, v, rhs) && is_output(v) && m_var_is_sliceable[v]) { - TRACE("dl", tout << "is_eq: " << mk_pp(e, m) << " " << (m_solved_vars[v].get()?"solved":"new") << "\n";); + TRACE(dl, tout << "is_eq: " << mk_pp(e, m) << " " << (m_solved_vars[v].get()?"solved":"new") << "\n";); add_var(v); if (!m_solved_vars[v].get()) { - TRACE("dl", tout << "#" << v << " is solved\n";); + TRACE(dl, tout << "#" << v << " is solved\n";); add_free_vars(parameter_vars, rhs); m_solved_vars[v] = rhs; } else { - TRACE("dl", tout << "#" << v << " is used\n";); + TRACE(dl, tout << "#" << v << " is used\n";); // variables can only be solved once. add_free_vars(used_vars, e); add_free_vars(used_vars, m_solved_vars[v].get()); @@ -489,7 +489,7 @@ namespace datalog { bool mk_slice::prune_rule(rule& r) { - TRACE("dl", r.display(m_ctx, tout << "prune:\n"); ); + TRACE(dl, r.display(m_ctx, tout << "prune:\n"); ); bool change = false; init_vars(r); // @@ -503,7 +503,7 @@ namespace datalog { if (!is_var(p->get_arg(i)) && bv.get(i)) { bv.unset(i); change = true; - TRACE("dl", tout << "argument " << i << " is not a variable " << p->get_decl()->get_name() << "\n";); + TRACE(dl, tout << "argument " << i << " is not a variable " << p->get_decl()->get_name() << "\n";); } } } @@ -524,7 +524,7 @@ namespace datalog { // or are used to solve output sliceable variables, or // don't occur in interpreted tail. // - TRACE("dl", tout << "num vars " << num_vars() << "\n"); + TRACE(dl, tout << "num vars " << num_vars() << "\n"); for (unsigned i = 0; i < num_vars(); ++i) { if (!m_var_is_sliceable[i]) { continue; @@ -535,7 +535,7 @@ namespace datalog { } bool is_input = m_input[i]; bool is_output = m_output[i]; - TRACE("dl", tout << "#"<< i << " " << is_input << " " << is_output << " solved: " << mk_pp(m_solved_vars.get(i), m) << "\n"); + TRACE(dl, tout << "#"<< i << " " << is_input << " " << is_output << " solved: " << mk_pp(m_solved_vars.get(i), m) << "\n"); if (is_input && is_output) { if (m_solved_vars.get(i)) m_var_is_sliceable[i] = false; @@ -646,7 +646,7 @@ namespace datalog { bit_vector& bv = get_predicate_slice(p); for (unsigned i = 0; i < p->get_num_args(); ++i) { if (is_neg_tail) { - TRACE("dl", tout << "negated " << i << " in " << p->get_decl()->get_name() << "\n";); + TRACE(dl, tout << "negated " << i << " in " << p->get_decl()->get_name() << "\n";); bv.unset(i); } expr* arg = p->get_arg(i); @@ -663,7 +663,7 @@ namespace datalog { } else { SASSERT(m.is_value(arg)); - TRACE("dl", tout << i << " in " << p->get_decl()->get_name() << " is a value, unable to slice\n";); + TRACE(dl, tout << i << " in " << p->get_decl()->get_name() << " is a value, unable to slice\n";); bv.unset(i); } } @@ -677,7 +677,7 @@ namespace datalog { if (is_var(arg) && !m_var_is_sliceable[to_var(arg)->get_idx()] && bv.get(i)) { bv.unset(i); change = true; - TRACE("dl", tout << "variable is unslicable " << mk_pp(arg, m) << " for index " << i << " in " << p->get_decl()->get_name() << "\n";); + TRACE(dl, tout << "variable is unslicable " << mk_pp(arg, m) << " for index " << i << " in " << p->get_decl()->get_name() << "\n";); } } return change; @@ -798,7 +798,7 @@ namespace datalog { rm.fix_unbound_vars(new_rule, false); - TRACE("dl", r.display(m_ctx, tout << "replacing:\n"); new_rule->display(m_ctx, tout << "by:\n");); + TRACE(dl, r.display(m_ctx, tout << "replacing:\n"); new_rule->display(m_ctx, tout << "by:\n");); if (m_ctx.generate_proof_trace()) { rm.mk_rule_asserted_proof(*new_rule.get()); } @@ -844,9 +844,9 @@ namespace datalog { // nothing could be sliced. return nullptr; } - TRACE("dl", display(tout);); + TRACE(dl, display(tout);); update_rules(src, *result); - TRACE("dl", result->display(tout);); + TRACE(dl, result->display(tout);); if (m_mc) { obj_map::iterator it = m_sliceable.begin(), end = m_sliceable.end(); for (; it != end; ++it) { diff --git a/src/muz/transforms/dl_mk_subsumption_checker.cpp b/src/muz/transforms/dl_mk_subsumption_checker.cpp index e8b1f4001..106358e6f 100644 --- a/src/muz/transforms/dl_mk_subsumption_checker.cpp +++ b/src/muz/transforms/dl_mk_subsumption_checker.cpp @@ -247,7 +247,7 @@ namespace datalog { } m_context.add_model_converter(mc0); } - TRACE("dl", + TRACE(dl, tout << "original set size: "<get_name() << " " << arg_index << " for " << cpred->get_name() << "\n";); + TRACE(dl, tout << "inserting: " << pred->get_name() << " " << arg_index << " for " << cpred->get_name() << "\n";); } void mk_unbound_compressor::detect_tasks(rule_set const& source, unsigned rule_index) { @@ -103,7 +103,7 @@ namespace datalog { if (is_var(arg, var_idx) && !tail_vars.contains(var_idx) && (1 == rm.get_counter().get(var_idx))) { - TRACE("dl", r->display(m_context, tout << "Compress: ");); + TRACE(dl, r->display(m_context, tout << "Compress: ");); add_task(head_pred, i); break; //we compress out the unbound arguments one by one @@ -164,7 +164,7 @@ namespace datalog { m_head_occurrence_ctr.dec(m_rules.get(rule_index)->get_decl()); unsigned new_size = m_rules.size() - 1; rule* last_rule = m_rules.get(new_size); - TRACE("dl", tout << "remove\n"; r->display(m_context, tout); + TRACE(dl, tout << "remove\n"; r->display(m_context, tout); tout << "shift\n"; last_rule->display(m_context, tout);); if (rule_index < new_size) { m_rules.set(rule_index, last_rule); @@ -177,7 +177,7 @@ namespace datalog { new_rule->set_accounting_parent_object(m_context, r); m_head_occurrence_ctr.dec(m_rules.get(rule_index)->get_decl()); - TRACE("dl", tout << "remove\n"; r->display(m_context, tout); + TRACE(dl, tout << "remove\n"; r->display(m_context, tout); tout << "set\n"; new_rule->display(m_context, tout);); m_rules.set(rule_index, new_rule); m_head_occurrence_ctr.inc(m_rules.get(rule_index)->get_decl()); @@ -192,7 +192,7 @@ namespace datalog { app * orig_dtail = r->get_tail(tail_index); //dtail ~ decompressed tail c_info ci(orig_dtail->get_decl(), arg_index); - TRACE("dl", tout << "retrieving: " << ci.first->get_name() << " " << ci.second << "\n";); + TRACE(dl, tout << "retrieving: " << ci.first->get_name() << " " << ci.second << "\n";); func_decl * dtail_pred = m_map.find(ci); ptr_vector dtail_args; @@ -247,7 +247,7 @@ namespace datalog { rule_ref new_rule = mk_decompression_rule(r, tail_index, arg_index); unsigned new_rule_index = m_rules.size(); m_rules.push_back(new_rule); - TRACE("dl", r->display(m_context, tout); new_rule->display(m_context, tout); ); + TRACE(dl, r->display(m_context, tout); new_rule->display(m_context, tout); ); m_context.get_rule_manager().mk_rule_rewrite_proof(*r, *new_rule.get()); m_head_occurrence_ctr.inc(new_rule->get_decl()); detect_tasks(source, new_rule_index); @@ -257,7 +257,7 @@ namespace datalog { void mk_unbound_compressor::replace_by_decompression_rule(rule_set const& source, unsigned rule_index, unsigned tail_index, unsigned arg_index) { rule * r = m_rules.get(rule_index); rule_ref new_rule = mk_decompression_rule(r, tail_index, arg_index); - TRACE("dl", tout << "remove\n"; r->display(m_context, tout); tout << "set\n"; new_rule->display(m_context, tout);); + TRACE(dl, tout << "remove\n"; r->display(m_context, tout); tout << "set\n"; new_rule->display(m_context, tout);); m_rules.set(rule_index, new_rule); // we don't update the m_head_occurrence_ctr because the head predicate doesn't change detect_tasks(source, rule_index); diff --git a/src/nlsat/nlsat_evaluator.cpp b/src/nlsat/nlsat_evaluator.cpp index ca6f9efae..00931a1f3 100644 --- a/src/nlsat/nlsat_evaluator.cpp +++ b/src/nlsat/nlsat_evaluator.cpp @@ -425,7 +425,7 @@ namespace nlsat { scoped_anum_vector & roots = m_tmp_values; roots.reset(); m_am.isolate_roots(polynomial_ref(a->p(), m_pm), undef_var_assignment(m_assignment, a->x()), roots); - TRACE("nlsat_evaluator", + TRACE(nlsat_evaluator, m_solver.display(tout << (neg?"!":""), *a); tout << "\n"; if (roots.empty()) { tout << "No roots\n"; @@ -463,7 +463,7 @@ namespace nlsat { svector & signs = m_add_signs_tmp; roots.reset(); signs.reset(); - TRACE("nlsat_evaluator", tout << "x: " << x << " max_var(p): " << m_pm.max_var(p) << "\n";); + TRACE(nlsat_evaluator, tout << "x: " << x << " max_var(p): " << m_pm.max_var(p) << "\n";); // Note: I added undef_var_assignment in the following statement, to allow us to obtain the infeasible interval sets // even when the maximal variable is assigned. I need this feature to minimize conflict cores. m_am.isolate_roots(polynomial_ref(p, m_pm), undef_var_assignment(m_assignment, x), roots, signs); @@ -477,7 +477,7 @@ namespace nlsat { unsigned num_ps = a->size(); for (unsigned i = 0; i < num_ps; i++) { ::sign curr_sign = t.sign_at(i, c); - TRACE("nlsat_evaluator_bug", tout << "sign of i: " << i << " at cell " << c << "\n"; + TRACE(nlsat_evaluator_bug, tout << "sign of i: " << i << " at cell " << c << "\n"; m_pm.display(tout, a->p(i)); tout << "\nsign: " << curr_sign << "\n";); if (a->is_even(i) && curr_sign < 0) @@ -492,15 +492,15 @@ namespace nlsat { interval_set_ref infeasible_intervals(ineq_atom * a, bool neg, clause const* cls) { sign_table & table = m_sign_table_tmp; table.reset(); - TRACE("nlsat_evaluator", m_solver.display(tout, *a) << "\n";); + TRACE(nlsat_evaluator, m_solver.display(tout, *a) << "\n";); unsigned num_ps = a->size(); var x = a->max_var(); for (unsigned i = 0; i < num_ps; i++) { add(a->p(i), x, table); - TRACE("nlsat_evaluator_bug", tout << "table after:\n"; m_pm.display(tout, a->p(i)); tout << "\n"; table.display_raw(tout);); + TRACE(nlsat_evaluator_bug, tout << "table after:\n"; m_pm.display(tout, a->p(i)); tout << "\n"; table.display_raw(tout);); } - TRACE("nlsat_evaluator", + TRACE(nlsat_evaluator, tout << "sign table for:\n"; for (unsigned i = 0; i < num_ps; i++) { m_pm.display(tout, a->p(i)); tout << "\n"; } table.display(tout);); @@ -518,7 +518,7 @@ namespace nlsat { unsigned num_cells = table.num_cells(); for (unsigned c = 0; c < num_cells; c++) { - TRACE("nlsat_evaluator", + TRACE(nlsat_evaluator, tout << "cell: " << c << "\n"; tout << "prev_sat: " << prev_sat << "\n"; tout << "prev_inf: " << prev_inf << "\n"; @@ -527,7 +527,7 @@ namespace nlsat { tout << "processing cell: " << c << "\n"; tout << "interval_set so far:\n" << result << "\n";); int sign = sign_at(a, table, c); - TRACE("nlsat_evaluator", tout << "sign: " << sign << "\n";); + TRACE(nlsat_evaluator, tout << "sign: " << sign << "\n";); if (satisfied(sign, k, neg)) { // current cell is satisfied if (!prev_sat) { @@ -571,13 +571,13 @@ namespace nlsat { if (table.is_section(c)) { prev_open = false; prev_root_id = table.get_root_id(c); - TRACE("nlsat_evaluator", tout << "updated prev_root_id: " << prev_root_id << " using cell: " << c << "\n";); + TRACE(nlsat_evaluator, tout << "updated prev_root_id: " << prev_root_id << " using cell: " << c << "\n";); } else { SASSERT(table.is_section(c-1)); prev_open = true; prev_root_id = table.get_root_id(c-1); - TRACE("nlsat_evaluator", tout << "updated prev_root_id: " << prev_root_id << " using cell: " << (c - 1) << "\n";); + TRACE(nlsat_evaluator, tout << "updated prev_root_id: " << prev_root_id << " using cell: " << (c - 1) << "\n";); } } prev_sat = false; @@ -590,7 +590,7 @@ namespace nlsat { } } } - TRACE("nlsat_evaluator", tout << "interval_set: " << result << "\n";); + TRACE(nlsat_evaluator, tout << "interval_set: " << result << "\n";); return result; } @@ -661,7 +661,7 @@ namespace nlsat { break; } } - TRACE("nlsat_evaluator", tout << "interval_set: " << result << "\n";); + TRACE(nlsat_evaluator, tout << "interval_set: " << result << "\n";); return result; } diff --git a/src/nlsat/nlsat_explain.cpp b/src/nlsat/nlsat_explain.cpp index 58b185e4c..dcca4fcfb 100644 --- a/src/nlsat/nlsat_explain.cpp +++ b/src/nlsat/nlsat_explain.cpp @@ -188,7 +188,7 @@ namespace nlsat { unsigned lidx = l.index(); if (m_already_added_literal.get(lidx, false)) return; - TRACE("nlsat_explain", tout << "adding literal: " << lidx << "\n"; m_solver.display(tout, l) << "\n";); + TRACE(nlsat_explain, tout << "adding literal: " << lidx << "\n"; m_solver.display(tout, l) << "\n";); m_already_added_literal.setx(lidx, true, false); m_result->push_back(l); } @@ -211,7 +211,7 @@ namespace nlsat { ::sign sign(polynomial_ref const & p) { SASSERT(max_var(p) == null_var || m_assignment.is_assigned(max_var(p))); auto s = m_am.eval_sign_at(p, m_assignment); - TRACE("nlsat_explain", tout << "p: " << p << " var: " << max_var(p) << " sign: " << s << "\n";); + TRACE(nlsat_explain, tout << "p: " << p << " var: " << max_var(p) << " sign: " << s << "\n";); return s; } @@ -220,7 +220,7 @@ namespace nlsat { */ void factor(polynomial_ref & p, polynomial_ref_vector & fs) { // TODO: add params, caching - TRACE("nlsat_factor", tout << "factor\n" << p << "\n";); + TRACE(nlsat_factor, tout << "factor\n" << p << "\n";); fs.reset(); m_cache.factor(p.get(), fs); } @@ -300,7 +300,7 @@ namespace nlsat { SASSERT(!m_zero_fs.empty()); // one of the factors must be zero in the current interpretation, since p is zero in it. literal l = m_solver.mk_ineq_literal(atom::EQ, m_zero_fs.size(), m_zero_fs.data(), m_is_even.data()); l.neg(); - TRACE("nlsat_explain", tout << "adding (zero assumption) literal:\n"; display(tout, l); tout << "\n";); + TRACE(nlsat_explain, tout << "adding (zero assumption) literal:\n"; display(tout, l); tout << "\n";); add_literal(l); } @@ -333,7 +333,7 @@ namespace nlsat { polynomial_ref lc(m_pm); polynomial_ref reduct(m_pm); while (true) { - TRACE("nlsat_explain", tout << "elim vanishing x" << x << " k:" << k << " " << p << "\n";); + TRACE(nlsat_explain, tout << "elim vanishing x" << x << " k:" << k << " " << p << "\n";); if (is_const(p)) return; if (k == 0) { @@ -353,11 +353,11 @@ namespace nlsat { } #endif if (m_pm.nonzero_const_coeff(p, x, k)) { - TRACE("nlsat_explain", tout << "nonzero const x" << x << "\n";); + TRACE(nlsat_explain, tout << "nonzero const x" << x << "\n";); return; // lc is a nonzero constant } lc = m_pm.coeff(p, x, k, reduct); - TRACE("nlsat_explain", tout << "lc: " << lc << " reduct: " << reduct << "\n";); + TRACE(nlsat_explain, tout << "lc: " << lc << " reduct: " << reduct << "\n";); if (!is_zero(lc)) { if (!::is_zero(sign(lc))) return; @@ -605,13 +605,13 @@ namespace nlsat { if (m_factor) { restore_factors _restore(m_factors, m_factors_save); factor(p, m_factors); - TRACE("nlsat_explain", display(tout << "adding factors of\n", p); tout << "\n" << m_factors << "\n";); + TRACE(nlsat_explain, display(tout << "adding factors of\n", p); tout << "\n" << m_factors << "\n";); polynomial_ref f(m_pm); for (unsigned i = 0; i < m_factors.size(); i++) { f = m_factors.get(i); elim_vanishing(f); if (!is_const(f)) { - TRACE("nlsat_explain", tout << "adding factor:\n"; display(tout, f); tout << "\n";); + TRACE(nlsat_explain, tout << "adding factor:\n"; display(tout, f); tout << "\n";); m_todo.insert(f); } } @@ -629,12 +629,12 @@ namespace nlsat { p = ps.get(i); unsigned k = degree(p, x); SASSERT(k > 0); - TRACE("nlsat_explain", tout << "add_lc, x: "; display_var(tout, x); tout << "\nk: " << k << "\n"; display(tout, p); tout << "\n";); + TRACE(nlsat_explain, tout << "add_lc, x: "; display_var(tout, x); tout << "\nk: " << k << "\n"; display(tout, p); tout << "\n";); for(; k > 0; k--){ lc = m_pm.coeff(p, x, k); add_factors(lc); if (m_pm.nonzero_const_coeff(p, x, k)){ - TRACE("nlsat_explain", tout << "constant coefficient, skipping...\n";); + TRACE(nlsat_explain, tout << "constant coefficient, skipping...\n";); break; } } @@ -676,9 +676,9 @@ namespace nlsat { p = ps.get(i); unsigned k = degree(p, x); SASSERT(k > 0); - TRACE("nlsat_explain", tout << "add_lc, x: "; display_var(tout, x); tout << "\nk: " << k << "\n"; display(tout, p); tout << "\n";); + TRACE(nlsat_explain, tout << "add_lc, x: "; display_var(tout, x); tout << "\nk: " << k << "\n"; display(tout, p); tout << "\n";); if (m_pm.nonzero_const_coeff(p, x, k)) { - TRACE("nlsat_explain", tout << "constant coefficient, skipping...\n";); + TRACE(nlsat_explain, tout << "constant coefficient, skipping...\n";); continue; } lc = m_pm.coeff(p, x, k); @@ -742,7 +742,7 @@ namespace nlsat { psc_chain(p, q, x, S); unsigned sz = S.size(); - TRACE("nlsat_explain", tout << "computing psc of\n"; display(tout, p); tout << "\n"; display(tout, q); tout << "\n"; + TRACE(nlsat_explain, tout << "computing psc of\n"; display(tout, p); tout << "\n"; display(tout, q); tout << "\n"; for (unsigned i = 0; i < sz; ++i) { s = S.get(i); tout << "psc: " << s << "\n"; @@ -750,21 +750,21 @@ namespace nlsat { for (unsigned i = 0; i < sz; i++) { s = S.get(i); - TRACE("nlsat_explain", display(tout << "processing psc(" << i << ")\n", s) << "\n";); + TRACE(nlsat_explain, display(tout << "processing psc(" << i << ")\n", s) << "\n";); if (is_zero(s)) { - TRACE("nlsat_explain", tout << "skipping psc is the zero polynomial\n";); + TRACE(nlsat_explain, tout << "skipping psc is the zero polynomial\n";); continue; } if (is_const(s)) { - TRACE("nlsat_explain", tout << "done, psc is a constant\n";); + TRACE(nlsat_explain, tout << "done, psc is a constant\n";); return; } if (is_zero(sign(s))) { - TRACE("nlsat_explain", tout << "psc vanished, adding zero assumption\n";); + TRACE(nlsat_explain, tout << "psc vanished, adding zero assumption\n";); add_zero_assumption(s); continue; } - TRACE("nlsat_explain", + TRACE(nlsat_explain, tout << "adding v-psc of\n"; display(tout, p); tout << "\n"; @@ -830,14 +830,14 @@ namespace nlsat { void add_root_literal(atom::kind k, var y, unsigned i, poly * p) { polynomial_ref pr(p, m_pm); - TRACE("nlsat_explain", + TRACE(nlsat_explain, display(tout << "x" << y << " " << k << "[" << i << "](", pr); tout << ")\n";); if (!mk_linear_root(k, y, i, p) && !mk_quadratic_root(k, y, i, p)) { bool_var b = m_solver.mk_root_atom(k, y, i, p); literal l(b, true); - TRACE("nlsat_explain", tout << "adding literal\n"; display(tout, l); tout << "\n";); + TRACE(nlsat_explain, tout << "adding literal\n"; display(tout, l); tout << "\n";); add_literal(l); } } @@ -949,7 +949,7 @@ namespace nlsat { #else int s = sign(p); if (!is_const(p)) { - TRACE("nlsat_explain", tout << p << "\n";); + TRACE(nlsat_explain, tout << p << "\n";); add_simple_assumption(s == 0 ? atom::EQ : (s < 0 ? atom::LT : atom::GT), p); } return s; @@ -965,7 +965,7 @@ namespace nlsat { */ void mk_linear_root(atom::kind k, var y, unsigned i, poly * p, bool mk_neg) { - TRACE("nlsat_explain", display_var(tout, y); m_pm.display(tout << ": ", p, m_solver.display_proc()); tout << "\n"); + TRACE(nlsat_explain, display_var(tout, y); m_pm.display(tout << ": ", p, m_solver.display_proc()); tout << "\n"); polynomial_ref p_prime(m_pm); p_prime = p; bool lsign = false; @@ -994,7 +994,7 @@ namespace nlsat { scoped_anum lower(m_am); scoped_anum upper(m_am); anum const & y_val = m_assignment.value(y); - TRACE("nlsat_explain", tout << "adding literals for "; display_var(tout, y); tout << " -> "; + TRACE(nlsat_explain, tout << "adding literals for "; display_var(tout, y); tout << " -> "; m_am.display_decimal(tout, y_val); tout << "\n";); polynomial_ref p_lower(m_pm); unsigned i_lower = UINT_MAX; @@ -1014,7 +1014,7 @@ namespace nlsat { bool all_lt = true; for (unsigned i = 0; i < num_roots; i++) { int s = m_am.compare(y_val, roots[i]); - TRACE("nlsat_explain", + TRACE(nlsat_explain, m_am.display_decimal(tout << "comparing root: ", roots[i]); tout << "\n"; m_am.display_decimal(tout << "with y_val:", y_val); tout << "\nsign " << s << "\n"; @@ -1097,7 +1097,7 @@ namespace nlsat { scoped_anum lower(m_am); scoped_anum upper(m_am); anum const & y_val = m_assignment.value(y); - TRACE("nlsat_explain", tout << "adding literals for "; display_var(tout, y); tout << " -> "; + TRACE(nlsat_explain, tout << "adding literals for "; display_var(tout, y); tout << " -> "; m_am.display_decimal(tout, y_val); tout << "\n";); polynomial_ref p_lower(m_pm); unsigned i_lower = UINT_MAX; @@ -1117,7 +1117,7 @@ namespace nlsat { bool all_lt = true; for (unsigned i = 0; i < num_roots; i++) { int s = m_am.compare(y_val, roots[i]); - TRACE("nlsat_explain", + TRACE(nlsat_explain, m_am.display_decimal(tout << "comparing root: ", roots[i]); tout << "\n"; m_am.display_decimal(tout << "with y_val:", y_val); tout << "\nsign " << s << "\n"; @@ -1207,7 +1207,7 @@ namespace nlsat { m_todo.reset(); break; } - TRACE("nlsat_explain", tout << "project loop, processing var "; display_var(tout, x); tout << "\npolynomials\n"; + TRACE(nlsat_explain, tout << "project loop, processing var "; display_var(tout, x); tout << "\npolynomials\n"; display(tout, ps); tout << "\n";); add_lc(ps, x); psc_discriminant(ps, x); @@ -1249,7 +1249,7 @@ namespace nlsat { m_todo.reset(); break; } - TRACE("nlsat_explain", tout << "project loop, processing var "; display_var(tout, x); tout << "\npolynomials\n"; + TRACE(nlsat_explain, tout << "project loop, processing var "; display_var(tout, x); tout << "\npolynomials\n"; display(tout, ps); tout << "\n";); if (first) { @@ -1373,7 +1373,7 @@ namespace nlsat { new_lit = l; return; } - TRACE("nlsat_simplify_core", display(tout << "trying to simplify literal\n", l) << "\nusing equation\n"; + TRACE(nlsat_simplify_core, display(tout << "trying to simplify literal\n", l) << "\nusing equation\n"; m_pm.display(tout, info.m_eq, m_solver.display_proc()); tout << "\n";); int atom_sign = 1; bool modified_lit = false; @@ -1393,22 +1393,22 @@ namespace nlsat { m_pm.pseudo_remainder(f, info.m_eq, info.m_x, d, new_factor); polynomial_ref fact(f, m_pm), eq(const_cast(info.m_eq), m_pm); - TRACE("nlsat_simplify_core", tout << "d: " << d << " factor " << fact << " eq " << eq << " new factor " << new_factor << "\n";); + TRACE(nlsat_simplify_core, tout << "d: " << d << " factor " << fact << " eq " << eq << " new factor " << new_factor << "\n";); // adjust sign based on sign of lc of eq if (d % 2 == 1 && // d is odd !is_even && // degree of the factor is odd info.m_lc_sign < 0) { // lc of the eq is negative atom_sign = -atom_sign; // flipped the sign of the current literal - TRACE("nlsat_simplify_core", tout << "odd degree\n";); + TRACE(nlsat_simplify_core, tout << "odd degree\n";); } if (is_const(new_factor)) { - TRACE("nlsat_simplify_core", tout << "new factor is const\n";); + TRACE(nlsat_simplify_core, tout << "new factor is const\n";); auto s = sign(new_factor); if (is_zero(s)) { bool atom_val = a->get_kind() == atom::EQ; bool lit_val = l.sign() ? !atom_val : atom_val; new_lit = lit_val ? true_literal : false_literal; - TRACE("nlsat_simplify_core", tout << "zero sign: " << info.m_lc_const << "\n";); + TRACE(nlsat_simplify_core, tout << "zero sign: " << info.m_lc_const << "\n";); if (!info.m_lc_const) { // We have essentially shown the current factor must be zero If the leading coefficient is not zero. // Note that, if the current factor is zero, then the whole polynomial is zero. @@ -1420,7 +1420,7 @@ namespace nlsat { return; } else { - TRACE("nlsat_simplify_core", tout << "non-zero sign: " << info.m_lc_const << "\n";); + TRACE(nlsat_simplify_core, tout << "non-zero sign: " << info.m_lc_const << "\n";); // We have shown the current factor is a constant MODULO the sign of the leading coefficient (of the equation used to rewrite the factor). if (!info.m_lc_const) { // If the leading coefficient is not a constant, we must store this information as an extra assumption. @@ -1460,7 +1460,7 @@ namespace nlsat { new_lit = m_solver.mk_ineq_literal(new_k, new_factors.size(), new_factors.data(), new_factors_even.data()); if (l.sign()) new_lit.neg(); - TRACE("nlsat_simplify_core", tout << "simplified literal:\n"; display(tout, new_lit) << " " << m_solver.value(new_lit) << "\n";); + TRACE(nlsat_simplify_core, tout << "simplified literal:\n"; display(tout, new_lit) << " " << m_solver.value(new_lit) << "\n";); if (max_var(new_lit) < max) { if (m_solver.value(new_lit) == l_true) { @@ -1473,7 +1473,7 @@ namespace nlsat { } else { new_lit = normalize(new_lit, max); - TRACE("nlsat_simplify_core", tout << "simplified literal after normalization:\n"; display(tout, new_lit); tout << " " << m_solver.value(new_lit) << "\n";); + TRACE(nlsat_simplify_core, tout << "simplified literal after normalization:\n"; display(tout, new_lit); tout << " " << m_solver.value(new_lit) << "\n";); } } else { @@ -1615,7 +1615,7 @@ namespace nlsat { poly * eq = select_eq(C, max); if (eq == nullptr) break; - TRACE("nlsat_simplify_core", tout << "using equality for simplifying core\n"; + TRACE(nlsat_simplify_core, tout << "using equality for simplifying core\n"; m_pm.display(tout, eq, m_solver.display_proc()); tout << "\n";); if (!simplify(C, eq, max)) break; @@ -1630,7 +1630,7 @@ namespace nlsat { poly * eq_p = eq->p(0); VERIFY(simplify(C, eq_p, max)); // add equation as an assumption - TRACE("nlsat_simpilfy_core", display(tout << "adding equality as assumption ", literal(eq->bvar(), true)); tout << "\n";); + TRACE(nlsat_simpilfy_core, display(tout << "adding equality as assumption ", literal(eq->bvar(), true)); tout << "\n";); add_literal(literal(eq->bvar(), true)); } } @@ -1643,11 +1643,11 @@ namespace nlsat { return; collect_polys(num, ls, m_ps); var max_x = max_var(m_ps); - TRACE("nlsat_explain", tout << "polynomials in the conflict:\n"; display(tout, m_ps); tout << "\n";); + TRACE(nlsat_explain, tout << "polynomials in the conflict:\n"; display(tout, m_ps); tout << "\n";); elim_vanishing(m_ps); - TRACE("nlsat_explain", tout << "elim vanishing\n"; display(tout, m_ps); tout << "\n";); + TRACE(nlsat_explain, tout << "elim vanishing\n"; display(tout, m_ps); tout << "\n";); project(m_ps, max_x); - TRACE("nlsat_explain", tout << "after projection\n"; display(tout, m_ps); tout << "\n";); + TRACE(nlsat_explain, tout << "after projection\n"; display(tout, m_ps); tout << "\n";); } void process2(unsigned num, literal const * ls) { @@ -1657,9 +1657,9 @@ namespace nlsat { var max = max_var(num, ls); SASSERT(max != null_var); normalize(m_core2, max); - TRACE("nlsat_explain", display(tout << "core after normalization\n", m_core2) << "\n";); + TRACE(nlsat_explain, display(tout << "core after normalization\n", m_core2) << "\n";); simplify(m_core2, max); - TRACE("nlsat_explain", display(tout << "core after simplify\n", m_core2) << "\n";); + TRACE(nlsat_explain, display(tout << "core after simplify\n", m_core2) << "\n";); main(m_core2.size(), m_core2.data()); m_core2.reset(); } @@ -1689,7 +1689,7 @@ namespace nlsat { return false; } } - TRACE("nlsat_minimize", tout << "interval set after adding partial core:\n" << r << "\n";); + TRACE(nlsat_minimize, tout << "interval set after adding partial core:\n" << r << "\n";); if (todo.size() == 1) { // Done core.push_back(todo[0]); @@ -1725,15 +1725,15 @@ namespace nlsat { todo.reset(); core.reset(); todo.append(num, ls); while (true) { - TRACE("nlsat_minimize", tout << "core minimization:\n"; display(tout, todo); tout << "\nCORE:\n"; display(tout, core) << "\n";); + TRACE(nlsat_minimize, tout << "core minimization:\n"; display(tout, todo); tout << "\nCORE:\n"; display(tout, core) << "\n";); if (!minimize_core(todo, core)) break; std::reverse(todo.begin(), todo.end()); - TRACE("nlsat_minimize", tout << "core minimization:\n"; display(tout, todo); tout << "\nCORE:\n"; display(tout, core) << "\n";); + TRACE(nlsat_minimize, tout << "core minimization:\n"; display(tout, todo); tout << "\nCORE:\n"; display(tout, core) << "\n";); if (!minimize_core(todo, core)) break; } - TRACE("nlsat_minimize", tout << "core:\n"; display(tout, core);); + TRACE(nlsat_minimize, tout << "core:\n"; display(tout, core);); r.append(core.size(), core.data()); } @@ -1752,7 +1752,7 @@ namespace nlsat { void operator()(unsigned num, literal const * ls, scoped_literal_vector & result) { SASSERT(check_already_added()); SASSERT(num > 0); - TRACE("nlsat_explain", + TRACE(nlsat_explain, tout << "[explain] set of literals is infeasible in the current interpretation\n"; display(tout, num, ls) << "\n"; m_assignment.display(tout); @@ -1761,7 +1761,7 @@ namespace nlsat { process(num, ls); reset_already_added(); m_result = nullptr; - TRACE("nlsat_explain", display(tout << "[explain] result\n", result) << "\n";); + TRACE(nlsat_explain, display(tout << "[explain] result\n", result) << "\n";); CASSERT("nlsat", check_already_added()); } @@ -1770,7 +1770,7 @@ namespace nlsat { m_result = &result; svector lits; - TRACE("nlsat", tout << "project x" << x << "\n"; + TRACE(nlsat, tout << "project x" << x << "\n"; m_solver.display(tout, num, ls); m_solver.display(tout);); @@ -1792,7 +1792,7 @@ namespace nlsat { } std::swap(renaming[x], renaming[mx_var]); m_solver.reorder(renaming.size(), renaming.data()); - TRACE("qe", tout << "x: " << x << " max: " << mx_var << " num_vars: " << m_solver.num_vars() << "\n"; + TRACE(qe, tout << "x: " << x << " max: " << mx_var << " num_vars: " << m_solver.num_vars() << "\n"; m_solver.display(tout);); } elim_vanishing(m_ps); @@ -1816,9 +1816,9 @@ namespace nlsat { result.set(i, ~result[i]); } #ifdef Z3DEBUG - TRACE("nlsat", m_solver.display(tout, result.size(), result.data()) << "\n"; ); + TRACE(nlsat, m_solver.display(tout, result.size(), result.data()) << "\n"; ); for (literal l : result) { - CTRACE("nlsat", l_true != m_solver.value(l), m_solver.display(tout, l) << " " << m_solver.value(l) << "\n";); + CTRACE(nlsat, l_true != m_solver.value(l), m_solver.display(tout, l) << " " << m_solver.value(l) << "\n";); SASSERT(l_true == m_solver.value(l)); } #endif @@ -1870,7 +1870,7 @@ namespace nlsat { void signed_project(polynomial_ref_vector& ps, var x) { - TRACE("nlsat_explain", tout << "Signed projection\n";); + TRACE(nlsat_explain, tout << "Signed projection\n";); polynomial_ref p(m_pm); unsigned eq_index = 0; bool eq_valid = false; @@ -1958,7 +1958,7 @@ namespace nlsat { if (s > 0) ++num_glb; } } - TRACE("nlsat_explain", tout << "glb: " << num_glb << " lub: " << num_lub << "\n" << lub_index << "\n" << glb_index << "\n" << ps << "\n";); + TRACE(nlsat_explain, tout << "glb: " << num_glb << " lub: " << num_lub << "\n" << lub_index << "\n" << glb_index << "\n" << ps << "\n";); if (num_lub == 0) { project_plus_infinity(x, ps); @@ -2000,7 +2000,7 @@ namespace nlsat { lc = m_pm.coeff(p, x, d); if (!is_const(lc)) { int s = sign(p); - TRACE("nlsat_explain", tout << "degree: " << d << " " << lc << " sign: " << s << "\n";); + TRACE(nlsat_explain, tout << "degree: " << d << " " << lc << " sign: " << s << "\n";); SASSERT(s != 0); atom::kind k; if (s > 0) { @@ -2015,7 +2015,7 @@ namespace nlsat { } void project_pairs(var x, unsigned idx, polynomial_ref_vector const& ps) { - TRACE("nlsat_explain", tout << "project pairs\n";); + TRACE(nlsat_explain, tout << "project pairs\n";); polynomial_ref p(m_pm); p = ps.get(idx); for (unsigned i = 0; i < ps.size(); ++i) { @@ -2048,7 +2048,7 @@ namespace nlsat { As.push_back(m_pm.mk_const(rational(1))); Bs.push_back(m_pm.mk_const(rational(1))); B = neg(B); - TRACE("nlsat_explain", tout << "p: " << p << " A: " << A << " B: " << B << "\n";); + TRACE(nlsat_explain, tout << "p: " << p << " A: " << A << " B: " << B << "\n";); // x = B/A for (unsigned i = 0; i < ps.size(); ++i) { if (i != idx) { @@ -2064,14 +2064,14 @@ namespace nlsat { for (unsigned j = 0; j <= d; ++j) { // A^d*p0 + A^{d-1}*B*p1 + ... + B^j*A^{d-j}*pj + ... + B^d*p_d C = m_pm.coeff(q, x, j); - TRACE("nlsat_explain", tout << "coeff: q" << j << ": " << C << "\n";); + TRACE(nlsat_explain, tout << "coeff: q" << j << ": " << C << "\n";); if (!is_zero(C)) { D = As.get(d - j); E = Bs.get(j); r = r + D*E*C; } } - TRACE("nlsat_explain", tout << "p: " << p << " q: " << q << " r: " << r << "\n";); + TRACE(nlsat_explain, tout << "p: " << p << " q: " << q << " r: " << r << "\n";); ensure_sign(r); } else { diff --git a/src/nlsat/nlsat_interval_set.cpp b/src/nlsat/nlsat_interval_set.cpp index 872266f5f..d5674774b 100644 --- a/src/nlsat/nlsat_interval_set.cpp +++ b/src/nlsat/nlsat_interval_set.cpp @@ -77,7 +77,7 @@ namespace nlsat { if (!i.m_lower_inf && !i.m_upper_inf) { auto s = am.compare(i.m_lower, i.m_upper); (void)s; - TRACE("nlsat_interval", tout << "lower: "; am.display_decimal(tout, i.m_lower); tout << ", upper: "; am.display_decimal(tout, i.m_upper); + TRACE(nlsat_interval, tout << "lower: "; am.display_decimal(tout, i.m_lower); tout << ", upper: "; am.display_decimal(tout, i.m_upper); tout << "\ns: " << s << "\n";); SASSERT(s <= 0); SASSERT(!is_zero(s) || (!i.m_lower_open && !i.m_upper_open)); @@ -89,7 +89,7 @@ namespace nlsat { SASSERT(!curr.m_upper_inf); SASSERT(!next.m_lower_inf); sign s = am.compare(curr.m_upper, next.m_lower); - CTRACE("nlsat", s > 0, display(tout, am, curr); tout << " "; display(tout, am, next); tout << "\n";); + CTRACE(nlsat, s > 0, display(tout, am, curr); tout << " "; display(tout, am, next); tout << "\n";); SASSERT(s <= 0); SASSERT(!is_zero(s) || curr.m_upper_open || next.m_lower_open); (void)s; @@ -200,12 +200,12 @@ namespace nlsat { inline ::sign compare_upper_lower(anum_manager & am, interval const & i1, interval const & i2) { if (i1.m_upper_inf || i2.m_lower_inf) { - TRACE("nlsat_interval", nlsat::display(tout << "i1: ", am, i1); nlsat::display(tout << "i2: ", am, i2);); + TRACE(nlsat_interval, nlsat::display(tout << "i1: ", am, i1); nlsat::display(tout << "i2: ", am, i2);); return sign_pos; } SASSERT(!i1.m_upper_inf && !i2.m_lower_inf); auto s = am.compare(i1.m_upper, i2.m_lower); - TRACE("nlsat_interval", nlsat::display(tout << "i1: ", am, i1); nlsat::display(tout << " i2: ", am, i2); + TRACE(nlsat_interval, nlsat::display(tout << "i1: ", am, i1); nlsat::display(tout << " i2: ", am, i2); tout << " compare: " << s << "\n";); if (!::is_zero(s)) return s; @@ -274,7 +274,7 @@ namespace nlsat { enable_trace("algebraic"); } #endif - TRACE("nlsat_interval", tout << "mk_union\ns1: "; display(tout, s1); tout << "\ns2: "; display(tout, s2); tout << "\n";); + TRACE(nlsat_interval, tout << "mk_union\ns1: "; display(tout, s1); tout << "\ns2: "; display(tout, s2); tout << "\n";); if (s1 == nullptr || s1 == s2) return const_cast(s2); if (s2 == nullptr) @@ -291,7 +291,7 @@ namespace nlsat { while (true) { if (i1 >= sz1) { while (i2 < sz2) { - TRACE("nlsat_interval", tout << "adding remaining intervals from s2: "; nlsat::display(tout, m_am, s2->m_intervals[i2]); tout << "\n";); + TRACE(nlsat_interval, tout << "adding remaining intervals from s2: "; nlsat::display(tout, m_am, s2->m_intervals[i2]); tout << "\n";); push_back(m_am, result, s2->m_intervals[i2]); i2++; } @@ -299,7 +299,7 @@ namespace nlsat { } if (i2 >= sz2) { while (i1 < sz1) { - TRACE("nlsat_interval", tout << "adding remaining intervals from s1: "; nlsat::display(tout, m_am, s1->m_intervals[i1]); tout << "\n";); + TRACE(nlsat_interval, tout << "adding remaining intervals from s1: "; nlsat::display(tout, m_am, s1->m_intervals[i1]); tout << "\n";); push_back(m_am, result, s1->m_intervals[i1]); i1++; } @@ -309,7 +309,7 @@ namespace nlsat { interval const & int2 = s2->m_intervals[i2]; int l1_l2_sign = compare_lower_lower(m_am, int1, int2); int u1_u2_sign = compare_upper_upper(m_am, int1, int2); - TRACE("nlsat_interval", + TRACE(nlsat_interval, tout << "i1: " << i1 << ", i2: " << i2 << "\n"; tout << "int1: "; nlsat::display(tout, m_am, int1); tout << "\n"; tout << "int2: "; nlsat::display(tout, m_am, int2); tout << "\n";); @@ -322,7 +322,7 @@ namespace nlsat { // 2) [ ] // [ ] // - TRACE("nlsat_interval", tout << "l1_l2_sign <= 0, u1_u2_sign == 0\n";); + TRACE(nlsat_interval, tout << "l1_l2_sign <= 0, u1_u2_sign == 0\n";); push_back(m_am, result, int1); i1++; i2++; @@ -336,7 +336,7 @@ namespace nlsat { // 2) [ ] // [ ] i2++; - TRACE("nlsat_interval", tout << "l1_l2_sign <= 0, u1_u2_sign > 0\n";); + TRACE(nlsat_interval, tout << "l1_l2_sign <= 0, u1_u2_sign > 0\n";); // i1 may consume other intervals of s2 } else { @@ -347,7 +347,7 @@ namespace nlsat { // Cases: // 1) [ ] // [ ] - TRACE("nlsat_interval", tout << "l1_l2_sign <= 0, u1_u2_sign < 0, u1_l2_sign < 0\n";); + TRACE(nlsat_interval, tout << "l1_l2_sign <= 0, u1_u2_sign < 0, u1_l2_sign < 0\n";); push_back(m_am, result, int1); i1++; } @@ -355,7 +355,7 @@ namespace nlsat { SASSERT(l1_l2_sign <= 0); SASSERT(!int1.m_upper_open && !int2.m_lower_open); SASSERT(!int2.m_lower_inf); - TRACE("nlsat_interval", tout << "l1_l2_sign <= 0, u1_u2_sign < 0, u1_l2_sign == 0\n";); + TRACE(nlsat_interval, tout << "l1_l2_sign <= 0, u1_u2_sign < 0, u1_l2_sign == 0\n";); // Cases: if (l1_l2_sign != 0) { SASSERT(l1_l2_sign < 0); @@ -380,7 +380,7 @@ namespace nlsat { SASSERT(l1_l2_sign <= 0); SASSERT(u1_u2_sign < 0); SASSERT(u1_l2_sign > 0); - TRACE("nlsat_interval", tout << "l1_l2_sign <= 0, u1_u2_sign < 0, u1_l2_sign > 0\n";); + TRACE(nlsat_interval, tout << "l1_l2_sign <= 0, u1_u2_sign < 0, u1_l2_sign > 0\n";); if (l1_l2_sign == 0) { // Case: // 1) [ ] @@ -406,7 +406,7 @@ namespace nlsat { else { SASSERT(l1_l2_sign > 0); if (u1_u2_sign == 0) { - TRACE("nlsat_interval", tout << "l2 < l1 <= u1 = u2\n";); + TRACE(nlsat_interval, tout << "l2 < l1 <= u1 = u2\n";); // Case: // 1) [ ] // [ ] @@ -416,7 +416,7 @@ namespace nlsat { i2++; } else if (u1_u2_sign < 0) { - TRACE("nlsat_interval", tout << "l2 < l1 <= u2 < u2\n";); + TRACE(nlsat_interval, tout << "l2 < l1 <= u2 < u2\n";); // Case: // 1) [ ] // [ ] @@ -426,7 +426,7 @@ namespace nlsat { else { auto u2_l1_sign = compare_upper_lower(m_am, int2, int1); if (u2_l1_sign < 0) { - TRACE("nlsat_interval", tout << "l2 <= u2 < l1 <= u1\n";); + TRACE(nlsat_interval, tout << "l2 <= u2 < l1 <= u1\n";); // Case: // 1) [ ] // [ ] @@ -434,7 +434,7 @@ namespace nlsat { i2++; } else if (is_zero(u2_l1_sign)) { - TRACE("nlsat_interval", tout << "l1_l2_sign > 0, u1_u2_sign > 0, u2_l1_sign == 0\n";); + TRACE(nlsat_interval, tout << "l1_l2_sign > 0, u1_u2_sign > 0, u2_l1_sign == 0\n";); SASSERT(!int1.m_lower_open && !int2.m_upper_open); SASSERT(!int1.m_lower_inf); // Case: @@ -447,7 +447,7 @@ namespace nlsat { i2++; } else { - TRACE("nlsat_interval", tout << "l2 < l1 < u2 < u1\n";); + TRACE(nlsat_interval, tout << "l2 < l1 < u2 < u1\n";); SASSERT(l1_l2_sign > 0); SASSERT(u1_u2_sign > 0); SASSERT(u2_l1_sign > 0); @@ -549,11 +549,11 @@ namespace nlsat { while (i1 < sz1 && i2 < sz2) { interval const & int1 = s1->m_intervals[i1]; interval const & int2 = s2->m_intervals[i2]; - TRACE("nlsat_interval", tout << "subset main loop, i1: " << i1 << ", i2: " << i2 << "\n"; + TRACE(nlsat_interval, tout << "subset main loop, i1: " << i1 << ", i2: " << i2 << "\n"; tout << "int1: "; nlsat::display(tout, m_am, int1); tout << "\n"; tout << "int2: "; nlsat::display(tout, m_am, int2); tout << "\n";); if (compare_lower_lower(m_am, int1, int2) < 0) { - TRACE("nlsat_interval", tout << "done\n";); + TRACE(nlsat_interval, tout << "done\n";); // interval [int1.lower1, int2.lower2] is not in s2 // s1: [ ... // s2: [ ... @@ -561,11 +561,11 @@ namespace nlsat { } while (i2 < sz2) { interval const & int2 = s2->m_intervals[i2]; - TRACE("nlsat_interval", tout << "inner loop, i2: " << i2 << "\n"; + TRACE(nlsat_interval, tout << "inner loop, i2: " << i2 << "\n"; tout << "int2: "; nlsat::display(tout, m_am, int2); tout << "\n";); int u1_u2_sign = compare_upper_upper(m_am, int1, int2); if (u1_u2_sign == 0) { - TRACE("nlsat_interval", tout << "case 1, break\n";); + TRACE(nlsat_interval, tout << "case 1, break\n";); // consume both // s1: ... ] // s2: ... ] @@ -574,7 +574,7 @@ namespace nlsat { break; } else if (u1_u2_sign < 0) { - TRACE("nlsat_interval", tout << "case 2, break\n";); + TRACE(nlsat_interval, tout << "case 2, break\n";); // consume only int1, int2 may cover other intervals of s1 // s1: ... ] // s2: ... ] @@ -584,9 +584,9 @@ namespace nlsat { else { SASSERT(u1_u2_sign > 0); int u2_l1_sign = compare_upper_lower(m_am, int2, int1); - TRACE("nlsat_interval", tout << "subset, u2_l1_sign: " << u2_l1_sign << "\n";); + TRACE(nlsat_interval, tout << "subset, u2_l1_sign: " << u2_l1_sign << "\n";); if (u2_l1_sign < 0) { - TRACE("nlsat_interval", tout << "case 3, break\n";); + TRACE(nlsat_interval, tout << "case 3, break\n";); // s1: [ ... // s2: [ ... ] ... i2++; @@ -596,7 +596,7 @@ namespace nlsat { // s1: [ ... ] // s2: [ ... ] if (i2 == sz2 - 1) { - TRACE("nlsat_interval", tout << "case 4, done\n";); + TRACE(nlsat_interval, tout << "case 4, done\n";); // s1: ... ] // s2: ...] // the interval [int2.upper, int1.upper] is not in s2 @@ -604,13 +604,13 @@ namespace nlsat { } interval const & next2 = s2->m_intervals[i2+1]; if (!adjacent(m_am, int2, next2)) { - TRACE("nlsat_interval", tout << "not adjacent, done\n";); + TRACE(nlsat_interval, tout << "not adjacent, done\n";); // s1: ... ] // s2: ... ] [ // the interval [int2.upper, min(int1.upper, next2.lower)] is not in s2 return false; } - TRACE("nlsat_interval", tout << "continue..\n";); + TRACE(nlsat_interval, tout << "continue..\n";); // continue with adjacent interval of s2 // s1: ... ] // s2: ..][ ... diff --git a/src/nlsat/nlsat_simple_checker.cpp b/src/nlsat/nlsat_simple_checker.cpp index f61bc97ad..bca4e5adc 100644 --- a/src/nlsat/nlsat_simple_checker.cpp +++ b/src/nlsat/nlsat_simple_checker.cpp @@ -271,7 +271,7 @@ namespace nlsat { return EQ; } bool update_interval_intersection(Domain_Interval &ia, const Domain_Interval &ib) { - TRACE("simple_checker", + TRACE(simple_checker, tout << "ia: "; display(tout, am, ia); tout << "\nib: "; @@ -294,7 +294,7 @@ namespace nlsat { - TRACE("simple_checker", + TRACE(simple_checker, tout << "after update: "; display(tout, am, ia); tout << "\n"; @@ -306,7 +306,7 @@ namespace nlsat { return update_interval_intersection(vd.ori_val, di); } bool update_var_mag_domain_interval_by_ori(Var_Domain &vd, const Domain_Interval &di) { - TRACE("simple_checker", + TRACE(simple_checker, tout << "vd mag val: "; display(tout, am, vd.mag_val); tout << "\n"; @@ -381,7 +381,7 @@ namespace nlsat { } } } - TRACE("simple_checker", + TRACE(simple_checker, tout << "mag di: "; display(tout, am, mag_di); tout << "\n"; @@ -401,7 +401,7 @@ namespace nlsat { Domain_Interval now_di(am); scoped_anum num(am); calc_formula(num, a, b, c); - TRACE("simple_checker", + TRACE(simple_checker, tout << "nsk: "; display(tout, nsk); tout << '\n'; @@ -439,7 +439,7 @@ namespace nlsat { else { UNREACHABLE(); } - TRACE("simple_checker", + TRACE(simple_checker, tout << "now_di: "; display(tout, am, now_di); tout << "\n"; @@ -653,14 +653,14 @@ namespace nlsat { else if (nsk == GT) nsk = LE; } - TRACE("simple_checker", + TRACE(simple_checker, tout << a << "x[" << x << "]^" << b << " + " << c << " "; display(tout, nsk); tout << " 0 \n"; ); if (!update_var_domain(nsk, a, x, b, c)) return false; - TRACE("simple_checker", + TRACE(simple_checker, tout << "original: "; display(tout, am, vars_domain[x].ori_val); tout << "\nmagnitude: "; @@ -777,7 +777,7 @@ namespace nlsat { unsigned sz = as.size(); for (unsigned i = 1; i < sz; ++i) { sign_kind now = get_axb_sign(as[i], xs[i], bs[i]); - TRACE("simple_checker", + TRACE(simple_checker, tout << "sta: "; display(tout, sta); tout << "\n"; @@ -802,14 +802,14 @@ namespace nlsat { if (sta != now) sta = GT; } - TRACE("simple_checker", + TRACE(simple_checker, tout << "after merge\n"; tout << "sta: "; display(tout, sta); tout << "\n"; ); } - TRACE("simple_checker", + TRACE(simple_checker, tout << "sta: "; display(tout, sta); tout << "\n"; @@ -979,7 +979,7 @@ else { // ( == 0) + (c > 0) -> > 0 } bool process_axbsc_form(sign_kind nsk, unsigned cid, vector &as, vector &xs, vector &bs, scoped_anum& c) { bool is_conflict(false); - TRACE("simple_checker", + TRACE(simple_checker, for (unsigned i = 0, sz = as.size(); i < sz; ++i) { if (i > 0) tout << "+ "; @@ -991,7 +991,7 @@ else { // ( == 0) + (c > 0) -> > 0 ); if (!check_is_sign_ineq_consistent(nsk, as, xs, bs, c, is_conflict)) return true; - TRACE("simple_checker", + TRACE(simple_checker, tout << "is conflict: " << is_conflict << "\n" ); if (is_conflict) @@ -1026,7 +1026,7 @@ else { // ( == 0) + (c > 0) -> > 0 return true; } literal_special_kind[cid][lid] = AXBSC; - TRACE("simple_checker", + TRACE(simple_checker, tout << "as size: " << as.size() << '\n'; ); while (as.size() > cnt) @@ -1041,7 +1041,7 @@ else { // ( == 0) + (c > 0) -> > 0 else if (nsk == GT) nsk = LE; } - TRACE("simple_checker", + TRACE(simple_checker, tout << "ineq atom: " << '\n'; for (unsigned i = 0, sz = iat->size(); i < sz; ++i) { pm.display(tout, iat->p(i)); @@ -1088,7 +1088,7 @@ else { // ( == 0) + (c > 0) -> > 0 if (!collect_domain_axbc_form(i, 0)) return false; } - TRACE("simple_checker", + TRACE(simple_checker, for (unsigned i = 0; i < arith_var_num; ++i) { tout << "====== arith[" << i << "] ======\n"; tout << "original value: "; @@ -1136,7 +1136,7 @@ else { // ( == 0) + (c > 0) -> > 0 } } void merge_mul_domain(Domain_Interval &pre, const Domain_Interval &now) { - TRACE("simple_checker", + TRACE(simple_checker, tout << "dom: "; display(tout, am, pre); tout << "\n"; @@ -1163,7 +1163,7 @@ else { // ( == 0) + (c > 0) -> > 0 } void get_monomial_domain(monomial *m, const scoped_anum &a, Domain_Interval &dom) { - TRACE("simple_checker", + TRACE(simple_checker, tout << "monomial: "; pm.display(tout, m); tout << '\n'; @@ -1182,7 +1182,7 @@ else { // ( == 0) + (c > 0) -> > 0 var v = pm.get_var(m, i); unsigned deg = pm.degree_of(m, v); const Domain_Interval &di = ((deg & 1) == 0 ? vars_domain[v].mag_val : vars_domain[v].ori_val); - TRACE("simple_checker", + TRACE(simple_checker, tout << "dom: "; display(tout, am, dom); tout << "\n"; @@ -1194,7 +1194,7 @@ else { // ( == 0) + (c > 0) -> > 0 for (unsigned j = 0; j < deg; ++j) { merge_mul_domain(dom, di); } - TRACE("simple_checker", + TRACE(simple_checker, tout << "after merge mul: "; display(tout, am, dom); tout << "\n"; @@ -1222,12 +1222,12 @@ else { // ( == 0) + (c > 0) -> > 0 am.set(a, pm.coeff(p, 0)); Domain_Interval pre(am); get_monomial_domain(pm.get_monomial(p, 0), a, pre); - TRACE("simple_checker", + TRACE(simple_checker, tout << "poly: "; pm.display(tout, p); tout << "\n"; ); - TRACE("simple_checker", + TRACE(simple_checker, tout << "pre: "; display(tout, am, pre); tout << "\n"; @@ -1236,7 +1236,7 @@ else { // ( == 0) + (c > 0) -> > 0 am.set(a, pm.coeff(p, i)); Domain_Interval now(am); get_monomial_domain(pm.get_monomial(p, i), a, now); - TRACE("simple_checker", + TRACE(simple_checker, tout << "pre: "; display(tout, am, pre); tout << "\n"; @@ -1247,7 +1247,7 @@ else { // ( == 0) + (c > 0) -> > 0 if (now.m_lower.m_inf && now.m_upper.m_inf) return NONE; merge_add_domain(pre, now); - TRACE("simple_checker", + TRACE(simple_checker, tout << "after merge: "; display(tout, am, pre); tout << "\n"; @@ -1327,7 +1327,7 @@ else { // ( == 0) + (c > 0) -> > 0 else if (ret != EQ) ret = GT; } - TRACE("simple_checker", + TRACE(simple_checker, tout << "ret sign: "; display(tout, ret); tout << "\n"; @@ -1393,7 +1393,7 @@ else { // ( == 0) + (c > 0) -> > 0 } } bool check_ineq_atom_satisfiable(const ineq_atom *iat, bool s) { - TRACE("simple_checker", + TRACE(simple_checker, tout << "s: " << s << "\n"; tout << "kd: " << iat->get_kind() << "\n"; ); @@ -1406,7 +1406,7 @@ else { // ( == 0) + (c > 0) -> > 0 else nsk = GE; } - TRACE("simple_checker", + TRACE(simple_checker, tout << "ineq atom: " << '\n'; for (unsigned i = 0, sz = iat->size(); i < sz; ++i) { pm.display(tout, iat->p(i)); @@ -1428,7 +1428,7 @@ else { // ( == 0) + (c > 0) -> > 0 (pre == EQ || pre == GE || pre == LE)) return true; } - TRACE("simple_checker", + TRACE(simple_checker, tout << "pre: "; display(tout, pre); tout << ", nsk: "; @@ -1461,7 +1461,7 @@ else { // ( == 0) + (c > 0) -> > 0 clauses_visited[cid].visited = true; return true; } - // TRACE("sign", + // TRACE(sign, // tout << "literal: " << lit << '\n'; // ); bool s = lit.sign(); @@ -1469,7 +1469,7 @@ else { // ( == 0) + (c > 0) -> > 0 } bool check_clause_satisfiable(unsigned cid) { const clause *cla = clauses[cid]; - TRACE("simple_checker", + TRACE(simple_checker, tout << "clause size: " << cla->size() << '\n'; ); unsigned sz = cla->size(); @@ -1493,7 +1493,7 @@ else { // ( == 0) + (c > 0) -> > 0 literal lit = (*clauses[cid])[i]; lit.neg(); learned_unit.push_back(lit); - TRACE("simple_checker_learned", + TRACE(simple_checker_learned, tout << "making new clauses!\n"; tout << "sign: " << lit.sign() << '\n'; if (atoms[lit.var()] != nullptr && atoms[lit.var()]->is_ineq_atom()) { @@ -1536,7 +1536,7 @@ else { // ( == 0) + (c > 0) -> > 0 improved = false; if (!check()) return false; - TRACE("simple_checker", + TRACE(simple_checker, for (unsigned i = 0; i < arith_var_num; ++i) { tout << "====== arith[" << i << "] ======\n"; tout << "original value: "; diff --git a/src/nlsat/nlsat_simplify.cpp b/src/nlsat/nlsat_simplify.cpp index d483a0391..53667bfe7 100644 --- a/src/nlsat/nlsat_simplify.cpp +++ b/src/nlsat/nlsat_simplify.cpp @@ -703,7 +703,7 @@ namespace nlsat { poly* po = a.p(i); m_pm.substitute(po, x, qq, p, pr); change |= pr != po; - TRACE("nlsat", tout << pr << "\n";); + TRACE(nlsat, tout << pr << "\n";); if (m_pm.is_zero(pr)) { ps.reset(); even.reset(); diff --git a/src/nlsat/nlsat_solver.cpp b/src/nlsat/nlsat_solver.cpp index 3d496fe45..ee843a02c 100644 --- a/src/nlsat/nlsat_solver.cpp +++ b/src/nlsat/nlsat_solver.cpp @@ -371,7 +371,7 @@ namespace nlsat { atom * a = m_atoms[b]; if (a == nullptr) return; - TRACE("ref", display(tout << "inc: " << b << " " << a->ref_count() << " ", *a) << "\n";); + TRACE(ref, display(tout << "inc: " << b << " " << a->ref_count() << " ", *a) << "\n";); a->inc_ref(); } @@ -387,7 +387,7 @@ namespace nlsat { return; SASSERT(a->ref_count() > 0); a->dec_ref(); - TRACE("ref", display(tout << "dec: " << b << " " << a->ref_count() << " ", *a) << "\n";); + TRACE(ref, display(tout << "dec: " << b << " " << a->ref_count() << " ", *a) << "\n";); if (a->ref_count() == 0) del(a); } @@ -579,7 +579,7 @@ namespace nlsat { } void del(ineq_atom * a) { - CTRACE("nlsat_solver", a->ref_count() > 0, display(tout, *a) << "\n";); + CTRACE(nlsat_solver, a->ref_count() > 0, display(tout, *a) << "\n";); // this triggers in too many benign cases: // SASSERT(a->ref_count() == 0); m_ineq_atoms.erase(a); @@ -601,7 +601,7 @@ namespace nlsat { void del(atom * a) { if (a == nullptr) return; - TRACE("nlsat_verbose", display(tout << "del: b" << a->m_bool_var << " " << a->ref_count() << " ", *a) << "\n";); + TRACE(nlsat_verbose, display(tout << "del: b" << a->m_bool_var << " " << a->ref_count() << " ", *a) << "\n";); if (a->is_ineq_atom()) del(to_ineq_atom(a)); else @@ -650,7 +650,7 @@ namespace nlsat { m_pm.gcd_simplify(p, t); } uniq_ps.push_back(m_cache.mk_unique(p)); - TRACE("nlsat_table_bug", tout << "p: " << p << ", uniq: " << uniq_ps.back() << "\n";); + TRACE(nlsat_table_bug, tout << "p: " << p << ", uniq: " << uniq_ps.back() << "\n";); //verbose_stream() << "p: " << p.get() << ", uniq: " << uniq_ps.back() << "\n"; } void * mem = m_allocator.allocate(ineq_atom::get_obj_size(sz)); @@ -658,9 +658,9 @@ namespace nlsat { k = atom::flip(k); ineq_atom * tmp_atom = new (mem) ineq_atom(k, sz, uniq_ps.data(), is_even, max); ineq_atom * atom = m_ineq_atoms.insert_if_not_there(tmp_atom); - CTRACE("nlsat_table_bug", tmp_atom != atom, ineq_atom::hash_proc h; + CTRACE(nlsat_table_bug, tmp_atom != atom, ineq_atom::hash_proc h; tout << "mk_ineq_atom hash: " << h(tmp_atom) << "\n"; display(tout, *tmp_atom, m_display_var) << "\n";); - CTRACE("nlsat_table_bug", atom->max_var() != max, display(tout << "nonmax: ", *atom, m_display_var) << "\n";); + CTRACE(nlsat_table_bug, atom->max_var() != max, display(tout << "nonmax: ", *atom, m_display_var) << "\n";); SASSERT(atom->max_var() == max); is_new = (atom == tmp_atom); if (is_new) { @@ -684,7 +684,7 @@ namespace nlsat { bool_var b = mk_bool_var_core(); m_atoms[b] = atom; atom->m_bool_var = b; - TRACE("nlsat_verbose", display(tout << "create: b" << atom->m_bool_var << " ", *atom) << "\n";); + TRACE(nlsat_verbose, display(tout << "create: b" << atom->m_bool_var << " ", *atom) << "\n";); return b; } } @@ -724,7 +724,7 @@ namespace nlsat { polynomial_ref p1(m_pm), uniq_p(m_pm); p1 = m_pm.flip_sign_if_lm_neg(p); // flipping the sign of the polynomial will not change its roots. uniq_p = m_cache.mk_unique(p1); - TRACE("nlsat_solver", tout << x << " " << p1 << " " << uniq_p << "\n";); + TRACE(nlsat_solver, tout << x << " " << p1 << " " << uniq_p << "\n";); SASSERT(i > 0); SASSERT(x >= max_var(p)); SASSERT(k == atom::ROOT_LT || k == atom::ROOT_GT || k == atom::ROOT_EQ || k == atom::ROOT_LE || k == atom::ROOT_GE); @@ -859,7 +859,7 @@ namespace nlsat { }; void check_lemma(unsigned n, literal const* cls, bool is_valid, assumption_set a) { - TRACE("nlsat", display(tout << "check lemma: ", n, cls) << "\n"; + TRACE(nlsat, display(tout << "check lemma: ", n, cls) << "\n"; display(tout);); IF_VERBOSE(2, display(verbose_stream() << "check lemma " << (is_valid?"valid: ":"consequence: "), n, cls) << "\n"); for (clause* c : m_learned) IF_VERBOSE(1, display(verbose_stream() << "lemma: ", *c) << "\n"); @@ -933,7 +933,7 @@ namespace nlsat { for (bool_var b : tr) { literal lit(b, false); IF_VERBOSE(0, checker.display(verbose_stream(), lit) << " := " << checker.value(lit) << "\n"); - TRACE("nlsat", checker.display(tout, lit) << " := " << checker.value(lit) << "\n";); + TRACE(nlsat, checker.display(tout, lit) << " := " << checker.value(lit) << "\n";); } for (clause* c : m_learned) { bool found = false; @@ -943,7 +943,7 @@ namespace nlsat { } if (!found) { IF_VERBOSE(0, display(verbose_stream() << "violdated clause: ", *c) << "\n"); - TRACE("nlsat", display(tout << "violdated clause: ", *c) << "\n";); + TRACE(nlsat, display(tout << "violdated clause: ", *c) << "\n";); } } for (clause* c : m_valids) { @@ -954,7 +954,7 @@ namespace nlsat { } if (!found) { IF_VERBOSE(0, display(verbose_stream() << "violdated tautology clause: ", *c) << "\n"); - TRACE("nlsat", display(tout << "violdated tautology clause: ", *c) << "\n";); + TRACE(nlsat, display(tout << "violdated tautology clause: ", *c) << "\n";); } } throw default_exception("lemma did not check"); @@ -980,7 +980,7 @@ namespace nlsat { display(out << "(echo \"#" << m_lemma_count << " ", n, cls) << "\")\n"; out << "(check-sat)\n(reset)\n"; - TRACE("nlsat", display(tout << "(echo \"#" << m_lemma_count << " ", n, cls) << "\")\n"); + TRACE(nlsat, display(tout << "(echo \"#" << m_lemma_count << " ", n, cls) << "\")\n"); } clause * mk_clause_core(unsigned num_lits, literal const * lits, bool learned, _assumption_set a) { @@ -1001,9 +1001,9 @@ namespace nlsat { } SASSERT(num_lits > 0); clause * cls = mk_clause_core(num_lits, lits, learned, a); - TRACE("nlsat_sort", display(tout << "mk_clause:\n", *cls) << "\n";); + TRACE(nlsat_sort, display(tout << "mk_clause:\n", *cls) << "\n";); std::sort(cls->begin(), cls->end(), lit_lt(*this)); - TRACE("nlsat", display(tout << " after sort:\n", *cls) << "\n";); + TRACE(nlsat, display(tout << " after sort:\n", *cls) << "\n";); if (learned && m_log_lemmas) { log_lemma(verbose_stream(), *cls); } @@ -1207,7 +1207,7 @@ namespace nlsat { \brief Assign literal using the given justification */ void assign(literal l, justification j) { - TRACE("nlsat_assign", + TRACE(nlsat_assign, display(tout << "assigning literal: ", l); display(tout << " <- ", j);); @@ -1224,7 +1224,7 @@ namespace nlsat { m_justifications[b] = j; save_assign_trail(b); updt_eq(b, j); - TRACE("nlsat_assign", tout << "b" << b << " -> " << m_bvalues[b] << "\n";); + TRACE(nlsat_assign, tout << "b" << b << " -> " << m_bvalues[b] << "\n";); } /** @@ -1241,23 +1241,23 @@ namespace nlsat { lbool value(literal l) { lbool val = assigned_value(l); if (val != l_undef) { - TRACE("nlsat_verbose", display(tout << " assigned value " << val << " for ", l) << "\n";); + TRACE(nlsat_verbose, display(tout << " assigned value " << val << " for ", l) << "\n";); return val; } bool_var b = l.var(); atom * a = m_atoms[b]; if (a == nullptr) { - TRACE("nlsat_verbose", display(tout << " no atom for ", l) << "\n";); + TRACE(nlsat_verbose, display(tout << " no atom for ", l) << "\n";); return l_undef; } var max = a->max_var(); if (!m_assignment.is_assigned(max)) { - TRACE("nlsat_verbose", display(tout << " maximal variable not assigned ", l) << "\n";); + TRACE(nlsat_verbose, display(tout << " maximal variable not assigned ", l) << "\n";); return l_undef; } val = to_lbool(m_evaluator.eval(a, l.sign())); - TRACE("nlsat_verbose", display(tout << " evaluated value " << val << " for ", l) << "\n";); - TRACE("value_bug", tout << "value of: "; display(tout, l); tout << " := " << val << "\n"; + TRACE(nlsat_verbose, display(tout << " evaluated value " << val << " for ", l) << "\n";); + TRACE(value_bug, tout << "value of: "; display(tout, l); tout << " := " << val << "\n"; tout << "xk: " << m_xk << ", a->max_var(): " << a->max_var() << "\n"; display_assignment(tout);); return val; @@ -1269,7 +1269,7 @@ namespace nlsat { bool is_satisfied(clause const & cls) const { for (literal l : cls) { if (const_cast(this)->value(l) == l_true) { - TRACE("value_bug:", tout << l << " := true\n";); + TRACE(value_bug, tout << l << " := true\n";); return true; } } @@ -1282,7 +1282,7 @@ namespace nlsat { bool is_inconsistent(unsigned sz, literal const * cls) { for (unsigned i = 0; i < sz; i++) { if (value(cls[i]) != l_false) { - TRACE("is_inconsistent", tout << "literal is not false:\n"; display(tout, cls[i]); tout << "\n";); + TRACE(is_inconsistent, tout << "literal is not false:\n"; display(tout, cls[i]); tout << "\n";); return false; } } @@ -1328,7 +1328,7 @@ namespace nlsat { if (include_l) core.push_back(~l); auto j = mk_lazy_jst(m_allocator, core.size(), core.data(), clauses.size(), clauses.data()); - TRACE("nlsat_resolve", display(tout, j); display_eval(tout << "evaluated:", j)); + TRACE(nlsat_resolve, display(tout, j); display_eval(tout << "evaluated:", j)); assign(l, j); SASSERT(value(l) == l_true); } @@ -1341,9 +1341,9 @@ namespace nlsat { interval_set * xk_set = m_infeasible[m_xk]; save_set_updt_trail(xk_set); interval_set_ref new_set(m_ism); - TRACE("nlsat_inf_set", tout << "updating infeasible set\n"; m_ism.display(tout, xk_set) << "\n"; m_ism.display(tout, s) << "\n";); + TRACE(nlsat_inf_set, tout << "updating infeasible set\n"; m_ism.display(tout, xk_set) << "\n"; m_ism.display(tout, s) << "\n";); new_set = m_ism.mk_union(s, xk_set); - TRACE("nlsat_inf_set", tout << "new infeasible set:\n"; m_ism.display(tout, new_set) << "\n";); + TRACE(nlsat_inf_set, tout << "new infeasible set:\n"; m_ism.display(tout, new_set) << "\n";); SASSERT(!m_ism.is_full(new_set)); m_ism.inc_ref(new_set); m_infeasible[m_xk] = new_set; @@ -1376,7 +1376,7 @@ namespace nlsat { SASSERT(x != null_var); if (m_var2eq[x] != 0 && degree(m_var2eq[x]) <= degree(a)) return; // we only update m_var2eq if the new equality has smaller degree - TRACE("nlsat_simplify_core", tout << "Saving equality for "; m_display_var(tout, x) << " (x" << x << ") "; + TRACE(nlsat_simplify_core, tout << "Saving equality for "; m_display_var(tout, x) << " (x" << x << ") "; tout << "scope-lvl: " << scope_lvl() << "\n"; display(tout, literal(b, false)) << "\n"; display(tout, j); ); @@ -1391,7 +1391,7 @@ namespace nlsat { */ bool process_arith_clause(clause const & cls, bool satisfy_learned) { if (!satisfy_learned && m_lazy >= 2 && cls.is_learned()) { - TRACE("nlsat", tout << "skip learned\n";); + TRACE(nlsat, tout << "skip learned\n";); return true; // ignore lemmas in super lazy mode } SASSERT(m_xk == max_var(cls)); @@ -1407,7 +1407,7 @@ namespace nlsat { continue; if (value(l) == l_true) return true; // could happen if clause is a tautology - CTRACE("nlsat", max_var(l) != m_xk || value(l) != l_undef, display(tout); + CTRACE(nlsat, max_var(l) != m_xk || value(l) != l_undef, display(tout); tout << "xk: " << m_xk << ", max_var(l): " << max_var(l) << ", l: "; display(tout, l) << "\n"; display(tout, cls) << "\n";); SASSERT(value(l) == l_undef); @@ -1417,28 +1417,28 @@ namespace nlsat { SASSERT(a != nullptr); interval_set_ref curr_set(m_ism); curr_set = m_evaluator.infeasible_intervals(a, l.sign(), &cls); - TRACE("nlsat_inf_set", tout << "infeasible set for literal: "; display(tout, l); tout << "\n"; m_ism.display(tout, curr_set); tout << "\n"; + TRACE(nlsat_inf_set, tout << "infeasible set for literal: "; display(tout, l); tout << "\n"; m_ism.display(tout, curr_set); tout << "\n"; display(tout, cls) << "\n";); if (m_ism.is_empty(curr_set)) { - TRACE("nlsat_inf_set", tout << "infeasible set is empty, found literal\n";); + TRACE(nlsat_inf_set, tout << "infeasible set is empty, found literal\n";); R_propagate(l, nullptr); SASSERT(is_satisfied(cls)); return true; } if (m_ism.is_full(curr_set)) { - TRACE("nlsat_inf_set", tout << "infeasible set is R, skip literal\n";); + TRACE(nlsat_inf_set, tout << "infeasible set is R, skip literal\n";); R_propagate(~l, nullptr); continue; } if (m_ism.subset(curr_set, xk_set)) { - TRACE("nlsat_inf_set", tout << "infeasible set is a subset of current set, found literal\n";); + TRACE(nlsat_inf_set, tout << "infeasible set is a subset of current set, found literal\n";); R_propagate(l, xk_set); return true; } interval_set_ref tmp(m_ism); tmp = m_ism.mk_union(curr_set, xk_set); if (m_ism.is_full(tmp)) { - TRACE("nlsat_inf_set", tout << "infeasible set + current set = R, skip literal\n"; + TRACE(nlsat_inf_set, tout << "infeasible set + current set = R, skip literal\n"; display(tout, cls) << "\n"; m_ism.display(tout, tmp); tout << "\n"; ); @@ -1451,7 +1451,7 @@ namespace nlsat { first_undef_set = curr_set; } } - TRACE("nlsat_inf_set", tout << "num_undef: " << num_undef << "\n";); + TRACE(nlsat_inf_set, tout << "num_undef: " << num_undef << "\n";); if (num_undef == 0) return false; SASSERT(first_undef != UINT_MAX); @@ -1467,7 +1467,7 @@ namespace nlsat { updt_infeasible(first_undef_set); } else { - TRACE("nlsat_lazy", tout << "skipping clause, satisfy_learned: " << satisfy_learned << ", cls.is_learned(): " << cls.is_learned() + TRACE(nlsat_lazy, tout << "skipping clause, satisfy_learned: " << satisfy_learned << ", cls.is_learned(): " << cls.is_learned() << ", lazy: " << m_lazy << "\n";); } return true; @@ -1532,10 +1532,10 @@ namespace nlsat { scoped_anum w(m_am); SASSERT(!m_ism.is_full(m_infeasible[m_xk])); m_ism.pick_in_complement(m_infeasible[m_xk], is_int(m_xk), w, m_randomize); - TRACE("nlsat", + TRACE(nlsat, tout << "infeasible intervals: "; m_ism.display(tout, m_infeasible[m_xk]); tout << "\n"; tout << "assigning "; m_display_var(tout, m_xk) << "(x" << m_xk << ") -> " << w << "\n";); - TRACE("nlsat_root", tout << "value as root object: "; m_am.display_root(tout, w); tout << "\n";); + TRACE(nlsat_root, tout << "value as root object: "; m_am.display_root(tout, w); tout << "\n";); if (!m_am.is_rational(w)) m_stats.m_irrational_assignments++; m_assignment.set_core(m_xk, w); @@ -1545,7 +1545,7 @@ namespace nlsat { bool is_satisfied() { if (m_bk == null_bool_var && m_xk >= num_vars()) { - TRACE("nlsat", tout << "found model\n"; display_assignment(tout);); + TRACE(nlsat, tout << "found model\n"; display_assignment(tout);); fix_patch(); SASSERT(check_satisfied(m_clauses)); return true; // all variables were assigned, and all clauses were satisfied. @@ -1560,11 +1560,11 @@ namespace nlsat { \brief main procedure */ lbool search() { - TRACE("nlsat", tout << "starting search...\n"; display(tout); tout << "\nvar order:\n"; display_vars(tout);); - TRACE("nlsat_proof", tout << "ASSERTED\n"; display(tout);); - TRACE("nlsat_proof_sk", tout << "ASSERTED\n"; display_abst(tout);); - TRACE("nlsat_mathematica", display_mathematica(tout);); - TRACE("nlsat", display_smt2(tout);); + TRACE(nlsat, tout << "starting search...\n"; display(tout); tout << "\nvar order:\n"; display_vars(tout);); + TRACE(nlsat_proof, tout << "ASSERTED\n"; display(tout);); + TRACE(nlsat_proof_sk, tout << "ASSERTED\n"; display_abst(tout);); + TRACE(nlsat_mathematica, display_mathematica(tout);); + TRACE(nlsat, display_smt2(tout);); m_bk = 0; m_xk = null_var; @@ -1589,12 +1589,12 @@ namespace nlsat { else { new_stage(); // peek next arith var } - TRACE("nlsat_bug", tout << "xk: x" << m_xk << " bk: b" << m_bk << "\n";); + TRACE(nlsat_bug, tout << "xk: x" << m_xk << " bk: b" << m_bk << "\n";); if (is_satisfied()) { return l_true; } while (true) { - TRACE("nlsat_verbose", tout << "processing variable "; + TRACE(nlsat_verbose, tout << "processing variable "; if (m_xk != null_var) { m_display_var(tout, m_xk); tout << " " << m_watches[m_xk].size(); } @@ -1772,7 +1772,7 @@ namespace nlsat { clause * cls = mk_clause(m_lemma.size(), m_lemma.data(), true, nullptr); IF_VERBOSE(4, display(verbose_stream(), *cls) << "\n"); if (cls) { - TRACE("nlsat", display(tout << "conflict " << lo << " " << hi, *cls); tout << "\n";); + TRACE(nlsat, display(tout << "conflict " << lo << " " << hi, *cls); tout << "\n";); } } } @@ -1796,7 +1796,7 @@ namespace nlsat { void run_variable_ordering_strategy() { - TRACE("reorder", tout << "runing vos: " << m_variable_ordering_strategy << '\n';); + TRACE(reorder, tout << "runing vos: " << m_variable_ordering_strategy << '\n';); unsigned num = num_vars(); vos_var_info_collector vos_collector(m_pm, m_atoms, num, m_variable_ordering_strategy); @@ -1826,16 +1826,16 @@ namespace nlsat { if (m_simple_check) { if (!simple_check()) { - TRACE("simple_check", tout << "real unsat\n";); + TRACE(simple_check, tout << "real unsat\n";); return l_false; } - TRACE("simple_checker_learned", + TRACE(simple_checker_learned, tout << "simple check done\n"; ); } - TRACE("nlsat_smt2", display_smt2(tout);); - TRACE("nlsat_fd", tout << "is_full_dimensional: " << is_full_dimensional() << "\n";); + TRACE(nlsat_smt2, display_smt2(tout);); + TRACE(nlsat_fd, tout << "is_full_dimensional: " << is_full_dimensional() << "\n";); init_search(); m_explain.set_full_dimensional(is_full_dimensional()); bool reordered = false; @@ -1858,12 +1858,12 @@ namespace nlsat { } sort_watched_clauses(); lbool r = search_check(); - CTRACE("nlsat_model", r == l_true, tout << "model before restore order\n"; display_assignment(tout);); + CTRACE(nlsat_model, r == l_true, tout << "model before restore order\n"; display_assignment(tout);); if (reordered) { restore_order(); } - CTRACE("nlsat_model", r == l_true, tout << "model\n"; display_assignment(tout);); - CTRACE("nlsat", r == l_false, display(tout << "unsat\n");); + CTRACE(nlsat_model, r == l_true, tout << "model\n"; display_assignment(tout);); + CTRACE(nlsat, r == l_false, display(tout << "unsat\n");); SASSERT(r != l_true || check_satisfied(m_clauses)); return r; } @@ -1993,14 +1993,14 @@ namespace nlsat { void process_antecedent(literal antecedent) { checkpoint(); bool_var b = antecedent.var(); - TRACE("nlsat_resolve", display(tout << "resolving antecedent: ", antecedent) << "\n";); + TRACE(nlsat_resolve, display(tout << "resolving antecedent: ", antecedent) << "\n";); if (assigned_value(antecedent) == l_undef) { checkpoint(); // antecedent must be false in the current arith interpretation SASSERT(value(antecedent) == l_false || m_rlimit.is_canceled()); if (!is_marked(b)) { SASSERT(is_arith_atom(b) && max_var(b) < m_xk); // must be in a previous stage - TRACE("nlsat_resolve", tout << "literal is unassigned, but it is false in arithmetic interpretation, adding it to lemma\n";); + TRACE(nlsat_resolve, tout << "literal is unassigned, but it is false in arithmetic interpretation, adding it to lemma\n";); mark(b); m_lemma.push_back(antecedent); } @@ -2008,15 +2008,15 @@ namespace nlsat { } unsigned b_lvl = m_levels[b]; - TRACE("nlsat_resolve", tout << "b_lvl: " << b_lvl << ", is_marked(b): " << is_marked(b) << ", m_num_marks: " << m_num_marks << "\n";); + TRACE(nlsat_resolve, tout << "b_lvl: " << b_lvl << ", is_marked(b): " << is_marked(b) << ", m_num_marks: " << m_num_marks << "\n";); if (!is_marked(b)) { mark(b); if (b_lvl == scope_lvl() /* same level */ && max_var(b) == m_xk /* same stage */) { - TRACE("nlsat_resolve", tout << "literal is in the same level and stage, increasing marks\n";); + TRACE(nlsat_resolve, tout << "literal is in the same level and stage, increasing marks\n";); m_num_marks++; } else { - TRACE("nlsat_resolve", tout << "previous level or stage, adding literal to lemma\n"; + TRACE(nlsat_resolve, tout << "previous level or stage, adding literal to lemma\n"; tout << "max_var(b): " << max_var(b) << ", m_xk: " << m_xk << ", lvl: " << b_lvl << ", scope_lvl: " << scope_lvl() << "\n";); m_lemma.push_back(antecedent); } @@ -2024,8 +2024,8 @@ namespace nlsat { } void resolve_clause(bool_var b, unsigned sz, literal const * c) { - TRACE("nlsat_proof", tout << "resolving "; if (b != null_bool_var) display_atom(tout, b) << "\n"; display(tout, sz, c); tout << "\n";); - TRACE("nlsat_proof_sk", tout << "resolving "; if (b != null_bool_var) tout << "b" << b; tout << "\n"; display_abst(tout, sz, c); tout << "\n";); + TRACE(nlsat_proof, tout << "resolving "; if (b != null_bool_var) display_atom(tout, b) << "\n"; display(tout, sz, c); tout << "\n";); + TRACE(nlsat_proof_sk, tout << "resolving "; if (b != null_bool_var) tout << "b" << b; tout << "\n"; display_abst(tout, sz, c); tout << "\n";); for (unsigned i = 0; i < sz; i++) { if (c[i].var() != b) @@ -2034,19 +2034,19 @@ namespace nlsat { } void resolve_clause(bool_var b, clause & c) { - TRACE("nlsat_resolve", tout << "resolving clause "; if (b != null_bool_var) tout << "for b: " << b << "\n"; display(tout, c) << "\n";); + TRACE(nlsat_resolve, tout << "resolving clause "; if (b != null_bool_var) tout << "for b: " << b << "\n"; display(tout, c) << "\n";); c.set_active(true); resolve_clause(b, c.size(), c.data()); m_lemma_assumptions = m_asm.mk_join(static_cast<_assumption_set>(c.assumptions()), m_lemma_assumptions); } void resolve_lazy_justification(bool_var b, lazy_justification const & jst) { - TRACE("nlsat_resolve", tout << "resolving lazy_justification for b" << b << "\n";); + TRACE(nlsat_resolve, tout << "resolving lazy_justification for b" << b << "\n";); unsigned sz = jst.num_lits(); // Dump lemma as Mathematica formula that must be true, // if the current interpretation (really) makes the core in jst infeasible. - TRACE("nlsat_mathematica", + TRACE(nlsat_mathematica, tout << "assignment lemma\n"; literal_vector core; for (unsigned i = 0; i < sz; i++) { @@ -2060,9 +2060,9 @@ namespace nlsat { m_lazy_clause.push_back(~jst.lit(i)); // lazy clause is a valid clause - TRACE("nlsat_mathematica", display_mathematica_lemma(tout, m_lazy_clause.size(), m_lazy_clause.data());); - TRACE("nlsat_proof_sk", tout << "theory lemma\n"; display_abst(tout, m_lazy_clause.size(), m_lazy_clause.data()); tout << "\n";); - TRACE("nlsat_resolve", + TRACE(nlsat_mathematica, display_mathematica_lemma(tout, m_lazy_clause.size(), m_lazy_clause.data());); + TRACE(nlsat_proof_sk, tout << "theory lemma\n"; display_abst(tout, m_lazy_clause.size(), m_lazy_clause.data()); tout << "\n";); + TRACE(nlsat_resolve, tout << "m_xk: " << m_xk << ", "; m_display_var(tout, m_xk) << "\n"; tout << "new valid clause:\n"; display(tout, m_lazy_clause.size(), m_lazy_clause.data()) << "\n";); @@ -2099,7 +2099,7 @@ namespace nlsat { for (unsigned i = 0; i < jst.num_clauses(); ++i) { clause const& c = jst.clause(i); - TRACE("nlsat", display(tout << "adding clause assumptions ", c) << "\n";); + TRACE(nlsat, display(tout << "adding clause assumptions ", c) << "\n";); m_lemma_assumptions = m_asm.mk_join(static_cast<_assumption_set>(c.assumptions()), m_lemma_assumptions); } } @@ -2148,7 +2148,7 @@ namespace nlsat { \pre This method assumes value(ls[i]) is l_false for i in [0, num) */ void remove_literals_from_lvl(scoped_literal_vector & lemma, unsigned lvl) { - TRACE("nlsat_resolve", tout << "removing literals from lvl: " << lvl << " and stage " << m_xk << "\n";); + TRACE(nlsat_resolve, tout << "removing literals from lvl: " << lvl << " and stage " << m_xk << "\n";); unsigned sz = lemma.size(); unsigned j = 0; for (unsigned i = 0; i < sz; i++) { @@ -2203,7 +2203,7 @@ namespace nlsat { } SASSERT(!found_lvl || new_lvl < scope_lvl()); if (!found_lvl) { - TRACE("nlsat_resolve", tout << "fail to find new lvl, using previous one\n";); + TRACE(nlsat_resolve, tout << "fail to find new lvl, using previous one\n";); new_lvl = scope_lvl() - 1; } return new_lvl; @@ -2224,10 +2224,10 @@ namespace nlsat { m_lemma_assumptions = nullptr; start: SASSERT(check_marks()); - TRACE("nlsat_proof", tout << "STARTING RESOLUTION\n";); - TRACE("nlsat_proof_sk", tout << "STARTING RESOLUTION\n";); + TRACE(nlsat_proof, tout << "STARTING RESOLUTION\n";); + TRACE(nlsat_proof_sk, tout << "STARTING RESOLUTION\n";); m_stats.m_conflicts++; - TRACE("nlsat", tout << "resolve, conflicting clause:\n"; display(tout, *conflict_clause) << "\n"; + TRACE(nlsat, tout << "resolve, conflicting clause:\n"; display(tout, *conflict_clause) << "\n"; tout << "xk: "; if (m_xk != null_var) m_display_var(tout, m_xk); else tout << ""; tout << "\n"; tout << "scope_lvl: " << scope_lvl() << "\n"; tout << "current assignment\n"; display_assignment(tout);); @@ -2250,7 +2250,7 @@ namespace nlsat { if (t.m_kind == trail::BVAR_ASSIGNMENT) { bool_var b = t.m_b; if (is_marked(b)) { - TRACE("nlsat_resolve", tout << "found marked: b" << b << "\n"; display_atom(tout, b) << "\n";); + TRACE(nlsat_resolve, tout << "found marked: b" << b << "\n"; display_atom(tout, b) << "\n";); m_num_marks--; reset_mark(b); justification jst = m_justifications[b]; @@ -2264,7 +2264,7 @@ namespace nlsat { case justification::DECISION: SASSERT(m_num_marks == 0); found_decision = true; - TRACE("nlsat_resolve", tout << "found decision\n";); + TRACE(nlsat_resolve, tout << "found decision\n";); m_lemma.push_back(literal(b, m_bvalues[b] == l_true)); break; default: @@ -2294,25 +2294,25 @@ namespace nlsat { // - and continue conflict resolution from there // - we must bump m_num_marks for literals removed from m_lemma unsigned max_lvl = max_scope_lvl(m_lemma.size(), m_lemma.data()); - TRACE("nlsat_resolve", tout << "conflict does not depend on current decision, backtracking to level: " << max_lvl << "\n";); + TRACE(nlsat_resolve, tout << "conflict does not depend on current decision, backtracking to level: " << max_lvl << "\n";); SASSERT(max_lvl < scope_lvl()); remove_literals_from_lvl(m_lemma, max_lvl); undo_until_level(max_lvl); top = m_trail.size(); - TRACE("nlsat_resolve", tout << "scope_lvl: " << scope_lvl() << " num marks: " << m_num_marks << "\n";); + TRACE(nlsat_resolve, tout << "scope_lvl: " << scope_lvl() << " num marks: " << m_num_marks << "\n";); SASSERT(scope_lvl() == max_lvl); } - TRACE("nlsat_proof", tout << "New lemma\n"; display(tout, m_lemma); tout << "\n=========================\n";); - TRACE("nlsat_proof_sk", tout << "New lemma\n"; display_abst(tout, m_lemma); tout << "\n=========================\n";); + TRACE(nlsat_proof, tout << "New lemma\n"; display(tout, m_lemma); tout << "\n=========================\n";); + TRACE(nlsat_proof_sk, tout << "New lemma\n"; display_abst(tout, m_lemma); tout << "\n=========================\n";); if (m_lemma.empty()) { - TRACE("nlsat", tout << "empty clause generated\n";); + TRACE(nlsat, tout << "empty clause generated\n";); return false; // problem is unsat, empty clause was generated } reset_marks(); // remove marks from the literals in m_lemmas. - TRACE("nlsat", tout << "new lemma:\n"; display(tout, m_lemma.size(), m_lemma.data()); tout << "\n"; + TRACE(nlsat, tout << "new lemma:\n"; display(tout, m_lemma.size(), m_lemma.data()); tout << "\n"; tout << "found_decision: " << found_decision << "\n";); if (m_check_lemmas) { @@ -2342,11 +2342,11 @@ namespace nlsat { // We just have to find the maximal variable in m_lemma, and return to that stage // Remark: the lemma may contain only boolean literals, in this case new_max_var == null_var; var new_max_var = max_var(sz, m_lemma.data()); - TRACE("nlsat_resolve", tout << "backtracking to stage: " << new_max_var << ", curr: " << m_xk << "\n";); + TRACE(nlsat_resolve, tout << "backtracking to stage: " << new_max_var << ", curr: " << m_xk << "\n";); undo_until_stage(new_max_var); SASSERT(m_xk == new_max_var); new_cls = mk_clause(sz, m_lemma.data(), true, m_lemma_assumptions.get()); - TRACE("nlsat", tout << "new_level: " << scope_lvl() << "\nnew_stage: " << new_max_var << "\n"; + TRACE(nlsat, tout << "new_level: " << scope_lvl() << "\nnew_stage: " << new_max_var << "\n"; if (new_max_var != null_var) m_display_var(tout, new_max_var) << "\n";); } else { @@ -2362,12 +2362,12 @@ namespace nlsat { // are at the same stage. If all these literals are from previous stages, // we just backtrack the current level. unsigned new_lvl = find_new_level_arith_lemma(m_lemma.size(), m_lemma.data()); - TRACE("nlsat", tout << "backtracking to new level: " << new_lvl << ", curr: " << m_scope_lvl << "\n";); + TRACE(nlsat, tout << "backtracking to new level: " << new_lvl << ", curr: " << m_scope_lvl << "\n";); undo_until_level(new_lvl); } if (lemma_is_clause(*conflict_clause)) { - TRACE("nlsat", tout << "found decision literal in conflict clause\n";); + TRACE(nlsat, tout << "found decision literal in conflict clause\n";); VERIFY(process_clause(*conflict_clause, true)); return true; } @@ -2375,14 +2375,14 @@ namespace nlsat { } NLSAT_VERBOSE(display(verbose_stream(), *new_cls) << "\n";); if (!process_clause(*new_cls, true)) { - TRACE("nlsat", tout << "new clause triggered another conflict, restarting conflict resolution...\n"; + TRACE(nlsat, tout << "new clause triggered another conflict, restarting conflict resolution...\n"; display(tout, *new_cls) << "\n"; ); // we are still in conflict conflict_clause = new_cls; goto start; } - TRACE("nlsat_resolve_done", display_assignment(tout);); + TRACE(nlsat_resolve_done, display_assignment(tout);); return true; } @@ -2440,7 +2440,7 @@ namespace nlsat { for (unsigned i = 0; i < sz; i++) { clause const & c = *(cs[i]); if (!is_satisfied(c)) { - TRACE("nlsat", tout << "not satisfied\n"; display(tout, c); tout << "\n";); + TRACE(nlsat, tout << "not satisfied\n"; display(tout, c); tout << "\n";); return false; } } @@ -2448,7 +2448,7 @@ namespace nlsat { } bool check_satisfied() const { - TRACE("nlsat", tout << "bk: b" << m_bk << ", xk: x" << m_xk << "\n"; if (m_xk != null_var) { m_display_var(tout, m_xk); tout << "\n"; }); + TRACE(nlsat, tout << "bk: b" << m_bk << ", xk: x" << m_xk << "\n"; if (m_xk != null_var) { m_display_var(tout, m_xk); tout << "\n"; }); unsigned num = m_atoms.size(); if (m_bk != null_bool_var) num = m_bk; @@ -2585,13 +2585,13 @@ namespace nlsat { collector.collect(m_clauses); collector.collect(m_learned); init_shuffle(collector.m_shuffle); - TRACE("nlsat_reorder", collector.display(tout, m_display_var);); + TRACE(nlsat_reorder, collector.display(tout, m_display_var);); var_vector new_order; for (var x = 0; x < num; x++) new_order.push_back(x); std::sort(new_order.begin(), new_order.end(), reorder_lt(collector)); - TRACE("nlsat_reorder", + TRACE(nlsat_reorder, tout << "new order: "; for (unsigned i = 0; i < num; i++) tout << new_order[i] << " "; tout << "\n";); var_vector perm; perm.resize(num, 0); @@ -2632,7 +2632,7 @@ namespace nlsat { remove_learned_roots(); SASSERT(can_reorder()); - TRACE("nlsat_reorder", tout << "solver before variable reorder\n"; display(tout); + TRACE(nlsat_reorder, tout << "solver before variable reorder\n"; display(tout); display_vars(tout); tout << "\npermutation:\n"; for (unsigned i = 0; i < sz; i++) tout << p[i] << " "; tout << "\n"; @@ -2640,7 +2640,7 @@ namespace nlsat { // verbose_stream() << "\npermutation: " << p[0] << " count " << count << " " << m_rlimit.is_canceled() << "\n"; reinit_cache(); SASSERT(num_vars() == sz); - TRACE("nlsat_bool_assignment_bug", tout << "before reset watches\n"; display_bool_assignment(tout);); + TRACE(nlsat_bool_assignment_bug, tout << "before reset watches\n"; display_bool_assignment(tout);); reset_watches(); assignment new_assignment(m_am); for (var x = 0; x < num_vars(); x++) { @@ -2682,12 +2682,12 @@ namespace nlsat { m_pm.rename(sz, p); for (auto& b : m_bounds) b.x = p[b.x]; - TRACE("nlsat_bool_assignment_bug", tout << "before reinit cache\n"; display_bool_assignment(tout);); + TRACE(nlsat_bool_assignment_bug, tout << "before reinit cache\n"; display_bool_assignment(tout);); reinit_cache(); m_assignment.swap(new_assignment); reattach_arith_clauses(m_clauses); reattach_arith_clauses(m_learned); - TRACE("nlsat_reorder", tout << "solver after variable reorder\n"; display(tout); display_vars(tout);); + TRACE(nlsat_reorder, tout << "solver after variable reorder\n"; display(tout); display_vars(tout);); } @@ -2819,7 +2819,7 @@ namespace nlsat { void sort_clauses_by_degree(unsigned sz, clause ** cs) { if (sz <= 1) return; - TRACE("nlsat_reorder_clauses", tout << "before:\n"; for (unsigned i = 0; i < sz; i++) { display(tout, *(cs[i])); tout << "\n"; }); + TRACE(nlsat_reorder_clauses, tout << "before:\n"; for (unsigned i = 0; i < sz; i++) { display(tout, *(cs[i])); tout << "\n"; }); m_cs_degrees.reset(); m_cs_p.reset(); for (unsigned i = 0; i < sz; i++) { @@ -2827,9 +2827,9 @@ namespace nlsat { m_cs_degrees.push_back(degree(*(cs[i]))); } std::sort(m_cs_p.begin(), m_cs_p.end(), degree_lt(m_cs_degrees)); - TRACE("nlsat_reorder_clauses", tout << "permutation: "; ::display(tout, m_cs_p.begin(), m_cs_p.end()); tout << "\n";); + TRACE(nlsat_reorder_clauses, tout << "permutation: "; ::display(tout, m_cs_p.begin(), m_cs_p.end()); tout << "\n";); apply_permutation(sz, cs, m_cs_p.data()); - TRACE("nlsat_reorder_clauses", tout << "after:\n"; for (unsigned i = 0; i < sz; i++) { display(tout, *(cs[i])); tout << "\n"; }); + TRACE(nlsat_reorder_clauses, tout << "after:\n"; for (unsigned i = 0; i < sz; i++) { display(tout, *(cs[i])); tout << "\n"; }); } @@ -2859,7 +2859,7 @@ namespace nlsat { void sort_clauses_by_degree_lit_num(unsigned sz, clause ** cs) { if (sz <= 1) return; - TRACE("nlsat_reorder_clauses", tout << "before:\n"; for (unsigned i = 0; i < sz; i++) { display(tout, *(cs[i])); tout << "\n"; }); + TRACE(nlsat_reorder_clauses, tout << "before:\n"; for (unsigned i = 0; i < sz; i++) { display(tout, *(cs[i])); tout << "\n"; }); m_dl_degrees.reset(); m_dl_lit_num.reset(); m_dl_p.reset(); @@ -2869,9 +2869,9 @@ namespace nlsat { m_dl_p.push_back(i); } std::sort(m_dl_p.begin(), m_dl_p.end(), degree_lit_num_lt(m_dl_degrees, m_dl_lit_num)); - TRACE("nlsat_reorder_clauses", tout << "permutation: "; ::display(tout, m_dl_p.begin(), m_dl_p.end()); tout << "\n";); + TRACE(nlsat_reorder_clauses, tout << "permutation: "; ::display(tout, m_dl_p.begin(), m_dl_p.end()); tout << "\n";); apply_permutation(sz, cs, m_dl_p.data()); - TRACE("nlsat_reorder_clauses", tout << "after:\n"; for (unsigned i = 0; i < sz; i++) { display(tout, *(cs[i])); tout << "\n"; }); + TRACE(nlsat_reorder_clauses, tout << "after:\n"; for (unsigned i = 0; i < sz; i++) { display(tout, *(cs[i])); tout << "\n"; }); } void sort_watched_clauses() { @@ -3003,7 +3003,7 @@ namespace nlsat { // is-upper: A < 0 // x <- B / A bool is_lower = m_am.is_pos(Av); - TRACE("nlsat", + TRACE(nlsat, m_display_var(tout << "patch v" << x << " ", x) << "\n"; if (m_assignment.is_assigned(x)) m_am.display(tout << "previous value: ", m_assignment.value(x)); tout << "\n"; m_am.display(tout << "updated value: ", val); tout << "\n"; @@ -3164,7 +3164,7 @@ namespace nlsat { display(out << "b" << b << " ", *m_atoms[b]) << " -> " << (m_bvalues[b] == l_true ? "true" : "false") << " @" << m_levels[b] << "\n"; } } - TRACE("nlsat_bool_assignment", + TRACE(nlsat_bool_assignment, for (bool_var b = 0; b < sz; b++) { out << "b" << b << " -> " << m_bvalues[b] << " "; if (m_atoms[b]) display(out, *m_atoms[b]); @@ -3984,11 +3984,11 @@ namespace nlsat { vs[b] = m_imp->m_bvalues[b]; } } - TRACE("nlsat", display(tout);); + TRACE(nlsat, display(tout);); } void solver::set_bvalues(svector const& vs) { - TRACE("nlsat", display(tout);); + TRACE(nlsat, display(tout);); for (bool_var b = 0; b < vs.size(); ++b) { if (vs[b] != l_undef) { m_imp->m_bvalues[b] = vs[b]; @@ -4007,7 +4007,7 @@ namespace nlsat { } } #endif - TRACE("nlsat", display(tout);); + TRACE(nlsat, display(tout);); } void solver::del_clause(clause* c) { diff --git a/src/nlsat/nlsat_variable_ordering_strategy.cpp b/src/nlsat/nlsat_variable_ordering_strategy.cpp index 5b91501e3..3b94e568c 100644 --- a/src/nlsat/nlsat_variable_ordering_strategy.cpp +++ b/src/nlsat/nlsat_variable_ordering_strategy.cpp @@ -239,7 +239,7 @@ namespace nlsat { else { UNREACHABLE(); } - TRACE("reorder", + TRACE(reorder, tout << "new order: "; for (unsigned i = 0; i < num_vars; i++) tout << new_order[i] << " "; diff --git a/src/nlsat/tactic/goal2nlsat.cpp b/src/nlsat/tactic/goal2nlsat.cpp index e779fc7fb..44f780600 100644 --- a/src/nlsat/tactic/goal2nlsat.cpp +++ b/src/nlsat/tactic/goal2nlsat.cpp @@ -98,7 +98,7 @@ struct goal2nlsat::imp { ptr_buffer ps; polynomial::factors fs(m_pm); m_pm.factor(p, fs, m_fparams); - TRACE("goal2nlsat_bug", tout << "factors:\n" << fs << "\n";); + TRACE(goal2nlsat_bug, tout << "factors:\n" << fs << "\n";); SASSERT(fs.distinct_factors() > 0); for (unsigned i = 0; i < fs.distinct_factors(); i++) { ps.push_back(fs[i]); @@ -126,7 +126,7 @@ struct goal2nlsat::imp { m_qm.neg(d2); polynomial_ref p(m_pm); p = m_pm.addmul(d1, m_pm.mk_unit(), p1, d2, m_pm.mk_unit(), p2); - TRACE("goal2nlsat_bug", tout << mk_pp(f, m) << " p: " << p << "\nk: " << k << "\n";); + TRACE(goal2nlsat_bug, tout << mk_pp(f, m) << " p: " << p << "\nk: " << k << "\n";); if (is_const(p)) { int sign; if (is_zero(p)) @@ -194,7 +194,7 @@ struct goal2nlsat::imp { switch (to_app(f)->get_decl_kind()) { case OP_TRUE: case OP_FALSE: - TRACE("goal2nlsat", tout << "f: " << mk_pp(f, m) << "\n";); + TRACE(goal2nlsat, tout << "f: " << mk_pp(f, m) << "\n";); throw tactic_exception("apply simplify before applying nlsat"); case OP_AND: case OP_OR: @@ -252,7 +252,7 @@ struct goal2nlsat::imp { } void operator()(goal const & g) { - TRACE("goal2nlsat", g.display(tout);); + TRACE(goal2nlsat, g.display(tout);); if (has_term_ite(g)) throw tactic_exception("eliminate term-ite before applying nlsat"); unsigned sz = g.size(); diff --git a/src/nlsat/tactic/nlsat_tactic.cpp b/src/nlsat/tactic/nlsat_tactic.cpp index aec39354c..ed7aa9066 100644 --- a/src/nlsat/tactic/nlsat_tactic.cpp +++ b/src/nlsat/tactic/nlsat_tactic.cpp @@ -62,7 +62,7 @@ class nlsat_tactic : public tactic { bool contains_unsupported(expr_ref_vector & b2a, expr_ref_vector & x2t) { for (unsigned x = 0; x < x2t.size(); x++) { if (!is_uninterp_const(x2t.get(x))) { - TRACE("unsupported", tout << "unsupported atom:\n" << mk_ismt2_pp(x2t.get(x), m) << "\n";); + TRACE(unsupported, tout << "unsupported atom:\n" << mk_ismt2_pp(x2t.get(x), m) << "\n";); return true; } } @@ -74,7 +74,7 @@ class nlsat_tactic : public tactic { continue; if (m_solver.is_interpreted(b)) continue; // arithmetic atom - TRACE("unsupported", tout << "unsupported atom:\n" << mk_ismt2_pp(a, m) << "\n";); + TRACE(unsupported, tout << "unsupported atom:\n" << mk_ismt2_pp(a, m) << "\n";); return true; // unsupported } return false; @@ -84,7 +84,7 @@ class nlsat_tactic : public tactic { unsigned sz = g.size(); for (unsigned i = 0; i < sz; i++) { if (model.is_false(g.form(i))) { - TRACE("nlsat", tout << mk_pp(g.form(i), m) << " -> " << model(g.form(i)) << "\n";); + TRACE(nlsat, tout << mk_pp(g.form(i), m) << " -> " << model(g.form(i)) << "\n";); IF_VERBOSE(0, verbose_stream() << mk_pp(g.form(i), m) << " -> " << model(g.form(i)) << "\n";); IF_VERBOSE(1, verbose_stream() << model << "\n"); IF_VERBOSE(1, m_solver.display(verbose_stream())); @@ -144,7 +144,7 @@ class nlsat_tactic : public tactic { fail_if_proof_generation("nlsat", g); - TRACE("nlsat", g->display(tout);); + TRACE(nlsat, g->display(tout);); expr2var a2b(m); expr2var t2x(m); @@ -153,7 +153,7 @@ class nlsat_tactic : public tactic { m_display_var.m_var2expr.reset(); t2x.mk_inv(m_display_var.m_var2expr); m_solver.set_display_var(m_display_var); - TRACE("nlsat", m_solver.display(tout);); + TRACE(nlsat, m_solver.display(tout);); IF_VERBOSE(10000, m_solver.display(verbose_stream())); IF_VERBOSE(10000, g->display(verbose_stream())); diff --git a/src/opt/maxcore.cpp b/src/opt/maxcore.cpp index 84906cbaa..db05926bb 100644 --- a/src/opt/maxcore.cpp +++ b/src/opt/maxcore.cpp @@ -193,7 +193,7 @@ public: } void add_soft(expr* e, rational const& w) { - TRACE("opt", tout << mk_pp(e, m) << " |-> " << w << "\n";); + TRACE(opt, tout << mk_pp(e, m) << " |-> " << w << "\n";); expr_ref asum(m), fml(m); app_ref cls(m); rational weight(0); @@ -219,7 +219,7 @@ public: m_asm2weight.insert(e, w); m_asms.push_back(e); m_trail.push_back(e); - TRACE("opt", tout << "insert: " << mk_pp(e, m) << " : " << w << "\n"; + TRACE(opt, tout << "insert: " << mk_pp(e, m) << " : " << w << "\n"; tout << m_asms << " " << "\n"; ); } @@ -235,7 +235,7 @@ public: improve_model(); if (is_sat != l_true) return is_sat; while (m_lower < m_upper) { - TRACE("opt_verbose", + TRACE(opt_verbose, s().display(tout << m_asms << "\n") << "\n"; display(tout);); is_sat = check_sat_hill_climb(m_asms); @@ -244,7 +244,7 @@ public: } switch (is_sat) { case l_true: - CTRACE("opt", m_model->is_false(m_asms), + CTRACE(opt, m_model->is_false(m_asms), tout << *m_model << "assumptions: "; for (expr* a : m_asms) tout << mk_pp(a, m) << " -> " << (*m_model)(a) << " "; tout << "\n";); @@ -344,7 +344,7 @@ public: if (r == l_true) { model_ref mdl; s().get_model(mdl); - TRACE("opt", tout << *mdl;); + TRACE(opt, tout << *mdl;); if (mdl.get()) { update_assignment(mdl); } @@ -407,7 +407,7 @@ public: } if (core.empty()) { IF_VERBOSE(100, verbose_stream() << "(opt.maxres core is empty)\n";); - TRACE("opt", tout << "empty core\n";); + TRACE(opt, tout << "empty core\n";); cores.reset(); m_lower = m_upper; return l_true; @@ -429,7 +429,7 @@ public: is_sat = check_sat_hill_climb(m_asms); } - TRACE("opt", + TRACE(opt, tout << "sat: " << is_sat << " num cores: " << cores.size() << "\n"; for (auto const& c : cores) display_vec(tout, c.m_core); tout << "num assumptions: " << m_asms.size() << "\n";); @@ -452,7 +452,7 @@ public: cs.push_back(a); } } - TRACE("opt", display_vec(tout << "new correction set: ", cs);); + TRACE(opt, display_vec(tout << "new correction set: ", cs);); } struct compare_asm { @@ -490,7 +490,7 @@ public: void process_sat(exprs const& corr_set) { ++m_stats.m_num_cs; expr_ref fml(m), tmp(m); - TRACE("opt", display_vec(tout << "corr_set: ", corr_set);); + TRACE(opt, display_vec(tout << "corr_set: ", corr_set);); remove_soft(corr_set, m_asms); rational w = split_core(corr_set); cs_max_resolve(corr_set, w); @@ -558,7 +558,7 @@ public: IF_VERBOSE(3, verbose_stream() << "(maxres cs model valid: " << (m_csmodel.get() != nullptr) << " cs size:" << m_correction_set_size << " core: " << core.size() << ")\n";); expr_ref fml(m); SASSERT(!core.empty()); - TRACE("opt", display_vec(tout << "minimized core: ", core);); + TRACE(opt, display_vec(tout << "minimized core: ", core);); IF_VERBOSE(10, display_vec(verbose_stream() << "core: ", core);); switch (m_st) { case strategy_t::s_primal_binary: @@ -594,7 +594,7 @@ public: exprs cs; get_current_correction_set(m_csmodel.get(), cs); m_correction_set_size = cs.size(); - TRACE("opt", tout << "cs " << m_correction_set_size << " " << core.size() << "\n";); + TRACE(opt, tout << "cs " << m_correction_set_size << " " << core.size() << "\n";); if (m_correction_set_size >= core.size()) return; rational w(0); @@ -895,7 +895,7 @@ public: // cs is a correction set (a complement of a (maximal) satisfying assignment). void cs_max_resolve(exprs const& cs, rational const& w) { if (cs.empty()) return; - TRACE("opt", display_vec(tout << "correction set: ", cs);); + TRACE(opt, display_vec(tout << "correction set: ", cs);); expr_ref fml(m), asum(m); app_ref cls(m), d(m), dd(m); m_B.reset(); @@ -991,12 +991,12 @@ public: m_correction_set_size = correction_set_size; } - TRACE("opt_verbose", tout << *mdl;); + TRACE(opt_verbose, tout << *mdl;); rational upper = cost(*mdl); if (upper > m_upper) { - TRACE("opt", tout << "new upper: " << upper << " vs existing upper: " << m_upper << "\n";); + TRACE(opt, tout << "new upper: " << upper << " vs existing upper: " << m_upper << "\n";); return; } @@ -1007,7 +1007,7 @@ public: m_model = mdl; m_c.model_updated(mdl.get()); - TRACE("opt", tout << "updated upper: " << upper << "\n";); + TRACE(opt, tout << "updated upper: " << upper << "\n";); for (soft& s : m_soft) s.set_value(m_model->is_true(s.s)); @@ -1033,18 +1033,18 @@ public: weights.push_back(s.weight); } fml = u.mk_lt(nsoft.size(), weights.data(), nsoft.data(), m_upper); - TRACE("opt", tout << "block upper bound " << fml << "\n";);; + TRACE(opt, tout << "block upper bound " << fml << "\n";);; add(fml); } void remove_soft(exprs const& core, expr_ref_vector& asms) { - TRACE("opt", tout << "before remove: " << asms << "\n";); + TRACE(opt, tout << "before remove: " << asms << "\n";); unsigned j = 0; for (expr* a : asms) if (!core.contains(a)) asms[j++] = a; asms.shrink(j); - TRACE("opt", tout << "after remove: " << asms << "\n";); + TRACE(opt, tout << "after remove: " << asms << "\n";); } void updt_params(params_ref& _p) override { @@ -1088,7 +1088,7 @@ public: if (m_found_feasible_optimum) { add(m_defs); add(m_asms); - TRACE("opt", tout << "Committing feasible solution\ndefs:" << m_defs << "\nasms:" << m_asms << "\n"); + TRACE(opt, tout << "Committing feasible solution\ndefs:" << m_defs << "\nasms:" << m_asms << "\n"); } // else: there is only a single assignment to these soft constraints. } @@ -1101,7 +1101,7 @@ public: _solver->assert_expr(core); lbool is_sat = _solver->check_sat(0, nullptr); IF_VERBOSE(0, verbose_stream() << "core status (l_false:) " << is_sat << " core size " << core.size() << "\n"); - CTRACE("opt", is_sat != l_false, + CTRACE(opt, is_sat != l_false, for (expr* c : core) tout << "core: " << mk_pp(c, m) << "\n"; _solver->display(tout); tout << "other solver\n"; diff --git a/src/opt/maxlex.cpp b/src/opt/maxlex.cpp index fa97359d0..414f1a120 100644 --- a/src/opt/maxlex.cpp +++ b/src/opt/maxlex.cpp @@ -133,7 +133,7 @@ namespace opt { model_ref mdl; s().get_model(mdl); if (mdl) { - TRACE("opt", tout << *mdl << "\n";); + TRACE(opt, tout << *mdl << "\n";); for (auto & soft : m_soft) { if (!mdl->is_true(soft.s)) { update_bounds(); diff --git a/src/opt/maxsmt.cpp b/src/opt/maxsmt.cpp index 721dae711..f6b083ecf 100644 --- a/src/opt/maxsmt.cpp +++ b/src/opt/maxsmt.cpp @@ -78,7 +78,7 @@ namespace opt { } pb_util pb(m); tmp = pb.mk_ge(weights.size(), weights.data(), fmls.data(), k); - TRACE("opt", tout << "cost: " << cost << "\n" << tmp << "\n";); + TRACE(opt, tout << "cost: " << cost << "\n" << tmp << "\n";); s().assert_expr(tmp); } @@ -100,7 +100,7 @@ namespace opt { m_c.add_offset(m_index, lower); m_upper -= lower; - TRACE("opt", + TRACE(opt, tout << "lower " << lower << " upper: " << m_upper << " assignments: "; for (soft& s : m_soft) tout << (s.is_true()?"T":"F"); tout << "\n";); @@ -184,7 +184,7 @@ namespace opt { opt_params optp(m_params); symbol const& maxsat_engine = m_c.maxsat_engine(); IF_VERBOSE(1, verbose_stream() << "(maxsmt)\n";); - TRACE("opt_verbose", s().display(tout << "maxsmt\n") << "\n";); + TRACE(opt_verbose, s().display(tout << "maxsmt\n") << "\n";); if (!committed && optp.maxlex_enable() && is_maxlex(m_soft)) m_msolver = mk_maxlex(m_c, m_index, m_soft); else if (m_soft.empty() || maxsat_engine == symbol("maxres") || maxsat_engine == symbol::null) @@ -293,7 +293,7 @@ namespace opt { } void maxsmt::add(expr* f, rational const& w) { - TRACE("opt", tout << mk_pp(f, m) << " weight: " << w << "\n";); + TRACE(opt, tout << mk_pp(f, m) << " weight: " << w << "\n";); SASSERT(m.is_bool(f)); SASSERT(w.is_pos()); unsigned index = 0; diff --git a/src/opt/opt_context.cpp b/src/opt/opt_context.cpp index 81a2b80b5..217fdaa26 100644 --- a/src/opt/opt_context.cpp +++ b/src/opt/opt_context.cpp @@ -323,7 +323,7 @@ namespace opt { lbool is_sat = s.check_sat(asms.size(), asms.data()); - TRACE("opt", s.display(tout << "initial search result: " << is_sat << "\n");); + TRACE(opt, s.display(tout << "initial search result: " << is_sat << "\n");); if (is_sat != l_false) { s.get_model(m_model); s.get_labels(m_labels); @@ -333,7 +333,7 @@ namespace opt { } } if (is_sat != l_true) { - TRACE("opt", tout << m_hard_constraints << " " << asms << "\n";); + TRACE(opt, tout << m_hard_constraints << " " << asms << "\n";); if (!asms.empty()) { s.get_unsat_core(m_core); } @@ -341,7 +341,7 @@ namespace opt { } s.assert_expr(asms); IF_VERBOSE(1, verbose_stream() << "(optimize:sat)\n"); - TRACE("opt", model_smt2_pp(tout, m, *m_model, 0);); + TRACE(opt, model_smt2_pp(tout, m, *m_model, 0);); m_optsmt.setup(*m_opt_solver.get()); update_lower(); @@ -389,7 +389,7 @@ namespace opt { void context::fix_model(model_ref& mdl) { if (mdl && !m_model_fixed.contains(mdl.get())) { - TRACE("opt", m_fm->display(tout << "fix-model\n"); + TRACE(opt, m_fm->display(tout << "fix-model\n"); tout << *mdl << "\n"; if (m_model_converter) m_model_converter->display(tout);); (*m_fm)(mdl); @@ -433,10 +433,10 @@ namespace opt { void context::get_model_core(model_ref& mdl) { mdl = m_model; - CTRACE("opt", mdl, tout << *mdl;); + CTRACE(opt, mdl, tout << *mdl;); fix_model(mdl); if (mdl) mdl->set_model_completion(true); - CTRACE("opt", mdl, tout << *mdl;); + CTRACE(opt, mdl, tout << *mdl;); } void context::get_box_model(model_ref& mdl, unsigned index) { @@ -530,7 +530,7 @@ namespace opt { lbool context::execute_box() { if (m_box_index < m_box_models.size()) { m_model = m_box_models[m_box_index]; - CTRACE("opt", m_model, tout << *m_model << "\n";); + CTRACE(opt, m_model, tout << *m_model << "\n";); ++m_box_index; return l_true; } @@ -562,7 +562,7 @@ namespace opt { } if (r == l_true && !m_box_models.empty()) { m_model = m_box_models[0]; - CTRACE("opt", m_model, tout << *m_model << "\n";); + CTRACE(opt, m_model, tout << *m_model << "\n";); } return r; } @@ -615,7 +615,7 @@ namespace opt { k += obj.m_weights[i]; } else { - TRACE("opt", tout << (*mdl)(obj.m_terms[i]) << "\n";); + TRACE(opt, tout << (*mdl)(obj.m_terms[i]) << "\n";); } } if (is_ge) { @@ -627,7 +627,7 @@ namespace opt { break; } } - TRACE("opt", + TRACE(opt, tout << (is_ge?">= ":"<= ") << k << "\n"; display_objective(tout, obj); tout << "\n"; @@ -651,7 +651,7 @@ namespace opt { m_pareto->get_model(m_model, m_labels); update_bound(true); update_bound(false); - TRACE("opt", model_smt2_pp(tout, m, *m_model.get(), 0);); + TRACE(opt, model_smt2_pp(tout, m, *m_model.get(), 0);); } lbool context::execute_pareto() { @@ -910,12 +910,12 @@ namespace opt { set_simplify(tac0.get()); } goal_ref_buffer result; - TRACE("opt", g->display(tout);); + TRACE(opt, g->display(tout);); (*m_simplify)(g, result); SASSERT(result.size() == 1); goal* r = result[0]; m_model_converter = r->mc(); - CTRACE("opt", r->mc(), r->mc()->display(tout);); + CTRACE(opt, r->mc(), r->mc()->display(tout);); fmls.reset(); expr_ref tmp(m); for (unsigned i = 0; i < r->size(); ++i) { @@ -1010,7 +1010,7 @@ namespace opt { bool is_max = is_maximize(fml, term, orig_term, index); bool is_min = !is_max && is_minimize(fml, term, orig_term, index); if (is_min && get_pb_sum(term, terms, weights, offset)) { - TRACE("opt", tout << "try to convert minimization\n" << mk_pp(term, m) << "\n";); + TRACE(opt, tout << "try to convert minimization\n" << mk_pp(term, m) << "\n";); // minimize 2*x + 3*y // <=> // (assert-soft (not x) 2) @@ -1025,7 +1025,7 @@ namespace opt { terms[i] = mk_not(m, terms[i].get()); } } - TRACE("opt", + TRACE(opt, tout << "Convert minimization " << orig_term << "\n"; tout << "to maxsat: " << term << "\n"; for (unsigned i = 0; i < weights.size(); ++i) { @@ -1039,7 +1039,7 @@ namespace opt { return true; } if (is_max && get_pb_sum(term, terms, weights, offset)) { - TRACE("opt", tout << "try to convert maximization " << mk_pp(term, m) << "\n";); + TRACE(opt, tout << "try to convert maximization " << mk_pp(term, m) << "\n";); // maximize 2*x + 3*y - z // <=> // (assert-soft x 2) @@ -1117,7 +1117,7 @@ namespace opt { } void context::from_fmls(expr_ref_vector const& fmls) { - TRACE("opt", tout << fmls << "\n";); + TRACE(opt, tout << fmls << "\n";); m_hard_constraints.reset(); for (expr * fml : fmls) { app_ref tr(m); @@ -1147,7 +1147,7 @@ namespace opt { obj.m_weights.append(weights); obj.m_adjust_value.set_offset(offset); obj.m_adjust_value.set_negate(neg); - TRACE("opt", tout << "maxsat: " << neg << " " << id << " offset: " << offset << "\n"; + TRACE(opt, tout << "maxsat: " << neg << " " << id << " offset: " << offset << "\n"; tout << terms << "\n";); } else if (is_maximize(fml, tr, orig_term, index)) { @@ -1206,17 +1206,17 @@ namespace opt { val = (*mdl)(term); unsigned bvsz; if (!m_arith.is_numeral(val, r) && !m_bv.is_numeral(val, r, bvsz)) { - TRACE("opt", tout << "model does not evaluate objective to a value but instead " << val << "\n"; + TRACE(opt, tout << "model does not evaluate objective to a value but instead " << val << "\n"; tout << *mdl << "\n"; ); return false; } if (r != v) { - TRACE("opt", tout << "Out of bounds: " << term << " " << val << " != " << v << "\n";); + TRACE(opt, tout << "Out of bounds: " << term << " " << val << " != " << v << "\n";); return false; } else { - TRACE("opt", tout << "validated: " << term << " = " << val << "\n";); + TRACE(opt, tout << "validated: " << term << " = " << val << "\n";); } return true; } @@ -1236,7 +1236,7 @@ namespace opt { term = m_arith.mk_add(args.size(), args.data()); } else if (m.is_ite(term) || !is_mul_const(term)) { - TRACE("opt", tout << "Purifying " << term << "\n";); + TRACE(opt, tout << "Purifying " << term << "\n";); term = purify(fm, term); } if (fm) { @@ -1309,7 +1309,7 @@ namespace opt { break; } } - TRACE("opt", tout << fmls << "\n";); + TRACE(opt, tout << fmls << "\n";); } void context::internalize() { @@ -1346,10 +1346,10 @@ namespace opt { switch(obj.m_type) { case O_MINIMIZE: { val = (*m_model)(obj.m_term); - TRACE("opt", tout << obj.m_term << " " << val << "\n";); + TRACE(opt, tout << obj.m_term << " " << val << "\n";); if (is_numeral(val, r)) { inf_eps val = inf_eps(obj.m_adjust_value(r)); - TRACE("opt", tout << "adjusted value: " << val << "\n";); + TRACE(opt, tout << "adjusted value: " << val << "\n";); if (is_lower) { m_optsmt.update_lower(obj.m_index, val); } @@ -1361,10 +1361,10 @@ namespace opt { } case O_MAXIMIZE: { val = (*m_model)(obj.m_term); - TRACE("opt", tout << obj.m_term << " " << val << "\n";); + TRACE(opt, tout << obj.m_term << " " << val << "\n";); if (is_numeral(val, r)) { inf_eps val = inf_eps(obj.m_adjust_value(r)); - TRACE("opt", tout << "adjusted value: " << val << "\n";); + TRACE(opt, tout << "adjusted value: " << val << "\n";); if (is_lower) { m_optsmt.update_lower(obj.m_index, val); } @@ -1377,7 +1377,7 @@ namespace opt { case O_MAXSMT: { for (unsigned j = 0; j < obj.m_terms.size(); ++j) { val = (*m_model)(obj.m_terms[j]); - TRACE("opt", tout << mk_pp(obj.m_terms[j], m) << " " << val << "\n";); + TRACE(opt, tout << mk_pp(obj.m_terms[j], m) << " " << val << "\n";); if (!m.is_true(val)) r += obj.m_weights[j]; } @@ -1385,11 +1385,11 @@ namespace opt { maxsmt& ms = *m_maxsmts.find(obj.m_id); if (is_lower) { ms.update_upper(r); - TRACE("opt", tout << "update upper from " << r << " to " << ms.get_upper() << "\n";); + TRACE(opt, tout << "update upper from " << r << " to " << ms.get_upper() << "\n";); } else { ms.update_lower(r); - TRACE("opt", tout << "update lower from " << r << " to " << ms.get_lower() << "\n";); + TRACE(opt, tout << "update lower from " << r << " to " << ms.get_lower() << "\n";); } break; } @@ -1737,7 +1737,7 @@ namespace opt { void context::validate_maxsat(symbol const& id) { maxsmt& ms = *m_maxsmts.find(id); - TRACE("opt", tout << "Validate: " << id << "\n";); + TRACE(opt, tout << "Validate: " << id << "\n";); for (objective const& obj : m_objectives) { if (obj.m_id == id && obj.m_type == O_MAXSMT) { SASSERT(obj.m_type == O_MAXSMT); @@ -1752,7 +1752,7 @@ namespace opt { } value = obj.m_adjust_value(value); rational value0 = ms.get_lower(); - TRACE("opt", tout << "value " << value << " " << value0 << "\n";); + TRACE(opt, tout << "value " << value << " " << value0 << "\n";); // TBD is this correct? SASSERT(value == value0); } } @@ -1778,7 +1778,7 @@ namespace opt { } maxsmt& ms = *m_maxsmts.find(obj.m_id); rational value0 = ms.get_lower(); - TRACE("opt", tout << "value " << value << " other " << value0 << "\n";); + TRACE(opt, tout << "value " << value << " other " << value0 << "\n";); // TBD SASSERT(value0 == value); break; } diff --git a/src/opt/opt_cores.cpp b/src/opt/opt_cores.cpp index 44376e2f5..049a64da2 100644 --- a/src/opt/opt_cores.cpp +++ b/src/opt/opt_cores.cpp @@ -316,7 +316,7 @@ namespace opt { add_core(core); if (core.empty()) { IF_VERBOSE(100, verbose_stream() << "(opt.maxres :empty-core)\n";); - TRACE("opt", tout << "empty core\n";); + TRACE(opt, tout << "empty core\n";); break; } diff --git a/src/opt/opt_lns.cpp b/src/opt/opt_lns.cpp index 3a5195658..13ab9a909 100644 --- a/src/opt/opt_lns.cpp +++ b/src/opt/opt_lns.cpp @@ -217,7 +217,7 @@ namespace opt { case l_undef: break; case l_false: - TRACE("opt", tout << "pruned " << mk_bounded_pp(unprocessed(i), m) << "\n";); + TRACE(opt, tout << "pruned " << mk_bounded_pp(unprocessed(i), m) << "\n";); m_hardened.push_back(m.mk_not(unprocessed(i))); for (unsigned k = i; k + 1 < m_unprocessed.size(); ++k) m_unprocessed[k] = unprocessed(k + 1); @@ -231,7 +231,7 @@ namespace opt { if (j <= i) ++offset; ++m_num_improves; - TRACE("opt", tout << "improved " << mk_bounded_pp(unprocessed(j), m) << "\n";); + TRACE(opt, tout << "improved " << mk_bounded_pp(unprocessed(j), m) << "\n";); m_hardened.push_back(unprocessed(j)); ++num_improved; } diff --git a/src/opt/opt_pareto.cpp b/src/opt/opt_pareto.cpp index 90398965c..cb1ab4b3d 100644 --- a/src/opt/opt_pareto.cpp +++ b/src/opt/opt_pareto.cpp @@ -74,7 +74,7 @@ namespace opt { fmls.push_back(mk_or(gt)); fml = mk_and(fmls); IF_VERBOSE(10, verbose_stream() << "dominates: " << fml << "\n";); - TRACE("opt", model_smt2_pp(tout << fml << "\n", m, *m_model, 0);); + TRACE(opt, model_smt2_pp(tout << fml << "\n", m, *m_model, 0);); m_solver->assert_expr(fml); } @@ -87,7 +87,7 @@ namespace opt { } fml = m.mk_not(mk_and(le)); IF_VERBOSE(10, verbose_stream() << "not dominated by: " << fml << "\n";); - TRACE("opt", tout << fml << "\n";); + TRACE(opt, tout << fml << "\n";); m_solver->assert_expr(fml); } diff --git a/src/opt/opt_preprocess.cpp b/src/opt/opt_preprocess.cpp index 886d7fbb0..2e1b78070 100644 --- a/src/opt/opt_preprocess.cpp +++ b/src/opt/opt_preprocess.cpp @@ -192,7 +192,7 @@ namespace opt { }; void preprocess::process_mutex(expr_ref_vector& mutex, obj_map& new_soft, rational& lower) { - TRACE("opt", + TRACE(opt, for (expr* e : mutex) { tout << mk_pp(e, m) << " |-> " << new_soft.find(e) << "\n"; }); diff --git a/src/opt/opt_sls_solver.h b/src/opt/opt_sls_solver.h index 2867f52a3..c7a0cd998 100644 --- a/src/opt/opt_sls_solver.h +++ b/src/opt/opt_sls_solver.h @@ -173,7 +173,7 @@ namespace opt { m_pb2bv(m_solver->get_assertion(i), tmp); g->assert_expr(tmp); } - TRACE("opt", g->display(tout);); + TRACE(opt, g->display(tout);); tactic_ref simplify = mk_nnf_tactic(m); proof_converter_ref pc; expr_dependency_ref core(m); @@ -185,7 +185,7 @@ namespace opt { for (unsigned i = 0; i < r->size(); ++i) { m_bvsls->assert_expr(r->form(i)); } - TRACE("opt", m_bvsls->display(tout);); + TRACE(opt, m_bvsls->display(tout);); } void pbsls_opt(model_ref& mdl) { @@ -212,7 +212,7 @@ namespace opt { m_bvsls = alloc(bvsls_opt_engine, m, m_params); assertions2sls(); expr_ref objective = soft2bv(m_soft, m_weights); - TRACE("opt", tout << objective << "\n";); + TRACE(opt, tout << objective << "\n";); opt_result res(m); res.is_sat = l_undef; try { diff --git a/src/opt/opt_solver.cpp b/src/opt/opt_solver.cpp index 19ff2cffe..ea414d441 100644 --- a/src/opt/opt_solver.cpp +++ b/src/opt/opt_solver.cpp @@ -160,7 +160,7 @@ namespace opt { } lbool opt_solver::check_sat_core2(unsigned num_assumptions, expr * const * assumptions) { - TRACE("opt_verbose", { + TRACE(opt_verbose, { tout << "context size: " << m_context.size() << "\n"; for (unsigned i = 0; i < m_context.size(); ++i) { tout << mk_pp(m_context.get_formula(i), m_context.m()) << "\n"; @@ -252,12 +252,12 @@ namespace opt { m_context.get_model(m_last_model); inf_eps val2; has_shared = true; - TRACE("opt", tout << (has_shared?"has shared":"non-shared") << " " << val << " " << blocker << "\n"; + TRACE(opt, tout << (has_shared?"has shared":"non-shared") << " " << val << " " << blocker << "\n"; if (m_last_model) tout << *m_last_model << "\n";); if (!m_models[i]) m_models.set(i, m_last_model.get()); - TRACE("opt", tout << "maximize " << i << " " << val << " " << m_objective_values[i] << " " << blocker << "\n";); + TRACE(opt, tout << "maximize " << i << " " << val << " " << m_objective_values[i] << " " << blocker << "\n";); if (val > m_objective_values[i]) { m_objective_values[i] = val; } @@ -291,7 +291,7 @@ namespace opt { // skip model updates } else if (m_context.get_context().update_model(has_shared)) { - TRACE("opt", tout << "updated\n";); + TRACE(opt, tout << "updated\n";); m_last_model = nullptr; m_context.get_model(m_last_model); if (!m_last_model) @@ -304,7 +304,7 @@ namespace opt { else if (!check_bound()) return false; m_objective_values[i] = val; - TRACE("opt", { + TRACE(opt, { tout << "objective: " << mk_pp(m_objective_terms.get(i), m) << "\n"; tout << "maximal value: " << val << "\n"; tout << "new condition: " << blocker << "\n"; @@ -353,12 +353,12 @@ namespace opt { for (unsigned i = m_models.size(); i-- > 0; ) { auto* mdl = m_models[i]; if (mdl) { - TRACE("opt", tout << "get " << i << "\n" << *mdl << "\n";); + TRACE(opt, tout << "get " << i << "\n" << *mdl << "\n";); m = mdl; return; } } - TRACE("opt", tout << "get last\n";); + TRACE(opt, tout << "get last\n";); m = m_last_model.get(); } @@ -397,7 +397,7 @@ namespace opt { smt::theory_var opt_solver::add_objective(app* term) { smt::theory_var v = get_optimizer().add_objective(term); - TRACE("opt", tout << v << " " << mk_pp(term, m) << "\n";); + TRACE(opt, tout << v << " " << mk_pp(term, m) << "\n";); m_objective_vars.push_back(v); m_objective_values.push_back(inf_eps(rational::minus_one(), inf_rational())); m_objective_terms.push_back(term); @@ -428,7 +428,7 @@ namespace opt { } smt::theory_opt& opt = get_optimizer(); smt::theory_var v = m_objective_vars[var]; - TRACE("opt", tout << "v" << var << " " << val << "\n";); + TRACE(opt, tout << "v" << var << " " << val << "\n";); if (typeid(smt::theory_inf_arith) == typeid(opt)) { smt::theory_inf_arith& th = dynamic_cast(opt); diff --git a/src/opt/optsmt.cpp b/src/opt/optsmt.cpp index 6218fa5f4..cc4b5a3d4 100644 --- a/src/opt/optsmt.cpp +++ b/src/opt/optsmt.cpp @@ -136,7 +136,7 @@ namespace opt { // only try to improve delta_index. bound = m_s->mk_ge(delta_index, m_lower[delta_index] + inf_eps(delta_per_step)); } - TRACE("opt", tout << mk_pp(m_objs.get(delta_index), m) << " index: " << delta_index + TRACE(opt, tout << mk_pp(m_objs.get(delta_index), m) << " index: " << delta_index << " delta: " << delta_per_step << " bound: " << bound << " " << m_lower[delta_index] << " " << m_upper[delta_index] << "\n"); if (bound == last_bound) { @@ -203,7 +203,7 @@ namespace opt { } lbool optsmt::geometric_lex(unsigned obj_index, bool is_maximize) { - TRACE("opt", tout << "index: " << obj_index << " is-max: " << is_maximize << "\n";); + TRACE(opt, tout << "index: " << obj_index << " is-max: " << is_maximize << "\n";); arith_util arith(m); bool is_int = arith.is_int(m_objs.get(obj_index)); lbool is_sat = l_true; @@ -222,7 +222,7 @@ namespace opt { SASSERT(delta_per_step.is_int()); SASSERT(delta_per_step.is_pos()); is_sat = m_s->check_sat(0, nullptr); - TRACE("opt", tout << "check " << is_sat << "\n"; + TRACE(opt, tout << "check " << is_sat << "\n"; tout << "last bound: " << last_bound << " bound " << bound << "\n"; tout << "lower: " << m_lower[obj_index] << "\n"; tout << "upper: " << m_upper[obj_index] << "\n"; @@ -233,7 +233,7 @@ namespace opt { m_s->get_model(m_model); SASSERT(m_model); inf_eps obj = m_s->saved_objective_value(obj_index); - TRACE("opt", tout << "saved objective: " << obj << "\n";); + TRACE(opt, tout << "saved objective: " << obj << "\n";); update_lower_lex(obj_index, obj, is_maximize); if (!is_int || !m_lower[obj_index].is_finite()) { delta_per_step = rational(1); @@ -272,7 +272,7 @@ namespace opt { } m_s->pop(num_scopes); - TRACE("opt", tout << is_sat << " " << num_scopes << "\n";); + TRACE(opt, tout << is_sat << " " << num_scopes << "\n";); if (is_sat == l_false && !m_model) { return l_false; @@ -328,7 +328,7 @@ namespace opt { solver::scoped_push _push(*m_s); while (m.inc()) { m_s->assert_expr(fml); - TRACE("opt", tout << fml << "\n";); + TRACE(opt, tout << fml << "\n";); is_sat = m_s->check_sat(1,vars); if (is_sat == l_true) { disj.reset(); @@ -367,7 +367,7 @@ namespace opt { } void optsmt::update_lower_lex(unsigned idx, inf_eps const& v, bool is_maximize) { - TRACE("opt", tout << v << " lower: " << m_lower[idx] << "\n";); + TRACE(opt, tout << v << " lower: " << m_lower[idx] << "\n";); if (v > m_lower[idx]) { m_lower[idx] = v; IF_VERBOSE(1, @@ -379,7 +379,7 @@ namespace opt { for (unsigned i = idx+1; i < m_vars.size(); ++i) { m_lower[i] = m_s->saved_objective_value(i); } - TRACE("opt", tout << "update best model " << *m_model << "\n";); + TRACE(opt, tout << "update best model " << *m_model << "\n";); m_best_model = m_model; m_s->get_labels(m_labels); m_context.set_model(m_model); @@ -387,13 +387,13 @@ namespace opt { } void optsmt::update_lower(unsigned idx, inf_eps const& v) { - TRACE("opt", tout << "v" << idx << " >= " << v << "\n";); + TRACE(opt, tout << "v" << idx << " >= " << v << "\n";); m_lower_fmls[idx] = m_s->mk_ge(idx, v); m_lower[idx] = v; } void optsmt::update_upper(unsigned idx, inf_eps const& v) { - TRACE("opt", tout << "v" << idx << " <= " << v << "\n";); + TRACE(opt, tout << "v" << idx << " <= " << v << "\n";); m_upper[idx] = v; } @@ -411,7 +411,7 @@ namespace opt { if (!m_s->maximize_objectives1(disj)) return expr_ref(m.mk_true(), m); set_max(m_lower, m_s->get_objective_values(), disj); - TRACE("opt", model_pp(tout << m_lower << "\n", *m_model);); + TRACE(opt, model_pp(tout << m_lower << "\n", *m_model);); IF_VERBOSE(2, verbose_stream() << "(optsmt.lower " << m_lower << ")\n";); return mk_or(disj); } @@ -506,7 +506,7 @@ namespace opt { } lbool optsmt::lex(unsigned obj_index, bool is_maximize) { - TRACE("opt", tout << "optsmt:lex\n";); + TRACE(opt, tout << "optsmt:lex\n";); m_context.get_base_model(m_best_model); solver::scoped_push _push(*m_s); SASSERT(obj_index < m_vars.size()); @@ -551,14 +551,14 @@ namespace opt { void optsmt::get_model(model_ref& mdl, svector & labels) { mdl = m_best_model.get(); - TRACE("opt", tout << *mdl << "\n";); + TRACE(opt, tout << *mdl << "\n";); labels = m_labels; } // force lower_bound(i) <= objective_value(i) void optsmt::commit_assignment(unsigned i) { inf_eps lo = m_lower[i]; - TRACE("opt", tout << "set lower bound of " << mk_pp(m_objs.get(i), m) << " to: " << lo << "\n"; + TRACE(opt, tout << "set lower bound of " << mk_pp(m_objs.get(i), m) << " to: " << lo << "\n"; tout << get_lower(i) << ":" << get_upper(i) << "\n";); // Only assert bounds for bounded objectives if (lo.is_finite()) { diff --git a/src/opt/pb_sls.cpp b/src/opt/pb_sls.cpp index e7cdf9476..4ae8793ae 100644 --- a/src/opt/pb_sls.cpp +++ b/src/opt/pb_sls.cpp @@ -344,7 +344,7 @@ namespace smt { } } m_best_penalty = m_penalty; - TRACE("opt", display(tout);); + TRACE(opt, display(tout);); } literal flip() { @@ -496,7 +496,7 @@ namespace smt { } } - TRACE("opt", tout << "flip: " << l << " num false: " << m_hard_false.num_elems() + TRACE(opt, tout << "flip: " << l << " num false: " << m_hard_false.num_elems() << " penalty: " << m_penalty << " break count: " << break_count << "\n";); return break_count; } diff --git a/src/opt/sortmax.cpp b/src/opt/sortmax.cpp index 28448fbe4..6c5c1e9fe 100644 --- a/src/opt/sortmax.cpp +++ b/src/opt/sortmax.cpp @@ -76,7 +76,7 @@ namespace opt { trace_bounds("sortmax"); s().assert_expr(out[first]); is_sat = s().check_sat(0, nullptr); - TRACE("opt", tout << is_sat << "\n"; s().display(tout); tout << "\n";); + TRACE(opt, tout << is_sat << "\n"; s().display(tout); tout << "\n";); if (!m.inc()) { is_sat = l_undef; } @@ -87,7 +87,7 @@ namespace opt { for (; first < out.size() && is_true(out[first]); ++first) { s().assert_expr(out[first]); } - TRACE("opt", model_smt2_pp(tout, m, *m_model.get(), 0);); + TRACE(opt, model_smt2_pp(tout, m, *m_model.get(), 0);); m_upper = m_lower + rational(out.size() - first); (*m_filter)(m_model); } @@ -96,7 +96,7 @@ namespace opt { is_sat = l_true; m_lower = m_upper; } - TRACE("opt", tout << "min cost: " << m_upper << "\n";); + TRACE(opt, tout << "min cost: " << m_upper << "\n";); return is_sat; } diff --git a/src/opt/wmax.cpp b/src/opt/wmax.cpp index 9a7d1a3ca..6cbc542c5 100644 --- a/src/opt/wmax.cpp +++ b/src/opt/wmax.cpp @@ -50,7 +50,7 @@ namespace opt { m_defs(m) {} lbool operator()() override { - TRACE("opt", tout << "weighted maxsat\n";); + TRACE(opt, tout << "weighted maxsat\n";); scoped_ensure_theory wth(*this); reset(); if (!init()) @@ -67,7 +67,7 @@ namespace opt { wth().init_min_cost(m_upper - m_lower); trace_bounds("wmax"); - TRACE("opt", + TRACE(opt, s().display(tout) << "\n"; tout << "lower: " << m_lower << " upper: " << m_upper << "\n";); while (m.inc() && m_lower < m_upper) { @@ -79,7 +79,7 @@ namespace opt { break; } if (is_sat == l_false) { - TRACE("opt", tout << "Unsat\n";); + TRACE(opt, tout << "Unsat\n";); break; } if (is_sat == l_true) { @@ -107,7 +107,7 @@ namespace opt { is_sat = l_true; m_lower = m_upper; } - TRACE("opt", tout << "min cost: " << m_upper << "\n";); + TRACE(opt, tout << "min cost: " << m_upper << "\n";); return is_sat; } diff --git a/src/parsers/smt2/smt2parser.cpp b/src/parsers/smt2/smt2parser.cpp index 70e324396..0841f73ee 100644 --- a/src/parsers/smt2/smt2parser.cpp +++ b/src/parsers/smt2/smt2parser.cpp @@ -358,7 +358,7 @@ namespace smt2 { return true; SASSERT(m_num_open_paren >= 0); while (m_num_open_paren > 0 || !curr_is_lparen()) { - TRACE("sync", tout << "sync(): curr: " << curr() << "\n"; + TRACE(sync, tout << "sync(): curr: " << curr() << "\n"; tout << "m_num_open_paren: " << m_num_open_paren << ", line: " << m_scanner.get_line() << ", pos: " << m_scanner.get_pos() << "\n";); if (curr() == scanner::EOF_TOKEN) { @@ -662,7 +662,7 @@ namespace smt2 { SASSERT(epos >= spos); unsigned num = epos - spos; if (!d->has_var_params() && d->get_num_params() != num) { - TRACE("smt2parser", tout << "num: " << num << ", d->get_num_params(): " << d->get_num_params() << "\n";); + TRACE(smt2parser, tout << "num: " << num << ", d->get_num_params(): " << d->get_num_params() << "\n";); throw parser_exception("invalid number of parameters to sort constructor"); } @@ -724,7 +724,7 @@ namespace smt2 { SASSERT(epos >= spos); unsigned num = epos - spos; if (!d->has_var_params() && d->get_num_params() != num) { - TRACE("smt2parser", tout << "num: " << num << ", d->get_num_params(): " << d->get_num_params() << "\n";); + TRACE(smt2parser, tout << "num: " << num << ", d->get_num_params(): " << d->get_num_params() << "\n";); throw parser_exception("invalid number of parameters to sort constructor"); } sort * r = d->instantiate(pm(), num, sort_stack().data() + spos); @@ -838,7 +838,7 @@ namespace smt2 { r_str += curr_id().str(); symbol r_name(r_str); next(); - TRACE("datatype_parser_bug", tout << ct_name << " " << r_name << "\n";); + TRACE(datatype_parser_bug, tout << ct_name << " " << r_name << "\n";); ct_decls.push_back(pm().mk_pconstructor_decl(m_sort_id2param_idx.size(), ct_name, r_name, 0, nullptr)); } else { @@ -949,7 +949,7 @@ namespace smt2 { m_ctx.insert(d); } } - TRACE("declare_datatypes", tout << "i: " << i << " new_dt_decls.size(): " << sz << "\n"; + TRACE(declare_datatypes, tout << "i: " << i << " new_dt_decls.size(): " << sz << "\n"; for (unsigned j = 0; j < new_dt_decls.size(); ++j) tout << new_dt_decls[j]->get_name() << "\n";); m_ctx.print_success(); next(); @@ -1031,7 +1031,7 @@ namespace smt2 { } void name_expr(expr * n, symbol const & s) { - TRACE("name_expr", tout << "naming: " << s << " ->\n" << mk_pp(n, m()) << "\n";); + TRACE(name_expr, tout << "naming: " << s << " ->\n" << mk_pp(n, m()) << "\n";); if (!is_ground(n) && m_has_free_vars(n)) throw parser_exception("invalid named expression, expression contains free variables"); m_ctx.insert(s, 0, nullptr, n); @@ -1105,7 +1105,7 @@ namespace smt2 { check_keyword("invalid attributed expression, keyword expected"); symbol id = curr_id(); fr->m_last_symbol = symbol::null; - TRACE("consume_attributes", tout << "id: " << id << ", expr_stack().size(): " << expr_stack().size() << "\n";); + TRACE(consume_attributes, tout << "id: " << id << ", expr_stack().size(): " << expr_stack().size() << "\n";); if (id == m_named) { next(); name_expr(expr_stack().back(), check_identifier_next("invalid attribute value, symbol expected")); @@ -1196,7 +1196,7 @@ namespace smt2 { void parse_numeral(bool is_int) { SASSERT(!is_int || curr_is_int()); SASSERT(is_int || curr_is_float()); - TRACE("parse_numeral", tout << "curr(): " << curr() << ", curr_numeral(): " << curr_numeral() << ", is_int: " << is_int << "\n";); + TRACE(parse_numeral, tout << "curr(): " << curr() << ", curr_numeral(): " << curr_numeral() << ", is_int: " << is_int << "\n";); expr_stack().push_back(autil().mk_numeral(curr_numeral(), is_int && !m_ctx.numeral_as_real())); next(); } @@ -1204,7 +1204,7 @@ namespace smt2 { void parse_bv_numeral() { SASSERT(curr() == scanner::BV_TOKEN); expr_stack().push_back(butil().mk_numeral(curr_numeral(), m_scanner.get_bv_size())); - TRACE("parse_bv_numeral", tout << "new numeral: " << mk_pp(expr_stack().back(), m()) << "\n";); + TRACE(parse_bv_numeral, tout << "new numeral: " << mk_pp(expr_stack().back(), m()) << "\n";); next(); } @@ -1212,7 +1212,7 @@ namespace smt2 { SASSERT(curr() == scanner::STRING_TOKEN); zstring zs(m_scanner.get_string()); expr_stack().push_back(sutil().str.mk_string(zs)); - TRACE("smt2parser", tout << "new string: " << mk_pp(expr_stack().back(), m()) << "\n";); + TRACE(smt2parser, tout << "new string: " << mk_pp(expr_stack().back(), m()) << "\n";); next(); } @@ -1284,21 +1284,21 @@ namespace smt2 { unsigned num = 0; unsigned sym_spos = symbol_stack().size(); unsigned sort_spos = sort_stack().size(); - TRACE("parse_sorted_vars", tout << "[before] symbol_stack().size(): " << symbol_stack().size() << "\n";); + TRACE(parse_sorted_vars, tout << "[before] symbol_stack().size(): " << symbol_stack().size() << "\n";); check_lparen_next("invalid list of sorted variables, '(' expected"); m_env.begin_scope(); while (!curr_is_rparen()) { check_lparen_next("invalid sorted variable, '(' expected"); check_identifier("invalid sorted variable, symbol expected"); symbol_stack().push_back(curr_id()); - TRACE("parse_sorted_vars", tout << "push_back curr_id(): " << curr_id() << "\n";); + TRACE(parse_sorted_vars, tout << "push_back curr_id(): " << curr_id() << "\n";); next(); parse_sort("invalid sorted variables"); check_rparen_next("invalid sorted variable, ')' expected"); num++; } next(); - TRACE("parse_sorted_vars", tout << "[after] symbol_stack().size(): " << symbol_stack().size() << "\n";); + TRACE(parse_sorted_vars, tout << "[after] symbol_stack().size(): " << symbol_stack().size() << "\n";); symbol const * sym_it = symbol_stack().data() + sym_spos; sort * const * sort_it = sort_stack().data() + sort_spos; m_num_bindings += num; @@ -1307,7 +1307,7 @@ namespace smt2 { --i; var * v = m().mk_var(i, *sort_it); expr_stack().push_back(v); // prevent v from being deleted - TRACE("parse_sorted_vars", tout << "registering " << *sym_it << " -> " << mk_pp(v, m()) << ", num: " << num << ", i: " << i << "\n";); + TRACE(parse_sorted_vars, tout << "registering " << *sym_it << " -> " << mk_pp(v, m()) << ", num: " << num << ", i: " << i << "\n";); m_env.insert(*sym_it, local(v, m_num_bindings)); SASSERT(m_env.contains(*sym_it)); ++sort_it; @@ -1325,7 +1325,7 @@ namespace smt2 { } void push_bang_frame(expr_frame * curr) { - TRACE("consume_attributes", tout << "begin bang, expr_stack.size(): " << expr_stack().size() << "\n";); + TRACE(consume_attributes, tout << "begin bang, expr_stack.size(): " << expr_stack().size() << "\n";); next(); void * mem = m_stack.allocate(sizeof(attr_expr_frame)); new (mem) attr_expr_frame(curr, symbol_stack().size(), expr_stack().size()); @@ -1421,7 +1421,7 @@ namespace smt2 { expr_ref compile_patterns(expr* t, expr_ref_vector const& patterns, expr_ref_vector const& cases) { expr_ref result(m()); var_subst sub(m(), false); - TRACE("parse_expr", tout << "term\n" << expr_ref(t, m()) << "\npatterns\n" << patterns << "\ncases\n" << cases << "\n";); + TRACE(parse_expr, tout << "term\n" << expr_ref(t, m()) << "\npatterns\n" << patterns << "\ncases\n" << cases << "\n";); check_patterns(patterns, t->get_sort()); for (unsigned i = patterns.size(); i > 0; ) { --i; @@ -1444,7 +1444,7 @@ namespace smt2 { result = new_case; } } - TRACE("parse_expr", tout << result << "\n";); + TRACE(parse_expr, tout << result << "\n";); return result; } @@ -1663,7 +1663,7 @@ namespace smt2 { // return true if *s == [0-9]+ bool is_bv_decimal(char const * s) { - TRACE("is_bv_num", tout << "is_bv_decimal: " << s << "\n";); + TRACE(is_bv_num, tout << "is_bv_decimal: " << s << "\n";); SASSERT('0' <= *s && *s <= '9'); rational & n = m_last_bv_numeral; n = rational(*s - '0'); @@ -1802,11 +1802,11 @@ namespace smt2 { void parse_qualified_name() { SASSERT(curr_is_identifier()); SASSERT(curr_id_is_as() || curr_id_is_underscore()); - TRACE("parse_qualified_name", tout << "parse_qualified_name() curr_id: " << curr_id() << "\n";); + TRACE(parse_qualified_name, tout << "parse_qualified_name() curr_id: " << curr_id() << "\n";); unsigned param_spos = m_param_stack.size(); bool has_as; symbol r = parse_qualified_identifier_core(has_as); - TRACE("parse_qualified_name", tout << "parse_qualified_name() r: " << r << "\n";); + TRACE(parse_qualified_name, tout << "parse_qualified_name() r: " << r << "\n";); expr * t; local l; if (m_env.find(r, l)) { @@ -1870,9 +1870,9 @@ namespace smt2 { void push_expr_frame(expr_frame * curr) { SASSERT(curr_is_lparen()); next(); - TRACE("push_expr_frame", tout << "push_expr_frame(), curr(): " << m_curr << "\n";); + TRACE(push_expr_frame, tout << "push_expr_frame(), curr(): " << m_curr << "\n";); if (curr_is_identifier()) { - TRACE("push_expr_frame", tout << "push_expr_frame(), curr_id(): " << curr_id() << "\n";); + TRACE(push_expr_frame, tout << "push_expr_frame(), curr_id(): " << curr_id() << "\n";); if (curr_id_is_let()) { push_let_frame(); } @@ -1946,7 +1946,7 @@ namespace smt2 { m_param_stack.shrink(fr->m_param_spos); if (fr->m_as_sort) sort_stack().pop_back(); - TRACE("pop_app_frame", tout << "new term: " << mk_pp(t_ref, m()) << "\n";); + TRACE(pop_app_frame, tout << "new term: " << mk_pp(t_ref, m()) << "\n";); expr_stack().push_back(t_ref.get()); m_stack.deallocate(fr); m_num_expr_frames--; @@ -1968,13 +1968,13 @@ namespace smt2 { for (; expr_it != expr_end; ++expr_it, ++sym_it) { if (!(*expr_it)) throw parser_exception("invalid let expression"); - TRACE("let_frame", tout << "declaring: " << *sym_it << " " << mk_pp(*expr_it, m()) << "\n";); + TRACE(let_frame, tout << "declaring: " << *sym_it << " " << mk_pp(*expr_it, m()) << "\n";); m_env.insert(*sym_it, local(*expr_it, m_num_bindings)); } } else { // the resultant expression is on the top of the stack - TRACE("let_frame", tout << "let result expr: " << mk_pp(expr_stack().back(), m()) << "\n";); + TRACE(let_frame, tout << "let result expr: " << mk_pp(expr_stack().back(), m()) << "\n";); expr_ref r(m()); if (expr_stack().size() < fr->m_expr_spos + 1) throw parser_exception("invalid let expression"); @@ -2019,9 +2019,9 @@ namespace smt2 { pattern_stack().shrink(end_pats); unsigned num_pats = end_pats - begin_pats; unsigned num_nopats = nopattern_stack().size() - fr->m_nopat_spos; - TRACE("parse_quantifier", tout << "weight: " << fr->m_weight << "\n";); - TRACE("skid", tout << "fr->m_skid: " << fr->m_skid << "\n";); - TRACE("parse_quantifier", tout << "body:\n" << mk_pp(expr_stack().back(), m()) << "\n";); + TRACE(parse_quantifier, tout << "weight: " << fr->m_weight << "\n";); + TRACE(skid, tout << "fr->m_skid: " << fr->m_skid << "\n";); + TRACE(parse_quantifier, tout << "body:\n" << mk_pp(expr_stack().back(), m()) << "\n";); if (fr->m_qid == symbol::null) fr->m_qid = symbol((unsigned)m_scanner.get_line()); if (fr->m_kind != lambda_k && !m().is_bool(expr_stack().back())) @@ -2037,8 +2037,8 @@ namespace smt2 { num_pats, pattern_stack().data() + fr->m_pat_spos, num_nopats, nopattern_stack().data() + fr->m_nopat_spos ); - TRACE("mk_quantifier", tout << "id: " << new_q->get_id() << "\n" << mk_ismt2_pp(new_q, m()) << "\n";); - TRACE("skid", tout << "new_q->skid: " << new_q->get_skid() << "\n";); + TRACE(mk_quantifier, tout << "id: " << new_q->get_id() << "\n" << mk_ismt2_pp(new_q, m()) << "\n";); + TRACE(skid, tout << "new_q->skid: " << new_q->get_skid() << "\n";); expr_stack().shrink(fr->m_expr_spos); pattern_stack().shrink(fr->m_pat_spos); nopattern_stack().shrink(fr->m_nopat_spos); @@ -2055,7 +2055,7 @@ namespace smt2 { void pop_attr_expr_frame(attr_expr_frame * fr) { process_last_symbol(fr); - TRACE("consume_attributes", tout << "pop_attr_expr_frame, expr_stack.size(): " << expr_stack().size() << "\n";); + TRACE(consume_attributes, tout << "pop_attr_expr_frame, expr_stack.size(): " << expr_stack().size() << "\n";); // the resultant expression is already on the top of the stack. if (expr_stack().size() != fr->m_expr_spos + 1) throw parser_exception("invalid expression"); @@ -2117,7 +2117,7 @@ namespace smt2 { void parse_expr() { m_num_expr_frames = 0; do { - TRACE("parse_expr", tout << "curr(): " << curr() << ", m_num_expr_frames: " << m_num_expr_frames + TRACE(parse_expr, tout << "curr(): " << curr() << ", m_num_expr_frames: " << m_num_expr_frames << ", expr_stack().size(): " << expr_stack().size() << "\n";); if (curr_is_rparen()) { if (m_num_expr_frames == 0) @@ -2126,7 +2126,7 @@ namespace smt2 { } else { pe_state st = parse_expr_state(); - TRACE("consume_attributes", tout << "parse_expr_state: " << st << ", expr_stack.size(): " << expr_stack().size() << "\n";); + TRACE(consume_attributes, tout << "parse_expr_state: " << st << ", expr_stack.size(): " << expr_stack().size() << "\n";); switch (st) { case PES_EXPR: switch (curr()) { @@ -2526,7 +2526,7 @@ namespace smt2 { SASSERT(!sort_stack().empty()); func_decl_ref c(m()); c = m().mk_const_decl(id, sort_stack().back()); - TRACE("declare_const", tout << "declaring " << id << " "; pm().display(tout, sort_stack().back()); tout << "\n";); + TRACE(declare_const, tout << "declaring " << id << " "; pm().display(tout, sort_stack().back()); tout << "\n";); SASSERT(c.get() != 0); sort_stack().pop_back(); m_ctx.insert(c); @@ -2573,7 +2573,7 @@ namespace smt2 { check_rparen("invalid pop command, ')' expected"); m_ctx.print_success(); next(); - TRACE("after_pop", tout << "expr_stack.size: " << expr_stack().size() << "\n"; m_ctx.dump_assertions(tout);); + TRACE(after_pop, tout << "expr_stack.size: " << expr_stack().size() << "\n"; m_ctx.dump_assertions(tout);); } std::string m_assert_expr; @@ -2598,7 +2598,7 @@ namespace smt2 { } expr * f = expr_stack().back(); if (!f || !m().is_bool(f)) { - TRACE("smt2parser", tout << expr_ref(f, m()) << "\n";); + TRACE(smt2parser, tout << expr_ref(f, m()) << "\n";); throw cmd_exception("invalid assert command, term is not Boolean"); } if (f == m_last_named_expr.second) { @@ -3228,7 +3228,7 @@ namespace smt2 { found_errors = true; if (!sync_after_error()) return false; - TRACE("parser_error", tout << "after sync: " << curr() << "\n";); + TRACE(parser_error, tout << "after sync: " << curr() << "\n";); SASSERT(m_num_open_paren == 0); } } diff --git a/src/parsers/smt2/smt2scanner.cpp b/src/parsers/smt2/smt2scanner.cpp index 8beb782c1..ce3f83bc5 100644 --- a/src/parsers/smt2/smt2scanner.cpp +++ b/src/parsers/smt2/smt2scanner.cpp @@ -103,7 +103,7 @@ namespace smt2 { next(); m_string.push_back(0); m_id = m_string.begin(); - TRACE("scanner", tout << "new quoted symbol: " << m_id << "\n";); + TRACE(scanner, tout << "new quoted symbol: " << m_id << "\n";); return SYMBOL_TOKEN; } else if (c != '|' && c != '\\' && escape) { @@ -128,7 +128,7 @@ namespace smt2 { else { m_string.push_back(0); m_id = m_string.begin(); - TRACE("scanner", tout << "new symbol: " << m_id << "\n";); + TRACE(scanner, tout << "new symbol: " << m_id << "\n";); return SYMBOL_TOKEN; } } @@ -175,7 +175,7 @@ namespace smt2 { } if (is_float) m_number /= q; - TRACE("scanner", tout << "new number: " << m_number << "\n";); + TRACE(scanner, tout << "new number: " << m_number << "\n";); return is_float ? FLOAT_TOKEN : INT_TOKEN; } diff --git a/src/parsers/util/scanner.cpp b/src/parsers/util/scanner.cpp index db8453ffe..a10c50150 100644 --- a/src/parsers/util/scanner.cpp +++ b/src/parsers/util/scanner.cpp @@ -264,7 +264,7 @@ scanner::token scanner::read_string(char delimiter, token result) { } scanner::token scanner::read_bv_literal() { - TRACE("scanner", tout << "read_bv_literal\n";); + TRACE(scanner, tout << "read_bv_literal\n";); if (m_bv_token) { int ch = read_char(); if (ch == 'x') { @@ -287,7 +287,7 @@ scanner::token scanner::read_bv_literal() { else { unread_char(); m_state = m_bv_size == 0 ? ERROR_TOKEN : BV_TOKEN; - TRACE("scanner", tout << m_state << ", bv-size: " << m_bv_size << ", INT_TOKEN: " << INT_TOKEN + TRACE(scanner, tout << m_state << ", bv-size: " << m_bv_size << ", INT_TOKEN: " << INT_TOKEN << ", BV_TOKEN: " << BV_TOKEN << "\n";); return m_state; } diff --git a/src/qe/lite/qe_lite_tactic.cpp b/src/qe/lite/qe_lite_tactic.cpp index 03ebc8c4e..4ced596ae 100644 --- a/src/qe/lite/qe_lite_tactic.cpp +++ b/src/qe/lite/qe_lite_tactic.cpp @@ -160,7 +160,7 @@ namespace qel { case AST_VAR: vidx = to_var(t)->get_idx(); if (fr.second == 0) { - CTRACE("der_bug", vidx >= definitions.size(), tout << "vidx: " << vidx << "\n";); + CTRACE(der_bug, vidx >= definitions.size(), tout << "vidx: " << vidx << "\n";); // Remark: The size of definitions may be smaller than the number of variables occurring in the quantified formula. if (definitions.get(vidx, nullptr) != nullptr) { if (visiting.is_marked(t)) { @@ -264,7 +264,7 @@ namespace qel { } vs.push_back(to_var(lhs)); ts.push_back(rhs); - TRACE("qe_lite", tout << mk_pp(eq, m) << "\n";); + TRACE(qe_lite, tout << mk_pp(eq, m) << "\n";); return true; } @@ -287,7 +287,7 @@ namespace qel { bool is_var_eq(expr * e, ptr_vector& vs, expr_ref_vector & ts) { expr* lhs = nullptr, *rhs = nullptr; - TRACE("qe_lite", tout << mk_pp(e, m) << "\n";); + TRACE(qe_lite, tout << mk_pp(e, m) << "\n";); // (= VAR t), (iff VAR t), (iff (not VAR) t), (iff t (not VAR)) cases if (m.is_eq(e, lhs, rhs) && trivial_solve(lhs, rhs, e, vs, ts)) { @@ -303,7 +303,7 @@ namespace qel { if (res != e && m.is_eq(res, lhs, rhs) && is_variable(lhs)) { vs.push_back(to_var(lhs)); ts.push_back(rhs); - TRACE("qe_lite", tout << res << "\n";); + TRACE(qe_lite, tout << res << "\n";); return true; } } @@ -321,7 +321,7 @@ namespace qel { } void get_elimination_order() { - TRACE("top_sort", + TRACE(top_sort, tout << "DEFINITIONS: " << std::endl; for(unsigned i = 0; i < m_map.size(); i++) if(m_map[i]) tout << "VAR " << i << " = " << mk_pp(m_map[i], m) << std::endl; @@ -329,7 +329,7 @@ namespace qel { der_sort_vars(m_inx2var, m_map, m_order); - TRACE("qe_lite", + TRACE(qe_lite, tout << "Elimination m_order:" << std::endl; tout << m_order << std::endl; ); @@ -346,8 +346,8 @@ namespace qel { expr_ref r(m); if (is_ground(cur)) r = cur; else m_subst(cur, r); unsigned inx = sz - idx - 1; - TRACE("qe_lite", tout << idx << " |-> " << r << "\n";); - CTRACE("top_sort", m_subst_map.get(inx) != nullptr, + TRACE(qe_lite, tout << idx << " |-> " << r << "\n";); + CTRACE(top_sort, m_subst_map.get(inx) != nullptr, tout << "inx is " << inx << "\n" << "idx is " << idx << "\n" << "sz is " << sz << "\n" @@ -401,7 +401,7 @@ namespace qel { break; } expr_ref new_e = m_subst(t, m_subst_map.size(), m_subst_map.data()); - TRACE("qe_lite", tout << new_e << "\n";); + TRACE(qe_lite, tout << new_e << "\n";); // don't forget to update the quantifier patterns expr_ref_buffer new_patterns(m); @@ -451,7 +451,7 @@ namespace qel { } } else { - TRACE("der_bug", tout << "Did not find any diseq\n" << mk_pp(q, m) << "\n";); + TRACE(der_bug, tout << "Did not find any diseq\n" << mk_pp(q, m) << "\n";); r = q; } @@ -537,7 +537,7 @@ namespace qel { m_map[idx] = t; m_new_exprs.push_back(std::move(t)); } - TRACE ("qe_def", + TRACE(qe_def, tout << "Replacing definition of VAR " << idx << " from " << mk_pp(old_def, m) << " to " << mk_pp(t, m) << " inferred from: " << mk_pp(args[i], m) << "\n";); @@ -548,7 +548,7 @@ namespace qel { } void flatten_definitions(expr_ref_vector& conjs) { - TRACE("qe_lite", + TRACE(qe_lite, expr_ref tmp(m); tmp = m.mk_and(conjs.size(), conjs.data()); tout << mk_pp(tmp, m) << "\n";); @@ -584,7 +584,7 @@ namespace qel { continue; } } - TRACE("qe_lite", + TRACE(qe_lite, expr_ref tmp(m); tmp = m.mk_and(conjs.size(), conjs.data()); tout << "after flatten\n" << mk_pp(tmp, m) << "\n";); @@ -633,7 +633,7 @@ namespace qel { change = false; for (unsigned i = 0; i < conjs.size(); ++i) { if (m.is_not(conjs[i].get(), ne) && m.is_eq(ne, l, r)) { - TRACE("qe_lite", tout << mk_pp(conjs[i].get(), m) << " " << is_variable(l) << " " << is_variable(r) << "\n";); + TRACE(qe_lite, tout << mk_pp(conjs[i].get(), m) << " " << is_variable(l) << " " << is_variable(r) << "\n";); if (is_variable(l) && ::is_var(l) && is_unconstrained(::to_var(l), r, i, conjs)) { conjs[i] = m.mk_true(); reduced = true; @@ -710,7 +710,7 @@ namespace qel { } void operator()(quantifier * q, expr_ref & r, proof_ref & pr) { - TRACE("qe_lite", tout << mk_pp(q, m) << "\n";); + TRACE(qe_lite, tout << mk_pp(q, m) << "\n";); pr = nullptr; r = q; reduce_quantifier(q, r, pr); @@ -808,7 +808,7 @@ namespace qel { expr_safe_replace rep(m); rep.insert(A, B); expr_ref tmp(m); - TRACE("qe_lite", + TRACE(qe_lite, tout << mk_pp(e1, m) << " = " << mk_pp(e2, m) << "\n";); for (unsigned j = 0; j < conjs.size(); ++j) { if (i == j) { @@ -1099,7 +1099,7 @@ namespace fm { if (m_util.is_le(t, lhs, rhs) || m_util.is_ge(t, lhs, rhs)) { result = m_util.is_numeral(rhs) && is_linear_pol(lhs); } - TRACE("qe_lite", tout << mk_pp(t, m) << " " << (result?"true":"false") << "\n";); + TRACE(qe_lite, tout << mk_pp(t, m) << " " << (result?"true":"false") << "\n";); return result; } @@ -1171,7 +1171,7 @@ namespace fm { cnstr->m_xs = reinterpret_cast(mem_xs); cnstr->m_as = reinterpret_cast(mem_as); for (unsigned i = 0; i < num_vars; i++) { - TRACE("qe_lite", tout << "xs[" << i << "]: " << xs[i] << "\n";); + TRACE(qe_lite, tout << "xs[" << i << "]: " << xs[i] << "\n";); cnstr->m_xs[i] = xs[i]; new (cnstr->m_as + i) rational(as[i]); } @@ -1363,7 +1363,7 @@ namespace fm { if (c2->m_dead) continue; if (subsumes(c, *c2)) { - TRACE("qe_lite", display(tout, c); tout << "\nsubsumed:\n"; display(tout, *c2); tout << "\n";); + TRACE(qe_lite, display(tout, c); tout << "\nsubsumed:\n"; display(tout, *c2); tout << "\n";); c2->m_dead = true; continue; } @@ -1439,10 +1439,10 @@ namespace fm { for (unsigned i = 0; i < sz; i++) { expr * f = g[i]; if (is_occ(f)) { - TRACE("qe_lite", tout << "OCC: " << mk_ismt2_pp(f, m) << "\n";); + TRACE(qe_lite, tout << "OCC: " << mk_ismt2_pp(f, m) << "\n";); continue; } - TRACE("qe_lite", tout << "not OCC:\n" << mk_ismt2_pp(f, m) << "\n";); + TRACE(qe_lite, tout << "not OCC:\n" << mk_ismt2_pp(f, m) << "\n";); quick_for_each_expr(proc, visited, f); } } @@ -1571,7 +1571,7 @@ namespace fm { SASSERT(m_uppers.size() == m_is_int.size()); SASSERT(m_forbidden.size() == m_is_int.size()); SASSERT(m_var2pos.size() == m_is_int.size()); - TRACE("qe_lite", tout << mk_pp(t,m) << " |-> " << x << " forbidden: " << forbidden << "\n";); + TRACE(qe_lite, tout << mk_pp(t,m) << " |-> " << x << " forbidden: " << forbidden << "\n";); return x; } @@ -1593,7 +1593,7 @@ namespace fm { x = mk_var(t); SASSERT(m_expr2var.contains(t)); SASSERT(m_var2expr.get(x) == t); - TRACE("qe_lite", tout << mk_ismt2_pp(t, m) << " --> " << x << "\n";); + TRACE(qe_lite, tout << mk_ismt2_pp(t, m) << " --> " << x << "\n";); return x; } @@ -1613,7 +1613,7 @@ namespace fm { void add_constraint(expr * f, expr_dependency * dep) { - TRACE("qe_lite", tout << mk_pp(f, m) << "\n";); + TRACE(qe_lite, tout << mk_pp(f, m) << "\n";); SASSERT(!m.is_or(f) || m_fm_occ); sbuffer lits; sbuffer xs; @@ -1693,7 +1693,7 @@ namespace fm { } } - TRACE("qe_lite", tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); i++) tout << " " << xs[i]; tout << "\n";); + TRACE(qe_lite, tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); i++) tout << " " << xs[i]; tout << "\n";); constraint * new_c = mk_constraint(lits.size(), lits.data(), @@ -1704,7 +1704,7 @@ namespace fm { strict, dep); - TRACE("qe_lite", tout << "add_constraint: "; display(tout, *new_c); tout << "\n";); + TRACE(qe_lite, tout << "add_constraint: "; display(tout, *new_c); tout << "\n";); VERIFY(register_constraint(new_c)); } @@ -1717,7 +1717,7 @@ namespace fm { if (is_false(*c)) { del_constraint(c); m_inconsistent = true; - TRACE("qe_lite", tout << "is false "; display(tout, *c); tout << "\n";); + TRACE(qe_lite, tout << "is false "; display(tout, *c); tout << "\n";); return false; } @@ -1740,7 +1740,7 @@ namespace fm { return true; } else { - TRACE("qe_lite", tout << "all variables are forbidden "; display(tout, *c); tout << "\n";); + TRACE(qe_lite, tout << "all variables are forbidden "; display(tout, *c); tout << "\n";); m_new_fmls.push_back(to_expr(*c)); del_constraint(c); return false; @@ -1794,7 +1794,7 @@ namespace fm { } // x_cost_lt is not a total order on variables std::stable_sort(x_cost_vector.begin(), x_cost_vector.end(), x_cost_lt(m_is_int)); - TRACE("qe_lite", + TRACE(qe_lite, for (auto const& kv : x_cost_vector) { tout << "(" << mk_ismt2_pp(m_var2expr.get(kv.first), m) << " " << kv.second << ") "; } @@ -1970,7 +1970,7 @@ namespace fm { if (new_xs.empty() && (new_c.is_pos() || (!new_strict && new_c.is_zero()))) { // literal is true - TRACE("qe_lite", tout << "resolution " << x << " consequent literal is always true: \n"; + TRACE(qe_lite, tout << "resolution " << x << " consequent literal is always true: \n"; display(tout, l); tout << "\n"; display(tout, u); tout << "\n";); @@ -2014,7 +2014,7 @@ namespace fm { } if (tautology) { - TRACE("qe_lite", tout << "resolution " << x << " tautology: \n"; + TRACE(qe_lite, tout << "resolution " << x << " tautology: \n"; display(tout, l); tout << "\n"; display(tout, u); tout << "\n";); @@ -2024,7 +2024,7 @@ namespace fm { expr_dependency * new_dep = m.mk_join(l.m_dep, u.m_dep); if (new_lits.empty() && new_xs.empty() && (new_c.is_neg() || (new_strict && new_c.is_zero()))) { - TRACE("qe_lite", tout << "resolution " << x << " inconsistent: \n"; + TRACE(qe_lite, tout << "resolution " << x << " inconsistent: \n"; display(tout, l); tout << "\n"; display(tout, u); tout << "\n";); @@ -2042,7 +2042,7 @@ namespace fm { new_strict, new_dep); - TRACE("qe_lite", tout << "resolution " << x << "\n"; + TRACE(qe_lite, tout << "resolution " << x << "\n"; display(tout, l); tout << "\n"; display(tout, u); @@ -2065,7 +2065,7 @@ namespace fm { if (l.empty() || u.empty()) { // easy case mark_constraints_dead(x); - TRACE("qe_lite", tout << "variable was eliminated (trivial case)\n";); + TRACE(qe_lite, tout << "variable was eliminated (trivial case)\n";); return true; } @@ -2083,7 +2083,7 @@ namespace fm { m_counter += num_lowers * num_uppers; - TRACE("qe_lite", tout << "eliminating " << mk_ismt2_pp(m_var2expr.get(x), m) << "\nlowers:\n"; + TRACE(qe_lite, tout << "eliminating " << mk_ismt2_pp(m_var2expr.get(x), m) << "\nlowers:\n"; display_constraints(tout, l); tout << "uppers:\n"; display_constraints(tout, u);); unsigned num_old_cnstrs = num_uppers + num_lowers; @@ -2093,7 +2093,7 @@ namespace fm { for (unsigned i = 0; i < num_lowers; i++) { for (unsigned j = 0; j < num_uppers; j++) { if (m_inconsistent || num_new_cnstrs > limit) { - TRACE("qe_lite", tout << "too many new constraints: " << num_new_cnstrs << "\n";); + TRACE(qe_lite, tout << "too many new constraints: " << num_new_cnstrs << "\n";); del_constraints(new_constraints.size(), new_constraints.data()); return false; } @@ -2118,7 +2118,7 @@ namespace fm { backward_subsumption(*c); register_constraint(c); } - TRACE("qe_lite", tout << "variables was eliminated old: " << num_old_cnstrs << " new_constraints: " << sz << "\n";); + TRACE(qe_lite, tout << "variables was eliminated old: " << num_old_cnstrs << " new_constraints: " << sz << "\n";); return true; } @@ -2128,7 +2128,7 @@ namespace fm { if (!c->m_dead) { c->m_dead = true; expr * new_f = to_expr(*c); - TRACE("qe_lite", tout << "asserting...\n" << mk_ismt2_pp(new_f, m) << "\nnew_dep: " << c->m_dep << "\n";); + TRACE(qe_lite, tout << "asserting...\n" << mk_ismt2_pp(new_f, m) << "\nnew_dep: " << c->m_dep << "\n";); m_new_fmls.push_back(new_f); } } @@ -2160,7 +2160,7 @@ namespace fm { m_new_fmls.push_back(m.mk_false()); } else { - TRACE("qe_lite", display(tout);); + TRACE(qe_lite, display(tout);); subsume(); var_vector candidates; @@ -2369,7 +2369,7 @@ public: fmls[index] = fml; return; } - TRACE("qe_lite", tout << fmls << "\n";); + TRACE(qe_lite, tout << fmls << "\n";); is_variable_test is_var(index_set, index_of_bound); m_der.set_is_variable_proc(is_var); m_fm.set_is_variable_proc(is_var); @@ -2378,7 +2378,7 @@ public: m_fm(fmls); // AG: disable m_array_der() since it interferes with other array handling if (m_use_array_der) m_array_der(fmls); - TRACE("qe_lite", for (unsigned i = 0; i < fmls.size(); ++i) tout << mk_pp(fmls[i].get(), m) << "\n";); + TRACE(qe_lite, for (unsigned i = 0; i < fmls.size(); ++i) tout << mk_pp(fmls[i].get(), m) << "\n";); } }; diff --git a/src/qe/mbp/mbp_arith.cpp b/src/qe/mbp/mbp_arith.cpp index 54d35f8ef..05347b61f 100644 --- a/src/qe/mbp/mbp_arith.cpp +++ b/src/qe/mbp/mbp_arith.cpp @@ -64,7 +64,7 @@ namespace mbp { expr* e1, * e2; DEBUG_CODE(expr_ref val(m); eval(lit, val); - CTRACE("qe", !m.is_true(val), tout << mk_pp(lit, m) << " := " << val << "\n";); + CTRACE(qe, !m.is_true(val), tout << mk_pp(lit, m) << " := " << val << "\n";); if (m.is_false(val)) return false; SASSERT(m.limit().is_canceled() || !m.is_false(val));); @@ -72,7 +72,7 @@ namespace mbp { if (!m.inc()) return false; - TRACE("opt", tout << mk_pp(lit, m) << " " << a.is_lt(lit) << " " << a.is_gt(lit) << "\n";); + TRACE(opt, tout << mk_pp(lit, m) << " " << a.is_lt(lit) << " " << a.is_gt(lit) << "\n";); bool is_not = m.is_not(lit, lit); if (is_not) { mul.neg(); @@ -115,7 +115,7 @@ namespace mbp { vector > nums; for (expr* arg : *alit) { val = eval(arg); - TRACE("qe", tout << mk_pp(arg, m) << " " << val << "\n";); + TRACE(qe, tout << mk_pp(arg, m) << " " << val << "\n";); if (!a.is_numeral(val, r)) return false; nums.push_back(std::make_pair(arg, r)); } @@ -138,7 +138,7 @@ namespace mbp { expr* arg1 = to_app(lit)->get_arg(i), * arg2 = nullptr; rational r; expr_ref val = eval(arg1); - TRACE("qe", tout << mk_pp(arg1, m) << " " << val << "\n";); + TRACE(qe, tout << mk_pp(arg1, m) << " " << val << "\n";); if (!a.is_numeral(val, r)) return false; if (values.find(r, arg2)) { ty = opt::t_eq; @@ -168,7 +168,7 @@ namespace mbp { return true; } } - TRACE("qe", tout << "Skipping " << mk_pp(lit, m) << "\n";); + TRACE(qe, tout << "Skipping " << mk_pp(lit, m) << "\n";); return false; } else if (m.is_and(lit) && is_not) { @@ -178,11 +178,11 @@ namespace mbp { return true; } } - TRACE("qe", tout << "Skipping " << mk_pp(lit, m) << "\n";); + TRACE(qe, tout << "Skipping " << mk_pp(lit, m) << "\n";); return false; } else { - TRACE("qe", tout << "Skipping " << mk_pp(lit, m) << "\n";); + TRACE(qe, tout << "Skipping " << mk_pp(lit, m) << "\n";); return false; } vars coeffs; @@ -230,7 +230,7 @@ namespace mbp { else if (m.is_ite(t, t1, t2, t3)) { val = eval(t1); - TRACE("qe", tout << mk_pp(t1, m) << " := " << val << "\n";); + TRACE(qe, tout << mk_pp(t1, m) << " := " << val << "\n";); if (m.is_true(val)) { linearize(mbo, eval, mul, t2, c, fmls, ts, tids); fmls.push_back(t1); @@ -275,7 +275,7 @@ namespace mbp { mbo.add_divides(coeffs, c0, mul1); } else { - TRACE("qe", tout << "insert mul " << mk_pp(t, m) << "\n"); + TRACE(qe, tout << "insert mul " << mk_pp(t, m) << "\n"); insert_mul(t, mul, ts); } } @@ -324,7 +324,7 @@ namespace mbp { if (!has_arith) return true; model_evaluator eval(model); - TRACE("qe", tout << model;); + TRACE(qe, tout << model;); eval.set_model_completion(true); model.set_inline(); compute_def |= m_apply_projection; @@ -333,12 +333,12 @@ namespace mbp { obj_map tids; expr_ref_vector pinned(m); unsigned j = 0; - TRACE("qe", tout << "vars: " << vars << "\n"; + TRACE(qe, tout << "vars: " << vars << "\n"; for (expr* f : fmls) tout << mk_pp(f, m) << " := " << model(f) << "\n";); for (unsigned i = 0; i < fmls.size(); ++i) { expr* fml = fmls.get(i); if (!linearize(mbo, eval, fml, fmls, tids)) { - TRACE("qe", tout << "could not linearize: " << mk_pp(fml, m) << "\n";); + TRACE(qe, tout << "could not linearize: " << mk_pp(fml, m) << "\n";); fmls[j++] = fml; } else { @@ -346,7 +346,7 @@ namespace mbp { } } fmls.shrink(j); - TRACE("qe", tout << "formulas\n" << fmls << "\n"; + TRACE(qe, tout << "formulas\n" << fmls << "\n"; for (auto const& [e, id] : tids) tout << mk_pp(e, m) << " -> " << id << "\n";); @@ -370,7 +370,7 @@ namespace mbp { IF_VERBOSE(1, verbose_stream() << "mbp failed on " << mk_pp(v, m) << " := " << val << "\n"); throw default_exception("evaluation did not produce a numeral"); } - TRACE("qe", tout << mk_pp(v, m) << " " << val << "\n";); + TRACE(qe, tout << mk_pp(v, m) << " " << val << "\n";); tids.insert(v, mbo.add_var(r, a.is_int(v))); } } @@ -414,7 +414,7 @@ namespace mbp { } vars.shrink(j); - TRACE("qe", tout << "remaining vars: " << vars << "\n"; + TRACE(qe, tout << "remaining vars: " << vars << "\n"; for (unsigned v : real_vars) tout << "v" << v << " " << mk_pp(index2expr[v], m) << "\n"; mbo.display(tout);); vector defs = mbo.project(real_vars.size(), real_vars.data(), compute_def); @@ -430,7 +430,7 @@ namespace mbp { def_vars.insert(r.m_id, r); } rows2fmls(def_vars, rows, index2expr, fmls); - TRACE("qe", mbo.display(tout << "mbo result\n"); + TRACE(qe, mbo.display(tout << "mbo result\n"); for (auto const& d : defs) if (d) tout << "def: " << *d << "\n"; tout << fmls << "\n";); @@ -439,7 +439,7 @@ namespace mbp { if (m_apply_projection && !apply_projection(eval, result, fmls)) return false; - TRACE("qe", + TRACE(qe, for (auto const& [v, t] : result) tout << v << " := " << t << "\n"; for (auto* f : fmls) @@ -629,7 +629,7 @@ namespace mbp { mdl.register_decl(f, val); } else { - TRACE("qe", tout << "omitting model update for non-uninterpreted constant " << mk_pp(e, m) << "\n";); + TRACE(qe, tout << "omitting model update for non-uninterpreted constant " << mk_pp(e, m) << "\n";); } } expr_ref val(a.mk_numeral(value.get_rational(), false), m); @@ -660,7 +660,7 @@ namespace mbp { expr_ref val = eval(fml); if (!m.is_true(val)) { valid = false; - TRACE("qe", tout << mk_pp(fml, m) << " := " << val << "\n";); + TRACE(qe, tout << mk_pp(fml, m) << " := " << val << "\n";); } } return valid; @@ -676,14 +676,14 @@ namespace mbp { rational r; expr_ref val = eval(v); if (!a.is_numeral(val, r)) { - TRACE("qe", tout << eval.get_model() << "\n";); + TRACE(qe, tout << eval.get_model() << "\n";); IF_VERBOSE(1, verbose_stream() << "mbp failed on " << mk_pp(v, m) << " := " << val << "\n"); throw default_exception("mbp evaluation was only partial"); } id = mbo.add_var(r, a.is_int(v)); tids.insert(v, id); } - CTRACE("qe", kv.m_value.is_zero(), tout << mk_pp(v, m) << " has coefficient 0\n";); + CTRACE(qe, kv.m_value.is_zero(), tout << mk_pp(v, m) << " has coefficient 0\n";); if (!kv.m_value.is_zero()) { coeffs.push_back(var(id, kv.m_value)); } diff --git a/src/qe/mbp/mbp_arrays.cpp b/src/qe/mbp/mbp_arrays.cpp index 6e036a714..201096bcd 100644 --- a/src/qe/mbp/mbp_arrays.cpp +++ b/src/qe/mbp/mbp_arrays.cpp @@ -123,7 +123,7 @@ namespace mbp { (m_arr_u.is_store (a) && (a->get_arg (0) == m_v))) { m_has_stores_v.mark (a, true); - TRACE ("qe", + TRACE(qe, tout << "has stores:\n"; tout << mk_pp (a, m) << "\n"; ); @@ -248,7 +248,7 @@ namespace mbp { app_ref p_exp = mk_peq (eq->get_arg (0), eq->get_arg (1), empty, m); bool subst_eq_found = false; while (true) { - TRACE ("qe", tout << "processing peq:\n" << p_exp << "\n";); + TRACE(qe, tout << "processing peq:\n" << p_exp << "\n";); peq p (p_exp, m); expr_ref lhs = p.lhs(), rhs = p.rhs(); @@ -294,7 +294,7 @@ namespace mbp { } } if (idx_in_I) { - TRACE ("qe", + TRACE(qe, tout << "store index in diff indices:\n"; tout << mk_pp (m_idx_lits_v.back (), m) << "\n"; ); @@ -302,7 +302,7 @@ namespace mbp { // arr0 ==I arr1 p_exp = mk_peq (arr0, arr1, I, m); - TRACE ("qe", + TRACE(qe, tout << "new peq:\n"; tout << mk_pp (p_exp, m) << "\n"; ); @@ -313,7 +313,7 @@ namespace mbp { I.push_back (idxs); p_exp = mk_peq (arr0, arr1, I, m); - TRACE ("qe", tout << "new peq:\n" << p_exp << "\n"; ); + TRACE(qe, tout << "new peq:\n" << p_exp << "\n"; ); // arr1[idx] == x ptr_vector sel_args; @@ -323,7 +323,7 @@ namespace mbp { expr_ref eq (m.mk_eq (arr1_idx, x), m); m_aux_lits_v.push_back (eq); - TRACE ("qe", + TRACE(qe, tout << "new eq:\n"; tout << mk_pp (eq, m) << "\n"; ); @@ -334,7 +334,7 @@ namespace mbp { } else if (lhs == m_v || rhs == m_v) { subst_eq_found = true; - TRACE ("qe", + TRACE(qe, tout << "subst eq found!\n"; ); break; @@ -348,7 +348,7 @@ namespace mbp { if (subst_eq_found) { factor_selects (p_exp); - TRACE ("qe", + TRACE(qe, tout << "after factoring selects:\n"; tout << mk_pp (p_exp, m) << "\n"; for (unsigned i = m_aux_lits_v.size () - m_aux_vars.size (); i < m_aux_lits_v.size (); i++) { @@ -366,7 +366,7 @@ namespace mbp { convert_peq_to_eq (p_exp, eq, stores_on_rhs); m_subst_term_v = eq->get_arg (1); - TRACE ("qe", + TRACE(qe, tout << "subst term found:\n"; tout << mk_pp (m_subst_term_v, m) << "\n"; ); @@ -406,7 +406,7 @@ namespace mbp { /* empty */ ; } if (store != m_v) { - TRACE("qe", tout << "not a store " << mk_pp(eq, m) << " " << lhs_has_v << " " << rhs_has_v << " " << mk_pp(m_v, m) << "\n";); + TRACE(qe, tout << "not a store " << mk_pp(eq, m) << " " << lhs_has_v << " " << rhs_has_v << " " << mk_pp(m_v, m) << "\n";); return UINT_MAX; } return nd; @@ -428,11 +428,11 @@ namespace mbp { svector > true_eqs; find_arr_eqs (fml, eqs); - TRACE ("qe", tout << "array equalities:\n" << eqs << "\n";); + TRACE(qe, tout << "array equalities:\n" << eqs << "\n";); // evaluate eqs in M for (app * eq : eqs) { - TRACE ("qe", tout << "array equality:\n" << mk_pp (eq, m) << "\n"; ); + TRACE(qe, tout << "array equality:\n" << mk_pp (eq, m) << "\n"; ); if (m_mev->is_false(eq)) { m_false_sub_v.insert (eq, m.mk_false()); @@ -506,13 +506,13 @@ namespace mbp { reset_v (); m_v = arr_vars.get (i); if (!m_arr_u.is_array (m_v)) { - TRACE ("qe", + TRACE(qe, tout << "not an array variable: " << m_v << "\n"; ); aux_vars.push_back (m_v); continue; } - TRACE ("qe", tout << "projecting equalities on variable: " << m_v << "\n"; ); + TRACE(qe, tout << "projecting equalities on variable: " << m_v << "\n"; ); if (project (fml)) { mk_result (fml); @@ -521,11 +521,11 @@ namespace mbp { if (!m_subst_term_v || contains_v (m_subst_term_v)) { arr_vars[j++] = m_v; } - TRACE ("qe", tout << "after projection: \n" << fml << "\n";); + TRACE(qe, tout << "after projection: \n" << fml << "\n";); } else { IF_VERBOSE(2, verbose_stream() << "can't project:" << m_v << "\n";); - TRACE ("qe", tout << "Failed to project: " << m_v << "\n";); + TRACE(qe, tout << "Failed to project: " << m_v << "\n";); arr_vars[j++] = m_v; } } @@ -705,7 +705,7 @@ namespace mbp { fml = mk_and(lits); // simplify all trivial expressions introduced m_rw (fml); - TRACE ("qe", tout << "after reducing selects:\n" << fml << "\n";); + TRACE(qe, tout << "after reducing selects:\n" << fml << "\n";); } public: @@ -741,7 +741,7 @@ namespace mbp { } else { IF_VERBOSE(2, verbose_stream() << "can't project arrays:" << "\n";); - TRACE ("qe", tout << "Failed to project arrays\n";); + TRACE(qe, tout << "Failed to project arrays\n";); } } }; @@ -888,7 +888,7 @@ namespace mbp { for (unsigned i = 0; i < arity && is_numeric; ++i) { sort* srt = get_array_domain(v_sort, i); if (!m_ari_u.is_real(srt) && !m_ari_u.is_int(srt) && !m_bv_u.is_bv_sort(srt)) { - TRACE("qe", tout << "non-numeric index sort for Ackerman" << mk_pp(srt, m) << "\n";); + TRACE(qe, tout << "non-numeric index sort for Ackerman" << mk_pp(srt, m) << "\n";); is_numeric = false; } } @@ -973,7 +973,7 @@ namespace mbp { // substitute for sel terms m_sub (fml); - TRACE ("qe", tout << "after projection of selects:\n" << fml << "\n";); + TRACE(qe, tout << "after projection of selects:\n" << fml << "\n";); } /** @@ -985,10 +985,10 @@ namespace mbp { collect_selects (fml); // model based ackermannization for (auto & kv : m_sel_terms) { - TRACE ("qe",tout << "ackermann for var: " << mk_pp (kv.m_key, m) << "\n";); + TRACE(qe,tout << "ackermann for var: " << mk_pp (kv.m_key, m) << "\n";); ackermann (*(kv.m_value)); } - TRACE ("qe", tout << "idx lits:\n" << m_idx_lits; ); + TRACE(qe, tout << "idx lits:\n" << m_idx_lits; ); return true; } @@ -1028,7 +1028,7 @@ namespace mbp { } else { IF_VERBOSE(2, verbose_stream() << "can't project arrays:" << "\n";); - TRACE ("qe", tout << "Failed to project arrays\n";); + TRACE(qe, tout << "Failed to project arrays\n";); } // dealloc @@ -1239,7 +1239,7 @@ namespace mbp { collect_store_expressions(tg, lits); collect_index_expressions(tg, lits); - TRACE("qe", + TRACE(qe, tout << "indices\n"; for (auto& kv : m_indices) { tout << sort_ref(kv.m_key, m) << " |-> " << *kv.m_value << "\n"; @@ -1253,7 +1253,7 @@ namespace mbp { assert_extensionality(model, tg, lits); assert_store_select(model, tg, lits); - TRACE("qe", tout << lits << "\n";); + TRACE(qe, tout << lits << "\n";); for (auto& kv : m_indices) { dealloc(kv.m_value); @@ -1265,7 +1265,7 @@ namespace mbp { m_indices.reset(); m_arrays.reset(); - TRACE("qe", tout << "done: " << lits << "\n";); + TRACE(qe, tout << "done: " << lits << "\n";); } @@ -1467,7 +1467,7 @@ namespace mbp { ast_manager& m = fml.get_manager(); array_project_eqs_util pe (m); pe (mdl, arr_vars, fml, aux_vars); - TRACE ("qe", + TRACE(qe, tout << "Projected array eqs: " << fml << "\n"; tout << "Remaining array vars: " << arr_vars << "\n"; tout << "Aux vars: " << aux_vars << "\n"; @@ -1477,13 +1477,13 @@ namespace mbp { array_select_reducer rs (m); rs (mdl, arr_vars, fml, reduce_all_selects); - TRACE ("qe", tout << "Reduced selects:\n" << fml << "\n"; ); + TRACE(qe, tout << "Reduced selects:\n" << fml << "\n"; ); // 3. project selects using model based ackermannization array_project_selects_util ps (m); ps (mdl, arr_vars, fml, aux_vars); - TRACE ("qe", + TRACE(qe, tout << "Projected array selects: " << fml << "\n"; tout << "All aux vars: " << aux_vars << "\n"; ); diff --git a/src/qe/mbp/mbp_arrays_tg.cpp b/src/qe/mbp/mbp_arrays_tg.cpp index 3d1c825f5..6efd27143 100644 --- a/src/qe/mbp/mbp_arrays_tg.cpp +++ b/src/qe/mbp/mbp_arrays_tg.cpp @@ -179,7 +179,7 @@ struct mbp_array_tg::impl { auto js = array_store_indices(to_app(p.lhs())); auto elem = array_store_elem(to_app(p.lhs())); - TRACE("mbp_tg", + TRACE(mbp_tg, tout << "applying elimwreq on " << expr_ref(p.mk_peq(), m) << " is neg: " << is_neg << "\n"); vector indices; bool in = false; @@ -251,7 +251,7 @@ struct mbp_array_tg::impl { void add_rdVar(expr *rd) { // do not assign new variable if rd is already equal to a value if (m_tg.has_val_in_class(rd)) return; - TRACE("mbp_tg", tout << "applying add_rdVar on " << expr_ref(rd, m);); + TRACE(mbp_tg, tout << "applying add_rdVar on " << expr_ref(rd, m);); app_ref u = new_var(to_app(rd)->get_sort(), m); m_new_vars.push_back(u); m_tg.add_var(u); @@ -262,7 +262,7 @@ struct mbp_array_tg::impl { // given a \peq_{indices} t, where a is a variable, merge equivalence class // of a with store(t, indices, elems) where elems are fresh constants void elimeq(peq p) { - TRACE("mbp_tg", + TRACE(mbp_tg, tout << "applying elimeq on " << expr_ref(p.mk_peq(), m);); app_ref_vector aux_consts(m); expr_ref eq(m); @@ -283,12 +283,12 @@ struct mbp_array_tg::impl { } m_tg.add_lit(eq); m_tg.add_eq(p.mk_peq(), m.mk_true()); - TRACE("mbp_tg", tout << "added lit " << eq;); + TRACE(mbp_tg, tout << "added lit " << eq;); } // rewrite select(store(a, i, k), j) into either select(a, j) or k void elimrdwr(app *term) { - TRACE("mbp_tg", tout << "applying elimrdwr on " << expr_ref(term, m);); + TRACE(mbp_tg, tout << "applying elimrdwr on " << expr_ref(term, m);); auto rd_indices = array_select_indices(term); auto store_term = to_app(term->get_arg(0)); auto wr_indices = array_store_indices(store_term); @@ -321,7 +321,7 @@ struct mbp_array_tg::impl { // iterate through all terms in m_tg and apply all array MBP rules once // returns true if any rules were applied bool apply() { - TRACE("mbp_tg", tout << "Iterating over terms of tg\n"); + TRACE(mbp_tg, tout << "Iterating over terms of tg\n"); indices.reset(); rdTerms.reset(); m_new_vars.reset(); @@ -336,7 +336,7 @@ struct mbp_array_tg::impl { continue; if (m_tg.is_cgr(term)) continue; - TRACE("mbp_tg", tout << "processing " << expr_ref(term, m) << "\n"); + TRACE(mbp_tg, tout << "processing " << expr_ref(term, m) << "\n"); expr* a, *b; if (is_implicit_peq(term, a, b) || is_neg_peq(term, a, b)) { // rewrite array eq as peq diff --git a/src/qe/mbp/mbp_basic_tg.cpp b/src/qe/mbp/mbp_basic_tg.cpp index 693624871..0d0d2099d 100644 --- a/src/qe/mbp/mbp_basic_tg.cpp +++ b/src/qe/mbp/mbp_basic_tg.cpp @@ -64,12 +64,12 @@ struct mbp_basic_tg::impl { expr *c, *th, *el; expr_ref nterm(m); bool progress = false; - TRACE("mbp_tg", tout << "Iterating over terms of tg";); + TRACE(mbp_tg, tout << "Iterating over terms of tg";); // Not resetting terms because get_terms calls resize on terms m_tg.get_terms(terms, false); for (expr *term : terms) { if (is_seen(term)) continue; - TRACE("mbp_tg", tout << "Processing " << expr_ref(term, m) << "\n";); + TRACE(mbp_tg, tout << "Processing " << expr_ref(term, m) << "\n";); if (m.is_ite(term, c, th, el) && should_split(c)) { mark_seen(term); progress = true; diff --git a/src/qe/mbp/mbp_datatypes.cpp b/src/qe/mbp/mbp_datatypes.cpp index 5a88016db..899d19ca8 100644 --- a/src/qe/mbp/mbp_datatypes.cpp +++ b/src/qe/mbp/mbp_datatypes.cpp @@ -43,7 +43,7 @@ namespace mbp { bool project1(model& model, app* var, app_ref_vector& vars, expr_ref_vector& lits) { expr_ref val = model(var); SASSERT(is_app(val)); - TRACE("qe", tout << mk_pp(var, m) << " := " << val << "\n";); + TRACE(qe, tout << mk_pp(var, m) << " := " << val << "\n";); m_val = to_app(val); if (!dt.is_constructor(m_val)) { // assert: var does not occur in lits. @@ -61,7 +61,7 @@ namespace mbp { } } catch (const cant_project &) { - TRACE("qe", tout << "can't project:" << mk_pp(var, m) << "\n";); + TRACE(qe, tout << "can't project:" << mk_pp(var, m) << "\n";); return false; } return true; @@ -82,7 +82,7 @@ namespace mbp { args.push_back(arg); } val = m.mk_app(f, args.size(), args.data()); - TRACE("qe", tout << mk_pp(m_var->x(), m) << " |-> " << val << "\n";); + TRACE(qe, tout << mk_pp(m_var->x(), m) << " |-> " << val << "\n";); reduce(val, lits); } @@ -110,7 +110,7 @@ namespace mbp { th_rewriter rw(m); expr_ref tmp(m); sub.insert(m_var->x(), val); - TRACE("qe", tout << mk_pp(m_var->x(), m) << " = " << mk_pp(val, m) << "\n"; + TRACE(qe, tout << mk_pp(m_var->x(), m) << " = " << mk_pp(val, m) << "\n"; tout << lits << "\n";); for (unsigned i = 0; i < lits.size(); ++i) { sub(lits[i].get(), tmp); @@ -211,7 +211,7 @@ namespace mbp { reduced = true; } } - CTRACE("qe", reduced, tout << vars << "\n" << lits << "\n";); + CTRACE(qe, reduced, tout << vars << "\n" << lits << "\n";); } return reduced; } @@ -274,10 +274,10 @@ namespace mbp { if (has_v) { has_var.mark(f); } - TRACE("qe", tout << "contains: " << mk_pp(f, m) << " " << has_var.is_marked(f) << "\n";); + TRACE(qe, tout << "contains: " << mk_pp(f, m) << " " << has_var.is_marked(f) << "\n";); visited.mark(f); } - TRACE("qe", tout << "contains: " << mk_pp(e, m) << " " << has_var.is_marked(e) << "\n";); + TRACE(qe, tout << "contains: " << mk_pp(e, m) << " " << has_var.is_marked(e) << "\n";); return has_var.is_marked(e); } diff --git a/src/qe/mbp/mbp_dt_tg.cpp b/src/qe/mbp/mbp_dt_tg.cpp index 4bbb4ed3b..824c7140b 100644 --- a/src/qe/mbp/mbp_dt_tg.cpp +++ b/src/qe/mbp/mbp_dt_tg.cpp @@ -76,7 +76,7 @@ struct mbp_dt_tg::impl { SASSERT(is_app(term) && m_dt_util.is_accessor(to_app(term)->get_decl()) && has_var(to_app(term)->get_arg(0))); - TRACE("mbp_tg", tout << "applying rm_accessor on " << expr_ref(term, m);); + TRACE(mbp_tg, tout << "applying rm_accessor on " << expr_ref(term, m);); expr *v = to_app(term)->get_arg(0); expr_ref sel(m); app_ref u(m); @@ -107,7 +107,7 @@ struct mbp_dt_tg::impl { // rewrite cons(v, u) = x with v = head(x) and u = tail(x) // where u or v contain variables void deconstruct_eq(expr *cons, expr *rhs) { - TRACE("mbp_tg", + TRACE(mbp_tg, tout << "applying deconstruct_eq on " << expr_ref(cons, m);); ptr_vector const *accessors = m_dt_util.get_constructor_accessors(to_app(cons)->get_decl()); @@ -125,7 +125,7 @@ struct mbp_dt_tg::impl { // rewrite cons(v, u) != x into one of !cons(x) or v != head(x) or u != // tail(x) where u or v contain variables void deconstruct_neq(expr *cons, expr *rhs) { - TRACE("mbp_tg", + TRACE(mbp_tg, tout << "applying deconstruct_neq on " << expr_ref(cons, m);); ptr_vector const *accessors = m_dt_util.get_constructor_accessors(to_app(cons)->get_decl()); @@ -153,7 +153,7 @@ struct mbp_dt_tg::impl { expr *cons, *rhs, *f, *term; bool progress = false; m_new_vars.reset(); - TRACE("mbp_tg", tout << "Iterating over terms of tg";); + TRACE(mbp_tg, tout << "Iterating over terms of tg";); // Not resetting terms because get_terms calls resize on terms m_tg.get_terms(terms, false); for (unsigned i = 0; i < terms.size(); i++) { diff --git a/src/qe/mbp/mbp_euf.cpp b/src/qe/mbp/mbp_euf.cpp index 1c85e9e21..1e4f63250 100644 --- a/src/qe/mbp/mbp_euf.cpp +++ b/src/qe/mbp/mbp_euf.cpp @@ -256,7 +256,7 @@ namespace mbp { todo.push_back({ ax->get_arg(i), ay->get_arg(i) }); } - TRACE("qe", tout << "unification attempt\n"; + TRACE(qe, tout << "unification attempt\n"; for (auto [a, b] : todo) tout << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n"; for (auto [key, value] : soln) diff --git a/src/qe/mbp/mbp_plugin.cpp b/src/qe/mbp/mbp_plugin.cpp index f560714d5..0825a2af1 100644 --- a/src/qe/mbp/mbp_plugin.cpp +++ b/src/qe/mbp/mbp_plugin.cpp @@ -63,7 +63,7 @@ namespace mbp { for (expr* e1 : *alit) { expr* e2; val = model(e1); - TRACE("qe", tout << mk_pp(e1, m) << " |-> " << val << "\n";); + TRACE(qe, tout << mk_pp(e1, m) << " |-> " << val << "\n";); if (val2expr.find(val, e2)) { return expr_ref(m.mk_eq(e1, e2), m); } @@ -193,8 +193,8 @@ namespace mbp { expr_ref val(m); model_evaluator eval(model); eval.set_expand_array_equalities(true); - TRACE("qe", tout << fmls << "\n";); - DEBUG_CODE(for (expr* fml : fmls) { CTRACE("qe", m.is_false(eval(fml)), tout << mk_pp(fml, m) << " is false\n" << model;); SASSERT(!m.is_false(eval(fml))); }); + TRACE(qe, tout << fmls << "\n";); + DEBUG_CODE(for (expr* fml : fmls) { CTRACE(qe, m.is_false(eval(fml)), tout << mk_pp(fml, m) << " is false\n" << model;); SASSERT(!m.is_false(eval(fml))); }); for (unsigned i = 0; i < fmls.size(); ++i) { expr* nfml, * fml = fmls.get(i); @@ -205,11 +205,11 @@ namespace mbp { else extract_bools(eval, fmls, i, fml, true); } - TRACE("qe", tout << "fmls: " << fmls << "\n";); + TRACE(qe, tout << "fmls: " << fmls << "\n";); } void project_plugin::extract_bools(model_evaluator& eval, expr_ref_vector& fmls, unsigned idx, expr* fml, bool is_true) { - TRACE("qe", tout << "extract bools: " << mk_pp(fml, m) << "\n";); + TRACE(qe, tout << "extract bools: " << mk_pp(fml, m) << "\n";); if (!is_app(fml)) return; m_to_visit.reset(); diff --git a/src/qe/mbp/mbp_qel.cpp b/src/qe/mbp/mbp_qel.cpp index 42366b737..dc3407c6d 100644 --- a/src/qe/mbp/mbp_qel.cpp +++ b/src/qe/mbp/mbp_qel.cpp @@ -126,7 +126,7 @@ public: init(vars, fml, mdl); // Apply MBP rules till saturation - TRACE("mbp_tg", + TRACE(mbp_tg, tout << "mbp tg " << m_tg.get_lits() << "\nand vars " << vars << "\n";); // First, apply rules without splitting on model @@ -137,9 +137,9 @@ public: // Do complete mbp saturate(vars); - TRACE("mbp_tg", + TRACE(mbp_tg, tout << "mbp tg " << m_tg.get_lits() << " and vars " << vars << "\n";); - TRACE("mbp_tg_verbose", obj_hashtable vars_tmp; + TRACE(mbp_tg_verbose, obj_hashtable vars_tmp; collect_uninterp_consts(mk_and(m_tg.get_lits()), vars_tmp); for (auto a : vars_tmp) tout << mk_pp(a->get_decl(), m) << "\n"; @@ -173,7 +173,7 @@ public: for (auto v : vars) if (is_red(v)) red_vars.mark(v); - CTRACE("mbp_tg", !core_vars.empty(), tout << "vars not redundant "; + CTRACE(mbp_tg, !core_vars.empty(), tout << "vars not redundant "; for (auto v : core_vars) tout << " " << app_ref(v, m); tout << "\n";); @@ -188,14 +188,14 @@ public: // Step 3. m_tg.qel(vars, fml, &non_core); - CTRACE("mbp_tg", !vars.empty(), + CTRACE(mbp_tg, !vars.empty(), tout << "before substitution " << fml << "\n";); // for all remaining non-cgr bool, dt, array variables, add v = mdl(v) expr_sparse_mark s_vars; for (auto v : vars) { if (m_dt_util.is_datatype(v->get_sort()) || m_array_util.is_array(v) || m.is_bool(v)) { - CTRACE("mbp_tg", + CTRACE(mbp_tg, m_array_util.is_array(v) || m_dt_util.is_datatype(v->get_sort()), tout << "Could not eliminate " << v->get_name() diff --git a/src/qe/mbp/mbp_solve_plugin.cpp b/src/qe/mbp/mbp_solve_plugin.cpp index 3820af59e..6770e335b 100644 --- a/src/qe/mbp/mbp_solve_plugin.cpp +++ b/src/qe/mbp/mbp_solve_plugin.cpp @@ -100,7 +100,7 @@ namespace mbp { v = e; a_val = rational(1)/a_val; t = mk_term(is_int, a_val, sign, done); - TRACE("qe", tout << mk_pp(e, m) << " := " << t << "\n";); + TRACE(qe, tout << mk_pp(e, m) << " := " << t << "\n";); return true; } else { diff --git a/src/qe/mbp/mbp_term_graph.cpp b/src/qe/mbp/mbp_term_graph.cpp index 6ae669f58..04985c2ff 100644 --- a/src/qe/mbp/mbp_term_graph.cpp +++ b/src/qe/mbp/mbp_term_graph.cpp @@ -390,7 +390,7 @@ void term_graph::add_deq_proc::inc_count() { bool term_graph::is_variable_proc::operator()(const expr *e) const { if (!is_app(e)) return false; const app *a = ::to_app(e); - TRACE("qe_verbose", tout << a->get_family_id() << " " + TRACE(qe_verbose, tout << a->get_family_id() << " " << m_solved.contains(a->get_decl()) << " " << m_decls.contains(a->get_decl()) << "\n";); return a->get_family_id() == null_family_id && @@ -773,7 +773,7 @@ void term_graph::mk_qe_lite_equalities(term &t, expr_ref_vector &out, rep = mk_app(t); if (contains_nc(rep)) { TRACE( - "qe_debug", tout << "repr not in core " << t; + qe_debug, tout << "repr not in core " << t; for (term *it = &t.get_next(); it != &t; it = &it->get_next()) { tout << *it << "\n"; };); DEBUG_CODE( @@ -1091,7 +1091,7 @@ class term_graph::projector { expr_ref_vector m_pinned; // tracks expr in the maps expr *mk_pure(term const &t) { - TRACE("qe", t.display(tout)); + TRACE(qe, t.display(tout)); expr *e = nullptr; if (find_term2app(t, e)) return e; @@ -1109,7 +1109,7 @@ class term_graph::projector { kids.push_back(e); else return nullptr; - TRACE("qe_verbose", tout << *ch << " -> " << mk_pp(e, m) << "\n";); + TRACE(qe_verbose, tout << *ch << " -> " << mk_pp(e, m) << "\n";); } expr_ref pure = m_rewriter.mk_app(a->get_decl(), kids.size(), kids.data()); m_pinned.push_back(pure); @@ -1183,7 +1183,7 @@ class term_graph::projector { for (auto *lit : m_tg.m_lits) if (!m.is_eq(lit) && find_app(lit, e)) res.push_back(e); - TRACE("qe", tout << "literals: " << res << "\n";); + TRACE(qe, tout << "literals: " << res << "\n";); } void lits2pure(expr_ref_vector &res) { @@ -1194,14 +1194,14 @@ class term_graph::projector { if (p1 != p2) res.push_back(m.mk_eq(p1, p2)); } else - TRACE("qe", tout << "skipping " << mk_pp(lit, m) << "\n";); + TRACE(qe, tout << "skipping " << mk_pp(lit, m) << "\n";); } else if (m.is_not(lit, e) && m.is_eq(e, e1, e2)) { if (find_app(e1, p1) && find_app(e2, p2)) { res.push_back(mk_neq(m, p1, p2)); } else - TRACE("qe", tout << "skipping " << mk_pp(lit, m) << "\n";); + TRACE(qe, tout << "skipping " << mk_pp(lit, m) << "\n";); } else if (m.is_distinct(lit)) { ptr_buffer diff; @@ -1210,15 +1210,15 @@ class term_graph::projector { if (diff.size() > 1) res.push_back(m.mk_distinct(diff.size(), diff.data())); else - TRACE("qe", tout << "skipping " << mk_pp(lit, m) << "\n";); + TRACE(qe, tout << "skipping " << mk_pp(lit, m) << "\n";); } else if (find_app(lit, p1)) res.push_back(p1); else - TRACE("qe", tout << "skipping " << mk_pp(lit, m) << "\n";); + TRACE(qe, tout << "skipping " << mk_pp(lit, m) << "\n";); } remove_duplicates(res); - TRACE("qe", tout << "literals: " << res << "\n";); + TRACE(qe, tout << "literals: " << res << "\n";); } void remove_duplicates(expr_ref_vector &v) { @@ -1291,7 +1291,7 @@ class term_graph::projector { if (roots.size() > 1) { ptr_buffer args; for (expr *r : roots) { args.push_back(r); } - TRACE("qe", tout << "function: " << d->get_name() << "\n";); + TRACE(qe, tout << "function: " << d->get_name() << "\n";); res.push_back(m.mk_distinct(args.size(), args.data())); } } @@ -1301,7 +1301,7 @@ class term_graph::projector { void mk_distinct(expr_ref_vector &res) { collect_decl2terms(); args_are_distinct(res); - TRACE("qe", tout << res << "\n";); + TRACE(qe, tout << res << "\n";); } void mk_pure_equalities(const term &t, expr_ref_vector &res) { @@ -1353,7 +1353,7 @@ class term_graph::projector { else mk_unpure_equalities(*t, res); } - TRACE("qe", tout << "literals: " << res << "\n";); + TRACE(qe, tout << "literals: " << res << "\n";); } void mk_pure_equalities(expr_ref_vector &res) { mk_equalities(res); } @@ -1412,7 +1412,7 @@ class term_graph::projector { res.push_back(m.mk_distinct(j - i, reps.data() + i)); i = j; } - TRACE("qe", tout << "after distinct: " << res << "\n";); + TRACE(qe, tout << "after distinct: " << res << "\n";); } std::ostream &display(std::ostream &out) const { @@ -1567,7 +1567,7 @@ public: if (!pure) continue; add_term2app(*t, pure); - TRACE("qe_verbose", + TRACE(qe_verbose, tout << "purified " << *t << " " << mk_pp(pure, m) << "\n";); expr *rep = nullptr; // ensure that the root has a representative m_root2rep.find(t->get_root().get_id(), rep); @@ -1592,7 +1592,7 @@ public: // and can be mined using other means, such as theory // aware core minimization m_tg.reset_marks(); - TRACE("qe", display(tout << "after purify\n");); + TRACE(qe, display(tout << "after purify\n");); } }; @@ -1689,7 +1689,7 @@ void term_graph::add_model_based_terms(model &mdl, } } TRACE( - "qe", for (auto &es + qe, for (auto &es : equivs) { tout << "equiv: "; for (expr *t : es) tout << expr_ref(t, m) << " "; @@ -1708,7 +1708,7 @@ expr* term_graph::rep_of(expr *e) { } expr_ref_vector term_graph::dcert(model &mdl, expr_ref_vector const &lits) { - TRACE("qe", tout << "dcert " << lits << "\n";); + TRACE(qe, tout << "dcert " << lits << "\n";); struct pair_t { expr *a, *b; pair_t() : a(nullptr), b(nullptr) {} @@ -1806,7 +1806,7 @@ expr_ref_vector term_graph::dcert(model &mdl, expr_ref_vector const &lits) { } } } - TRACE("qe", tout << result << "\n";); + TRACE(qe, tout << result << "\n";); return result; } diff --git a/src/qe/nlarith_util.cpp b/src/qe/nlarith_util.cpp index e86e42091..60ff87537 100644 --- a/src/qe/nlarith_util.cpp +++ b/src/qe/nlarith_util.cpp @@ -124,7 +124,7 @@ namespace nlarith { } if (!get_polys(contains_x, num_lits, lits, polys, comps, &branch_conds, nullptr)) { - TRACE("nlarith", + TRACE(nlarith, tout << "could not extract polynomials " << mk_pp(x, m()) << "\n"; for (unsigned i = 0; i < num_lits; ++i) { tout << mk_pp(lits[i], m()) << " "; @@ -137,7 +137,7 @@ namespace nlarith { return false; } if (!m_enable_linear && is_linear(polys)) { - TRACE("nlarith", tout << "this is a linear problem " << mk_pp(x,m()) << "\n"; display(tout, polys);); + TRACE(nlarith, tout << "this is a linear problem " << mk_pp(x,m()) << "\n"; display(tout, polys);); return false; } unsigned idx; @@ -152,7 +152,7 @@ namespace nlarith { } } inf_branch(polys, comps, branch_conds); - TRACE("nlarith", + TRACE(nlarith, for (unsigned i = 0; i < num_lits; ++i) { tout << mk_pp(lits[i], m()) << " "; } @@ -229,7 +229,7 @@ namespace nlarith { } } - TRACE("nlarith", + TRACE(nlarith, tout << "Non-linear variables: "; for (unsigned i = 0; i < nl_vars.size(); ++i) { tout << mk_pp(nl_vars[i], m()) << " "; @@ -522,12 +522,12 @@ namespace nlarith { apply_subst(sub, comps[j], polys[j], t1); es.push_back(m().mk_implies(bc.preds(j), t1)); subst.push_back(t1); - TRACE("nlarith_verbose", + TRACE(nlarith_verbose, display(tout << "inf", polys[j]); display(tout, comps[j]); tout << " 0 [-oo] --> " << mk_pp(t1.get(), m()) << "\n";); } - TRACE("nlarith", tout << "inf-branch\n";); + TRACE(nlarith, tout << "inf-branch\n";); bc.add_branch(mk_and(es.size(), es.data()), m().mk_true(), subst, mk_inf(bc), z(), z(), z()); } @@ -545,7 +545,7 @@ namespace nlarith { if (b != z()) { sqrt_form e0(*this, mk_uminus(c), 0, z(), b); // a_i = 0 /\ b_i != 0 /\ phi[e_i/x] - TRACE("nlarith", display(tout << "a_i != 0 & b_i != 0 & hi[e_i / x]", p);tout<<"\n";); + TRACE(nlarith, display(tout << "a_i != 0 & b_i != 0 & hi[e_i / x]", p);tout<<"\n";); scoped_ptr rp = mk_default_expr_replacer(m(), false); expr_substitution sub(m()); sub.insert(a, z()); @@ -565,7 +565,7 @@ namespace nlarith { if (i == j && a != z()) { // a != 0 & phi[-b/(2a)/x] - TRACE("nlarith", display(tout << "a != 0 & phi[-b/2a / x]", p);tout<<"\n";); + TRACE(nlarith, display(tout << "a != 0 & phi[-b/2a / x]", p);tout<<"\n";); app* a2 = mk_mul(num(2), a); sqrt_form e1(*this, mk_uminus(b), 0, z(), a2); es.reset(); @@ -594,7 +594,7 @@ namespace nlarith { d = mk_sub(mk_mul(b,b), mk_mul(num(4), a, c)); a2 = mk_mul(a, num(2)); - TRACE("nlarith", + TRACE(nlarith, display(tout, p); tout << "\n"; tout << "a:" << mk_pp(a, m()) << "\n"; tout << "b:" << mk_pp(b,m()) << "\n"; @@ -644,9 +644,9 @@ namespace nlarith { } branch = mk_and(es.size(), es.data()); bc.add_branch(branch, cond, subst, mk_def(cmp, abc_poly(*this, a, b, c), e1), a, b, c); - TRACE("nlarith", tout << mk_pp(branch,m()) << "\n";); + TRACE(nlarith, tout << mk_pp(branch,m()) << "\n";); - TRACE("nlarith", + TRACE(nlarith, tout << "0 <= " << mk_pp(d,m()) << "\n"; tout << mk_pp(mk_ge(d), m()) << "\n";); @@ -659,7 +659,7 @@ namespace nlarith { } branch = mk_and(es.size(), es.data()); bc.add_branch(branch, cond, subst, mk_def(cmp, abc_poly(*this, a, b, c), e2), a, b, c); - TRACE("nlarith", tout << mk_pp(branch,m()) << "\n";); + TRACE(nlarith, tout << mk_pp(branch,m()) << "\n";); } } @@ -675,7 +675,7 @@ namespace nlarith { else { apply_subst(sub, c, p, r); } - TRACE("nlarith_verbose", + TRACE(nlarith_verbose, display(tout, p); display(tout, c); e.display(tout << " 0 "); @@ -700,7 +700,7 @@ namespace nlarith { bool is_degree_two_plus(polys const& ps) { for (unsigned i = 0; i < ps.size(); ++i) { if (ps[i].size() > 3) { - TRACE("nlarith", tout << "not second-degree: "; + TRACE(nlarith, tout << "not second-degree: "; display(tout, ps[i]); tout <<"\n"; ); return true; } @@ -796,7 +796,7 @@ namespace nlarith { if (literals) { literals->push_back(to_app(lits[i])); } - TRACE("nlarith_verbose", + TRACE(nlarith_verbose, tout << mk_pp(lits[i], m()) << " -> "; display(tout, p); tout << "\n"; ); } @@ -904,7 +904,7 @@ namespace nlarith { mk_uminus(result); return true; default: - TRACE("nlarith", tout << "Cannot decompose " << mk_pp(f, m()) << "\n" << mk_pp(e, m()) << "\n";); + TRACE(nlarith, tout << "Cannot decompose " << mk_pp(f, m()) << "\n" << mk_pp(e, m()) << "\n";); return false; } } @@ -951,7 +951,7 @@ namespace nlarith { } result.push_back(t); } - TRACE("nlarith_verbose", display(tout, r); display(tout <<" * ", other); display(tout << " = ", result); tout <<"\n";); + TRACE(nlarith_verbose, display(tout, r); display(tout <<" * ", other); display(tout << " = ", result); tout <<"\n";); r.reset(); r.append(result.size(), result.data()); } @@ -1316,7 +1316,7 @@ namespace nlarith { dr = mk_mul(d, dr); ar = tmp1; } - TRACE("nlarith_verbose", + TRACE(nlarith_verbose, display(tout, p); s.display(tout << " "); tout << " " << mk_pp(ar, m()) << " " << mk_pp(br, m()) << " " << mk_pp(dr, m()) << "\n";); @@ -1453,7 +1453,7 @@ namespace nlarith { mk_sub(q1, u); for (unsigned i = 0; i < q1.size(); ++i) { if (z() != q1[i].get()) { - TRACE("nlarith", display(tout, q1);); + TRACE(nlarith, display(tout, q1);); return false; } } diff --git a/src/qe/nlqsat.cpp b/src/qe/nlqsat.cpp index 9fd1d4e0e..66da9d707 100644 --- a/src/qe/nlqsat.cpp +++ b/src/qe/nlqsat.cpp @@ -267,7 +267,7 @@ namespace qe { check_cancel(); init_assumptions(); lbool res = s.m_solver.check(s.m_asms); - TRACE("qe", s.display(tout << res << "\n"); ); + TRACE(qe, s.display(tout << res << "\n"); ); switch (res) { case l_true: s.save_model(is_exists(level())); @@ -290,7 +290,7 @@ namespace qe { s.m_asms.reset(); s.m_asms.push_back(is_exists()?s.m_is_true:~s.m_is_true); s.m_asms.append(s.m_assumptions); - TRACE("qe", tout << "model valid: " << s.m_valid_model << " level: " << lvl << " "; + TRACE(qe, tout << "model valid: " << s.m_valid_model << " level: " << lvl << " "; s.display_assumptions(tout); s.m_solver.display(tout);); @@ -322,7 +322,7 @@ namespace qe { } } } - TRACE("qe", s.display(tout); + TRACE(qe, s.display(tout); tout << "assumptions\n"; for (nlsat::literal a : s.m_asms) { s.m_solver.display(tout, a) << "\n"; @@ -380,14 +380,14 @@ namespace qe { result.push_back(lit); } } - TRACE("qe", s.m_solver.display(tout, result.size(), result.data()); tout << "\n";); + TRACE(qe, s.m_solver.display(tout, result.size(), result.data()); tout << "\n";); // project quantified real variables. // They are sorted by size, so we project the largest variables first to avoid // renaming variables. for (unsigned i = vars.size(); i-- > 0;) { new_result.reset(); ex.project(vars[i], result.size(), result.data(), new_result); - TRACE("qe", display_project(tout, vars[i], result, new_result);); + TRACE(qe, display_project(tout, vars[i], result, new_result);); result.swap(new_result); } negate_clause(result); @@ -435,7 +435,7 @@ namespace qe { } nlsat::var_vector vs; s.m_solver.vars(l, vs); - TRACE("qe", s.m_solver.display(tout << vs << " ", l) << "\n";); + TRACE(qe, s.m_solver.display(tout << vs << " ", l) << "\n";); for (unsigned v : vs) { level.merge(s.m_rvar2level.get(v, max_level())); } @@ -454,11 +454,11 @@ namespace qe { s.m_preds[k]->push_back(l); s.m_solver.inc_ref(v); s.m_bvar2level.insert(v, level); - TRACE("qe", s.m_solver.display(tout, l); tout << ": " << level << "\n";); + TRACE(qe, s.m_solver.display(tout, l); tout << ": " << level << "\n";); } void project() { - TRACE("qe", s.display_assumptions(tout);); + TRACE(qe, s.display_assumptions(tout);); if (!s.m_valid_model) { pop(1); return; @@ -487,7 +487,7 @@ namespace qe { SASSERT(num_scopes >= 2); } - TRACE("qe", tout << "backtrack: " << num_scopes << "\n";); + TRACE(qe, tout << "backtrack: " << num_scopes << "\n";); pop(num_scopes); } @@ -497,7 +497,7 @@ namespace qe { mbp(std::max(1u, level()-1), cl); expr_ref fml = s.clause2fml(cl); - TRACE("qe", tout << level() << ": " << fml << "\n";); + TRACE(qe, tout << level() << ": " << fml << "\n";); max_level clevel = get_level(cl); if (level() == 1 || clevel.max() == 0) { add_assumption_literal(cl, fml); @@ -621,7 +621,7 @@ namespace qe { m_has_divs = true; return; } - TRACE("qe", tout << "not NRA: " << mk_pp(n, s.m) << "\n";); + TRACE(qe, tout << "not NRA: " << mk_pp(n, s.m) << "\n";); throw tactic_exception("not NRA"); } void operator()(quantifier * n) {} @@ -740,7 +740,7 @@ namespace qe { goal_ref_buffer result; (*m_nftactic)(g, result); SASSERT(result.size() == 1); - TRACE("qe", result[0]->display(tout);); + TRACE(qe, result[0]->display(tout);); s.g2s(*result[0]); // insert variables and their levels. @@ -753,18 +753,18 @@ namespace qe { if (s.m_a2b.is_var(v)) { SASSERT(m.is_bool(v)); nlsat::bool_var b = s.m_a2b.to_var(v); - TRACE("qe", tout << mk_pp(v, m) << " |-> b" << b << "\n";); + TRACE(qe, tout << mk_pp(v, m) << " |-> b" << b << "\n";); s.m_bound_bvars.back().push_back(b); set_level(b, lvl); } else if (s.m_t2x.is_var(v)) { nlsat::var w = s.m_t2x.to_var(v); - TRACE("qe", tout << mk_pp(v, m) << " |-> x" << w << "\n";); + TRACE(qe, tout << mk_pp(v, m) << " |-> x" << w << "\n";); s.m_bound_rvars.back().push_back(w); s.m_rvar2level.setx(w, lvl, max_level()); } else { - TRACE("qe", tout << mk_pp(v, m) << " not found\n";); + TRACE(qe, tout << mk_pp(v, m) << " not found\n";); } } } @@ -772,13 +772,13 @@ namespace qe { s.m_is_true = nlsat::literal(s.m_a2b.to_var(is_true), false); // insert literals from arithmetical sub-formulas nlsat::atom_vector const& atoms = s.m_solver.get_atoms(); - TRACE("qe", s.m_solver.display(tout);); + TRACE(qe, s.m_solver.display(tout);); for (unsigned i = 0; i < atoms.size(); ++i) { if (atoms[i]) { get_level(nlsat::literal(i, false)); } } - TRACE("qe", tout << fml << "\n";); + TRACE(qe, tout << fml << "\n";); return true; } @@ -864,12 +864,12 @@ namespace qe { fml = m.mk_not(fml); } reset(); - TRACE("qe", tout << fml << "\n";); + TRACE(qe, tout << fml << "\n";); if (!hoist(fml)) { result.push_back(in.get()); return; } - TRACE("qe", tout << "ex: " << fml << "\n";); + TRACE(qe, tout << "ex: " << fml << "\n";); lbool is_sat = check_sat(); switch (is_sat) { diff --git a/src/qe/qe.cpp b/src/qe/qe.cpp index 189953dcd..eb7f47f62 100644 --- a/src/qe/qe.cpp +++ b/src/qe/qe.cpp @@ -148,7 +148,7 @@ namespace qe { rewriter.mk_and(conjs_mixed.size(), conjs_mixed.data(), fml_mixed); rewriter.mk_and(conjs_open.size(), conjs_open.data(), fml_open); - TRACE("qe", + TRACE(qe, tout << "closed\n" << mk_ismt2_pp(fml_closed, m) << "\n"; tout << "open\n" << mk_ismt2_pp(fml_open, m) << "\n"; tout << "mixed\n" << mk_ismt2_pp(fml_mixed, m) << "\n"; @@ -182,7 +182,7 @@ namespace qe { for (unsigned i = 0; i < num_args; ++i) { if (contains_x(args[i])) { contains_index.push_back(i); - TRACE("qe_verbose", tout << "var " << v << " in " << i << "\n";); + TRACE(qe_verbose, tout << "var " << v << " in " << i << "\n";); } } // @@ -194,7 +194,7 @@ namespace qe { partition.push_back(unsigned_vector()); } partition.back().push_back(v); - TRACE("qe_verbose", tout << "majority " << v << "\n";); + TRACE(qe_verbose, tout << "majority " << v << "\n";); continue; } // @@ -242,7 +242,7 @@ namespace qe { for (unsigned idx = 0; idx < non_shared_vars.size(); ++idx) { unsigned x = non_shared_vars[idx]; unsigned r = non_shared_vars[uf.find(idx)]; - TRACE("qe_verbose", tout << "x: " << x << " r: " << r << "\n";); + TRACE(qe_verbose, tout << "x: " << x << " r: " << r << "\n";); bool found = false; for (unsigned i = 0; !found && i < roots.size(); ++i) { if (roots[i] == r) { @@ -257,7 +257,7 @@ namespace qe { } } - TRACE("qe_verbose", + TRACE(qe_verbose, for (unsigned i = 0; i < partition.size(); ++i) { for (unsigned j = 0; j < partition[i].size(); ++j) { tout << " " << mk_ismt2_pp(vars[partition[i][j]]->x(), m);; @@ -327,12 +327,12 @@ namespace qe { if (leqs.contains(tmp2)) { eqs.push_back(tmp1); - TRACE("qe", tout << "found: " << mk_ismt2_pp(tmp1, m) << "\n";); + TRACE(qe, tout << "found: " << mk_ismt2_pp(tmp1, m) << "\n";); } else { trail.push_back(tmp1); leqs.insert(tmp1); - TRACE("qe_verbose", tout << "insert: " << mk_ismt2_pp(tmp1, m) << "\n";); + TRACE(qe_verbose, tout << "insert: " << mk_ismt2_pp(tmp1, m) << "\n";); } } else { @@ -466,7 +466,7 @@ namespace qe { else { m_neg.insert(e, r); } - TRACE("nnf", + TRACE(nnf, tout << mk_ismt2_pp(e, m) << " " << p << "\n"; tout << mk_ismt2_pp(r, m) << "\n";); @@ -516,7 +516,7 @@ namespace qe { m_rewriter.mk_and(r1, th, tmp1); m_rewriter.mk_and(r2, el, tmp2); m_rewriter.mk_or(tmp1, tmp2, tmp); - TRACE("nnf", + TRACE(nnf, tout << mk_ismt2_pp(a, m) << "\n"; tout << mk_ismt2_pp(tmp, m) << "\n";); insert(a, p, tmp); @@ -572,7 +572,7 @@ namespace qe { } bool get_nnf(expr_ref& fml, bool p0) { - TRACE("nnf", tout << mk_ismt2_pp(fml.get(), m) << "\n";); + TRACE(nnf, tout << mk_ismt2_pp(fml.get(), m) << "\n";); bool p = p0; unsigned sz = m_todo.size(); expr_ref tmp(m); @@ -855,7 +855,7 @@ namespace qe { m_nnf_core(fml); m_normalize_literals(fml); m_collect_atoms(fml, pos, neg); - TRACE("qe", + TRACE(qe, ast_manager& m = fml.get_manager(); tout << mk_ismt2_pp(orig, m) << "\n-->\n" << mk_ismt2_pp(fml, m) << "\n";); } @@ -916,7 +916,7 @@ namespace qe { // - assigned formula, but unassigned variable for branching // - assigned variable and formula with 0 or more branches. // -#define CHECK_COND(_cond_) if (!(_cond_)) { TRACE("qe", tout << "violated: " << #_cond_ << "\n";); return false; } +#define CHECK_COND(_cond_) if (!(_cond_)) { TRACE(qe, tout << "violated: " << #_cond_ << "\n";); return false; } bool invariant() const { CHECK_COND(assignment()); CHECK_COND(m_children.empty() || fml()); @@ -979,7 +979,7 @@ namespace qe { todo.pop_back(); if (st->m_children.empty() && st->fml() && st->m_vars.empty() && !st->has_var()) { - TRACE("qe", st->display(tout << "appending leaf\n");); + TRACE(qe, st->display(tout << "appending leaf\n");); result.push_back(st->fml()); } for (auto * ch : st->m_children) @@ -1009,7 +1009,7 @@ namespace qe { } void reset() { - TRACE("qe",tout << "resetting\n";); + TRACE(qe,tout << "resetting\n";); for (auto* ch : m_children) dealloc(ch); m_pos.reset(); m_neg.reset(); @@ -1037,7 +1037,7 @@ namespace qe { // app* const* free_vars() const { return m_vars.c_ptr(); } app_ref_vector const& free_vars() const { return m_vars; } app* free_var(unsigned i) const { return m_vars[i]; } - void reset_free_vars() { TRACE("qe", tout << m_vars << "\n";); m_vars.reset(); } + void reset_free_vars() { TRACE(qe, tout << m_vars << "\n";); m_vars.reset(); } atom_set const& pos_atoms() const { return m_pos; } atom_set const& neg_atoms() const { return m_neg; } @@ -1107,7 +1107,7 @@ namespace qe { st->init(fml); st->m_vars.append(m_vars.size(), m_vars.data()); SASSERT(invariant()); - TRACE("qe", display_node(tout); st->display_node(tout);); + TRACE(qe, display_node(tout); st->display_node(tout);); return st; } @@ -1121,7 +1121,7 @@ namespace qe { m_branch_index.insert(branch_id, index); st->m_vars.append(m_vars.size(), m_vars.data()); SASSERT(invariant()); - TRACE("qe", display_node(tout); st->display_node(tout);); + TRACE(qe, display_node(tout); st->display_node(tout);); return st; } @@ -1245,7 +1245,7 @@ namespace qe { return true; } } - TRACE("qe_verbose", tout << "Not relevant: " << mk_ismt2_pp(e, m_s.get_manager()) << "\n";); + TRACE(qe_verbose, tout << "Not relevant: " << mk_ismt2_pp(e, m_s.get_manager()) << "\n";); return false; } @@ -1285,14 +1285,14 @@ namespace qe { void i_solver_context::mk_atom(expr* e, bool p, expr_ref& result) { ast_manager& m = get_manager(); - TRACE("qe_verbose", tout << mk_ismt2_pp(e, m) << "\n";); + TRACE(qe_verbose, tout << mk_ismt2_pp(e, m) << "\n";); for (unsigned i = 0; i < m_plugins.size(); ++i) { qe_solver_plugin* pl = m_plugins[i]; if (pl && pl->mk_atom(e, p, result)) { return; } } - TRACE("qe_verbose", tout << "No plugin for " << mk_ismt2_pp(e, m) << "\n";); + TRACE(qe_verbose, tout << "No plugin for " << mk_ismt2_pp(e, m) << "\n";); result = p?e:mk_not(m, e); } @@ -1425,7 +1425,7 @@ namespace qe { m_solver.assert_expr(f); } m_root.init(f); - TRACE("qe", + TRACE(qe, for (unsigned i = 0; i < num_vars; ++i) tout << mk_ismt2_pp(vars[i], m) << "\n"; tout << mk_ismt2_pp(f, m) << "\n";); @@ -1474,7 +1474,7 @@ namespace qe { defs->project(num_vars, vars); } - TRACE("qe", + TRACE(qe, tout << "result:" << mk_ismt2_pp(fml, m) << "\n"; tout << "input: " << mk_ismt2_pp(m_fml, m) << "\n"; tout << "subformula: " << mk_ismt2_pp(m_subfml, m) << "\n"; @@ -1508,7 +1508,7 @@ namespace qe { scoped_ptr model_eval = alloc(model_evaluator, *model); while (m.inc()) { - TRACE("qe", model_v2_pp(tout, *model);); + TRACE(qe, model_v2_pp(tout, *model);); while (can_propagate_assignment(*model_eval)) propagate_assignment(*model_eval); VERIFY(CHOOSE_VAR == update_current(*model_eval, true)); @@ -1550,7 +1550,7 @@ namespace qe { void elim_var(unsigned idx, expr* _fml, expr* def) override { app* x = get_var(idx); expr_ref fml(_fml, m); - TRACE("qe", tout << mk_pp(x,m) << " " << mk_pp(def, m) << "\n";); + TRACE(qe, tout << mk_pp(x,m) << " " << mk_pp(def, m) << "\n";); m_current->set_var(x, rational(1)); m_current = m_current->add_child(fml); m_current->add_def(x, def); @@ -1573,7 +1573,7 @@ namespace qe { bv = m.mk_fresh_const("b", m_bv.mk_sort(20)); m_trail.push_back(bv); } - TRACE("qe", tout << "Add branch var: " << mk_ismt2_pp(x, m) << " " << mk_ismt2_pp(bv, m) << "\n";); + TRACE(qe, tout << "Add branch var: " << mk_ismt2_pp(x, m) << " " << mk_ismt2_pp(bv, m) << "\n";); m_var2branch.insert(x, bv); } @@ -1593,7 +1593,7 @@ namespace qe { add_literal(l3); expr_ref fml(m); fml = m.mk_or(m_literals); - TRACE("qe", tout << fml << "\n";); + TRACE(qe, tout << fml << "\n";); m_solver.assert_expr(fml); } @@ -1685,7 +1685,7 @@ namespace qe { nb = m_current->get_num_branches(); expr_ref fml(m_current->fml(), m); if (!eval(model_eval, b, branch) || branch >= nb) { - TRACE("qe", tout << "evaluation failed: setting branch to 0\n";); + TRACE(qe, tout << "evaluation failed: setting branch to 0\n";); branch = rational::zero(); } SASSERT(!branch.is_neg()); @@ -1769,7 +1769,7 @@ namespace qe { model_eval2.set_model_completion(true); model_eval2(x, val); } - TRACE("qe", tout << mk_pp(x,m) << " " << mk_pp(val, m) << "\n";); + TRACE(qe, tout << mk_pp(x,m) << " " << mk_pp(val, m) << "\n";); m_current->add_def(x, val); } m_current->reset_free_vars(); @@ -1796,9 +1796,9 @@ namespace qe { simplified = pl && pl->simplify(result); } } - TRACE("qe_verbose", tout << "simp: " << mk_ismt2_pp(result.get(), m) << "\n";); + TRACE(qe_verbose, tout << "simp: " << mk_ismt2_pp(result.get(), m) << "\n";); m_nnf(result, pos, neg); - TRACE("qe", tout << "nnf: " << mk_ismt2_pp(result.get(), m) << "\n";); + TRACE(qe, tout << "nnf: " << mk_ismt2_pp(result.get(), m) << "\n";); } // @@ -1888,7 +1888,7 @@ namespace qe { // all bound decisions have been made. // void block_assignment() { - TRACE("qe_verbose", m_solver.display(tout);); + TRACE(qe_verbose, m_solver.display(tout);); add_constraint(true); } @@ -1904,7 +1904,7 @@ namespace qe { } m_current->set_var(x, k); - TRACE("qe", tout << mk_pp(x, m) << " := " << k << "\n";); + TRACE(qe, tout << mk_pp(x, m) << " := " << k << "\n";); if (m_bv.is_bv(x)) { return; } @@ -1945,7 +1945,7 @@ namespace qe { vars.reset(); closed = closed && (r != l_undef); } - TRACE("qe", tout << fml << " free: " << m_current->free_vars() << "\n";); + TRACE(qe, tout << fml << " free: " << m_current->free_vars() << "\n";); m_current->add_child(fml)->reset_free_vars(); block_assignment(); } @@ -1979,7 +1979,7 @@ namespace qe { plugin(x).get_num_branches(contains(x), fml, num_branches)) { return true; } - TRACE("qe", tout << "setting variable " << mk_pp(x, m) << " free\n";); + TRACE(qe, tout << "setting variable " << mk_pp(x, m) << " free\n";); m_free_vars.push_back(x); m_current->del_var(x); } @@ -1994,7 +1994,7 @@ namespace qe { bool solved = true; while (solved) { expr_ref fml(m_current->fml(), m); - TRACE("qe", tout << fml << "\n";); + TRACE(qe, tout << fml << "\n";); conj_enum conjs(m, fml); solved = false; for (unsigned i = 0; !solved && i < m_plugins.size(); ++i) { @@ -2132,7 +2132,7 @@ namespace qe { flet fl4(m_fparams.m_bv_enable_int2bv2int, true); flet fl5(m_fparams.m_array_canonize_simplify, true); flet fl6(m_fparams.m_relevancy_lvl, 0); - TRACE("qe", + TRACE(qe, for (unsigned i = 0; i < num_vars; ++i) { tout << mk_ismt2_pp(vars[i], m) << " "; } @@ -2148,7 +2148,7 @@ namespace qe { th->check(num_vars, vars, m_assumption, fml, get_first, free_vars, defs); push_context(th.detach()); - TRACE("qe", + TRACE(qe, for (unsigned i = 0; i < num_vars; ++i) { tout << mk_ismt2_pp(vars[i], m) << " "; } @@ -2221,7 +2221,7 @@ namespace qe { } void expr_quant_elim::operator()(expr* assumption, expr* fml, expr_ref& result) { - TRACE("qe", + TRACE(qe, if (assumption) tout << "elim assumption\n" << mk_ismt2_pp(assumption, m) << "\n"; tout << "elim input\n" << mk_ismt2_pp(fml, m) << "\n";); expr_ref_vector bound(m); @@ -2232,7 +2232,7 @@ namespace qe { m_trail.reset(); m_visited.reset(); abstract_expr(bound.size(), bound.data(), result); - TRACE("qe", tout << "elim result\n" << mk_ismt2_pp(result, m) << "\n";); + TRACE(qe, tout << "elim result\n" << mk_ismt2_pp(result, m) << "\n";); } void expr_quant_elim::updt_params(params_ref const& p) { @@ -2380,7 +2380,7 @@ namespace qe { bool expr_quant_elim::solve_for_vars(unsigned num_vars, app* const* vars, expr* _fml, guarded_defs& defs) { app_ref_vector fvs(m); expr_ref fml(_fml, m); - TRACE("qe", tout << mk_pp(fml, m) << "\n";); + TRACE(qe, tout << mk_pp(fml, m) << "\n";); init_qe(); lbool is_sat = m_qe->eliminate_exists(num_vars, vars, fml, fvs, false, &defs); return is_sat != l_undef; @@ -2512,7 +2512,7 @@ namespace qe { qe_solver_plugin* p = m_plugins[i]; solved = p && p->solve(conjs, fml); } - TRACE("qe", + TRACE(qe, tout << (solved?"solved":"not solved") << "\n"; if (solved) tout << mk_ismt2_pp(fml, m) << "\n"; tout << *m_vars << "\n"; @@ -2547,7 +2547,7 @@ namespace qe { // callback to replace variable at index 'idx' with definition 'def' and updated formula 'fml' void elim_var(unsigned idx, expr* fml, expr* def) override { - TRACE("qe", tout << idx << ": " << mk_pp(m_vars->get(idx), m) << " " << mk_pp(fml, m) << " " << m_contains.size() << "\n";); + TRACE(qe, tout << idx << ": " << mk_pp(m_vars->get(idx), m) << " " << mk_pp(fml, m) << " " << m_contains.size() << "\n";); *m_fml = fml; m_vars->set(idx, m_vars->get(m_vars->size()-1)); m_vars->pop_back(); @@ -2558,7 +2558,7 @@ namespace qe { // callback to add new variable to branch. void add_var(app* x) override { - TRACE("qe", tout << "add var: " << mk_pp(x, m) << "\n";); + TRACE(qe, tout << "add var: " << mk_pp(x, m) << "\n";); m_vars->push_back(x); m_contains.push_back(alloc(contains_app, m, x)); } @@ -2583,7 +2583,7 @@ namespace qe { reset(); m_fml = &fml; m_vars = &vars; - TRACE("qe", tout << "Vars: " << vars << "\n";); + TRACE(qe, tout << "Vars: " << vars << "\n";); for (auto* v : vars) { m_contains.push_back(alloc(contains_app, m, v)); } @@ -2619,10 +2619,10 @@ namespace qe { } // bool is_forall = old_q->is_forall(); app_ref_vector vars(m); - TRACE("qe", tout << "simplifying" << mk_pp(new_body, m) << "\n";); + TRACE(qe, tout << "simplifying" << mk_pp(new_body, m) << "\n";); result = new_body; extract_vars(old_q, result, vars); - TRACE("qe", tout << "variables extracted" << mk_pp(result, m) << "\n";); + TRACE(qe, tout << "variables extracted" << mk_pp(result, m) << "\n";); if (is_forall(old_q)) { result = mk_not(m, result); @@ -2635,7 +2635,7 @@ namespace qe { var_shifter shift(m); shift(result, vars.size(), result); result = expr_abstract(vars, result); - TRACE("qe", tout << "abstracted" << mk_pp(result, m) << "\n";); + TRACE(qe, tout << "abstracted" << mk_pp(result, m) << "\n";); ptr_vector sorts; svector names; for (app* v : vars) { diff --git a/src/qe/qe_arith_plugin.cpp b/src/qe/qe_arith_plugin.cpp index 62d15d4bc..05b611644 100644 --- a/src/qe/qe_arith_plugin.cpp +++ b/src/qe/qe_arith_plugin.cpp @@ -182,7 +182,7 @@ namespace qe { } } if (!found) { - TRACE("qe_verbose", + TRACE(qe_verbose, tout << "Did not find: " << mk_pp(x, m) << " in " @@ -205,7 +205,7 @@ namespace qe { if (contains_x(rest)) { return false; } - TRACE("qe_verbose", + TRACE(qe_verbose, tout << mk_pp(p, m) << " = " << "(+ (* " << k << " " @@ -463,7 +463,7 @@ namespace qe { result = m.mk_not(m_arith.mk_le(mk_zero(e), e)); } simplify(result); - TRACE("qe_verbose", tout << "mk_lt " << mk_pp(result, m) << "\n";); + TRACE(qe_verbose, tout << "mk_lt " << mk_pp(result, m) << "\n";); } // ax + t = 0 @@ -583,7 +583,7 @@ namespace qe { mk_divides(abs_b, sz, b_divides_sz); mk_and(b_divides_sz, asz_bt_le_0, tmp4); mk_big_or(abs_b - numeral(2), x, tmp4, tmp2); - TRACE("qe", + TRACE(qe, tout << "b | s + z: " << mk_pp(b_divides_sz, m) << "\n"; tout << "a(s+z) + bt <= 0: " << mk_pp(asz_bt_le_0, m) << "\n"; ); @@ -597,7 +597,7 @@ namespace qe { // or exists z in [0 .. |b|-2] . |b| | (z + s) && a*n_sign(b)(s + z) + |b|t <= 0 } - TRACE("qe", + TRACE(qe, { tout << (is_strict?"strict":"non-strict") << "\n"; bound(m, a, t, false).pp(tout, x); @@ -714,7 +714,7 @@ namespace qe { else { return false; } - TRACE("qe_verbose", tout << "Atom: " << mk_pp(result, m) << "\n";); + TRACE(qe_verbose, tout << "Atom: " << mk_pp(result, m) << "\n";); return true; } @@ -772,12 +772,12 @@ namespace qe { normalize_sum(tmp2); if (leqs.contains(tmp2)) { eqs.push_back(tmp1); - TRACE("qe", tout << "found: " << mk_pp(tmp1, m) << "\n";); + TRACE(qe, tout << "found: " << mk_pp(tmp1, m) << "\n";); } else { trail.push_back(tmp1); leqs.insert(tmp1); - TRACE("qe_verbose", tout << "insert: " << mk_pp(tmp1, m) << "\n";); + TRACE(qe_verbose, tout << "insert: " << mk_pp(tmp1, m) << "\n";); } } } @@ -827,7 +827,7 @@ namespace qe { } void mk_big_or(numeral up, app* x, expr* body, expr_ref& result) { - TRACE("qe", tout << mk_pp(x, m) << " " << mk_pp(body, m) << "\n";); + TRACE(qe, tout << mk_pp(x, m) << " " << mk_pp(body, m) << "\n";); if (numeral(1) >= up) { mk_big_or_blast(up, x, body, result); } @@ -847,7 +847,7 @@ namespace qe { ++index; } mk_or(ors.size(), ors.data(), result); - TRACE("qe", + TRACE(qe, tout << "[0 " << up << "] " << mk_pp(x, m) << "\n" @@ -974,7 +974,7 @@ namespace qe { tmp = m_arith.mk_add(p, tmp); e = m_arith.mk_div(tmp, ke); } - TRACE("qe", + TRACE(qe, tout << "is singular:\n" << mk_pp(p, m) << "\n" << mk_pp(fml, m) << "\n" @@ -984,7 +984,7 @@ namespace qe { expr_ref result(fml, m); m_replace.apply_substitution(x, e, result); simplify(result); - TRACE("qe", + TRACE(qe, tout << "singular solved:\n" << mk_pp(result, m) << "\n"; ); @@ -1019,7 +1019,7 @@ namespace qe { return false; } - TRACE("qe", tout << "is linear: " << mk_pp(p, m) << "\n";); + TRACE(qe, tout << "is linear: " << mk_pp(p, m) << "\n";); SASSERT(values.size() == num_vars + 1); SASSERT(num_vars > 0); @@ -1059,7 +1059,7 @@ namespace qe { } p1 = m_arith.mk_add(p1, m_arith.mk_numeral(values[0], s)); - TRACE("qe", + TRACE(qe, tout << "is linear:\n" << mk_pp(fml, m) << "\n" << mk_pp(p, m) << "\n" @@ -1075,7 +1075,7 @@ namespace qe { m_replace.apply_substitution(x, p1, result); simplify(result); m_ctx.elim_var(index-1, result, p1); - TRACE("qe", tout << "Reduced " << index-1 << " : " << result << "\n";); + TRACE(qe, tout << "Reduced " << index-1 << " : " << result << "\n";); return true; } @@ -1141,7 +1141,7 @@ namespace qe { values[0] += k; } else { - TRACE("qe_verbose", tout << "non-linear " << mk_pp(p, m) << "\n";); + TRACE(qe_verbose, tout << "non-linear " << mk_pp(p, m) << "\n";); return false; } } @@ -1200,7 +1200,7 @@ namespace qe { if (has_bound) { m_mark.mark(a, true); } - TRACE("qe_verbose", + TRACE(qe_verbose, ast_manager& m = m_util.get_manager(); app* x = contains_x.x(); tout << has_bound << " bound for " << mk_pp(x, m) << " within " << mk_pp(a, m) << "\n";); @@ -1583,7 +1583,7 @@ public: mk_non_resolve(bounds, false, is_lower, result); m_util.simplify(result); add_cache(x, fml, v, result, x_t.get_coeff(), x_t.get_term()); - TRACE("qe", + TRACE(qe, tout << vl << " " << mk_pp(x, m) << " infinite case\n"; tout << mk_pp(fml, m) << "\n"; tout << mk_pp(result, m) << "\n";); @@ -1596,7 +1596,7 @@ public: SASSERT(index < t_size + e_size); if (is_strict) { index -= e_size; - TRACE("qe_verbose", bounds.display(tout); ); + TRACE(qe_verbose, bounds.display(tout); ); } else if (m_util.is_real(x)) { SASSERT(0 == (e_size & 0x1)); @@ -1630,7 +1630,7 @@ public: mk_resolve(bounds, x, x_t, false, is_eq, is_strict, is_lower, index, a, t, result); m_util.simplify(result); add_cache(x, fml, v, result, x_t.get_coeff(), x_t.get_term()); - TRACE("qe", + TRACE(qe, { tout << vl << " " << mk_pp(bounds.atoms(is_strict, is_lower)[index],m) << "\n"; tout << mk_pp(fml, m) << "\n"; @@ -1658,12 +1658,12 @@ public: get_def(contains_x, vl.get_unsigned(), fml, *def); } VERIFY(get_cache(contains_x.x(), fml, vl.get_unsigned(), fml)); - TRACE("qe", tout << mk_pp(contains_x.x(), m) << " " << vl << "\n" << mk_pp(fml, m) << "\n";); + TRACE(qe, tout << mk_pp(contains_x.x(), m) << " " << vl << "\n" << mk_pp(fml, m) << "\n";); } bool project(contains_app& x, model_ref& model, expr_ref& fml) override { if (!update_bounds(x, fml)) { - TRACE("qe", tout << mk_pp(x.x(), m) << " failed to update bounds\n";); + TRACE(qe, tout << mk_pp(x.x(), m) << " failed to update bounds\n";); return false; } if (m_util.m_arith.is_real(x.x())) { @@ -1762,7 +1762,7 @@ public: x_t.set_coeff(bf.m_coeff); // x is of the form: x_t.get_coeff()*x' + x_t.get_term() - CTRACE("qe", x_t.get_term(), tout << x_t.get_coeff() << " " << mk_pp(x_t.get_term(), m) << "\n";); + CTRACE(qe, x_t.get_term(), tout << x_t.get_coeff() << " " << mk_pp(x_t.get_term(), m) << "\n";); // // a*x + t <= 0 // a*(c*x' + s) + t <= 0 @@ -1788,14 +1788,14 @@ public: // x := coeff * x' + s // solve instead for // a*coeff*x' + term + a*s <= 0 - TRACE("qe", tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + " + TRACE(qe, tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + " << mk_pp(x_t.get_term(), m) << "\n";); SASSERT(x_t.get_coeff().is_pos()); term = m_util.mk_add(term, m_util.mk_mul(a, x_t.get_term())); a = a * x_t.get_coeff(); } - TRACE("qe", tout << a << "* " << mk_pp(x,m) << " + " << mk_pp(term, m) << " <= 0\n";); + TRACE(qe, tout << a << "* " << mk_pp(x,m) << " + " << mk_pp(term, m) << " <= 0\n";); SASSERT(a.is_int()); SASSERT(is_lower == a.is_pos()); @@ -1806,7 +1806,7 @@ public: term = m_util.mk_uminus(term); term = mk_idiv(term, a); terms.push_back(term); - TRACE("qe", tout << "a: " << a << " term: " << mk_pp(term, m) << "\n";); + TRACE(qe, tout << "a: " << a << " term: " << mk_pp(term, m) << "\n";); } is_strict = true; sz = bounds.size(is_strict, !is_lower); @@ -1837,7 +1837,7 @@ public: if (x_t.get_term()) { // x := coeff * x + s - TRACE("qe", tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + " + TRACE(qe, tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + " << mk_pp(x_t.get_term(), m) << "\n";); def = m_util.mk_add(m_util.mk_mul(x_t.get_coeff(), def), x_t.get_term()); } @@ -1850,7 +1850,7 @@ public: SASSERT(v < t_size + e_size); if (is_strict) { v -= e_size; - TRACE("qe_verbose", bounds.display(tout); ); + TRACE(qe_verbose, bounds.display(tout); ); } else if (m_util.is_real(x)) { SASSERT(0 == (e_size & 0x1)); @@ -1872,7 +1872,7 @@ public: // x := coeff * x' + s // solve instead for // a*coeff*x' + term + a*s <= 0 - TRACE("qe", tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + " + TRACE(qe, tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + " << mk_pp(x_t.get_term(), m) << "\n";); SASSERT(x_t.get_coeff().is_pos()); def = m_util.mk_add(def, m_util.mk_mul(a, x_t.get_term())); @@ -1904,7 +1904,7 @@ public: m_util.simplify(def); - TRACE("qe", tout << "TBD (for Real): " << a << " " << mk_pp(def, m) << "\n";); + TRACE(qe, tout << "TBD (for Real): " << a << " " << mk_pp(def, m) << "\n";); } expr_ref mk_not(expr* e) { @@ -1957,7 +1957,7 @@ public: } assign(x, fml, vl); subst(x, vl, fml, nullptr); - TRACE("qe", tout << mk_pp(fml, m) << "\n";); + TRACE(qe, tout << mk_pp(fml, m) << "\n";); return true; } @@ -1980,7 +1980,7 @@ public: } assign(x, fml, vl); subst(x, vl, fml, nullptr); - TRACE("qe", tout << mk_pp(fml, m) << "\n";); + TRACE(qe, tout << mk_pp(fml, m) << "\n";); return true; } @@ -2075,7 +2075,7 @@ public: // z < d expr* z_lt_d = m_util.m_arith.mk_le(z, m_util.m_arith.mk_numeral(d-rational(1), true)); m_ctx.add_constraint(false, z_lt_d); - TRACE("qe", tout << mk_pp(z_lt_d, m) << "\n";); + TRACE(qe, tout << mk_pp(z_lt_d, m) << "\n";); // result <- result & z <= d - 1 SASSERT(!abs(d).is_one()); @@ -2089,11 +2089,11 @@ public: t1 = m_util.mk_sub(x, z); m_util.mk_divides(d, t1, new_atom); m_ctx.add_constraint(false, new_atom); - TRACE("qe", tout << mk_pp(new_atom, m) << "\n";); + TRACE(qe, tout << mk_pp(new_atom, m) << "\n";); // (c | ax + t <-> c | az + t) for each divisor. mk_div_equivs(bounds, z, result); - TRACE("qe", tout << mk_pp(result, m) << "\n";); + TRACE(qe, tout << mk_pp(result, m) << "\n";); // update x_t to map x |-> dx + z x_t.set_term(z); @@ -2173,7 +2173,7 @@ public: m_util.simplify(mod_eq); result = m.mk_and(result, mod_eq); - TRACE("qe", tout << mk_pp(mod_eq, m) << "\n";); + TRACE(qe, tout << mk_pp(mod_eq, m) << "\n";); } } @@ -2260,7 +2260,7 @@ public: } } m_util.simplify(result); - TRACE("qe", + TRACE(qe, tout << (is_strict?"strict":"non-strict") << "\n"; tout << (is_lower?"is-lower":"is-upper") << "\n"; tout << "a: " << a << " " << mk_pp(t, m) << "\n"; @@ -2291,7 +2291,7 @@ public: rational const& a, expr* t, expr_ref& result) { - TRACE("qe", tout << mk_pp(t, m) << "\n";); + TRACE(qe, tout << mk_pp(t, m) << "\n";); SASSERT(!is_eq_ctx || !is_strict_ctx); unsigned sz = bounds.size(is_strict, is_lower); expr_ref tmp(m), eq(m); @@ -2307,7 +2307,7 @@ public: if (same_strict && i == index) { if (non_strict_real) { m_util.mk_eq(a, x, t, eq); - TRACE("qe", tout << "a:" << a << " x: " << mk_pp(x, m) << "t: " << + TRACE(qe, tout << "a:" << a << " x: " << mk_pp(x, m) << "t: " << mk_pp(t, m) << " eq: " << mk_pp(eq, m) << "\n";); if (is_eq_ctx) { m_ctx.add_constraint(true, eq); @@ -2340,7 +2340,7 @@ public: mk_bound(result_is_strict, is_lower, a, t, b, s, tmp); m_util.m_replace.apply_substitution(e, tmp.get(), result); - TRACE("qe", + TRACE(qe, tout << (result_is_strict?"strict result":"non-strict result") << "\n"; tout << (is_strict?"strict":"non-strict") << "\n"; tout << mk_pp(atm, m) << " & "; @@ -2379,7 +2379,7 @@ public: m_ctx.add_constraint(true, mk_not(e), tmp); - TRACE("qe_verbose", + TRACE(qe_verbose, app* atm = bounds.atoms(is_strict_ctx, is_lower)[index]; tout << mk_pp(atm, m) << " "; tout << mk_pp(e, m) << " ==>\n"; @@ -2454,7 +2454,7 @@ public: m_trail(m), m_factor_rw(m), m_produce_models(produce_models) { - TRACE("qe", tout << "produce models: " << produce_models << "\n";); + TRACE(qe, tout << "produce models: " << produce_models << "\n";); m_util.set_enable_linear(true); // (produce_models); } @@ -2485,7 +2485,7 @@ public: expr_ref result(m), tmp(m); m_factor_rw(branch_fml, tmp); m_rewriter(tmp, result); - TRACE("qe", tout << vl << " " << mk_pp(result.get(), m) << "\n";); + TRACE(qe, tout << vl << " " << mk_pp(result.get(), m) << "\n";); m_ctx.add_constraint(true, result); } @@ -2502,9 +2502,9 @@ public: brs = alloc(nlarith::branch_conditions, m); - TRACE("nlarith", tout << mk_pp(fml, m) << "\n";); + TRACE(nlarith, tout << mk_pp(fml, m) << "\n";); if (!m_util.create_branches(x.x(), lits.size(), lits.data(), *brs)) { - TRACE("nlarith", tout << "no branches for " << mk_pp(x.x(), m) << "\n";); + TRACE(nlarith, tout << "no branches for " << mk_pp(x.x(), m) << "\n";); dealloc(brs); return false; } diff --git a/src/qe/qe_array_plugin.cpp b/src/qe/qe_array_plugin.cpp index ce0e61d02..15c60e5e7 100644 --- a/src/qe/qe_array_plugin.cpp +++ b/src/qe/qe_array_plugin.cpp @@ -52,7 +52,7 @@ namespace qe { expr_ref_vector eqs(m); conjs.extract_equalities(eqs); for (unsigned i = 0; i < eqs.size(); ++i) { - TRACE("qe_verbose", + TRACE(qe_verbose, tout << mk_pp(eqs[i].get(), m) << "\n";); expr* e = eqs[i].get(); if (solve_eq_zero(e, fml)) { @@ -114,7 +114,7 @@ namespace qe { return false; } - TRACE("qe_verbose", + TRACE(qe_verbose, tout << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << "\n";); expr_ref tmp(m); @@ -172,7 +172,7 @@ namespace qe { store_B_i_t = m.mk_app(m_fid, OP_STORE, args2.size(), args2.data()); - TRACE("qe", + TRACE(qe, tout << "fml: " << mk_pp(fml, m) << "\n"; tout << "solved form: " << mk_pp(store_B_i_t, m) << "\n"; tout << "eq: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << "\n"; @@ -244,7 +244,7 @@ namespace qe { m_ctx.add_var(w); } - TRACE("qe", + TRACE(qe, tout << "Variable: " << mk_pp(A, m) << "\n"; tout << "fml: " << mk_pp(fml, m) << "\n"; tout << "solved form: " << mk_pp(store_t, m) << "\n"; diff --git a/src/qe/qe_bool_plugin.cpp b/src/qe/qe_bool_plugin.cpp index f8bac21c8..65ec4d338 100644 --- a/src/qe/qe_bool_plugin.cpp +++ b/src/qe/qe_bool_plugin.cpp @@ -62,7 +62,7 @@ namespace qe { expr_ref val_x(m); rational val; model_eval(x.x(), val_x); - CTRACE("qe", (!m.is_true(val_x) && !m.is_false(val_x)), + CTRACE(qe, (!m.is_true(val_x) && !m.is_false(val_x)), tout << "Boolean is a don't care: " << mk_pp(x.x(), m) << "\n";); val = m.is_true(val_x)?rational::one():rational::zero(); subst(x, val, fml, nullptr); @@ -131,7 +131,7 @@ namespace qe { app* x = contains_x.x(); bool p = m_ctx.pos_atoms().contains(x); bool n = m_ctx.neg_atoms().contains(x); - TRACE("quant_elim", tout << mk_pp(x, m) << " " << mk_pp(fml, m) << "\n";); + TRACE(quant_elim, tout << mk_pp(x, m) << " " << mk_pp(fml, m) << "\n";); if (p && n) { return false; } diff --git a/src/qe/qe_datatype_plugin.cpp b/src/qe/qe_datatype_plugin.cpp index 0f3ab7ccb..5f9eb16a1 100644 --- a/src/qe/qe_datatype_plugin.cpp +++ b/src/qe/qe_datatype_plugin.cpp @@ -139,7 +139,7 @@ namespace qe { func_decl* f = a->get_decl(); if (m_util.is_recognizer(f) && a->get_arg(0) == x) { m_recognizers.push_back(a); - TRACE("qe", tout << "add recognizer:" << mk_pp(a, m) << "\n";); + TRACE(qe, tout << "add recognizer:" << mk_pp(a, m) << "\n";); return true; } if (!m.is_eq(a)) { @@ -222,7 +222,7 @@ namespace qe { } void add_atom(app* a, bool is_pos) { - TRACE("qe", tout << "add atom:" << mk_pp(a, m) << " " << (is_pos?"pos":"neg") << "\n";); + TRACE(qe, tout << "add atom:" << mk_pp(a, m) << " " << (is_pos?"pos":"neg") << "\n";); if (is_pos) { m_eq_atoms.push_back(a); } @@ -336,7 +336,7 @@ namespace qe { for_each_expr(*this, fml.get()); if (m_change) { fml = get_expr(fml.get()); - TRACE("qe", tout << "lift:\n" << mk_pp(fml.get(), m) << "\n";); + TRACE(qe, tout << "lift:\n" << mk_pp(fml.get(), m) << "\n";); } return m_change; } @@ -390,7 +390,7 @@ namespace qe { } expr* e = m.mk_and(conj.size(), conj.data()); m_map.insert(a, e, nullptr); - TRACE("qe", tout << "replace: " << mk_pp(a, m) << " ==> \n" << mk_pp(e, m) << "\n";); + TRACE(qe, tout << "replace: " << mk_pp(a, m) << " ==> \n" << mk_pp(e, m) << "\n";); return true; } @@ -466,7 +466,7 @@ namespace qe { void assign(contains_app& x, expr* fml, rational const& vl) override { sort* s = x.x()->get_decl()->get_range(); SASSERT(m_datatype_util.is_datatype(s)); - TRACE("qe", tout << mk_pp(x.x(), m) << " " << vl << "\n";); + TRACE(qe, tout << mk_pp(x.x(), m) << " " << vl << "\n";); if (m_datatype_util.is_recursive(s)) { assign_rec(x, fml, vl); } @@ -478,7 +478,7 @@ namespace qe { void subst(contains_app& x, rational const& vl, expr_ref& fml, expr_ref* def) override { sort* s = x.x()->get_decl()->get_range(); SASSERT(m_datatype_util.is_datatype(s)); - TRACE("qe", tout << mk_pp(x.x(), m) << " " << vl << "\n";); + TRACE(qe, tout << mk_pp(x.x(), m) << " " << vl << "\n";); if (m_datatype_util.is_recursive(s)) { subst_rec(x, vl, fml, def); } @@ -612,7 +612,7 @@ namespace qe { num_branches = rational(eqs.num_eqs() + 1); return true; } - TRACE("qe", tout << "could not get number of branches " << mk_pp(x.x(), m) << "\n";); + TRACE(qe, tout << "could not get number of branches " << mk_pp(x.x(), m) << "\n";); return false; } @@ -667,7 +667,7 @@ namespace qe { SASSERT(m_datatype_util.is_datatype(s)); func_decl* c = nullptr, *r = nullptr; - TRACE("qe", tout << mk_pp(x, m) << " " << vl << " " << mk_pp(fml, m) << " " << (def != 0) << "\n";); + TRACE(qe, tout << mk_pp(x, m) << " " << vl << " " << mk_pp(fml, m) << " " << (def != 0) << "\n";); // // Add recognizer to formula. // Introduce auxiliary variable to eliminate. @@ -681,13 +681,13 @@ namespace qe { m_ctx.add_var(fresh_x); m_replace.apply_substitution(x, fresh_x, fml); add_def(fresh_x, def); - TRACE("qe", tout << "Add recognizer " << mk_pp(is_c, m) << "\n";); + TRACE(qe, tout << "Add recognizer " << mk_pp(is_c, m) << "\n";); return; } if (has_selector(contains_x, fml, c)) { - TRACE("qe", tout << "Eliminate selector " << mk_ll_pp(c, m) << "\n";); + TRACE(qe, tout << "Eliminate selector " << mk_ll_pp(c, m) << "\n";); subst_constructor(contains_x, c, fml, def); return; } @@ -741,7 +741,7 @@ namespace qe { add_def(t, def); } } - TRACE("qe", tout << "reduced " << mk_pp(fml.get(), m) << "\n";); + TRACE(qe, tout << "reduced " << mk_pp(fml.get(), m) << "\n";); } bool get_num_branches_nonrec( contains_app& x, expr* fml, rational& num_branches) { @@ -751,10 +751,10 @@ namespace qe { func_decl* c = nullptr, *r = nullptr; if (sz != 1 && has_recognizer(x.x(), fml, r, c)) { - TRACE("qe", tout << mk_pp(x.x(), m) << " has a recognizer\n";); + TRACE(qe, tout << mk_pp(x.x(), m) << " has a recognizer\n";); num_branches = rational(1); } - TRACE("qe", tout << mk_pp(x.x(), m) << " branches: " << sz << "\n";); + TRACE(qe, tout << mk_pp(x.x(), m) << " branches: " << sz << "\n";); return true; } @@ -770,7 +770,7 @@ namespace qe { } func_decl* c = nullptr, *r = nullptr; if (has_recognizer(x, fml, r, c)) { - TRACE("qe", tout << mk_pp(x, m) << " has a recognizer\n";); + TRACE(qe, tout << mk_pp(x, m) << " has a recognizer\n";); return; } @@ -789,7 +789,7 @@ namespace qe { SASSERT(!m_datatype_util.is_recursive(s)); func_decl* c = nullptr, *r = nullptr; if (has_recognizer(x.x(), fml, r, c)) { - TRACE("qe", tout << mk_pp(x.x(), m) << " has a recognizer\n";); + TRACE(qe, tout << mk_pp(x.x(), m) << " has a recognizer\n";); } else { SASSERT(vl.is_unsigned()); diff --git a/src/qe/qe_dl_plugin.cpp b/src/qe/qe_dl_plugin.cpp index 2791105d9..3161903a3 100644 --- a/src/qe/qe_dl_plugin.cpp +++ b/src/qe/qe_dl_plugin.cpp @@ -209,14 +209,14 @@ namespace qe { } expr* e1, *e2; if (!m.is_eq(e, e1, e2)) { - TRACE("quant_elim", tout << "Cannot handle: " << mk_pp(e, m) << "\n";); + TRACE(quant_elim, tout << "Cannot handle: " << mk_pp(e, m) << "\n";); return false; } if (x == e2) { std::swap(e1, e2); } if (contains_x(e2) || x != e1) { - TRACE("quant_elim", tout << "Cannot handle: " << mk_pp(e, m) << "\n";); + TRACE(quant_elim, tout << "Cannot handle: " << mk_pp(e, m) << "\n";); return false; } if (is_pos) { diff --git a/src/qe/qe_mbi.cpp b/src/qe/qe_mbi.cpp index 48a7928be..ba8f5faa3 100644 --- a/src/qe/qe_mbi.cpp +++ b/src/qe/qe_mbi.cpp @@ -75,7 +75,7 @@ namespace qe { }; intersect_proc symbols_in_b(*this, symbols_in_a.s); quick_for_each_expr(symbols_in_b, marks, b); - TRACE("qe", + TRACE(qe, tout << mk_pp(a, m) << "\n" << mk_pp(b, m) << "\n"; for (func_decl* f : m_shared) tout << f->get_name() << " "; tout << "\n";); } @@ -134,7 +134,7 @@ namespace qe { mbi_result prop_mbi_plugin::operator()(expr_ref_vector& lits, model_ref& mdl) { lbool r = m_solver->check_sat(lits); - TRACE("qe", tout << r << " " << lits << "\n"); + TRACE(qe, tout << r << " " << lits << "\n"); switch (r) { case l_false: lits.reset(); @@ -221,11 +221,11 @@ namespace qe { else if (mdl->is_false(e)) lits.push_back(m.mk_not(e)); } - TRACE("qe", tout << "atoms from model: " << lits << "\n";); + TRACE(qe, tout << "atoms from model: " << lits << "\n";); solver_ref dual = m_dual_solver->translate(m, m_dual_solver->get_params()); dual->assert_expr(mk_not(mk_and(m_fmls))); lbool r = dual->check_sat(lits); - TRACE("qe", dual->display(tout << "dual result " << r << "\n");); + TRACE(qe, dual->display(tout << "dual result " << r << "\n");); if (l_false == r) { // use the dual solver to find a 'small' implicant lits.reset(); @@ -263,7 +263,7 @@ namespace qe { } } order_avars(avars); - TRACE("qe", tout << "vars: " << avars << " from " << lits << "\n";); + TRACE(qe, tout << "vars: " << avars << " from " << lits << "\n";); return avars; } @@ -331,7 +331,7 @@ namespace qe { vector defs; bool ok = ap.project(*mdl.get(), avars, lits, defs); (void)ok; - CTRACE("qe", !ok, tout << "projection failure ignored!!!!\n"); + CTRACE(qe, !ok, tout << "projection failure ignored!!!!\n"); fix_non_shared(*mdl, lits); return defs; } @@ -343,7 +343,7 @@ namespace qe { case l_false: lits.reset(); m_solver->get_unsat_core(lits); - TRACE("qe", tout << "unsat core: " << lits << "\n";); + TRACE(qe, tout << "unsat core: " << lits << "\n";); // optionally minimize core using superposition. return mbi_unsat; case l_true: @@ -367,7 +367,7 @@ namespace qe { \brief main projection routine */ void uflia_mbi::project(model_ref& mdl, expr_ref_vector& lits) { - TRACE("qe", + TRACE(qe, tout << "project literals: " << lits << "\n" << *mdl << "\n"; tout << m_solver->get_assertions() << "\n";); @@ -377,13 +377,13 @@ namespace qe { auto avars = get_arith_vars(lits); vector defs = arith_project(mdl, avars, alits); for (auto const& d : defs) uflits.push_back(m.mk_eq(d.var, d.term)); - TRACE("qe", tout << "uflits: " << uflits << "\n";); + TRACE(qe, tout << "uflits: " << uflits << "\n";); project_euf(mdl, uflits); lits.reset(); lits.append(alits); lits.append(uflits); IF_VERBOSE(10, verbose_stream() << "projection : " << lits << "\n"); - TRACE("qe", + TRACE(qe, tout << "projection: " << lits << "\n"; tout << "avars: " << avars << "\n"; tout << "alits: " << lits << "\n"; @@ -410,7 +410,7 @@ namespace qe { uflits.push_back(lit); } } - TRACE("qe", + TRACE(qe, tout << "alits: " << alits << "\n"; tout << "uflits: " << uflits << "\n";); } @@ -426,7 +426,7 @@ namespace qe { func_decl_ref_vector shared(m_shared_trail); tg.set_vars(shared, false); lits.append(tg.dcert(*mdl.get(), lits)); - TRACE("qe", tout << "project: " << lits << "\n";); + TRACE(qe, tout << "project: " << lits << "\n";); } /** @@ -479,7 +479,7 @@ namespace qe { tg.add_lits(lits); lits.reset(); lits.append(tg.project(*mdl.get())); - TRACE("qe", tout << "project: " << lits << "\n";); + TRACE(qe, tout << "project: " << lits << "\n";); } /** @@ -496,14 +496,14 @@ namespace qe { (x->get_depth() == y->get_depth() && x->get_id() > y->get_id()); }; std::sort(avars.data(), avars.data() + avars.size(), compare_depth); - TRACE("qe", tout << "avars:" << avars << "\n";); + TRACE(qe, tout << "avars:" << avars << "\n";); } void uflia_mbi::block(expr_ref_vector const& lits) { expr_ref clause(mk_not(mk_and(lits)), m); collect_atoms(lits); m_fmls.push_back(clause); - TRACE("qe", tout << "block " << lits << "\n";); + TRACE(qe, tout << "block " << lits << "\n";); m_solver->assert_expr(clause); } @@ -533,7 +533,7 @@ namespace qe { itp = nullptr; return l_true; } - TRACE("mbi", tout << "new lits " << lits << "\n";); + TRACE(mbi, tout << "new lits " << lits << "\n";); break; // continue case mbi_unsat: { if (lits.empty()) { @@ -544,7 +544,7 @@ namespace qe { } t2->block(lits); expr_ref lemma(mk_not(mk_and(lits))); - TRACE("mbi", tout << lemma << "\n";); + TRACE(mbi, tout << lemma << "\n";); blocks[turn].push_back(lemma); itp = m.mk_implies(mk_and(blocks[!turn]), lemma); // TBD: compute closure over variables not in vars @@ -600,7 +600,7 @@ namespace qe { th_rewriter rewrite(m); rewrite(a); rewrite(b); - TRACE("interpolator", tout << a << " " << b << "\n"); + TRACE(interpolator, tout << a << " " << b << "\n"); solver_ref sA = sf(m, p, false /* no proofs */, true, true, symbol::null); solver_ref sB = sf(m, p, false /* no proofs */, true, true, symbol::null); solver_ref sNotA = sf(m, p, false /* no proofs */, true, true, symbol::null); diff --git a/src/qe/qe_mbp.cpp b/src/qe/qe_mbp.cpp index 147bd9b5f..c18144efc 100644 --- a/src/qe/qe_mbp.cpp +++ b/src/qe/qe_mbp.cpp @@ -249,7 +249,7 @@ class mbproj::impl { sub(fml, val); m_rw(val); if (!m.is_true(val)) { - TRACE("qe", tout << mk_pp(fml, m) << " -> " << val << "\n";); + TRACE(qe, tout << mk_pp(fml, m) << " -> " << val << "\n";); fmls[j++] = val; } } @@ -295,22 +295,22 @@ class mbproj::impl { bool project_var(model_evaluator& eval, app* var, expr_ref& fml) { expr_ref val = eval(var); - TRACE("mbqi_project_verbose", tout << "MBQI: var: " << mk_pp(var, m) << "\n" << "fml: " << fml << "\n";); + TRACE(mbqi_project_verbose, tout << "MBQI: var: " << mk_pp(var, m) << "\n" << "fml: " << fml << "\n";); expr_ref_vector terms(m); index_term_finder finder(m, var, terms); for_each_expr(finder, fml); - TRACE("mbqi_project_verbose", tout << "terms:\n" << terms;); + TRACE(mbqi_project_verbose, tout << "terms:\n" << terms;); for (expr* term : terms) { expr_ref tval = eval(term); - TRACE("mbqi_project_verbose", tout << "term: " << mk_pp(term, m) << " tval: " << tval << " val: " << val << "\n";); + TRACE(mbqi_project_verbose, tout << "term: " << mk_pp(term, m) << " tval: " << tval << " val: " << val << "\n";); // -- if the term does not contain an occurrence of var // -- and is in the same equivalence class in the model if (tval == val && !occurs(var, term)) { - TRACE("mbqi_project", + TRACE(mbqi_project, tout << "MBQI: replacing " << mk_pp(var, m) << " with " << mk_pp(term, m) << "\n";); expr_safe_replace sub(m); sub.insert(var, term); @@ -319,7 +319,7 @@ class mbproj::impl { } } - TRACE("mbqi_project", + TRACE(mbqi_project, tout << "MBQI: failed to eliminate " << mk_pp(var, m) << " from " << fml << "\n";); return false; @@ -434,11 +434,11 @@ public: fmls.reset(); flatten_and(fml, fmls); m_dont_sub = dsub; - TRACE("qe", tout << "spacer-qel " << vars << " " << fml << "\n"); + TRACE(qe, tout << "spacer-qel " << vars << " " << fml << "\n"); } else { mbp(force_elim, vars, model, fmls, defs); - TRACE("qe", tout << "mbp " << vars << " " << fmls << "\n"; + TRACE(qe, tout << "mbp " << vars << " " << fmls << "\n"; if (defs) { tout << "defs: "; for (auto const& d : *defs) tout << d << "\n"; tout << "\n";}); } } @@ -449,12 +449,12 @@ public: app_ref var(m); expr_ref_vector unused_fmls(m); bool progress = true; - TRACE("qe", tout << "eliminate vars: " << vars << "fmls: " << fmls << "\n"); + TRACE(qe, tout << "eliminate vars: " << vars << "fmls: " << fmls << "\n"); if (!defs) preprocess_solve(model, vars, fmls); filter_variables(model, vars, fmls, unused_fmls); project_bools(model, vars, fmls); - TRACE("qe", tout << "eliminate vars: " << vars << "\nfmls: " << fmls << "\nunused: " << unused_fmls <<"\n"); + TRACE(qe, tout << "eliminate vars: " << vars << "\nfmls: " << fmls << "\nunused: " << unused_fmls <<"\n"); while (progress && !vars.empty() && !fmls.empty() && m.limit().inc()) { app_ref_vector new_vars(m); progress = false; @@ -463,12 +463,12 @@ public: unsigned sz = defs->size(); p->project(model, vars, fmls, *defs); progress |= sz < defs->size(); - TRACE("qe", tout << "after project " << m.get_family_name(p->get_family_id()) << ": " << vars << "\n"); + TRACE(qe, tout << "after project " << m.get_family_name(p->get_family_id()) << ": " << vars << "\n"); } else if (p) (*p)(model, vars, fmls); } - TRACE("qe", tout << "projecting " << vars << "\n"); + TRACE(qe, tout << "projecting " << vars << "\n"); while (!vars.empty() && !fmls.empty() && !defs && m.limit().inc()) { var = vars.back(); vars.pop_back(); @@ -503,7 +503,7 @@ public: vars.append(new_vars); if (progress && !defs) preprocess_solve(model, vars, fmls); - TRACE("qe", tout << "looping " << vars << "\n"); + TRACE(qe, tout << "looping " << vars << "\n"); } if (fmls.empty()) { @@ -511,14 +511,14 @@ public: } fmls.append(unused_fmls); SASSERT(validate_model(model, fmls)); - TRACE("qe", tout << "vars: " << vars << "\nfmls: " << fmls << "\n";); + TRACE(qe, tout << "vars: " << vars << "\nfmls: " << fmls << "\n";); } void do_qe_lite(app_ref_vector& vars, expr_ref& fml) { qe_lite qe(m, m_params, false); qe(vars, fml); m_rw(fml); - TRACE("qe", tout << "After qe_lite:\n" << fml << "\n" << "Vars: " << vars << "\n";); + TRACE(qe, tout << "After qe_lite:\n" << fml << "\n" << "Vars: " << vars << "\n";); SASSERT(!m.is_false(fml)); } @@ -527,7 +527,7 @@ public: qel qe(m, m_params); qe(vars, fml); m_rw(fml); - TRACE("qe", tout << "After qel:\n" + TRACE(qe, tout << "After qel:\n" << fml << "\n" << "Vars: " << vars << "\n";); SASSERT(!m.is_false(fml)); @@ -546,13 +546,13 @@ public: mbptg(vars, fml, mdl); if (reduce_all_selects) rewrite_read_over_write(fml, mdl, fml); m_rw(fml); - TRACE("qe", tout << "After mbp_tg:\n" + TRACE(qe, tout << "After mbp_tg:\n" << fml << " models " << mdl.is_true(fml) << "\n" << "Vars: " << vars << "\n";); } void spacer_qel(app_ref_vector& vars, model& mdl, expr_ref& fml) { - TRACE("qe", tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";); + TRACE(qe, tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";); model_evaluator eval(mdl, m_params); eval.set_model_completion(true); @@ -575,7 +575,7 @@ public: // project reals, ints and other variables. if (!other_vars.empty()) { - TRACE("qe", tout << "Other vars: " << other_vars << "\n" << mdl;); + TRACE(qe, tout << "Other vars: " << other_vars << "\n" << mdl;); expr_ref_vector fmls(m); flatten_and(fml, fmls); @@ -584,7 +584,7 @@ public: fml = mk_and(fmls); m_rw(fml); - TRACE("qe", + TRACE(qe, tout << "Projected other vars:\n" << fml << "\n"; tout << "Remaining other vars:\n" << other_vars << "\n";); SASSERT(!m.is_false(fml)); @@ -598,7 +598,7 @@ public: // substitute any remaining other vars if (!m_dont_sub && !other_vars.empty()) { subst_vars(eval, other_vars, fml); - TRACE("qe", tout << "After substituting remaining other vars:\n" << fml << "\n";); + TRACE(qe, tout << "After substituting remaining other vars:\n" << fml << "\n";); // an extra round of simplification because subst_vars is not simplifying m_rw(fml); other_vars.reset(); @@ -611,7 +611,7 @@ public: } void spacer(app_ref_vector& vars, model& mdl, expr_ref& fml) { - TRACE("qe", tout << "spacer " << m_use_qel << " " << fml << " " << vars << "\n"); + TRACE(qe, tout << "spacer " << m_use_qel << " " << fml << " " << vars << "\n"); if (m_use_qel) spacer_qel(vars, mdl, fml); else @@ -619,7 +619,7 @@ public: } void spacer_qe_lite(app_ref_vector& vars, model& mdl, expr_ref& fml) { - TRACE("qe", tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";); + TRACE(qe, tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";); model_evaluator eval(mdl, m_params); eval.set_model_completion(true); @@ -646,7 +646,7 @@ public: } } - TRACE("qe", tout << "Array vars: " << array_vars << "\n";); + TRACE(qe, tout << "Array vars: " << array_vars << "\n";); vars.reset(); @@ -657,14 +657,14 @@ public: m_rw(fml); SASSERT(!m.is_false(fml)); - TRACE("qe", + TRACE(qe, tout << "extended model:\n" << mdl; tout << "Vars: " << vars << "\n";); } // project reals, ints and other variables. if (!other_vars.empty()) { - TRACE("qe", tout << "Other vars: " << other_vars << "\n" << mdl;); + TRACE(qe, tout << "Other vars: " << other_vars << "\n" << mdl;); expr_ref_vector fmls(m); flatten_and(fml, fmls); @@ -673,7 +673,7 @@ public: fml = mk_and(fmls); m_rw(fml); - TRACE("qe", + TRACE(qe, tout << "Projected other vars:\n" << fml << "\n"; tout << "Remaining other vars:\n" << other_vars << "\n";); SASSERT(!m.is_false(fml)); @@ -687,7 +687,7 @@ public: // substitute any remaining other vars if (!m_dont_sub && !other_vars.empty()) { subst_vars(eval, other_vars, fml); - TRACE("qe", tout << "After substituting remaining other vars:\n" << fml << "\n";); + TRACE(qe, tout << "After substituting remaining other vars:\n" << fml << "\n";); // an extra round of simplification because subst_vars is not simplifying m_rw(fml); other_vars.reset(); diff --git a/src/qe/qsat.cpp b/src/qe/qsat.cpp index 0ff054a89..334999411 100644 --- a/src/qe/qsat.cpp +++ b/src/qe/qsat.cpp @@ -164,7 +164,7 @@ namespace qe { } model_evaluator eval(*mdl); eval.set_model_completion(true); - TRACE("qe_assumptions", model_v2_pp(tout, *mdl);); + TRACE(qe_assumptions, model_v2_pp(tout, *mdl);); expr_ref val(m); for (unsigned i = 0; i <= level-1; ++i) { @@ -204,7 +204,7 @@ namespace qe { } } } - TRACE("qe_assumptions", tout << "level: " << level << "\n"; + TRACE(qe_assumptions, tout << "level: " << level << "\n"; model_v2_pp(tout, *mdl); display(tout, asms);); } @@ -251,13 +251,13 @@ namespace qe { mark.mark(a); if (m_lit2pred.find(a, p)) { - TRACE("qe", tout << mk_pp(a, m) << " " << mk_pp(p, m) << "\n";); + TRACE(qe, tout << mk_pp(a, m) << " " << mk_pp(p, m) << "\n";); level.merge(m_elevel.find(p)); continue; } if (is_uninterp_const(a) && m.is_bool(a)) { - TRACE("qe", tout << mk_pp(a, m) << "\n";); + TRACE(qe, tout << mk_pp(a, m) << "\n";); l = m_elevel.find(a); level.merge(l); if (!m_pred2lit.contains(a)) { @@ -277,7 +277,7 @@ namespace qe { (!m.is_distinct(a) || a->get_num_args() == 0 || m.is_bool(a->get_arg(0))); if (!is_boolop && m.is_bool(a)) { - TRACE("qe", tout << mk_pp(a, m) << "\n";); + TRACE(qe, tout << mk_pp(a, m) << "\n";); r = fresh_bool("p"); max_level l = compute_level(a); add_pred(r, a); @@ -356,7 +356,7 @@ namespace qe { app *b; expr *c, *d; max_level lvl2; - TRACE("qe", tout << mk_pp(a, m) << " " << lvl << "\n";); + TRACE(qe, tout << mk_pp(a, m) << " " << lvl << "\n";); if (m_asm2pred.find(a, b)) q = b; else if (m.is_not(a, c) && m_asm2pred.find(c, b)) @@ -384,7 +384,7 @@ namespace qe { fml = mk_abstract(fml); defs.push_back(m.mk_eq(p, fml)); add_asm(p, a); - TRACE("qe", tout << mk_pp(a, m) << " |-> " << p << "\n";); + TRACE(qe, tout << mk_pp(a, m) << " |-> " << p << "\n";); } return q; } @@ -515,7 +515,7 @@ namespace qe { val_b = model(b); if ((m.is_true(val_a) && m.is_false(val_b)) || (m.is_false(val_a) && m.is_true(val_b))) { - TRACE("qe", + TRACE(qe, tout << model << "\n"; tout << mk_pp(a, m) << " := " << val_a << "\n"; tout << mk_pp(b, m) << " := " << val_b << "\n"; @@ -585,7 +585,7 @@ namespace qe { void get_core(expr_ref_vector& core) { core.reset(); m_solver->get_unsat_core(core); - TRACE("qe_core", m_solver->display(tout << "core: " << core << "\n") << "\n";); + TRACE(qe_core, m_solver->display(tout << "core: " << core << "\n") << "\n";); } }; @@ -636,26 +636,26 @@ namespace qe { while (true) { ++m_stats.m_num_rounds; IF_VERBOSE(1, verbose_stream() << "(check-qsat level: " << m_level << " round: " << m_stats.m_num_rounds << ")\n";); - TRACE("qe", + TRACE(qe, tout << "level: " << m_level << " round: " << m_stats.m_num_rounds << "\n"); check_cancel(); expr_ref_vector asms(m_asms); m_pred_abs.get_assumptions(m_model.get(), asms); if (m_model.get()) validate_assumptions(*m_model.get(), asms); - TRACE("qe", tout << asms << "\n";); + TRACE(qe, tout << asms << "\n";); solver& s = get_kernel(m_level).s(); lbool res = s.check_sat(asms); switch (res) { case l_true: s.get_model(m_model); - CTRACE("qe", !m_model, tout << "no model\n"); + CTRACE(qe, !m_model, tout << "no model\n"); if (!m_model) return l_undef; SASSERT(validate_defs("check_sat")); SASSERT(!m_model.get() || validate_assumptions(*m_model.get(), asms)); SASSERT(validate_model(asms)); - TRACE("qe", s.display(tout); display(tout << "\n", *m_model.get()); display(tout, asms); ); + TRACE(qe, s.display(tout); display(tout << "\n", *m_model.get()); display(tout, asms); ); if (m_level == 0) m_model_save = m_model; push(); @@ -689,7 +689,7 @@ namespace qe { } break; case l_undef: - TRACE("qe", tout << "check-sat is undef\n"); + TRACE(qe, tout << "check-sat is undef\n"); return res; } } @@ -785,7 +785,7 @@ namespace qe { while (!vars.empty()); SASSERT(m_vars.back().empty()); initialize_levels(); - TRACE("qe", tout << fml << "\n";); + TRACE(qe, tout << fml << "\n";); } void check_sort(sort* s) { @@ -817,7 +817,7 @@ namespace qe { bool validate_defs(char const* msg) { if (m_model.get() && !m_pred_abs.validate_defs(*m_model.get())) { - TRACE("qe", + TRACE(qe, tout << msg << "\n"; display(tout); if (m_level > 0) { @@ -843,7 +843,7 @@ namespace qe { bool minimize_core(expr_ref_vector& core, unsigned level) { expr_ref_vector core1(m), core2(m), dels(m); - TRACE("qe", tout << core.size() << "\n";); + TRACE(qe, tout << core.size() << "\n";); mus mus(get_kernel(level).s()); for (expr* arg : core) { app* a = to_app(arg); @@ -857,12 +857,12 @@ namespace qe { mus.add_assumption(a); } } - TRACE("qe", tout << core1.size() << " " << core2.size() << "\n";); + TRACE(qe, tout << core1.size() << " " << core2.size() << "\n";); if (core1.size() > 8) { if (l_true != mus.get_mus(core2)) { return false; } - TRACE("qe", tout << core1.size() << " -> " << core2.size() << "\n";); + TRACE(qe, tout << core1.size() << " -> " << core2.size() << "\n";); core.reset(); core.append(core2); } @@ -927,7 +927,7 @@ namespace qe { bool project(expr_ref_vector& core) { get_core(core, m_level); - TRACE("qe", display(tout); display(tout << "core\n", core);); + TRACE(qe, display(tout); display(tout << "core\n", core);); SASSERT(m_level >= 2); expr_ref fml(m); expr_ref_vector defs(m), core_save(m); @@ -937,7 +937,7 @@ namespace qe { SASSERT(validate_project(mdl, core)); mdl.set_inline(); m_mbp(force_elim(), m_avars, mdl, core); - TRACE("qe", tout << "aux vars: " << m_avars << "\n";); + TRACE(qe, tout << "aux vars: " << m_avars << "\n";); for (app* v : m_avars) m_pred_abs.ensure_expr_level(v, m_level-1); m_free_vars.append(m_avars); fml = negate_core(core); @@ -952,7 +952,7 @@ namespace qe { } else if (level.max() + 2 > m_level) { // fishy - this can happen. - TRACE("qe", tout << "max-level: " << level.max() << " level: " << m_level << "\n"); + TRACE(qe, tout << "max-level: " << level.max() << " level: " << m_level << "\n"); return false; } else { @@ -964,13 +964,13 @@ namespace qe { } pop(num_scopes); - TRACE("qe", tout << "backtrack: " << num_scopes << " new level: " << m_level << "\nproject:\n" << core << "\n|->\n" << fml << "\n";); + TRACE(qe, tout << "backtrack: " << num_scopes << " new level: " << m_level << "\nproject:\n" << core << "\n|->\n" << fml << "\n";); if (m_level == 0 && m_mode != qsat_sat) { add_assumption(fml); } else { fml = m_pred_abs.mk_abstract(fml); - TRACE("qe_block", tout << "Blocking fml at level: " << m_level << "\n" << fml << "\n";); + TRACE(qe_block, tout << "Blocking fml at level: " << m_level << "\n" << fml << "\n";); get_kernel(m_level).assert_blocking_fml(fml); } SASSERT(!m_model.get()); @@ -1044,13 +1044,13 @@ namespace qe { bool is_fa = ::is_forall(q); tmp = q->get_expr(); extract_vars(q, tmp, vars); - TRACE("qe", tout << vars << " " << mk_pp(q, m) << " " << tmp << "\n";); + TRACE(qe, tout << vars << " " << mk_pp(q, m) << " " << tmp << "\n";); tmp = elim_rec(tmp); if (is_fa) { tmp = ::push_not(tmp); } - TRACE("qe", tout << "elim-rec " << tmp << "\n";); + TRACE(qe, tout << "elim-rec " << tmp << "\n";); tmp = elim(vars, tmp); if (!tmp) { visited.insert(e, e); @@ -1061,7 +1061,7 @@ namespace qe { tmp = ::push_not(tmp); } trail.push_back(tmp); - TRACE("qe", tout << tmp << "\n";); + TRACE(qe, tout << tmp << "\n";); visited.insert(e, tmp); todo.pop_back(); break; @@ -1080,7 +1080,7 @@ namespace qe { */ expr_ref elim(app_ref_vector& vars, expr* _fml) { expr_ref fml(_fml, m); - TRACE("qe", tout << vars << ": " << fml << "\n";); + TRACE(qe, tout << vars << ": " << fml << "\n";); expr_ref_vector defs(m); if (has_quantifiers(fml)) { return expr_ref(m); @@ -1098,7 +1098,7 @@ namespace qe { m_fa.assert_expr(mk_and(defs)); m_ex.assert_expr(fml); m_fa.assert_expr(m.mk_not(fml)); - TRACE("qe", tout << "ex: " << fml << "\n";); + TRACE(qe, tout << "ex: " << fml << "\n";); lbool is_sat = check_sat(); unsigned j = 0; @@ -1121,7 +1121,7 @@ namespace qe { bool validate_assumptions(model& mdl, expr_ref_vector const& core) { for (expr* c : core) { if (!mdl.is_true(c)) { - TRACE("qe", tout << "component of core is not true: " << mk_pp(c, m) << "\n"; + TRACE(qe, tout << "component of core is not true: " << mk_pp(c, m) << "\n"; tout << mdl << "\n";); if (mdl.is_false(c)) { return false; @@ -1134,7 +1134,7 @@ namespace qe { bool validate_core(model& mdl, expr_ref_vector const& core) { return true; #if 0 - TRACE("qe", tout << "Validate core\n";); + TRACE(qe, tout << "Validate core\n";); solver& s = get_kernel(m_level).s(); expr_ref_vector fmls(m); fmls.append(core.size(), core.c_ptr()); @@ -1150,7 +1150,7 @@ namespace qe { solver.assert_expr(fmls[i]); } lbool is_sat = solver.check(); - CTRACE("qe", is_sat != l_false, + CTRACE(qe, is_sat != l_false, tout << fmls << "\nare not unsat\n";); return (is_sat == l_false) || !m.inc(); } @@ -1158,7 +1158,7 @@ namespace qe { bool validate_model(expr_ref_vector const& asms) { return true; #if 0 - TRACE("qe", tout << "Validate model\n";); + TRACE(qe, tout << "Validate model\n";); solver& s = get_kernel(m_level).s(); expr_ref_vector fmls(m); s.get_assertions(fmls); @@ -1172,7 +1172,7 @@ namespace qe { expr_ref val(m); for (unsigned i = 0; i < sz; ++i) { if (!m_model->is_true(fmls[i]) && m.inc()) { - TRACE("qe", tout << "Formula does not evaluate to true in model: " << mk_pp(fmls[i], m) << "\n";); + TRACE(qe, tout << "Formula does not evaluate to true in model: " << mk_pp(fmls[i], m) << "\n";); return false; } } @@ -1189,18 +1189,18 @@ namespace qe { bool validate_project(model& mdl, expr_ref_vector const& core) { return true; #if 0 - TRACE("qe", tout << "Validate projection\n";); + TRACE(qe, tout << "Validate projection\n";); if (!validate_model(mdl, core.size(), core.c_ptr())) return false; expr_ref_vector proj(core); app_ref_vector vars(m_avars); m_mbp(false, vars, mdl, proj); if (!vars.empty()) { - TRACE("qe", tout << "Not validating partial projection\n";); + TRACE(qe, tout << "Not validating partial projection\n";); return true; } if (!validate_model(mdl, proj.size(), proj.c_ptr())) { - TRACE("qe", tout << "Projection is false in model\n";); + TRACE(qe, tout << "Projection is false in model\n";); return false; } if (!m.inc()) { @@ -1209,7 +1209,7 @@ namespace qe { for (unsigned i = 0; i < m_avars.size(); ++i) { contains_app cont(m, m_avars.get(i)); if (cont(proj)) { - TRACE("qe", tout << "Projection contains free variable: " << mk_pp(m_avars.get(i), m) << "\n";); + TRACE(qe, tout << "Projection contains free variable: " << mk_pp(m_avars.get(i), m) << "\n";); return false; } } @@ -1229,7 +1229,7 @@ namespace qe { } fmls.push_back(m.mk_not(mk_and(proj))); if (!check_fmls(fmls)) { - TRACE("qe", tout << "implication check failed, could be due to turning != into >\n";); + TRACE(qe, tout << "implication check failed, could be due to turning != into >\n";); } return true; #endif @@ -1288,7 +1288,7 @@ namespace qe { // fail if cores. (TBD) // fail if proofs. (TBD) - TRACE("qe", tout << fml << "\n";); + TRACE(qe, tout << fml << "\n";); if (m_mode == qsat_qe_rec) { fml = elim_rec(fml); @@ -1313,7 +1313,7 @@ namespace qe { m_fa.assert_expr(mk_and(defs)); m_ex.assert_expr(fml); m_fa.assert_expr(m.mk_not(fml)); - TRACE("qe", tout << "ex: " << fml << "\n";); + TRACE(qe, tout << "ex: " << fml << "\n";); lbool is_sat = check_sat(); switch (is_sat) { case l_false: @@ -1421,7 +1421,7 @@ namespace qe { void maximize_core(expr_ref_vector const& core, model& mdl) { SASSERT(m_value); SASSERT(m_objective); - TRACE("qe", tout << "maximize: " << core << "\n";); + TRACE(qe, tout << "maximize: " << core << "\n";); m_was_sat |= !core.empty(); expr_ref bound(m); *m_value = m_value_save; diff --git a/src/sat/sat_aig_cuts.cpp b/src/sat/sat_aig_cuts.cpp index 9ec4ab199..8fd98bc9e 100644 --- a/src/sat/sat_aig_cuts.cpp +++ b/src/sat/sat_aig_cuts.cpp @@ -33,9 +33,9 @@ namespace sat { vector const& aig_cuts::operator()() { if (m_config.m_full) flush_roots(); unsigned_vector node_ids = filter_valid_nodes(); - TRACE("cut_simplifier", display(tout);); + TRACE(cut_simplifier, display(tout);); augment(node_ids); - TRACE("cut_simplifier", display(tout);); + TRACE(cut_simplifier, display(tout);); ++m_num_cut_calls; return m_cuts; } @@ -328,13 +328,13 @@ namespace sat { } else if (m_aig[v][0].is_const() || !insert_aux(v, n)) { m_literals.shrink(m_literals.size() - n.size()); - TRACE("cut_simplifier", tout << "duplicate\n";); + TRACE(cut_simplifier, tout << "duplicate\n";); } SASSERT(!m_aig[v].empty()); } void aig_cuts::add_node(bool_var v, uint64_t lut, unsigned sz, bool_var const* args) { - TRACE("cut_simplifier", tout << v << " == " << cut::table2string(sz, lut) << " " << bool_var_vector(sz, args) << "\n";); + TRACE(cut_simplifier, tout << v << " == " << cut::table2string(sz, lut) << " " << bool_var_vector(sz, args) << "\n";); reserve(v); unsigned offset = m_literals.size(); node n(lut, sz, offset); @@ -346,7 +346,7 @@ namespace sat { } void aig_cuts::add_node(literal head, bool_op op, unsigned sz, literal const* args) { - TRACE("cut_simplifier", tout << head << " == " << op << " " << literal_vector(sz, args) << "\n";); + TRACE(cut_simplifier, tout << head << " == " << op << " " << literal_vector(sz, args) << "\n";); unsigned v = head.var(); reserve(v); unsigned offset = m_literals.size(); @@ -407,7 +407,7 @@ namespace sat { flush_roots(to_root, cs); } m_roots.reset(); - TRACE("cut_simplifier", display(tout);); + TRACE(cut_simplifier, display(tout);); } bool aig_cuts::flush_roots(bool_var var, to_root const& to_root, node& n) { @@ -711,7 +711,7 @@ namespace sat { m_clause.push_back(lit); } m_clause.push_back(parity ? r : ~r); - TRACE("cut_simplifier", tout << "validate: " << m_clause << "\n";); + TRACE(cut_simplifier, tout << "validate: " << m_clause << "\n";); on_clause(m_clause); } return; @@ -726,7 +726,7 @@ namespace sat { m_clause.push_back(lit); } m_clause.push_back(0 == (n.lut() & (1ull << i)) ? ~r : r); - TRACE("cut_simplifier", tout << n.lut() << " " << m_clause << "\n";); + TRACE(cut_simplifier, tout << n.lut() << " " << m_clause << "\n";); on_clause(m_clause); } return; diff --git a/src/sat/sat_anf_simplifier.cpp b/src/sat/sat_anf_simplifier.cpp index 5ed45171c..81d3bb2dd 100644 --- a/src/sat/sat_anf_simplifier.cpp +++ b/src/sat/sat_anf_simplifier.cpp @@ -47,9 +47,9 @@ namespace sat { report _report(*this); configure_solver(solver); clauses2anf(solver); - TRACE("anf_simplifier", solver.display(tout); s.display(tout);); + TRACE(anf_simplifier, solver.display(tout); s.display(tout);); solver.simplify(); - TRACE("anf_simplifier", solver.display(tout);); + TRACE(anf_simplifier, solver.display(tout);); anf2clauses(solver); anf2phase(solver); save_statistics(solver); @@ -85,7 +85,7 @@ namespace sat { literal lit(p.var(), p.lo().is_zero()); s.assign_unit(lit); ++m_stats.m_num_units; - TRACE("anf_simplifier", tout << "unit " << p << " : " << lit << "\n";); + TRACE(anf_simplifier, tout << "unit " << p << " : " << lit << "\n";); } else if (p.is_binary()) { // equivalence @@ -95,7 +95,7 @@ namespace sat { literal y(p.lo().var(), p.lo().lo().is_one()); add_eq(x, y); ++m_stats.m_num_eqs; - TRACE("anf_simplifier", tout << "equivalence " << p << " : " << x << " == " << y << "\n";); + TRACE(anf_simplifier, tout << "equivalence " << p << " : " << x << " == " << y << "\n";); } } @@ -248,7 +248,7 @@ namespace sat { oclauses.shrink(j); } - TRACE("anf_simplifier", + TRACE(anf_simplifier, tout << "kept:\n"; for (clause* cp : clauses) tout << *cp << "\n"; for (auto b : bins) tout << b.first << " " << b.second << "\n"; @@ -390,7 +390,7 @@ namespace sat { auto& m = ps.get_manager(); dd::pdd p = (lit2pdd(b.first) | lit2pdd(b.second)) ^ true; ps.add(p); - TRACE("anf_simplifier", tout << "bin: " << b.first << " " << b.second << " : " << p << "\n";); + TRACE(anf_simplifier, tout << "bin: " << b.first << " " << b.second << " : " << p << "\n";); } void anf_simplifier::add_clause(clause const& c, pdd_solver& ps) { @@ -400,7 +400,7 @@ namespace sat { for (literal l : c) p |= lit2pdd(l); p = p ^ true; ps.add(p); - TRACE("anf_simplifier", tout << "clause: " << c << " : " << p << "\n";); + TRACE(anf_simplifier, tout << "clause: " << c << " : " << p << "\n";); } void anf_simplifier::add_xor(literal_vector const& x, pdd_solver& ps) { @@ -408,7 +408,7 @@ namespace sat { dd::pdd p = m.one(); for (literal l : x) p ^= lit2pdd(l); ps.add(p); - TRACE("anf_simplifier", tout << "xor: " << x << " : " << p << "\n";); + TRACE(anf_simplifier, tout << "xor: " << x << " : " << p << "\n";); } void anf_simplifier::add_aig(literal head, literal_vector const& ands, pdd_solver& ps) { @@ -417,7 +417,7 @@ namespace sat { for (literal l : ands) q &= lit2pdd(l); dd::pdd p = lit2pdd(head) ^ q; ps.add(p); - TRACE("anf_simplifier", tout << "aig: " << head << " == " << ands << " poly : " << p << "\n";); + TRACE(anf_simplifier, tout << "aig: " << head << " == " << ands << " poly : " << p << "\n";); } void anf_simplifier::add_if(literal head, literal c, literal th, literal el, pdd_solver& ps) { @@ -425,7 +425,7 @@ namespace sat { dd::pdd cond = lit2pdd(c); dd::pdd p = lit2pdd(head) ^ (cond & lit2pdd(th)) ^ (~cond & lit2pdd(el)); ps.add(p); - TRACE("anf_simplifier", tout << "ite: " << head << " == " << c << "?" << th << ":" << el << " poly : " << p << "\n";); + TRACE(anf_simplifier, tout << "ite: " << head << " == " << c << "?" << th << ":" << el << " poly : " << p << "\n";); } void anf_simplifier::save_statistics(pdd_solver& solver) { diff --git a/src/sat/sat_asymm_branch.cpp b/src/sat/sat_asymm_branch.cpp index 21e6a008d..29ef5f56e 100644 --- a/src/sat/sat_asymm_branch.cpp +++ b/src/sat/sat_asymm_branch.cpp @@ -168,7 +168,7 @@ namespace sat { return; } CASSERT("asymm_branch", s.check_invariant()); - TRACE("asymm_branch_detail", s.display(tout);); + TRACE(asymm_branch_detail, s.display(tout);); report rpt(*this); bool_vector saved_phase(s.m_phase); flet _is_probing(s.m_is_probing, true); @@ -343,7 +343,7 @@ namespace sat { return false; } SASSERT(!s.inconsistent()); - TRACE("asymm_branch_detail", tout << "assigning: " << l << "\n";); + TRACE(asymm_branch_detail, tout << "assigning: " << l << "\n";); s.assign_scoped(l); s.propagate_core(false); // must not use propagate(), since check_missed_propagation may fail for c return s.inconsistent(); @@ -403,7 +403,7 @@ namespace sat { s.set_conflict(); return false; case 1: - TRACE("asymm_branch", tout << "produced unit clause: " << c[0] << "\n";); + TRACE(asymm_branch, tout << "produced unit clause: " << c[0] << "\n";); s.assign_unit(c[0]); s.propagate_core(false); scoped_d.del_clause(); @@ -433,7 +433,7 @@ namespace sat { } bool asymm_branch::process(clause & c) { - TRACE("asymm_branch_detail", tout << "processing: " << c << "\n";); + TRACE(asymm_branch_detail, tout << "processing: " << c << "\n";); SASSERT(s.scope_lvl() == 0); SASSERT(!s.inconsistent()); diff --git a/src/sat/sat_bcd.cpp b/src/sat/sat_bcd.cpp index 7dd92cf67..2904000bd 100644 --- a/src/sat/sat_bcd.cpp +++ b/src/sat/sat_bcd.cpp @@ -44,7 +44,7 @@ namespace sat { report(bcd& f):f(f) {} ~report() { IF_VERBOSE(1, verbose_stream() << "Decomposed set " << f.m_L.size() << " rest: " << f.m_R.size() << "\n";); - TRACE("sat", + TRACE(sat, tout << "Decomposed set " << f.m_L.size() << "\n"; for (bclause b : f.m_L) tout << b.lit << ": " << *b.cls << "\n"; tout << "Remainder " << f.m_R.size() << "\n"; @@ -90,7 +90,7 @@ namespace sat { m_bin_clauses.push_back(cls); register_clause(cls); } - TRACE("sat", for (clause* cls : m_clauses) if (cls) tout << *cls << "\n";); + TRACE(sat, for (clause* cls : m_clauses) if (cls) tout << *cls << "\n";); } void bcd::register_clause(clause* cls) { @@ -128,7 +128,7 @@ namespace sat { } m_L.append(tmpL); m_R.append(tmpR); - TRACE("bcd", tout << lit << " " << "pos: " << tmpL.size() << " " << "neg: " << tmpR.size() << "\n";); + TRACE(bcd, tout << lit << " " << "pos: " << tmpL.size() << " " << "neg: " << tmpR.size() << "\n";); } void bcd::pure_decompose(use_list& ul, literal lit, svector& clauses) { @@ -239,7 +239,7 @@ namespace sat { } literal bcd::find_blocked(use_list& ul, clause const& cls) { - TRACE("bcd", tout << cls << "\n";); + TRACE(bcd, tout << cls << "\n";); for (literal lit : cls) { m_marked[(~lit).index()] = true; @@ -247,7 +247,7 @@ namespace sat { literal result = null_literal; for (literal lit : cls) { if (is_blocked(ul, lit)) { - TRACE("bcd", tout << "is blocked " << lit << " : " << cls << "\n";); + TRACE(bcd, tout << "is blocked " << lit << " : " << cls << "\n";); result = lit; break; } @@ -342,7 +342,7 @@ namespace sat { } } IF_VERBOSE(0, verbose_stream() << "num merge: " << num_merge << "\n"); - TRACE("sat", uf.display(tout);); + TRACE(sat, uf.display(tout);); } void bcd::cleanup() { diff --git a/src/sat/sat_clause.cpp b/src/sat/sat_clause.cpp index 03ae55092..351a80281 100644 --- a/src/sat/sat_clause.cpp +++ b/src/sat/sat_clause.cpp @@ -178,7 +178,7 @@ namespace sat { size_t size = clause::get_obj_size(num_lits); void * mem = m_allocator.allocate(size); clause * cls = new (mem) clause(m_id_gen.mk(), num_lits, lits, learned); - TRACE("sat_clause", tout << "alloc: " << cls->id() << " " << *cls << " " << (learned?"l":"a") << "\n";); + TRACE(sat_clause, tout << "alloc: " << cls->id() << " " << *cls << " " << (learned?"l":"a") << "\n";); SASSERT(!learned || cls->is_learned()); return cls; } @@ -196,7 +196,7 @@ namespace sat { } void clause_allocator::del_clause(clause * cls) { - TRACE("sat_clause", tout << "delete: " << cls->id() << " " << *cls << "\n";); + TRACE(sat_clause, tout << "delete: " << cls->id() << " " << *cls << "\n";); m_id_gen.recycle(cls->id()); size_t size = clause::get_obj_size(cls->m_capacity); cls->~clause(); diff --git a/src/sat/sat_clause_use_list.h b/src/sat/sat_clause_use_list.h index 6f313a952..14961a223 100644 --- a/src/sat/sat_clause_use_list.h +++ b/src/sat/sat_clause_use_list.h @@ -32,7 +32,7 @@ namespace sat { unsigned m_num_redundant; public: clause_use_list() { - STRACE("clause_use_list_bug", tout << "[cul_created] " << this << "\n";); + STRACE(clause_use_list_bug, tout << "[cul_created] " << this << "\n";); m_size = 0; m_num_redundant = 0; } @@ -52,7 +52,7 @@ namespace sat { bool empty() const { return size() == 0; } void insert(clause & c) { - STRACE("clause_use_list_bug", tout << "[cul_insert] " << this << " " << &c << "\n";); + STRACE(clause_use_list_bug, tout << "[cul_insert] " << this << " " << &c << "\n";); SASSERT(!m_clauses.contains(&c)); SASSERT(!c.was_removed()); m_clauses.push_back(&c); @@ -61,7 +61,7 @@ namespace sat { } void erase_not_removed(clause & c) { - STRACE("clause_use_list_bug", tout << "[cul_erase_not_removed] " << this << " " << &c << "\n";); + STRACE(clause_use_list_bug, tout << "[cul_erase_not_removed] " << this << " " << &c << "\n";); SASSERT(m_clauses.contains(&c)); SASSERT(!c.was_removed()); m_clauses.erase(&c); @@ -70,7 +70,7 @@ namespace sat { } void erase(clause & c) { - STRACE("clause_use_list_bug", tout << "[cul_erase] " << this << " " << &c << "\n";); + STRACE(clause_use_list_bug, tout << "[cul_erase] " << this << " " << &c << "\n";); SASSERT(m_clauses.contains(&c)); // SASSERT(c.was_removed()); m_size--; diff --git a/src/sat/sat_cleaner.cpp b/src/sat/sat_cleaner.cpp index 8da933fb2..20545476d 100644 --- a/src/sat/sat_cleaner.cpp +++ b/src/sat/sat_cleaner.cpp @@ -45,7 +45,7 @@ namespace sat { SASSERT(it->empty()); continue; } - TRACE("cleanup_bug", tout << "processing wlist of " << to_literal(l_idx) << "\n";); + TRACE(cleanup_bug, tout << "processing wlist of " << to_literal(l_idx) << "\n";); watch_list & wlist = *it; watch_list::iterator it2 = wlist.begin(); watch_list::iterator it_prev = it2; @@ -53,7 +53,7 @@ namespace sat { for (; it2 != end2; ++it2) { switch (it2->get_kind()) { case watched::BINARY: - TRACE("cleanup_bug", + TRACE(cleanup_bug, tout << ~to_literal(l_idx) << " " << it2->get_literal() << "\n"; tout << s.value(~to_literal(l_idx)) << " " << s.value(it2->get_literal()) << "\n"; tout << s.was_eliminated(it2->get_literal()) << " " << s.inconsistent() << "\n";); @@ -62,7 +62,7 @@ namespace sat { *it_prev = *it2; ++it_prev; } - TRACE("cleanup_bug", tout << "keeping: " << ~to_literal(l_idx) << " " << it2->get_literal() << "\n";); + TRACE(cleanup_bug, tout << "keeping: " << ~to_literal(l_idx) << " " << it2->get_literal() << "\n";); break; case watched::CLAUSE: // skip @@ -86,9 +86,9 @@ namespace sat { clause_vector::iterator end = cs.end(); for (; it != end; ++it) { clause & c = *(*it); - TRACE("sat_cleaner_bug", tout << "cleaning: " << c << "\n"; + TRACE(sat_cleaner_bug, tout << "cleaning: " << c << "\n"; for (unsigned i = 0; i < c.size(); i++) tout << c[i] << ": " << s.value(c[i]) << "\n";); - CTRACE("sat_cleaner_frozen", c.frozen(), tout << c << "\n";); + CTRACE(sat_cleaner_frozen, c.frozen(), tout << c << "\n";); unsigned sz = c.size(); unsigned i = 0, j = 0; m_cleanup_counter += sz; @@ -108,7 +108,7 @@ namespace sat { } } end_loop: - CTRACE("sat_cleaner_frozen", c.frozen(), + CTRACE(sat_cleaner_frozen, c.frozen(), tout << "sat: " << (i < sz) << ", new_size: " << j << "\n"; tout << mk_lits_pp(j, c.begin()) << "\n";); if (i < sz) { @@ -117,7 +117,7 @@ namespace sat { } else { unsigned new_sz = j; - CTRACE("sat_cleaner_bug", new_sz < 2, tout << "new_sz: " << new_sz << "\n"; + CTRACE(sat_cleaner_bug, new_sz < 2, tout << "new_sz: " << new_sz << "\n"; if (c.size() > 0) tout << "unit: " << c[0] << "\n"; s.display_watches(tout);); switch (new_sz) { @@ -131,7 +131,7 @@ namespace sat { break; case 2: SASSERT(s.value(c[0]) == l_undef && s.value(c[1]) == l_undef); - TRACE("cleanup_bug", tout << "clause became binary: " << c[0] << " " << c[1] << "\n";); + TRACE(cleanup_bug, tout << "clause became binary: " << c[0] << " " << c[1] << "\n";); s.mk_bin_clause(c[0], c[1], c.is_learned()); s.del_clause(c); break; @@ -198,7 +198,7 @@ namespace sat { unsigned trail_sz = s.m_trail.size(); s.propagate(false); // make sure that everything was propagated. - TRACE("sat_cleaner_bug", s.display(tout); s.display_watches(tout);); + TRACE(sat_cleaner_bug, s.display(tout); s.display_watches(tout);); if (s.m_inconsistent) return false; if (m_last_num_units == trail_sz) diff --git a/src/sat/sat_cut_simplifier.cpp b/src/sat/sat_cut_simplifier.cpp index 71a98ba05..0125a7af1 100644 --- a/src/sat/sat_cut_simplifier.cpp +++ b/src/sat/sat_cut_simplifier.cpp @@ -159,7 +159,7 @@ namespace sat { bool force = s.m_config.m_cut_force; report _report(*this); - TRACE("cut_simplifier", s.display(tout);); + TRACE(cut_simplifier, s.display(tout);); unsigned n = 0, i = 0; ++m_stats.m_num_calls; do { @@ -220,7 +220,7 @@ namespace sat { // <=> // ~head = t1 + t2 + .. literal head = ~xors[index]; - TRACE("cut_simplifier", tout << xors << "\n";); + TRACE(cut_simplifier, tout << xors << "\n";); unsigned sz = xors.size() - 1; m_lits.reset(); for (unsigned i = xors.size(); i-- > 0; ) { @@ -342,7 +342,7 @@ namespace sat { void cut_simplifier::assign_equiv(cut const& c, literal u, literal v) { if (u.var() == v.var()) return; IF_VERBOSE(10, verbose_stream() << u << " " << v << " " << c << "\n";); - TRACE("cut_simplifier", tout << u << " == " << v << "\n";); + TRACE(cut_simplifier, tout << u << " == " << v << "\n";); certify_equivalence(u, v, c); validate_eq(u, v); } diff --git a/src/sat/sat_drat.cpp b/src/sat/sat_drat.cpp index 836a76c96..2242b8621 100644 --- a/src/sat/sat_drat.cpp +++ b/src/sat/sat_drat.cpp @@ -180,7 +180,7 @@ namespace sat { } void drat::append(literal l, status st) { - TRACE("sat_drat", pp(tout, st) << " " << l << "\n";); + TRACE(sat_drat, pp(tout, st) << " " << l << "\n";); declare(l); IF_VERBOSE(20, trace(verbose_stream(), 1, &l, st);); @@ -198,7 +198,7 @@ namespace sat { } void drat::append(literal l1, literal l2, status st) { - TRACE("sat_drat", pp(tout, st) << " " << l1 << " " << l2 << "\n";); + TRACE(sat_drat, pp(tout, st) << " " << l1 << " " << l2 << "\n";); declare(l1); declare(l2); literal lits[2] = { l1, l2 }; @@ -230,7 +230,7 @@ namespace sat { } void drat::append(clause& c, status st) { - TRACE("sat_drat", pp(tout, st) << " " << c << "\n";); + TRACE(sat_drat, pp(tout, st) << " " << c << "\n";); for (literal lit : c) declare(lit); unsigned n = c.size(); IF_VERBOSE(20, trace(verbose_stream(), n, c.begin(), st);); @@ -371,7 +371,7 @@ namespace sat { case l_undef: num_undef++; break; } } - CTRACE("sat_drat", num_true == 0 && num_undef == 1, display(tout);); + CTRACE(sat_drat, num_true == 0 && num_undef == 1, display(tout);); VERIFY(num_true != 0 || num_undef != 1); } } @@ -425,7 +425,7 @@ namespace sat { exit(0); UNREACHABLE(); //display(std::cout); - TRACE("sat_drat", + TRACE(sat_drat, tout << literal_vector(n, c) << "\n"; display(tout); s.display(tout);); @@ -545,7 +545,7 @@ namespace sat { void drat::assign(literal l, clause* c) { lbool new_value = l.sign() ? l_false : l_true; lbool old_value = value(l); - // TRACE("sat_drat", tout << "assign " << l << " := " << new_value << " from " << old_value << "\n";); + // TRACE(sat_drat, tout << "assign " << l << " := " << new_value << " from " << old_value << "\n";); switch (old_value) { case l_false: m_inconsistent = true; @@ -578,7 +578,7 @@ namespace sat { watched_clause& wc = m_watched_clauses[idx]; clause& c = *wc.m_clause; - //TRACE("sat_drat", tout << "Propagate " << l << " " << c << " watch: " << wc.m_l1 << " " << wc.m_l2 << "\n";); + //TRACE(sat_drat, tout << "Propagate " << l << " " << c << " watch: " << wc.m_l1 << " " << wc.m_l2 << "\n";); if (wc.m_l1 == ~l) { std::swap(wc.m_l1, wc.m_l2); } diff --git a/src/sat/sat_elim_eqs.cpp b/src/sat/sat_elim_eqs.cpp index 9bd42f1df..8ec2992c9 100644 --- a/src/sat/sat_elim_eqs.cpp +++ b/src/sat/sat_elim_eqs.cpp @@ -70,7 +70,7 @@ namespace sat { } if (l1 != r1 || l2 != r2) { if (r1.index() < r2.index()) { - TRACE("elim_eqs", tout << l1 << " " << l2 << " " << r1 << " " << r2 << "\n";); + TRACE(elim_eqs, tout << l1 << " " << l2 << " " << r1 << " " << r2 << "\n";); m_new_bin.push_back(bin(r1, r2, it->is_learned())); } continue; @@ -101,7 +101,7 @@ namespace sat { clause_vector::iterator end = cs.end(); for (; it != end; ++it) { clause & c = *(*it); - TRACE("sats", tout << "processing: " << c << "\n";); + TRACE(sats, tout << "processing: " << c << "\n";); unsigned sz = c.size(); unsigned i; for (i = 0; i < sz; i++) { @@ -135,10 +135,10 @@ namespace sat { } std::sort(c.begin(), c.end()); for (literal l : c) VERIFY(l == norm(roots, l)); - TRACE("sats", tout << "after normalization/sorting: " << c << "\n"; tout.flush();); + TRACE(sats, tout << "after normalization/sorting: " << c << "\n"; tout.flush();); DEBUG_CODE({ for (literal l : c) { - CTRACE("sat", l != norm(roots, l), tout << l << " " << norm(roots, l) << "\n"; tout.flush();); + CTRACE(sat, l != norm(roots, l), tout << l << " " << norm(roots, l) << "\n"; tout.flush();); SASSERT(l == norm(roots, l)); } }); @@ -165,7 +165,7 @@ namespace sat { c[j] = l; j++; } - TRACE("elim_eqs", tout << "after removing duplicates: " << c << " j: " << j << "\n";); + TRACE(elim_eqs, tout << "after removing duplicates: " << c << " j: " << j << "\n";); if (i < sz) { drat_delete_clause(); @@ -233,7 +233,7 @@ namespace sat { m_solver.m_cut_simplifier->set_root(v, r); bool set_root = m_solver.set_root(l, r); - TRACE("elim_eqs", tout << l << " " << r << "\n";); + TRACE(elim_eqs, tout << l << " " << r << "\n";); if (m_solver.is_assumption(v) || (m_solver.is_external(v) && (m_solver.is_incremental() || !set_root))) { // cannot really eliminate v, since we have to notify extension of future assignments if (m_solver.m_config.m_drat) { @@ -245,7 +245,7 @@ namespace sat { } else { model_converter::entry & e = mc.mk(model_converter::ELIM_VAR, v); - TRACE("save_elim", tout << "marking as deleted: " << v << " l: " << l << " r: " << r << "\n";); + TRACE(save_elim, tout << "marking as deleted: " << v << " l: " << l << " r: " << r << "\n";); m_solver.set_eliminated(v, true); mc.insert(e, ~l, r); mc.insert(e, l, ~r); @@ -256,7 +256,7 @@ namespace sat { bool elim_eqs::check_clause(clause const& c, literal_vector const& roots) const { for (literal l : c) { - CTRACE("elim_eqs_bug", m_solver.was_eliminated(l.var()), tout << "lit: " << l << " " << norm(roots, l) << "\n"; + CTRACE(elim_eqs_bug, m_solver.was_eliminated(l.var()), tout << "lit: " << l << " " << norm(roots, l) << "\n"; tout << c << "\n";); if (m_solver.was_eliminated(l.var())) { IF_VERBOSE(0, verbose_stream() << c << " contains eliminated literal " << l << " " << norm(roots, l) << "\n";); @@ -278,9 +278,9 @@ namespace sat { } void elim_eqs::operator()(literal_vector const & roots, bool_var_vector const & to_elim) { - TRACE("elim_eqs", tout << "before bin cleanup\n"; m_solver.display(tout);); + TRACE(elim_eqs, tout << "before bin cleanup\n"; m_solver.display(tout);); cleanup_bin_watches(roots); - TRACE("elim_eqs", tout << "after bin cleanup\n"; m_solver.display(tout);); + TRACE(elim_eqs, tout << "after bin cleanup\n"; m_solver.display(tout);); cleanup_clauses(roots, m_solver.m_clauses); if (m_solver.inconsistent()) return; cleanup_clauses(roots, m_solver.m_learned); @@ -288,11 +288,11 @@ namespace sat { save_elim(roots, to_elim); m_solver.propagate(false); SASSERT(check_clauses(roots)); - TRACE("elim_eqs", tout << "after full cleanup\n"; m_solver.display(tout);); + TRACE(elim_eqs, tout << "after full cleanup\n"; m_solver.display(tout);); } void elim_eqs::operator()(union_find<>& uf) { - TRACE("elim_eqs", tout << "before union-find bin\n";); + TRACE(elim_eqs, tout << "before union-find bin\n";); literal_vector roots(m_solver.num_vars(), null_literal); bool_var_vector to_elim; for (unsigned i = m_solver.num_vars(); i-- > 0; ) { @@ -301,7 +301,7 @@ namespace sat { if (idx != l1.index()) { roots[i] = to_literal(idx); to_elim.push_back(i); - TRACE("elim_eqs", tout << "remove " << roots[i] << "\n";); + TRACE(elim_eqs, tout << "remove " << roots[i] << "\n";); } else { roots[i] = l1; diff --git a/src/sat/sat_gc.cpp b/src/sat/sat_gc.cpp index a655956db..10e96f243 100644 --- a/src/sat/sat_gc.cpp +++ b/src/sat/sat_gc.cpp @@ -36,7 +36,7 @@ namespace sat { void solver::do_gc() { if (!should_gc()) return; - TRACE("sat", tout << m_conflicts_since_gc << " " << m_gc_threshold << "\n";); + TRACE(sat, tout << m_conflicts_since_gc << " " << m_gc_threshold << "\n";); unsigned gc = m_stats.m_gc_clause; m_conflicts_since_gc = 0; m_gc_threshold += m_config.m_gc_increment; @@ -157,7 +157,7 @@ namespace sat { \brief GC (the second) half of the clauses in the database. */ void solver::gc_half(char const * st_name) { - TRACE("sat", tout << "gc\n";); + TRACE(sat, tout << "gc\n";); unsigned sz = m_learned.size(); unsigned new_sz = sz/2; // std::min(sz/2, m_clauses.size()*2); unsigned j = new_sz; @@ -192,7 +192,7 @@ namespace sat { \brief Use gc based on dynamic psm. Clauses are initially frozen. */ void solver::gc_dyn_psm() { - TRACE("sat", tout << "gc\n";); + TRACE(sat, tout << "gc\n";); // To do gc at scope_lvl() > 0, I will need to use the reinitialization stack, or live with the fact // that I may miss some propagations for reactivated clauses. SASSERT(at_base_lvl()); @@ -213,7 +213,7 @@ namespace sat { double d_tk = V_tk == 0 ? static_cast(num_vars() + 1) : static_cast(h)/static_cast(V_tk); if (d_tk < m_min_d_tk) m_min_d_tk = d_tk; - TRACE("sat_frozen", tout << "m_min_d_tk: " << m_min_d_tk << "\n";); + TRACE(sat_frozen, tout << "m_min_d_tk: " << m_min_d_tk << "\n";); unsigned frozen = 0; unsigned deleted = 0; unsigned activated = 0; @@ -242,7 +242,7 @@ namespace sat { c.unmark_used(); if (psm(c) > static_cast(c.size() * m_min_d_tk)) { // move to frozen; - TRACE("sat_frozen", tout << "freezing size: " << c.size() << " psm: " << psm(c) << " " << c << "\n";); + TRACE(sat_frozen, tout << "freezing size: " << c.size() << " psm: " << psm(c) << " " << c << "\n";); detach_clause(c); c.reset_inact_rounds(); c.freeze(); @@ -284,7 +284,7 @@ namespace sat { // return true if should keep the clause, and false if we should delete it. bool solver::activate_frozen_clause(clause & c) { - TRACE("sat_gc", tout << "reactivating:\n" << c << "\n";); + TRACE(sat_gc, tout << "reactivating:\n" << c << "\n";); SASSERT(at_base_lvl()); // do some cleanup unsigned sz = c.size(); @@ -304,7 +304,7 @@ namespace sat { break; } } - TRACE("sat", tout << "after cleanup:\n" << mk_lits_pp(j, c.begin()) << "\n";); + TRACE(sat, tout << "after cleanup:\n" << mk_lits_pp(j, c.begin()) << "\n";); unsigned new_sz = j; switch (new_sz) { case 0: diff --git a/src/sat/sat_integrity_checker.cpp b/src/sat/sat_integrity_checker.cpp index 6733feac0..dac2345f6 100644 --- a/src/sat/sat_integrity_checker.cpp +++ b/src/sat/sat_integrity_checker.cpp @@ -48,18 +48,18 @@ namespace sat { } } } - TRACE("sat", tout << "clause " << c << " not found in watch-list\n"); - TRACE("sat", s.display_watches(tout)); + TRACE(sat, tout << "clause " << c << " not found in watch-list\n"); + TRACE(sat, s.display_watches(tout)); UNREACHABLE(); return false; } bool integrity_checker::check_clause(clause const & c) const { - CTRACE("sat_bug", c.was_removed(), s.display(tout << "c: " << c.id() << ": " << c << "\n")); + CTRACE(sat_bug, c.was_removed(), s.display(tout << "c: " << c.id() << ": " << c << "\n")); SASSERT(!c.was_removed()); for (unsigned i = 0; i < c.size(); i++) { VERIFY(c[i].var() <= s.num_vars()); - CTRACE("sat_bug", s.was_eliminated(c[i].var()), + CTRACE(sat_bug, s.was_eliminated(c[i].var()), tout << "l: " << c[i].var() << "\n"; tout << "c: " << c << "\n"; s.display(tout);); @@ -84,7 +84,7 @@ namespace sat { // the clause has been satisfied or all other literals are assigned to false. if (!on_prop_stack && s.status(c) != l_true) { for (unsigned i = 2; i < c.size(); i++) { - CTRACE("sat_bug", s.value(c[i]) != l_false, + CTRACE(sat_bug, s.value(c[i]) != l_false, tout << c << " status: " << s.status(c) << "\n"; for (unsigned i = 0; i < c.size(); i++) tout << "val(" << i << "): " << s.value(c[i]) << "\n";); VERIFY(s.value(c[i]) == l_false); @@ -151,7 +151,7 @@ namespace sat { switch (w.get_kind()) { case watched::BINARY: VERIFY(!s.was_eliminated(w.get_literal().var())); - CTRACE("sat_watched_bug", !s.get_wlist(~(w.get_literal())).contains(watched(l, w.is_learned())), + CTRACE(sat_watched_bug, !s.get_wlist(~(w.get_literal())).contains(watched(l, w.is_learned())), tout << "l: " << l << " l2: " << w.get_literal() << "\n"; tout << "was_eliminated1: " << s.was_eliminated(l.var()); tout << " was_eliminated2: " << s.was_eliminated(w.get_literal().var()); @@ -176,7 +176,7 @@ namespace sat { unsigned l_idx = 0; for (watch_list const& wlist : s.m_watches) { literal l = ~to_literal(l_idx++); - CTRACE("sat_bug", + CTRACE(sat_bug, s.was_eliminated(l.var()) && !wlist.empty(), tout << "l: " << l << "\n"; s.display_watches(tout); @@ -203,7 +203,7 @@ namespace sat { } for (clause* cp : s.m_learned) { if (ids.contains(cp->id())) { - TRACE("sat", tout << "Repeated clause: " << cp->id() << "\n";); + TRACE(sat, tout << "Repeated clause: " << cp->id() << "\n";); return false; } } diff --git a/src/sat/sat_local_search.cpp b/src/sat/sat_local_search.cpp index 5cb983baa..2436af280 100644 --- a/src/sat/sat_local_search.cpp +++ b/src/sat/sat_local_search.cpp @@ -261,7 +261,7 @@ namespace sat { void local_search::verify_constraint(constraint const& c) const { uint64_t value = constraint_value(c); IF_VERBOSE(11, display(verbose_stream() << "verify ", c);); - TRACE("sat", display(verbose_stream() << "verify ", c);); + TRACE(sat, display(verbose_stream() << "verify ", c);); if (c.m_k < value) { IF_VERBOSE(0, display(verbose_stream() << "violated constraint: ", c) << "value: " << value << "\n";); } @@ -492,14 +492,14 @@ namespace sat { return l_false; walksat(); - TRACE("sat", tout << m_units << "\n";); + TRACE(sat, tout << m_units << "\n";); // remove unit clauses for (unsigned i = m_units.size(); i-- > num_units; ) { m_vars[m_units[i]].m_unit = false; } m_units.shrink(num_units); - TRACE("sat", display(tout);); + TRACE(sat, display(tout);); lbool result; if (m_is_unsat) { @@ -715,7 +715,7 @@ namespace sat { m_max_steps = std::min(static_cast(20 * num_vars()), static_cast(1 << 17)); // cut steps off at 100K - TRACE("sat", + TRACE(sat, tout << "seed:\t" << m_config.random_seed() << '\n'; tout << "best_known_value:\t" << m_config.best_known_value() << '\n'; tout << "max_steps:\t" << m_max_steps << '\n'; diff --git a/src/sat/sat_lookahead.cpp b/src/sat/sat_lookahead.cpp index 3fef08559..108f1b31f 100644 --- a/src/sat/sat_lookahead.cpp +++ b/src/sat/sat_lookahead.cpp @@ -82,7 +82,7 @@ namespace sat { } void lookahead::add_binary(literal l1, literal l2) { - TRACE("sat", tout << "binary: " << l1 << " " << l2 << "\n";); + TRACE(sat, tout << "binary: " << l1 << " " << l2 << "\n";); SASSERT(l1 != l2); // don't add tautologies and don't add already added binaries if (~l1 == l2) return; @@ -95,7 +95,7 @@ namespace sat { } void lookahead::del_binary(unsigned idx) { - // TRACE("sat", display(tout << "Delete " << to_literal(idx) << "\n");); + // TRACE(sat, display(tout << "Delete " << to_literal(idx) << "\n");); literal_vector & lits = m_binary[idx]; SASSERT(!lits.empty()); literal l = lits.back(); @@ -157,7 +157,7 @@ namespace sat { if (!is_fixed(w)) { if (is_stamped(~w)) { // u \/ v, ~v \/ w, u \/ ~w => u is unit - TRACE("sat", tout << "tc1: " << u << "\n";); + TRACE(sat, tout << "tc1: " << u << "\n";); propagated(u); return false; } @@ -183,14 +183,14 @@ namespace sat { } set_bstamps(~u); if (is_stamped(~v)) { - TRACE("sat", tout << "try_add_binary: " << u << "\n";); + TRACE(sat, tout << "try_add_binary: " << u << "\n";); propagated(u); // u \/ ~v, u \/ v => u is a unit literal } else if (!is_stamped(v) && add_tc1(u, v)) { // u \/ v is not in index set_bstamps(~v); if (is_stamped(~u)) { - TRACE("sat", tout << "try_add_binary: " << v << "\n";); + TRACE(sat, tout << "try_add_binary: " << v << "\n";); propagated(v); // v \/ ~u, u \/ v => v is a unit literal } else if (add_tc1(v, u)) { @@ -258,14 +258,14 @@ namespace sat { } } } - TRACE("sat", display_candidates(tout);); + TRACE(sat, display_candidates(tout);); SASSERT(!m_candidates.empty()); heap_sort(); while (m_candidates.size() > max_num_cand) { m_candidates.pop_back(); } SASSERT(!m_candidates.empty() && m_candidates.size() <= max_num_cand); - TRACE("sat", display_candidates(tout);); + TRACE(sat, display_candidates(tout);); return true; } @@ -342,7 +342,7 @@ namespace sat { } } } - TRACE("sat", display_candidates(tout << "sum: " << sum << "\n");); + TRACE(sat, display_candidates(tout << "sum: " << sum << "\n");); if (skip_candidates > 0) { IF_VERBOSE(1, verbose_stream() << "(sat-lookahead :candidates " << m_candidates.size() << " :skipped " << skip_candidates << ")\n";); } @@ -395,7 +395,7 @@ namespace sat { literal_vector const& lits1 = m_binary[l.index()]; for (literal lit1 : lits1) { if (!is_true(lit1)) { - TRACE("sat", tout << l << " " << lit1 << "\n";); + TRACE(sat, tout << l << " " << lit1 << "\n";); return false; } } @@ -403,7 +403,7 @@ namespace sat { literal_vector const& lits2 = m_binary[l.index()]; for (literal lit2 : lits2) { if (!is_true(lit2)) { - TRACE("sat", tout << l << " " << lit2 << "\n";); + TRACE(sat, tout << l << " " << lit2 << "\n";); return false; } } @@ -651,7 +651,7 @@ namespace sat { if (get_rank(lit) == 0) get_scc(lit); if (get_rank(~lit) == 0) get_scc(~lit); } - TRACE("sat", display_scc(tout);); + TRACE(sat, display_scc(tout);); } void lookahead::init_scc() { inc_bstamp(); @@ -669,7 +669,7 @@ namespace sat { m_rank_max = UINT_MAX; m_active = null_literal; m_settled = null_literal; - TRACE("sat", display_dfs(tout);); + TRACE(sat, display_dfs(tout);); } void lookahead::init_dfs_info(literal l) { unsigned idx = l.index(); @@ -712,7 +712,7 @@ namespace sat { } void lookahead::get_scc(literal v) { - TRACE("scc", tout << v << "\n";); + TRACE(scc, tout << v << "\n";); set_parent(v, null_literal); activate_scc(v); do { @@ -764,7 +764,7 @@ namespace sat { set_link(v, m_settled); m_settled = t; while (t != v) { if (t == ~v) { - TRACE("sat", display_scc(tout << "found contradiction during scc search\n");); + TRACE(sat, display_scc(tout << "found contradiction during scc search\n");); set_conflict(); break; } @@ -850,13 +850,13 @@ namespace sat { literal pp = null_literal; unsigned h = 0; literal w, uu; - TRACE("sat", + TRACE(sat, for (literal u = m_settled; u != null_literal; u = get_link(u)) { tout << u << " "; } tout << "\n";); for (literal u = m_settled; u != null_literal; u = uu) { - TRACE("sat", tout << "process: " << u << "\n";); + TRACE(sat, tout << "process: " << u << "\n";); uu = get_link(u); literal p = get_parent(u); if (p != pp) { @@ -869,7 +869,7 @@ namespace sat { unsigned sz = num_next(~u); for (unsigned j = 0; j < sz; ++j) { literal v = ~get_next(~u, j); - TRACE("sat", tout << "child " << v << " link: " << get_link(v) << "\n";); + TRACE(sat, tout << "child " << v << " link: " << get_link(v) << "\n";); literal pv = get_parent(v); // skip nodes in same equivalence, they will all be processed if (pv == p) continue; @@ -888,10 +888,10 @@ namespace sat { set_child(u, null_literal); set_link(u, v); set_child(w, u); - TRACE("sat", tout << "child(" << w << ") = " << u << " link(" << u << ") = " << v << "\n";); + TRACE(sat, tout << "child(" << w << ") = " << u << " link(" << u << ") = " << v << "\n";); } } - TRACE("sat", + TRACE(sat, display_forest(tout << "forest: ", get_child(null_literal)); tout << "\n"; display_scc(tout); ); @@ -958,7 +958,7 @@ namespace sat { } } SASSERT(2*m_lookahead.size() == offset); - TRACE("sat", for (unsigned i = 0; i < m_lookahead.size(); ++i) + TRACE(sat, for (unsigned i = 0; i < m_lookahead.size(); ++i) tout << m_lookahead[i].m_lit << " : " << m_lookahead[i].m_offset << "\n";); } @@ -1040,7 +1040,7 @@ namespace sat { propagate(); m_qhead = m_trail.size(); m_init_freevars = m_freevars.size(); - TRACE("sat", m_s.display(tout); display(tout);); + TRACE(sat, m_s.display(tout); display(tout);); } void lookahead::copy_clauses(clause_vector const& clauses, bool learned) { @@ -1095,7 +1095,7 @@ namespace sat { --i; literal l = m_trail[i]; set_undef(l); - TRACE("sat", tout << "inserting free var v" << l.var() << "\n";); + TRACE(sat, tout << "inserting free var v" << l.var() << "\n";); m_freevars.insert_fresh(l.var()); } @@ -1163,7 +1163,7 @@ namespace sat { literal l2 = m_wstack[i]; //update_prefix(~lit); //update_prefix(m_wstack[i]); - TRACE("sat", tout << "windfall: " << nlit << " " << l2 << "\n";); + TRACE(sat, tout << "windfall: " << nlit << " " << l2 << "\n";); // if we use try_add_binary, then this may produce new assignments // these assignments get put on m_trail, and they are cleared by // lookahead_backtrack. @@ -1234,7 +1234,7 @@ namespace sat { if (is_fixed(l1)) { if (is_false(l1)) { if (is_false(l2)) { - TRACE("sat", tout << l1 << " " << l2 << " " << "\n";); + TRACE(sat, tout << l1 << " " << l2 << " " << "\n";); set_conflict(); return l_false; } @@ -1270,7 +1270,7 @@ namespace sat { for (binary const& b : m_ternary[(~l).index()]) { if (sz-- == 0) break; // this could create a conflict from propagation, but we complete the transaction. - TRACE("sat", display(tout);); + TRACE(sat, display(tout);); literal l1 = b.m_u; literal l2 = b.m_v; switch (propagate_ternary(l1, l2)) { @@ -1705,7 +1705,7 @@ namespace sat { } } - TRACE("sat", + TRACE(sat, for (literal lit : clauses) { if (lit == null_literal) { tout << "\n"; @@ -1721,7 +1721,7 @@ namespace sat { void lookahead::propagate_binary(literal l) { literal_vector const& lits = m_binary[l.index()]; - TRACE("sat", tout << l << " => " << lits << "\n";); + TRACE(sat, tout << l << " => " << lits << "\n";); for (literal lit : lits) { if (inconsistent()) break; assign(lit); @@ -1732,7 +1732,7 @@ namespace sat { unsigned i = m_qhead; for (; i < m_trail.size() && !inconsistent(); ++i) { literal l = m_trail[i]; - TRACE("sat", tout << "propagate " << l << " @ " << m_level << "\n";); + TRACE(sat, tout << "propagate " << l << " @ " << m_level << "\n";); propagate_binary(l); } while (m_qhead < m_trail.size() && !inconsistent()) { @@ -1741,12 +1741,12 @@ namespace sat { SASSERT(m_qhead == m_trail.size() || (inconsistent() && m_qhead < m_trail.size())); //SASSERT(!missed_conflict()); //VERIFY(!missed_propagation()); - TRACE("sat_verbose", display(tout << scope_lvl() << " " << (inconsistent()?"unsat":"sat") << "\n");); + TRACE(sat_verbose, display(tout << scope_lvl() << " " << (inconsistent()?"unsat":"sat") << "\n");); } void lookahead::compute_lookahead_reward() { - TRACE("sat", display_lookahead(tout); ); + TRACE(sat, display_lookahead(tout); ); m_delta_decrease = pow(m_config.m_delta_rho, 1.0 / (double)m_lookahead.size()); unsigned base = 2; bool change = true; @@ -1775,7 +1775,7 @@ namespace sat { unsat = true; } else { - TRACE("sat", tout << "lookahead: " << lit << " @ " << m_lookahead[i].m_offset << "\n";); + TRACE(sat, tout << "lookahead: " << lit << " @ " << m_lookahead[i].m_offset << "\n";); reset_lookahead_reward(lit); unsigned num_units = push_lookahead1(lit, level); update_lookahead_reward(lit, level); @@ -1788,7 +1788,7 @@ namespace sat { pop_lookahead1(lit, num_units); } if (unsat) { - TRACE("sat", tout << "backtracking and setting " << ~lit << "\n";); + TRACE(sat, tout << "backtracking and setting " << ~lit << "\n";); lookahead_backtrack(); assign(~lit); propagate(); @@ -1821,7 +1821,7 @@ namespace sat { base += 2 * m_lookahead.size(); } lookahead_backtrack(); - TRACE("sat", display_lookahead(tout); ); + TRACE(sat, display_lookahead(tout); ); } literal lookahead::select_literal() { @@ -1838,13 +1838,13 @@ namespace sat { if (mixd == h) ++count; if (mixd > h || (mixd == h && m_s.m_rand(count) == 0)) { - CTRACE("sat", l != null_literal, tout << lit << " mix diff: " << mixd << "\n";); + CTRACE(sat, l != null_literal, tout << lit << " mix diff: " << mixd << "\n";); if (mixd > h) count = 1; h = mixd; l = diff1 < diff2 ? lit : ~lit; } } - TRACE("sat", tout << "selected: " << l << "\n";); + TRACE(sat, tout << "selected: " << l << "\n";); return l; } @@ -1937,7 +1937,7 @@ namespace sat { unsat = push_lookahead2(lit, level); } if (unsat) { - TRACE("sat", tout << "unit: " << ~lit << "\n";); + TRACE(sat, tout << "unit: " << ~lit << "\n";); ++m_stats.m_double_lookahead_propagations; SASSERT(m_level == dl_truth); lookahead_backtrack(); @@ -2007,13 +2007,13 @@ namespace sat { void lookahead::assign(literal l) { SASSERT(m_level > 0); if (is_undef(l)) { - TRACE("sat", tout << "assign: " << l << " @ " << m_level << " " << m_trail_lim.size() << " " << m_search_mode << "\n";); + TRACE(sat, tout << "assign: " << l << " @ " << m_level << " " << m_trail_lim.size() << " " << m_search_mode << "\n";); set_true(l); SASSERT(m_trail.empty() || get_level(m_trail.back()) >= get_level(l)); m_trail.push_back(l); if (m_search_mode == lookahead_mode::searching) { m_stats.m_propagations++; - TRACE("sat", tout << "removing free var v" << l.var() << "\n";); + TRACE(sat, tout << "removing free var v" << l.var() << "\n";); if (l.var() > m_freevars.max_var()) IF_VERBOSE(0, verbose_stream() << "bigger than max-var: " << l << " " << " " << m_freevars.max_var() << "\n";); if (!m_freevars.contains(l.var())) IF_VERBOSE(0, verbose_stream() << "does not contain: " << l << " eliminated: " << m_s.was_eliminated(l.var()) << "\n";); if (m_freevars.contains(l.var())) { m_freevars.remove(l.var()); } @@ -2021,7 +2021,7 @@ namespace sat { } } else if (is_false(l)) { - TRACE("sat", tout << "conflict: " << l << " @ " << m_level << " " << m_search_mode << "\n";); + TRACE(sat, tout << "conflict: " << l << " @ " << m_level << " " << m_search_mode << "\n";); SASSERT(!is_true(l)); validate_assign(l); set_conflict(); @@ -2032,7 +2032,7 @@ namespace sat { assign(l); for (unsigned i = m_trail.size()-1; i < m_trail.size() && !inconsistent(); ++i) { literal l = m_trail[i]; - TRACE("sat", tout << "propagate " << l << " @ " << m_level << "\n";); + TRACE(sat, tout << "propagate " << l << " @ " << m_level << "\n";); propagate_binary(l); } if (m_search_mode == lookahead_mode::lookahead1) { @@ -2058,7 +2058,7 @@ namespace sat { literal_vector trail; m_search_mode = lookahead_mode::searching; while (true) { - TRACE("sat", display(tout);); + TRACE(sat, display(tout);); inc_istamp(); checkpoint(); literal l = choose(); @@ -2069,7 +2069,7 @@ namespace sat { if (l == null_literal) { return l_true; } - TRACE("sat", tout << "choose: " << l << " " << trail << "\n";); + TRACE(sat, tout << "choose: " << l << " " << trail << "\n";); ++m_stats.m_decisions; IF_VERBOSE(1, display_search_string();); push(l, c_fixed_truth); @@ -2165,11 +2165,11 @@ namespace sat { } while (true) { - TRACE("sat", display(tout);); + TRACE(sat, display(tout);); checkpoint(); inc_istamp(); if (inconsistent()) { - TRACE("sat", tout << "inconsistent: " << m_cube_state.m_cube << "\n";); + TRACE(sat, tout << "inconsistent: " << m_cube_state.m_cube << "\n";); m_cube_state.m_freevars_threshold = m_freevars.size(); m_cube_state.m_psat_threshold = m_config.m_cube_cutoff == adaptive_psat_cutoff ? psat_heur() : dbl_max; // MN. only compute PSAT if enabled m_cube_state.inc_conflict(); @@ -2204,7 +2204,7 @@ namespace sat { double prev_psat = m_config.m_cube_cutoff == adaptive_psat_cutoff ? psat_heur() : dbl_max; // MN. only compute PSAT if enabled literal lit = choose(); if (inconsistent()) { - TRACE("sat", tout << "inconsistent: " << m_cube_state.m_cube << "\n";); + TRACE(sat, tout << "inconsistent: " << m_cube_state.m_cube << "\n";); m_cube_state.m_freevars_threshold = prev_nfreevars; m_cube_state.m_psat_threshold = prev_psat; m_cube_state.inc_conflict(); @@ -2220,7 +2220,7 @@ namespace sat { init_model(); return m_freevars.empty() ? l_true : l_undef; } - TRACE("sat", tout << "choose: " << lit << " cube: " << m_cube_state.m_cube << "\n";); + TRACE(sat, tout << "choose: " << lit << " cube: " << m_cube_state.m_cube << "\n";); SASSERT(vars.empty() || vars.contains(lit.var())); ++m_stats.m_decisions; push(lit, c_fixed_truth); diff --git a/src/sat/sat_lookahead.h b/src/sat/sat_lookahead.h index 784293461..31192fa28 100644 --- a/src/sat/sat_lookahead.h +++ b/src/sat/sat_lookahead.h @@ -438,7 +438,7 @@ namespace sat { void set_min(literal v, literal u) { m_dfs[v.index()].m_min = u; } void set_rank(literal v, unsigned r) { m_dfs[v.index()].m_rank = r; } void set_height(literal v, unsigned h) { m_dfs[v.index()].m_height = h; } - void set_parent(literal v, literal p) { TRACE("scc", tout << v << " <- " << p << "\n";); m_dfs[v.index()].m_parent = p; } + void set_parent(literal v, literal p) { TRACE(scc, tout << v << " <- " << p << "\n";); m_dfs[v.index()].m_parent = p; } void set_vcomp(literal v, literal u) { m_dfs[v.index()].m_vcomp = u; } void get_scc(literal v); void activate_scc(literal l); @@ -532,7 +532,7 @@ namespace sat { unsigned do_double(literal l, unsigned& base); unsigned double_look(literal l, unsigned& base); - void set_conflict() { TRACE("sat", tout << "conflict\n";); m_inconsistent = true; } + void set_conflict() { TRACE(sat, tout << "conflict\n";); m_inconsistent = true; } bool inconsistent() const { return m_inconsistent; } unsigned scope_lvl() const { return m_trail_lim.size(); } diff --git a/src/sat/sat_lut_finder.cpp b/src/sat/sat_lut_finder.cpp index 60143f91c..0e683eade 100644 --- a/src/sat/sat_lut_finder.cpp +++ b/src/sat/sat_lut_finder.cpp @@ -115,7 +115,7 @@ namespace sat { m_removed_clauses.append(m_clauses_to_remove); bool_var v; uint64_t lut = convert_combination(m_vars, v); - TRACE("aig_simplifier", + TRACE(aig_simplifier, for (clause* cp : m_clauses_to_remove) { tout << *cp << "\n" << v << ": " << m_vars << "\n"; } diff --git a/src/sat/sat_model_converter.cpp b/src/sat/sat_model_converter.cpp index fa5720ede..2560e7e45 100644 --- a/src/sat/sat_model_converter.cpp +++ b/src/sat/sat_model_converter.cpp @@ -116,7 +116,7 @@ namespace sat { bool undef = false; for (literal const& l : e.m_clauses) { if (l == null_literal) { - CTRACE("sat", !sat, + CTRACE(sat, !sat, tout << "exposed: " << m_exposed_lim << "\n"; if (m_solver) m_solver->display(tout); display(tout); @@ -159,7 +159,7 @@ namespace sat { if (l == null_literal) { // end of clause if (!sat) { - TRACE("sat_model_bug", tout << "failed eliminated: " << mk_lits_pp(static_cast(it - itbegin), itbegin) << "\n";); + TRACE(sat_model_bug, tout << "failed eliminated: " << mk_lits_pp(static_cast(it - itbegin), itbegin) << "\n";); (void)itbegin; ok = false; } @@ -223,7 +223,7 @@ namespace sat { for (literal l : c) e.m_clauses.push_back(l); e.m_clauses.push_back(null_literal); add_elim_stack(e); - TRACE("sat_mc_bug", tout << "adding: " << c << "\n";); + TRACE(sat_mc_bug, tout << "adding: " << c << "\n";); } void model_converter::insert(entry & e, literal l1, literal l2) { @@ -234,7 +234,7 @@ namespace sat { e.m_clauses.push_back(l2); e.m_clauses.push_back(null_literal); add_elim_stack(e); - TRACE("sat_mc_bug", tout << "adding (binary): " << l1 << " " << l2 << "\n";); + TRACE(sat_mc_bug, tout << "adding (binary): " << l1 << " " << l2 << "\n";); } void model_converter::insert(entry & e, clause_wrapper const & c) { @@ -246,7 +246,7 @@ namespace sat { e.m_clauses.push_back(c[i]); e.m_clauses.push_back(null_literal); add_elim_stack(e); - // TRACE("sat_mc_bug", tout << "adding (wrapper): "; for (literal l : c) tout << l << " "; tout << "\n";); + // TRACE(sat_mc_bug, tout << "adding (wrapper): "; for (literal l : c) tout << l << " "; tout << "\n";); } void model_converter::insert(entry & e, literal_vector const& c) { @@ -256,7 +256,7 @@ namespace sat { for (literal l : c) e.m_clauses.push_back(l); e.m_clauses.push_back(null_literal); add_elim_stack(e); - TRACE("sat_mc_bug", tout << "adding: " << c << "\n";); + TRACE(sat_mc_bug, tout << "adding: " << c << "\n";); } @@ -274,7 +274,7 @@ namespace sat { SASSERT(it2->var() != it->var()); if (it2->var() == it->var()) return false; for (literal l : it2->m_clauses) { - CTRACE("sat_model_converter", l.var() == it->var(), tout << "var: " << it->var() << "\n"; display(tout);); + CTRACE(sat_model_converter, l.var() == it->var(), tout << "var: " << it->var() << "\n"; display(tout);); SASSERT(l.var() != it->var()); VERIFY(l == null_literal || l.var() < num_vars); if (it2->var() == it->var()) return false; diff --git a/src/sat/sat_mus.cpp b/src/sat/sat_mus.cpp index 5b7542cb2..c6ca56405 100644 --- a/src/sat/sat_mus.cpp +++ b/src/sat/sat_mus.cpp @@ -35,7 +35,7 @@ namespace sat { m_mus.append(m_core); s.m_core.reset(); s.m_core.append(m_mus); - TRACE("sat", tout << "new core: " << s.m_core << "\n";); + TRACE(sat, tout << "new core: " << s.m_core << "\n";); } void mus::update_model() { @@ -56,7 +56,7 @@ namespace sat { lbool mus::mus1() { bool minimize_partial = s.m_config.m_core_minimize_partial; - TRACE("sat", tout << "old core: " << s.get_core() << "\n";); + TRACE(sat, tout << "old core: " << s.get_core() << "\n";); literal_vector& core = get_core(); literal_vector& mus = m_mus; if (!minimize_partial && core.size() > 64) { @@ -66,7 +66,7 @@ namespace sat { IF_VERBOSE(1, verbose_stream() << "(sat.mus num-to-process: " << core.size() << " mus: " << mus.size(); if (minimize_partial) verbose_stream() << " max-restarts: " << m_max_num_restarts; verbose_stream() << ")\n";); - TRACE("sat", + TRACE(sat, tout << "core: " << core << "\n"; tout << "mus: " << mus << "\n";); @@ -88,7 +88,7 @@ namespace sat { scoped_append _sa(mus, core); mus.push_back(~lit); is_sat = s.check(mus.size(), mus.data()); - TRACE("sat", tout << "mus: " << mus << "\n";); + TRACE(sat, tout << "mus: " << mus << "\n";); } IF_VERBOSE(1, verbose_stream() << "(sat.mus " << is_sat << ")\n";); switch (is_sat) { @@ -115,7 +115,7 @@ namespace sat { IF_VERBOSE(3, verbose_stream() << "(sat.mus unit reduction, literal is in both cores " << lit << ")\n";); } else { - TRACE("sat", tout << "core: " << new_core << " mus: " << mus << "\n";); + TRACE(sat, tout << "core: " << new_core << " mus: " << mus << "\n";); core.reset(); for (unsigned i = 0; i < new_core.size(); ++i) { literal lit = new_core[i]; diff --git a/src/sat/sat_probing.cpp b/src/sat/sat_probing.cpp index ee30d0644..604e8ff6c 100644 --- a/src/sat/sat_probing.cpp +++ b/src/sat/sat_probing.cpp @@ -82,13 +82,13 @@ namespace sat { else { m_to_assert.reset(); s.push(); - TRACE("sat", tout << "probing " << l << "\n";); + TRACE(sat, tout << "probing " << l << "\n";); s.assign_scoped(l); m_counter--; unsigned old_tr_sz = s.m_trail.size(); s.propagate(false); if (s.inconsistent()) { - TRACE("sat", tout << "probe failed: " << ~l << "\n";); + TRACE(sat, tout << "probe failed: " << ~l << "\n";); // ~l must be true s.drat_explain_conflict(); s.pop(1); @@ -121,19 +121,19 @@ namespace sat { } void probing::process_core(bool_var v) { - TRACE("probing", tout << "processing: " << v << " counter: " << -m_counter << "\n";); + TRACE(probing, tout << "processing: " << v << " counter: " << -m_counter << "\n";); SASSERT(s.m_qhead == s.m_trail.size()); SASSERT(s.value(v) == l_undef); m_counter--; s.push(); literal l(v, false); s.assign_scoped(l); - TRACE("sat", tout << "probing " << l << "\n";); + TRACE(sat, tout << "probing " << l << "\n";); unsigned old_tr_sz = s.m_trail.size(); s.propagate(false); if (s.inconsistent()) { // ~l must be true - TRACE("sat", tout << "probe failed: " << ~l << "\n"; + TRACE(sat, tout << "probe failed: " << ~l << "\n"; s.display(tout);); s.drat_explain_conflict(); s.pop(1); diff --git a/src/sat/sat_proof_trim.cpp b/src/sat/sat_proof_trim.cpp index 7531da99f..e04bb69fe 100644 --- a/src/sat/sat_proof_trim.cpp +++ b/src/sat/sat_proof_trim.cpp @@ -65,7 +65,7 @@ namespace sat { } void proof_trim::del(literal_vector const& cl, clause* cp) { - CTRACE("sat", cp, tout << "del " << *cp << "\n"); + CTRACE(sat, cp, tout << "del " << *cp << "\n"); if (cp) s.detach_clause(*cp); else @@ -314,7 +314,7 @@ namespace sat { clause* proof_trim::del(literal_vector const& cl) { clause* cp = nullptr; - TRACE("sat", tout << "del: " << cl << "\n"); + TRACE(sat, tout << "del: " << cl << "\n"); if (cl.size() == 2) { s.detach_bin_clause(cl[0], cl[1], true); return cp; @@ -325,7 +325,7 @@ namespace sat { auto& [clauses, id, in_core] = e->get_data().m_value; if (!clauses.empty()) { cp = clauses.back(); - TRACE("sat", tout << "del: " << *cp << "\n"); + TRACE(sat, tout << "del: " << *cp << "\n"); s.detach_clause(*cp); clauses.pop_back(); } diff --git a/src/sat/sat_scc.cpp b/src/sat/sat_scc.cpp index c21f67ce5..c6302594d 100644 --- a/src/sat/sat_scc.cpp +++ b/src/sat/sat_scc.cpp @@ -136,7 +136,7 @@ namespace sat { // visited all successors if (lowlink[l_idx] == index[l_idx]) { // found new SCC - CTRACE("scc_cycle", s.back() != l_idx, { + CTRACE(scc_cycle, s.back() != l_idx, { tout << "cycle: "; unsigned j = s.size() - 1; unsigned l2_idx; @@ -153,7 +153,7 @@ namespace sat { bool_var v = l.var(); if (roots[v] != null_literal) { // variable was already assigned... just consume stack - TRACE("scc_detail", tout << "consuming stack...\n";); + TRACE(scc_detail, tout << "consuming stack...\n";); unsigned l2_idx; do { l2_idx = s.back(); @@ -164,7 +164,7 @@ namespace sat { } else { // check if the SCC has an external variable, and check for conflicts - TRACE("scc_detail", tout << "assigning roots...\n";); + TRACE(scc_detail, tout << "assigning roots...\n";); literal r = null_literal; unsigned j = s.size() - 1; unsigned l2_idx; @@ -186,7 +186,7 @@ namespace sat { r = to_literal(l_idx); } - TRACE("scc_detail", tout << "r: " << r << "\n";); + TRACE(scc_detail, tout << "r: " << r << "\n";); do { l2_idx = s.back(); @@ -228,23 +228,23 @@ namespace sat { return 0; CASSERT("scc_bug", m_solver.check_invariant()); report rpt(*this); - TRACE("scc", m_solver.display(tout);); - TRACE("scc_details", m_solver.display_watches(tout);); + TRACE(scc, m_solver.display(tout);); + TRACE(scc_details, m_solver.display_watches(tout);); literal_vector roots; bool_var_vector to_elim; if (!extract_roots(roots, to_elim)) return 0; - TRACE("scc", for (unsigned i = 0; i < roots.size(); i++) { tout << i << " -> " << roots[i] << "\n"; } + TRACE(scc, for (unsigned i = 0; i < roots.size(); i++) { tout << i << " -> " << roots[i] << "\n"; } tout << "to_elim: "; for (unsigned v : to_elim) tout << v << " "; tout << "\n";); m_num_elim += to_elim.size(); elim_eqs eliminator(m_solver); eliminator(roots, to_elim); - TRACE("scc_detail", m_solver.display(tout);); + TRACE(scc_detail, m_solver.display(tout);); CASSERT("scc_bug", m_solver.check_invariant()); if (m_scc_tr) reduce_tr(); - TRACE("scc_detail", m_solver.display(tout);); + TRACE(scc_detail, m_solver.display(tout);); return to_elim.size(); } diff --git a/src/sat/sat_simplifier.cpp b/src/sat/sat_simplifier.cpp index 289afdd75..39d01981b 100644 --- a/src/sat/sat_simplifier.cpp +++ b/src/sat/sat_simplifier.cpp @@ -135,7 +135,7 @@ namespace sat { } m_sub_todo.erase(c); c.set_removed(true); - TRACE("sat_simplifier", tout << "del_clause: " << c << "\n";); + TRACE(sat_simplifier, tout << "del_clause: " << c << "\n";); m_need_cleanup = true; m_use_list.erase(c); } @@ -180,7 +180,7 @@ namespace sat { m_sub_bin_todo.reset(); m_elim_todo.reset(); init_visited(); - TRACE("after_cleanup", s.display(tout);); + TRACE(after_cleanup, s.display(tout);); CASSERT("sat_solver", s.check_invariant()); } @@ -194,10 +194,10 @@ namespace sat { initialize(); CASSERT("sat_solver", s.check_invariant()); - TRACE("sat_simplifier", s.display(tout);); + TRACE(sat_simplifier, s.display(tout);); s.m_cleaner(true); - TRACE("after_cleanup", s.display(tout);); + TRACE(after_cleanup, s.display(tout);); CASSERT("sat_solver", s.check_invariant()); m_need_cleanup = false; m_use_list.init(s.num_vars()); @@ -243,7 +243,7 @@ namespace sat { bool vars_eliminated = m_num_elim_vars > m_old_num_elim_vars; if (m_need_cleanup || vars_eliminated) { - TRACE("after_simplifier", tout << "cleanning watches...\n";); + TRACE(after_simplifier, tout << "cleanning watches...\n";); cleanup_watches(); move_clauses(s.m_learned, true); move_clauses(s.m_clauses, false); @@ -252,7 +252,7 @@ namespace sat { } CASSERT("sat_solver", s.check_invariant()); - TRACE("sat_simplifier", s.display(tout); tout << "model_converter:\n"; s.m_mc.display(tout);); + TRACE(sat_simplifier, s.display(tout); tout << "model_converter:\n"; s.m_mc.display(tout);); finalize(); } @@ -301,7 +301,7 @@ namespace sat { } void simplifier::cleanup_clauses(clause_vector & cs, bool learned, bool vars_eliminated) { - TRACE("sat", tout << "cleanup_clauses\n";); + TRACE(sat, tout << "cleanup_clauses\n";); clause_vector::iterator it = cs.begin(); clause_vector::iterator it2 = it; clause_vector::iterator end = cs.end(); @@ -428,7 +428,7 @@ namespace sat { clause_use_list const & cs = m_use_list.get(target); for (auto it = cs.mk_iterator(); !it.at_end(); it.next()) { clause & c2 = it.curr(); - CTRACE("sat_simplifier", c2.was_removed(), tout << "clause has been removed:\n" << c2 << "\n";); + CTRACE(sat_simplifier, c2.was_removed(), tout << "clause has been removed:\n" << c2 << "\n";); SASSERT(!c2.was_removed()); if (&c2 != &c1 && c1.size() <= c2.size() && @@ -470,16 +470,16 @@ namespace sat { if (c1.is_learned() && !c2.is_learned()) { s.set_learned(c1, false); } - TRACE("subsumption", tout << c1 << " subsumed " << c2 << "\n";); + TRACE(subsumption, tout << c1 << " subsumed " << c2 << "\n";); remove_clause(c2, false); m_num_subsumed++; } else if (!c2.was_removed()) { // subsumption resolution - TRACE("subsumption_resolution", tout << c1 << " sub-ref(" << *l_it << ") " << c2 << "\n";); + TRACE(subsumption_resolution, tout << c1 << " sub-ref(" << *l_it << ") " << c2 << "\n";); elim_lit(c2, *l_it); m_num_sub_res++; - TRACE("subsumption_resolution", tout << "result: " << c2 << "\n";); + TRACE(subsumption_resolution, tout << "result: " << c2 << "\n";); } if (s.inconsistent()) break; @@ -570,7 +570,7 @@ namespace sat { // c2 was subsumed if (c1.is_learned() && !c2.is_learned()) s.set_learned(c1, false); - TRACE("subsumption", tout << c1 << " subsumed " << c2 << "\n";); + TRACE(subsumption, tout << c1 << " subsumed " << c2 << "\n";); remove_clause(c2, false); m_num_subsumed++; } @@ -672,7 +672,7 @@ namespace sat { } void simplifier::elim_lit(clause & c, literal l) { - TRACE("elim_lit", tout << "processing: " << l << " @ " << c << "\n";); + TRACE(elim_lit, tout << "processing: " << l << " @ " << c << "\n";); m_need_cleanup = true; m_num_elim_lits++; insert_elim_todo(l.var()); @@ -694,31 +694,31 @@ namespace sat { unsigned sz0 = c.size(); if (cleanup_clause(c)) { // clause was satisfied - TRACE("elim_lit", tout << "clause was satisfied\n";); + TRACE(elim_lit, tout << "clause was satisfied\n";); remove_clause(c, true); return; } unsigned sz = c.size(); switch (sz) { case 0: - TRACE("elim_lit", tout << "clause is empty\n";); + TRACE(elim_lit, tout << "clause is empty\n";); s.set_conflict(); break; case 1: - TRACE("elim_lit", tout << "clause became unit: " << c[0] << "\n";); + TRACE(elim_lit, tout << "clause became unit: " << c[0] << "\n";); c.restore(sz0); propagate_unit(c[0]); // unit propagation removes c break; case 2: - TRACE("elim_lit", tout << "clause became binary: " << c[0] << " " << c[1] << "\n";); + TRACE(elim_lit, tout << "clause became binary: " << c[0] << " " << c[1] << "\n";); c.restore(sz0); s.mk_bin_clause(c[0], c[1], c.is_learned()); m_sub_bin_todo.push_back(bin_clause(c[0], c[1], c.is_learned())); remove_clause(c, sz0 != sz); break; default: - TRACE("elim_lit", tout << "result: " << c << "\n";); + TRACE(elim_lit, tout << "result: " << c << "\n";); m_sub_todo.insert(c); break; } @@ -742,7 +742,7 @@ namespace sat { back_subsumption1(c); if (w.is_learned() && !c.is_learned()) { SASSERT(wlist[j] == w); - TRACE("set_not_learned_bug", + TRACE(set_not_learned_bug, tout << "marking as not learned: " << l2 << " " << wlist[j].is_learned() << "\n";); wlist[j].set_learned(false); mark_as_not_learned_core(get_wlist(~l2), l); @@ -806,7 +806,7 @@ namespace sat { continue; } if (it->get_literal() == last_lit) { - TRACE("subsumption", tout << "eliminating: " << ~to_literal(l_idx) + TRACE(subsumption, tout << "eliminating: " << ~to_literal(l_idx) << " " << it->get_literal() << "\n";); elim++; } @@ -850,9 +850,9 @@ namespace sat { subsumption_report rpt(*this); elim_dup_bins(); subsume_with_binaries(); - TRACE("subsumption_bug", s.display(tout);); + TRACE(subsumption_bug, s.display(tout);); while (true) { - TRACE("subsumption", tout << "sub_todo size: " << m_sub_todo.size() << "\n";); + TRACE(subsumption, tout << "sub_todo size: " << m_sub_todo.size() << "\n";); m_sub_counter -= m_sub_bin_todo.size(); while (!m_sub_bin_todo.empty()) { @@ -869,7 +869,7 @@ namespace sat { checkpoint(); - TRACE("subsumption_bug", s.display(tout);); + TRACE(subsumption_bug, s.display(tout);); if (m_sub_todo.empty()) { m_last_sub_trail_sz = s.m_trail.size(); @@ -883,7 +883,7 @@ namespace sat { c.unmark_strengthened(); m_sub_counter--; - TRACE("subsumption", tout << "next: " << c << "\n";); + TRACE(subsumption, tout << "next: " << c << "\n";); if (s.m_trail.size() > m_last_sub_trail_sz) { unsigned sz0 = c.size(); if (cleanup_clause(c)) { @@ -901,7 +901,7 @@ namespace sat { // unit propagation removes c continue; case 2: - TRACE("subsumption", tout << "clause became binary: " << c << "\n";); + TRACE(subsumption, tout << "clause became binary: " << c << "\n";); s.mk_bin_clause(c[0], c[1], c.is_learned()); m_sub_bin_todo.push_back(bin_clause(c[0], c[1], c.is_learned())); c.restore(sz0); @@ -911,7 +911,7 @@ namespace sat { break; } } - TRACE("subsumption", tout << "using: " << c << "\n";); + TRACE(subsumption, tout << "using: " << c << "\n";); back_subsumption1(c); } } @@ -1584,7 +1584,7 @@ namespace sat { } void block_covered_clause(clause& c, literal l, model_converter::kind k) { - TRACE("blocked_clause", tout << "new blocked clause: " << c << "\n";); + TRACE(blocked_clause, tout << "new blocked clause: " << c << "\n";); SASSERT(!s.is_external(l)); model_converter::entry& new_entry = m_mc.mk(k, l.var()); for (literal lit : c) { @@ -1599,7 +1599,7 @@ namespace sat { SASSERT(!s.is_external(blocked)); model_converter::entry& new_entry = m_mc.mk(k, blocked.var()); literal l2 = w.get_literal(); - TRACE("blocked_clause", tout << "new blocked clause: " << l2 << " " << l1 << "\n";); + TRACE(blocked_clause, tout << "new blocked clause: " << l2 << " " << l1 << "\n";); s.set_learned(l1, l2); m_mc.insert(new_entry, m_covered_clause); m_mc.set_clause(new_entry, l1, l2); @@ -1716,7 +1716,7 @@ namespace sat { }; void simplifier::elim_blocked_clauses() { - TRACE("blocked_clause_bug", tout << "trail: " << s.m_trail.size() << "\n"; s.display_watches(tout); s.display(tout);); + TRACE(blocked_clause_bug, tout << "trail: " << s.m_trail.size() << "\n"; s.display_watches(tout); s.display(tout);); blocked_cls_report rpt(*this); blocked_clause_elim elim(*this, m_blocked_clause_limit, s.m_mc, m_use_list, s.m_watches); elim(); @@ -1740,7 +1740,7 @@ namespace sat { unsigned num_bin_pos = num_nonlearned_bin(pos_l); unsigned num_bin_neg = num_nonlearned_bin(neg_l); unsigned cost = 2 * num_pos * num_neg + num_pos * num_bin_neg + num_neg * num_bin_pos; - CTRACE("sat_simplifier", cost == 0, tout << v << " num_pos: " << num_pos << " num_neg: " << num_neg << " num_bin_pos: " << num_bin_pos + CTRACE(sat_simplifier, cost == 0, tout << v << " num_pos: " << num_pos << " num_neg: " << num_neg << " num_bin_pos: " << num_bin_pos << " num_bin_neg: " << num_bin_neg << " cost: " << cost << "\n";); return cost; } @@ -1765,7 +1765,7 @@ namespace sat { } m_elim_todo.reset(); std::stable_sort(tmp.begin(), tmp.end(), bool_var_and_cost_lt()); - TRACE("sat_simplifier", + TRACE(sat_simplifier, for (auto& p : tmp) tout << "(" << p.first << ", " << p.second << ") "; tout << "\n";); for (auto& p : tmp) @@ -1803,7 +1803,7 @@ namespace sat { Return false if the result is a tautology */ bool simplifier::resolve(clause_wrapper const & c1, clause_wrapper const & c2, literal l, literal_vector & r) { - CTRACE("resolve_bug", !c1.contains(l) || !c2.contains(~l), tout << c1 << "\n" << c2 << "\nl: " << l << "\n";); + CTRACE(resolve_bug, !c1.contains(l) || !c2.contains(~l), tout << c1 << "\n" << c2 << "\nl: " << l << "\n";); if (m_visited.size() <= 2*s.num_vars()) m_visited.resize(2*s.num_vars(), false); if (c1.was_removed() && !c1.contains(l)) @@ -1873,7 +1873,7 @@ namespace sat { watch_list::iterator end2 = wlist2.end(); for (; it2 != end2; ++it2) { if (it2->is_binary_clause() && it2->get_literal() == l) { - TRACE("bin_clause_bug", tout << "removing: " << l << " " << it2->get_literal() << "\n";); + TRACE(bin_clause_bug, tout << "removing: " << l << " " << it2->get_literal() << "\n";); m_sub_bin_todo.erase(bin_clause(l2, l, it2->is_learned())); continue; } @@ -1884,7 +1884,7 @@ namespace sat { m_sub_bin_todo.erase(bin_clause(l, l2, w.is_learned())); } } - TRACE("bin_clause_bug", tout << "collapsing watch_list of: " << l << "\n";); + TRACE(bin_clause_bug, tout << "collapsing watch_list of: " << l << "\n";); wlist.finalize(); } @@ -1903,7 +1903,7 @@ namespace sat { c.set_removed(true); m_use_list.erase(c, l); m_sub_todo.erase(c); - TRACE("sat_simplifier", tout << "del_clause (elim_var): " << c << "\n";); + TRACE(sat_simplifier, tout << "del_clause (elim_var): " << c << "\n";); m_need_cleanup = true; } } @@ -1922,7 +1922,7 @@ namespace sat { unsigned num_pos = pos_occs.num_irredundant() + num_bin_pos; unsigned num_neg = neg_occs.num_irredundant() + num_bin_neg; - TRACE("sat_simplifier", tout << v << " num_pos: " << num_pos << " neg_pos: " << num_neg << "\n";); + TRACE(sat_simplifier, tout << v << " num_pos: " << num_pos << " neg_pos: " << num_neg << "\n";); if (num_pos >= m_res_occ_cutoff && num_neg >= m_res_occ_cutoff) return false; @@ -1939,7 +1939,7 @@ namespace sat { before_lits += it.curr().size(); } - TRACE("sat_simplifier", tout << v << " num_pos: " << num_pos << " neg_pos: " << num_neg << " before_lits: " << before_lits << "\n";); + TRACE(sat_simplifier, tout << v << " num_pos: " << num_pos << " neg_pos: " << num_neg << " before_lits: " << before_lits << "\n";); if (num_pos >= m_res_occ_cutoff3 && num_neg >= m_res_occ_cutoff3 && before_lits > m_res_lit_cutoff3 && s.m_clauses.size() > m_res_cls_cutoff2) return false; @@ -1955,24 +1955,24 @@ namespace sat { collect_clauses(pos_l, m_pos_cls); collect_clauses(neg_l, m_neg_cls); - TRACE("sat_simplifier", tout << "collecting number of after_clauses\n";); + TRACE(sat_simplifier, tout << "collecting number of after_clauses\n";); unsigned before_clauses = num_pos + num_neg; unsigned after_clauses = 0; for (clause_wrapper& c1 : m_pos_cls) { for (clause_wrapper& c2 : m_neg_cls) { m_new_cls.reset(); if (resolve(c1, c2, pos_l, m_new_cls)) { - TRACE("sat_simplifier", tout << c1 << "\n" << c2 << "\n-->\n"; + TRACE(sat_simplifier, tout << c1 << "\n" << c2 << "\n-->\n"; for (literal l : m_new_cls) tout << l << " "; tout << "\n";); after_clauses++; if (after_clauses > before_clauses) { - TRACE("sat_simplifier", tout << "too many after clauses: " << after_clauses << "\n";); + TRACE(sat_simplifier, tout << "too many after clauses: " << after_clauses << "\n";); return false; } } } } - TRACE("sat_simplifier", tout << "eliminate " << v << ", before: " << before_clauses << " after: " << after_clauses << "\n"; + TRACE(sat_simplifier, tout << "eliminate " << v << ", before: " << before_clauses << " after: " << after_clauses << "\n"; tout << "pos\n"; for (auto & c : m_pos_cls) tout << c << "\n"; @@ -2000,7 +2000,7 @@ namespace sat { m_new_cls.reset(); if (!resolve(c1, c2, pos_l, m_new_cls)) continue; - TRACE("sat_simplifier", tout << c1 << "\n" << c2 << "\n-->\n" << m_new_cls << "\n";); + TRACE(sat_simplifier, tout << c1 << "\n" << c2 << "\n-->\n" << m_new_cls << "\n";); if (cleanup_clause(m_new_cls)) { continue; // clause is already satisfied. } diff --git a/src/sat/sat_solver.cpp b/src/sat/sat_solver.cpp index ba3ed2e3a..4011b27ca 100644 --- a/src/sat/sat_solver.cpp +++ b/src/sat/sat_solver.cpp @@ -90,9 +90,9 @@ namespace sat { solver::~solver() { m_ext = nullptr; SASSERT(m_config.m_num_threads > 1 || m_trim || rlimit().is_canceled() || check_invariant()); - CTRACE("sat", !m_clauses.empty(), tout << "Delete clauses\n";); + CTRACE(sat, !m_clauses.empty(), tout << "Delete clauses\n";); del_clauses(m_clauses); - CTRACE("sat", !m_learned.empty(), tout << "Delete learned\n";); + CTRACE(sat, !m_learned.empty(), tout << "Delete learned\n";); del_clauses(m_learned); dealloc(m_cuber); m_cuber = nullptr; @@ -346,7 +346,7 @@ namespace sat { DEBUG_CODE({ for (unsigned i = 0; i < num_lits; i++) { - CTRACE("sat", was_eliminated(lits[i]), tout << lits[i] << " was eliminated\n";); + CTRACE(sat, was_eliminated(lits[i]), tout << lits[i] << " was eliminated\n";); SASSERT(!was_eliminated(lits[i])); } }); @@ -412,12 +412,12 @@ namespace sat { clause * solver::mk_clause_core(unsigned num_lits, literal * lits, sat::status st) { bool redundant = st.is_redundant(); - TRACE("sat", tout << "mk_clause: " << mk_lits_pp(num_lits, lits) << (redundant?" learned":" aux") << "\n";); + TRACE(sat, tout << "mk_clause: " << mk_lits_pp(num_lits, lits) << (redundant?" learned":" aux") << "\n";); bool logged = false; if (!redundant || !st.is_sat()) { unsigned old_sz = num_lits; bool keep = m_trim || simplify_clause(num_lits, lits); - TRACE("sat_mk_clause", tout << "mk_clause (after simp), keep: " << keep << "\n" << mk_lits_pp(num_lits, lits) << "\n";); + TRACE(sat_mk_clause, tout << "mk_clause (after simp), keep: " << keep << "\n" << mk_lits_pp(num_lits, lits) << "\n";); if (!keep) { return nullptr; // clause is equivalent to true. } @@ -472,7 +472,7 @@ namespace sat { } watched* w0 = redundant ? find_binary_watch(get_wlist(~l1), l2) : nullptr; if (w0 && !m_trim) { - TRACE("sat", tout << "found binary " << l1 << " " << l2 << "\n";); + TRACE(sat, tout << "found binary " << l1 << " " << l2 << "\n";); if (w0->is_learned() && !redundant) { w0->set_learned(false); w0 = find_binary_watch(get_wlist(~l2), l1); @@ -532,13 +532,13 @@ namespace sat { void solver::push_reinit_stack(clause & c) { SASSERT(!at_base_lvl()); - TRACE("sat_reinit", tout << "adding to reinit stack: " << c << "\n";); + TRACE(sat_reinit, tout << "adding to reinit stack: " << c << "\n";); m_clauses_to_reinit.push_back(clause_wrapper(c)); c.set_reinit_stack(true); } void solver::push_reinit_stack(literal l1, literal l2) { - TRACE("sat_reinit", tout << "adding to reinit stack: " << l1 << " " << l2 << "\n";); + TRACE(sat_reinit, tout << "adding to reinit stack: " << l1 << " " << l2 << "\n";); m_clauses_to_reinit.push_back(clause_wrapper(l1, l2)); } @@ -802,7 +802,7 @@ namespace sat { unsigned num_lits = cls.size(); for (unsigned i = 1; i < num_lits; i++) { literal l = cls[i]; - CTRACE("sat", value(l) != l_false, tout << l << ":=" << value(l);); + CTRACE(sat, value(l) != l_false, tout << l << ":=" << value(l);); SASSERT(value(l) == l_false); if (max_false_idx == UINT_MAX || lvl(l) > lvl(cls[max_false_idx])) max_false_idx = i; @@ -877,13 +877,13 @@ namespace sat { m_inconsistent = true; m_conflict = c; m_not_l = not_l; - TRACE("sat", display(display_justification(tout << "conflict " << not_l << " ", c) << "\n")); + TRACE(sat, display(display_justification(tout << "conflict " << not_l << " ", c) << "\n")); } void solver::assign_core(literal l, justification j) { SASSERT(value(l) == l_undef); SASSERT(!m_trail.contains(l) && !m_trail.contains(~l)); - TRACE("sat_assign_core", tout << l << " " << j << "\n";); + TRACE(sat_assign_core, tout << l << " " << j << "\n";); if (j.level() == 0) { if (m_config.m_drat) drat_log_unit(l, j); @@ -1015,7 +1015,7 @@ namespace sat { bool keep; unsigned curr_level = lvl(l); - TRACE("sat_propagate", tout << "propagating: " << l << "@" << curr_level << " " << m_justification[l.var()] << "\n"; ); + TRACE(sat_propagate, tout << "propagating: " << l << "@" << curr_level << " " << m_justification[l.var()] << "\n"; ); literal not_l = ~l; SASSERT(value(l) == l_true); @@ -1052,7 +1052,7 @@ namespace sat { break; case watched::CLAUSE: { if (value(it->get_blocked_literal()) == l_true) { - TRACE("propagate_clause_bug", tout << "blocked literal " << it->get_blocked_literal() << "\n"; + TRACE(propagate_clause_bug, tout << "blocked literal " << it->get_blocked_literal() << "\n"; tout << get_clause(it) << "\n";); *it2 = *it; it2++; @@ -1060,10 +1060,10 @@ namespace sat { } clause_offset cls_off = it->get_clause_offset(); clause& c = get_clause(cls_off); - TRACE("propagate_clause_bug", tout << "processing... " << c << "\nwas_removed: " << c.was_removed() << "\n";); + TRACE(propagate_clause_bug, tout << "processing... " << c << "\nwas_removed: " << c.was_removed() << "\n";); if (c[0] == not_l) std::swap(c[0], c[1]); - CTRACE("propagate_bug", c[1] != not_l, tout << "l: " << l << " " << c << "\n";); + CTRACE(propagate_bug, c[1] != not_l, tout << "l: " << l << " " << c << "\n";); if (c.was_removed() || c.size() == 1 || c[1] != not_l) { @@ -1267,8 +1267,8 @@ namespace sat { propagate(false); if (check_inconsistent()) return l_false; if (m_config.m_force_cleanup) do_cleanup(true); - TRACE("sat", display(tout);); - TRACE("before_search", display(tout);); + TRACE(sat, display(tout);); + TRACE(before_search, display(tout);); if (m_config.m_gc_burst) { // force gc @@ -1283,7 +1283,7 @@ namespace sat { if (m_config.m_max_conflicts == 0) { IF_VERBOSE(SAT_VB_LVL, verbose_stream() << "(sat \"abort: max-conflicts = 0\")\n";); - TRACE("sat", display(tout); m_mc.display(tout);); + TRACE(sat, display(tout); m_mc.display(tout);); return l_undef; } @@ -1662,7 +1662,7 @@ namespace sat { if (num_vars() == 0) return null_bool_var; next = m_rand() % num_vars(); - TRACE("random_split", tout << "next: " << next << " value(next): " << value(next) << "\n";); + TRACE(random_split, tout << "next: " << next << " value(next): " << value(next) << "\n";); if (value(next) == l_undef && !was_eliminated(next)) return next; } @@ -1730,7 +1730,7 @@ namespace sat { push(); m_stats.m_decision++; - CTRACE("sat", m_best_phase[next] != guess(next), tout << "phase " << phase << " " << m_best_phase[next] << " " << guess(next) << "\n"); + CTRACE(sat, m_best_phase[next] != guess(next), tout << "phase " << phase << " " << m_best_phase[next] << " " << guess(next) << "\n"); if (phase == l_undef) phase = guess(next) ? l_true: l_false; @@ -1754,7 +1754,7 @@ namespace sat { if (!is_pos) next_lit.neg(); - TRACE("sat_decide", tout << scope_lvl() << ": next-case-split: " << next_lit << "\n";); + TRACE(sat_decide, tout << scope_lvl() << ": next-case-split: " << next_lit << "\n";); assign_scoped(next_lit); return true; } @@ -1845,7 +1845,7 @@ namespace sat { if (inconsistent()) return; - TRACE("sat", + TRACE(sat, tout << literal_vector(num_lits, lits) << "\n"; if (!m_user_scope_literals.empty()) tout << "user literals: " << m_user_scope_literals << "\n"; @@ -1894,7 +1894,7 @@ namespace sat { pop_to_base_level(); push(); reset_assumptions(); - TRACE("sat", tout << "reassert: " << m_min_core << "\n";); + TRACE(sat, tout << "reassert: " << m_min_core << "\n";); for (literal lit : m_min_core) { SASSERT(is_external(lit.var())); add_assumption(lit); @@ -1906,7 +1906,7 @@ namespace sat { void solver::reinit_assumptions() { if (tracking_assumptions() && at_base_lvl() && !inconsistent()) { - TRACE("sat", tout << "assumptions: " << m_assumptions << " user scopes: " << m_user_scope_literals << "\n";); + TRACE(sat, tout << "assumptions: " << m_assumptions << " user scopes: " << m_user_scope_literals << "\n";); if (!propagate(false)) return; push(); for (literal lit : m_user_scope_literals) { @@ -1921,7 +1921,7 @@ namespace sat { if (!inconsistent()) propagate(false); - TRACE("sat", + TRACE(sat, tout << "consistent: " << !inconsistent() << "\n"; for (literal a : m_assumptions) { index_set s; @@ -2006,7 +2006,7 @@ namespace sat { m_mc.init_search(*this); if (m_ext) m_ext->init_search(); - TRACE("sat", display(tout);); + TRACE(sat, display(tout);); } bool solver::should_simplify() const { @@ -2022,7 +2022,7 @@ namespace sat { log_stats(); m_simplifications++; - TRACE("sat", tout << "simplify\n";); + TRACE(sat, tout << "simplify\n";); pop(scope_lvl()); struct report { @@ -2152,7 +2152,7 @@ namespace sat { m_best_phase[v] = value(v) == l_true; } } - TRACE("sat_mc_bug", m_mc.display(tout);); + TRACE(sat_mc_bug, m_mc.display(tout);); #if 0 IF_VERBOSE(2, for (bool_var v = 0; v < num; v++) verbose_stream() << v << ": " << m_model[v] << "\n";); @@ -2184,7 +2184,7 @@ namespace sat { throw solver_exception("check model failed"); } - TRACE("sat", for (bool_var v = 0; v < num; v++) tout << v << ": " << m_model[v] << "\n";); + TRACE(sat, for (bool_var v = 0; v < num; v++) tout << v << ": " << m_model[v] << "\n";); if (m_clone) { IF_VERBOSE(1, verbose_stream() << "\"checking model (on original set of clauses)\"\n";); @@ -2202,7 +2202,7 @@ namespace sat { clause const & c = *cp; if (!c.satisfied_by(m)) { IF_VERBOSE(1, verbose_stream() << "failed clause " << c.id() << ": " << c << "\n";); - TRACE("sat", tout << "failed: " << c << "\n"; + TRACE(sat, tout << "failed: " << c << "\n"; tout << "assumptions: " << m_assumptions << "\n"; tout << "trail: " << m_trail << "\n"; tout << "model: " << m << "\n"; @@ -2227,7 +2227,7 @@ namespace sat { if (value_at(l2, m) != l_true) { IF_VERBOSE(1, verbose_stream() << "failed binary: " << l << " := " << value_at(l, m) << " " << l2 << " := " << value_at(l2, m) << "\n"); IF_VERBOSE(1, verbose_stream() << "elim l1: " << was_eliminated(l.var()) << " elim l2: " << was_eliminated(l2) << "\n"); - TRACE("sat", m_mc.display(tout << "failed binary: " << l << " " << l2 << "\n");); + TRACE(sat, m_mc.display(tout << "failed binary: " << l << " " << l2 << "\n");); ok = false; } } @@ -2238,7 +2238,7 @@ namespace sat { if (value_at(l, m) != l_true) { VERIFY(is_external(l.var())); IF_VERBOSE(1, verbose_stream() << "assumption: " << l << " does not model check " << value_at(l, m) << "\n";); - TRACE("sat", + TRACE(sat, tout << l << " does not model check\n"; tout << "trail: " << m_trail << "\n"; tout << "model: " << m << "\n"; @@ -2257,7 +2257,7 @@ namespace sat { bool ok = check_clauses(m); if (ok && !m_mc.check_model(m)) { ok = false; - TRACE("sat", tout << "model: " << m << "\n"; m_mc.display(tout);); + TRACE(sat, tout << "model: " << m << "\n"; m_mc.display(tout);); IF_VERBOSE(0, verbose_stream() << "model check failed\n"); } return ok; @@ -2349,9 +2349,9 @@ namespace sat { } log_stats(); } - TRACE("sat", tout << "restart " << restart_level(to_base) << "\n";); + TRACE(sat, tout << "restart " << restart_level(to_base) << "\n";); IF_VERBOSE(30, display_status(verbose_stream());); - TRACE("sat", tout << "restart " << restart_level(to_base) << "\n";); + TRACE(sat, tout << "restart " << restart_level(to_base) << "\n";); pop_reinit(restart_level(to_base)); set_next_restart(); } @@ -2446,7 +2446,7 @@ namespace sat { if (m_conflict_lvl <= 1 && (!m_assumptions.empty() || !m_ext_assumption_set.empty() || !m_user_scope_literals.empty())) { - TRACE("sat", tout << "unsat core\n";); + TRACE(sat, tout << "unsat core\n";); resolve_conflict_for_unsat_core(); return l_false; } @@ -2455,7 +2455,7 @@ namespace sat { drat_explain_conflict(); if (m_config.m_drat) drat_log_clause(0, nullptr, sat::status::redundant()); - TRACE("sat", tout << "conflict level is 0\n";); + TRACE(sat, tout << "conflict level is 0\n";); return l_false; } @@ -2464,7 +2464,7 @@ namespace sat { // that only get triggered after decisions. if (allow_backtracking() && unique_max && !m_force_conflict_analysis) { - TRACE("sat", tout << "unique max " << js << " " << m_not_l << "\n";); + TRACE(sat, tout << "unique max " << js << " " << m_not_l << "\n";); pop_reinit(m_scope_lvl - m_conflict_lvl + 1); m_force_conflict_analysis = true; ++m_stats.m_backtracks; @@ -2494,7 +2494,7 @@ namespace sat { // save space for first uip m_lemma.push_back(null_literal); - TRACE("sat_conflict_detail", + TRACE(sat_conflict_detail, tout << "resolve: " << m_not_l << " " << " js: " << js << " idx: " << idx @@ -2504,13 +2504,13 @@ namespace sat { unsigned num_marks = 0; literal consequent = null_literal; if (m_not_l != null_literal) { - TRACE("sat_conflict_detail", tout << "not_l: " << m_not_l << "\n";); + TRACE(sat_conflict_detail, tout << "not_l: " << m_not_l << "\n";); process_antecedent(m_not_l, num_marks); consequent = ~m_not_l; } do { - TRACE("sat_conflict_detail", tout << "processing consequent: " << consequent << " @" << (consequent==null_literal?m_conflict_lvl:lvl(consequent)) << "\n"; + TRACE(sat_conflict_detail, tout << "processing consequent: " << consequent << " @" << (consequent==null_literal?m_conflict_lvl:lvl(consequent)) << "\n"; tout << "num_marks: " << num_marks << "\n"; display_justification(tout, js) << "\n";); @@ -2540,7 +2540,7 @@ namespace sat { } case justification::EXT_JUSTIFICATION: { fill_ext_antecedents(consequent, js, false); - TRACE("sat", tout << "ext antecedents: " << m_ext_antecedents << "\n";); + TRACE(sat, tout << "ext antecedents: " << m_ext_antecedents << "\n";); for (literal l : m_ext_antecedents) process_antecedent(l, num_marks); break; @@ -2560,12 +2560,12 @@ namespace sat { } SASSERT(lvl(c_var) < m_conflict_lvl); } - CTRACE("sat", idx == 0, + CTRACE(sat, idx == 0, tout << "conflict level " << m_conflict_lvl << "\n"; for (literal lit : m_trail) if (is_marked(lit.var())) tout << "missed " << lit << "@" << lvl(lit) << "\n";); - CTRACE("sat", idx == 0, display(tout);); + CTRACE(sat, idx == 0, display(tout);); if (idx == 0) IF_VERBOSE(0, verbose_stream() << "num-conflicts: " << m_stats.m_conflict << "\n"); VERIFY(idx > 0); @@ -2577,7 +2577,7 @@ namespace sat { num_marks--; reset_mark(c_var); - TRACE("sat", display_justification(tout << consequent << " ", js) << "\n";); + TRACE(sat, display_justification(tout << consequent << " ", js) << "\n";); } while (num_marks > 0); @@ -2588,7 +2588,7 @@ namespace sat { } void solver::learn_lemma_and_backjump() { - TRACE("sat_lemma", tout << "new lemma size: " << m_lemma.size() << "\n" << m_lemma << "\n";); + TRACE(sat_lemma, tout << "new lemma size: " << m_lemma.size() << "\n" << m_lemma << "\n";); if (m_lemma.empty()) { pop_reinit(m_scope_lvl); @@ -2601,7 +2601,7 @@ namespace sat { reset_lemma_var_marks(); if (m_config.m_dyn_sub_res) dyn_sub_res(); - TRACE("sat_lemma", tout << "new lemma (after minimization) size: " << m_lemma.size() << "\n" << m_lemma << "\n";); + TRACE(sat_lemma, tout << "new lemma (after minimization) size: " << m_lemma.size() << "\n" << m_lemma << "\n";); } else { reset_lemma_var_marks(); @@ -2619,7 +2619,7 @@ namespace sat { backtrack_lvl = backjump_lvl; for (unsigned i = m_lemma.size(); i-- > 1;) { if (lvl(m_lemma[i]) == backjump_lvl) { - TRACE("sat", tout << "swap " << m_lemma[0] << "@" << lvl(m_lemma[0]) << m_lemma[1] << "@" << backjump_lvl << "\n";); + TRACE(sat, tout << "swap " << m_lemma[0] << "@" << lvl(m_lemma[0]) << m_lemma[1] << "@" << backjump_lvl << "\n";); std::swap(m_lemma[i], m_lemma[0]); break; } @@ -2638,7 +2638,7 @@ namespace sat { pop_reinit(num_scopes); } else { - TRACE("sat", tout << "backtrack " << (m_scope_lvl - backtrack_lvl + 1) << " scopes\n";); + TRACE(sat, tout << "backtrack " << (m_scope_lvl - backtrack_lvl + 1) << " scopes\n";); ++m_stats.m_backtracks; pop_reinit(m_scope_lvl - backtrack_lvl + 1); } @@ -2650,7 +2650,7 @@ namespace sat { m_par->share_clause(*this, *lemma); } m_lemma.reset(); - TRACE("sat_conflict_detail", tout << "consistent " << (!m_inconsistent) << " scopes: " << scope_lvl() << " backtrack: " << backtrack_lvl << " backjump: " << backjump_lvl << "\n";); + TRACE(sat_conflict_detail, tout << "consistent " << (!m_inconsistent) << " scopes: " << scope_lvl() << " backtrack: " << backtrack_lvl << " backjump: " << backjump_lvl << "\n";); decay_activity(); updt_phase_counters(); } @@ -2668,7 +2668,7 @@ namespace sat { void solver::process_antecedent_for_unsat_core(literal antecedent) { bool_var var = antecedent.var(); SASSERT(var < num_vars()); - TRACE("sat", tout << antecedent << " " << (is_marked(var)?"+":"-") << "\n";); + TRACE(sat, tout << antecedent << " " << (is_marked(var)?"+":"-") << "\n";); if (!is_marked(var)) { mark(var); m_unmark.push_back(var); @@ -2679,7 +2679,7 @@ namespace sat { } void solver::process_consequent_for_unsat_core(literal consequent, justification const& js) { - TRACE("sat", tout << "processing consequent: "; + TRACE(sat, tout << "processing consequent: "; if (consequent == null_literal) tout << "null\n"; else tout << consequent << "\n"; display_justification(tout << "js kind: ", js) << "\n";); @@ -2722,7 +2722,7 @@ namespace sat { } void solver::resolve_conflict_for_unsat_core() { - TRACE("sat_verbose", display(tout); + TRACE(sat_verbose, display(tout); unsigned level = 0; for (literal l : m_trail) { if (level != lvl(l)) { @@ -2755,7 +2755,7 @@ namespace sat { literal consequent = m_not_l; if (m_not_l != null_literal) { justification js = m_justification[m_not_l.var()]; - TRACE("sat", tout << "not_l: " << m_not_l << "\n"; + TRACE(sat, tout << "not_l: " << m_not_l << "\n"; display_justification(tout, js) << "\n";); process_antecedent_for_unsat_core(m_not_l); @@ -2818,7 +2818,7 @@ namespace sat { if (not_l != null_literal) { level = lvl(not_l); } - TRACE("sat", tout << "level " << not_l << " is " << level << " " << js << "\n"); + TRACE(sat, tout << "level " << not_l << " is " << level << " " << js << "\n"); switch (js.get_kind()) { case justification::NONE: @@ -2842,7 +2842,7 @@ namespace sat { UNREACHABLE(); break; } - TRACE("sat", tout << "max-level " << level << " " << unique_max << "\n"); + TRACE(sat, tout << "max-level " << level << " " << unique_max << "\n"); return level; } @@ -2869,7 +2869,7 @@ namespace sat { bool_var var = antecedent.var(); unsigned var_lvl = lvl(var); SASSERT(var < num_vars()); - TRACE("sat_verbose", tout << "process " << var << "@" << var_lvl << " marked " << is_marked(var) << " conflict " << m_conflict_lvl << "\n";); + TRACE(sat_verbose, tout << "process " << var << "@" << var_lvl << " marked " << is_marked(var) << " conflict " << m_conflict_lvl << "\n";); if (!is_marked(var) && var_lvl > 0) { mark(var); switch (m_config.m_branching_heuristic) { @@ -2917,7 +2917,7 @@ namespace sat { unsigned sz = m_trail.size(); for (unsigned i = head; i < sz; i++) { bool_var v = m_trail[i].var(); - TRACE("forget_phase", tout << "forgetting phase of v" << v << "\n";); + TRACE(forget_phase, tout << "forgetting phase of v" << v << "\n";); m_phase[v] = m_rand() % 2 == 0; } if (is_sat_phase() && head >= m_best_phase_size) { @@ -3229,7 +3229,7 @@ namespace sat { UNREACHABLE(); break; } - TRACE("sat_conflict", + TRACE(sat_conflict, display_justification(tout << var << " ",js) << "\n";); } return true; @@ -3496,7 +3496,7 @@ namespace sat { void solver::push() { SASSERT(!m_ext || !m_ext->can_propagate()); SASSERT(!inconsistent()); - TRACE("sat_verbose", tout << "q:" << m_qhead << " trail: " << m_trail.size() << "\n";); + TRACE(sat_verbose, tout << "q:" << m_qhead << " trail: " << m_trail.size() << "\n";); SASSERT(m_qhead == m_trail.size()); m_scopes.push_back(scope()); scope & s = m_scopes.back(); @@ -3568,7 +3568,7 @@ namespace sat { cleanup_watch(literal(v, true)); } - TRACE("sat", + TRACE(sat, tout << "clauses to reinit: " << (m_clauses_to_reinit.size() - old_sz) << "\n"; tout << "new level: " << new_lvl << "\n"; tout << "vars to reinit: " << m_vars_to_reinit << "\n"; @@ -3654,7 +3654,7 @@ namespace sat { DEBUG_CODE(for (literal l : m_trail) SASSERT(lvl(l.var()) <= new_lvl);); m_qhead = m_trail.size(); if (!m_replay_assign.empty()) IF_VERBOSE(20, verbose_stream() << "replay assign: " << m_replay_assign.size() << "\n"); - CTRACE("sat", !m_replay_assign.empty(), tout << "replay-assign: " << m_replay_assign << "\n";); + CTRACE(sat, !m_replay_assign.empty(), tout << "replay-assign: " << m_replay_assign << "\n";); for (unsigned i = m_replay_assign.size(); i-- > 0; ) { literal lit = m_replay_assign[i]; SASSERT(value(lit) == l_true); @@ -3710,7 +3710,7 @@ namespace sat { m_cut_simplifier = nullptr; // for simplicity, wipe it out if (m_ext) m_ext->user_push(); - TRACE("sat", tout << "user_push: " << lit << "\n";); + TRACE(sat, tout << "user_push: " << lit << "\n";); } void solver::user_pop(unsigned num_scopes) { @@ -3725,7 +3725,7 @@ namespace sat { m_ext->user_pop(num_scopes); gc_vars(max_var); - TRACE("sat", display(tout);); + TRACE(sat, display(tout);); m_qhead = 0; unsigned j = 0; @@ -3859,7 +3859,7 @@ namespace sat { literal l2 = w.get_literal(); if (l.index() > l2.index()) continue; - TRACE("cleanup_bug", tout << "collected: " << l << " " << l2 << "\n";); + TRACE(cleanup_bug, tout << "collected: " << l << " " << l2 << "\n";); r.push_back(bin_clause(l, l2)); } } @@ -4121,7 +4121,7 @@ namespace sat { if (c.frozen()) continue; if (is_empty(c) || is_unit(c)) { - TRACE("sat_missed_prop", tout << "missed_propagation: " << c << "\n"; + TRACE(sat_missed_prop, tout << "missed_propagation: " << c << "\n"; for (literal l : c) tout << l << ": " << value(l) << "\n";); UNREACHABLE(); } @@ -4355,16 +4355,16 @@ namespace sat { void solver::fixup_consequence_core() { index_set s; - TRACE("sat", tout << m_core << "\n";); + TRACE(sat, tout << m_core << "\n";); for (unsigned i = 0; i < m_core.size(); ++i) { - TRACE("sat", tout << m_core[i] << ": "; display_index_set(tout, m_antecedents.find(m_core[i].var())) << "\n";); + TRACE(sat, tout << m_core[i] << ": "; display_index_set(tout, m_antecedents.find(m_core[i].var())) << "\n";); s |= m_antecedents.find(m_core[i].var()); } m_core.reset(); for (unsigned idx : s) { m_core.push_back(to_literal(idx)); } - TRACE("sat", tout << m_core << "\n";); + TRACE(sat, tout << m_core << "\n";); } bool solver::reached_max_conflicts() { @@ -4385,7 +4385,7 @@ namespace sat { for (bool_var v : vars) { unfixed_vars.insert(v); } - TRACE("sat", tout << asms << "\n";); + TRACE(sat, tout << asms << "\n";); m_antecedents.reset(); pop_to_base_level(); if (inconsistent()) return l_false; @@ -4438,7 +4438,7 @@ namespace sat { } lbool solver::get_consequences(literal_vector const& asms, literal_vector const& lits, vector& conseq) { - TRACE("sat", tout << asms << "\n";); + TRACE(sat, tout << asms << "\n";); m_antecedents.reset(); literal_set unfixed_lits(lits), assumptions(asms); bool_var_set unfixed_vars; @@ -4489,7 +4489,7 @@ namespace sat { propagate(false); while (inconsistent()) { if (!resolve_conflict()) { - TRACE("sat", display(tout << "inconsistent\n");); + TRACE(sat, display(tout << "inconsistent\n");); m_inconsistent = false; is_sat = l_undef; break; @@ -4516,7 +4516,7 @@ namespace sat { } } if (is_sat == l_false) { - TRACE("sat", tout << "unsat\n";); + TRACE(sat, tout << "unsat\n";); m_inconsistent = false; } if (is_sat == l_true) { @@ -4576,7 +4576,7 @@ namespace sat { void solver::extract_fixed_consequences(literal_set const& unfixed_lits, literal_set const& assumptions, bool_var_set& unfixed_vars, vector& conseq) { for (literal lit: unfixed_lits) { - TRACE("sat", tout << "extract: " << lit << " " << value(lit) << " " << lvl(lit) << "\n";); + TRACE(sat, tout << "extract: " << lit << " " << value(lit) << " " << lvl(lit) << "\n";); if (lvl(lit) <= 1 && value(lit) == l_true) { extract_fixed_consequences(lit, assumptions, unfixed_vars, conseq); } @@ -4597,7 +4597,7 @@ namespace sat { bool solver::extract_assumptions(literal lit, index_set& s) { justification js = m_justification[lit.var()]; - TRACE("sat", tout << lit << " " << js << "\n";); + TRACE(sat, tout << lit << " " << js << "\n";); bool all_found = true; switch (js.get_kind()) { case justification::NONE: @@ -4635,7 +4635,7 @@ namespace sat { UNREACHABLE(); break; } - TRACE("sat", display_index_set(tout << lit << ": " , s) << "\n";); + TRACE(sat, display_index_set(tout << lit << ": " , s) << "\n";); return all_found; } diff --git a/src/sat/sat_solver.h b/src/sat/sat_solver.h index 5b96cc1b8..da81c15c7 100644 --- a/src/sat/sat_solver.h +++ b/src/sat/sat_solver.h @@ -395,7 +395,7 @@ namespace sat { unsigned trail_size() const { return m_trail.size(); } literal scope_literal(unsigned n) const { return m_trail[m_scopes[n].m_trail_lim]; } void assign(literal l, justification j) { - TRACE("sat_assign", tout << l << " previous value: " << value(l) << " j: " << j << "\n";); + TRACE(sat_assign, tout << l << " previous value: " << value(l) << " j: " << j << "\n";); switch (value(l)) { case l_false: set_conflict(j, ~l); break; case l_undef: assign_core(l, j); break; @@ -418,7 +418,7 @@ namespace sat { bool limit_reached() { if (!m_rlimit.inc()) { m_model_is_current = false; - TRACE("sat", tout << "canceled\n";); + TRACE(sat, tout << "canceled\n";); m_reason_unknown = "sat.canceled"; return true; } diff --git a/src/sat/sat_solver/inc_sat_solver.cpp b/src/sat/sat_solver/inc_sat_solver.cpp index adea6eec1..f74e0fca1 100644 --- a/src/sat/sat_solver/inc_sat_solver.cpp +++ b/src/sat/sat_solver/inc_sat_solver.cpp @@ -213,7 +213,7 @@ public: } } - TRACE("sat", tout << _assumptions << "\n";); + TRACE(sat, tout << _assumptions << "\n";); m_dep2asm.reset(); lbool r = internalize_formulas(); if (r != l_true) return r; @@ -366,7 +366,7 @@ public: ast_manager& get_manager() const override { return m; } void assert_expr_core(expr * t) override { - TRACE("goal2sat", tout << mk_pp(t, m) << "\n";); + TRACE(goal2sat, tout << mk_pp(t, m) << "\n";); m_is_cnf &= is_clause(t); m_fmls.push_back(t); } @@ -488,7 +488,7 @@ public: lbool get_consequences_core(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector& conseq) override { init_preprocess(); - TRACE("sat", tout << assumptions << "\n" << vars << "\n";); + TRACE(sat, tout << assumptions << "\n" << vars << "\n";); sat::literal_vector asms; sat::bool_var_vector bvars; vector lconseq; @@ -513,7 +513,7 @@ public: // the consequences that cover them. u_map bool_var2conseq; for (unsigned i = 0; i < lconseq.size(); ++i) { - TRACE("sat", tout << lconseq[i] << "\n";); + TRACE(sat, tout << lconseq[i] << "\n";); bool_var2conseq.insert(lconseq[i][0].var(), i); } @@ -607,7 +607,7 @@ public: m_cached_mc = m_mcs.back(); m_cached_mc = concat(solver::get_model_converter().get(), m_cached_mc.get()); m_cached_mc = concat(m_cached_mc.get(), m_sat_mc.get()); - TRACE("sat", m_cached_mc->display(tout);); + TRACE(sat, m_cached_mc->display(tout);); return m_cached_mc; } else { @@ -627,7 +627,7 @@ public: s2g(m_solver, m_map, m_params, g, m_sat_mc); m_internalized_fmls.reset(); g.get_formulas(m_internalized_fmls); - TRACE("sat", m_solver.display(tout); tout << m_internalized_fmls << "\n";); + TRACE(sat, m_solver.display(tout); tout << m_internalized_fmls << "\n";); m_internalized_converted = true; } @@ -738,7 +738,7 @@ private: m_has_uninterpreted = true; std::stringstream strm; strm << "(sat.giveup interpreted functions sent to SAT solver " << funs <<")"; - TRACE("sat", tout << strm.str() << "\n";); + TRACE(sat, tout << strm.str() << "\n";); IF_VERBOSE(1, verbose_stream() << strm.str() << "\n";); set_reason_unknown(strm.str()); return l_undef; @@ -771,7 +771,7 @@ private: throw default_exception("generation of proof objects is not supported in this mode"); } SASSERT(!g->proofs_enabled()); - TRACE("sat", m_solver.display(tout); g->display(tout);); + TRACE(sat, m_solver.display(tout); g->display(tout);); try { if (m_is_cnf) { @@ -785,7 +785,7 @@ private: catch (tactic_exception & ex) { IF_VERBOSE(1, verbose_stream() << "exception in tactic " << ex.what() << "\n";); set_reason_unknown(ex.what()); - TRACE("sat", tout << "exception: " << ex.what() << "\n";); + TRACE(sat, tout << "exception: " << ex.what() << "\n";); m_preprocess = nullptr; m_bb_rewriter = nullptr; return l_undef; @@ -803,7 +803,7 @@ private: g = m_subgoals[0]; m_pc = g->pc(); m_mcs.set(m_mcs.size()-1, concat(m_mcs.back(), g->mc())); - TRACE("sat", g->display_with_dependencies(tout);); + TRACE(sat, g->display_with_dependencies(tout);); // ensure that if goal is already internalized, then import mc from m_solver. @@ -881,12 +881,12 @@ private: bvars.push_back(b); } } - CTRACE("sat", internalized, tout << "var: " << bvars << "\n";); + CTRACE(sat, internalized, tout << "var: " << bvars << "\n";); } else if (is_uninterp_const(v) && bvutil.is_bv(v)) { // variable does not occur in assertions, so is unconstrained. } - CTRACE("sat", !internalized, tout << "unhandled variable " << mk_pp(v, m) << "\n";); + CTRACE(sat, !internalized, tout << "unhandled variable " << mk_pp(v, m) << "\n";); return internalized; } @@ -907,7 +907,7 @@ private: } } else { - TRACE("sat", tout << "variable is not bound " << mk_pp(v, m) << "\n";); + TRACE(sat, tout << "variable is not bound " << mk_pp(v, m) << "\n";); return false; } } @@ -1021,7 +1021,7 @@ private: } } } - CTRACE("sat", m_dep2asm.size() != m_asms.size(), + CTRACE(sat, m_dep2asm.size() != m_asms.size(), tout << m_dep2asm.size() << " vs " << m_asms.size() << "\n"; tout << m_asms << "\n"; for (auto const& kv : m_dep2asm) { @@ -1040,7 +1040,7 @@ private: u_map asm2dep; extract_asm2dep(asm2dep); sat::literal_vector const& core = m_solver.get_core(); - TRACE("sat", + TRACE(sat, for (auto const& kv : m_dep2asm) { tout << mk_pp(kv.m_key, m) << " |-> " << sat::literal(kv.m_value) << "\n"; } @@ -1078,7 +1078,7 @@ private: } void get_model_core(model_ref & mdl) override { - TRACE("sat", tout << "retrieve model " << (m_solver.model_is_current()?"present":"absent") << "\n";); + TRACE(sat, tout << "retrieve model " << (m_solver.model_is_current()?"present":"absent") << "\n";); if (!m_solver.model_is_current()) { mdl = nullptr; return; @@ -1087,8 +1087,8 @@ private: mdl = nullptr; return; } - TRACE("sat", m_solver.display_model(tout);); - CTRACE("sat", m_sat_mc, m_sat_mc->display(tout);); + TRACE(sat, m_solver.display_model(tout);); + CTRACE(sat, m_sat_mc, m_sat_mc->display(tout);); sat::model ll_m = m_solver.get_model(); mdl = alloc(model, m); if (m_sat_mc) { @@ -1115,18 +1115,18 @@ private: } } - TRACE("sat", m_solver.display(tout);); + TRACE(sat, m_solver.display(tout);); if (m_sat_mc) { (*m_sat_mc)(mdl); } m_goal2sat.update_model(mdl); if (m_mcs.back()) { - TRACE("sat", m_mcs.back()->display(tout);); + TRACE(sat, m_mcs.back()->display(tout);); (*m_mcs.back())(mdl); } - TRACE("sat", model_smt2_pp(tout, m, *mdl, 0);); + TRACE(sat, model_smt2_pp(tout, m, *mdl, 0);); if (!gparams::get_ref().get_bool("model_validate", false)) { return; @@ -1142,7 +1142,7 @@ private: eval(f, tmp); if (m.limit().is_canceled()) return; - CTRACE("sat", !m.is_true(tmp), + CTRACE(sat, !m.is_true(tmp), tout << "Evaluation failed: " << mk_pp(f, m) << " to " << tmp << "\n"; model_smt2_pp(tout, m, *(mdl.get()), 0);); if (m.is_false(tmp)) { diff --git a/src/sat/sat_solver/sat_smt_solver.cpp b/src/sat/sat_solver/sat_smt_solver.cpp index 19ff978dc..6e036c8e3 100644 --- a/src/sat/sat_solver/sat_smt_solver.cpp +++ b/src/sat/sat_solver/sat_smt_solver.cpp @@ -172,7 +172,7 @@ public: expr_ref_vector assumptions(m); for (unsigned i = 0; i < sz; ++i) assumptions.push_back(ensure_literal(_assumptions[i])); - TRACE("sat", tout << assumptions << "\n";); + TRACE(sat, tout << assumptions << "\n";); lbool r = internalize_formulas(assumptions); if (r != l_true) return r; @@ -501,7 +501,7 @@ public: if (is_internalized() && m_internalized_converted) { if (m_sat_mc) m_sat_mc->flush_smc(m_solver, m_map); m_cached_mc = concat(solver::get_model_converter().get(), m_sat_mc.get()); - TRACE("sat", m_cached_mc->display(tout);); + TRACE(sat, m_cached_mc->display(tout);); return m_cached_mc; } else { @@ -521,7 +521,7 @@ public: s2g(m_solver, m_map, m_params, g, m_sat_mc); m_internalized_fmls.reset(); g.get_formulas(m_internalized_fmls); - TRACE("sat", m_solver.display(tout); tout << m_internalized_fmls << "\n";); + TRACE(sat, m_solver.display(tout); tout << m_internalized_fmls << "\n";); m_internalized_converted = true; } @@ -604,7 +604,7 @@ private: if (is_internalized() && assumptions.empty()) return l_true; - TRACE("sat", tout << "qhead " << m_qhead << "\n"); + TRACE(sat, tout << "qhead " << m_qhead << "\n"); m_internalized_converted = false; @@ -624,7 +624,7 @@ private: return; for (sat::literal c : m_solver.get_core()) m_core.push_back(m_dep.lit2orig(c)); - TRACE("sat", + TRACE(sat, tout << "core: " << m_solver.get_core() << "\n"; tout << "core: " << m_core << "\n"; m_solver.display(tout)); @@ -644,7 +644,7 @@ private: } void get_model_core(model_ref & mdl) override { - TRACE("sat", tout << "retrieve model " << (m_solver.model_is_current()?"present":"absent") << "\n";); + TRACE(sat, tout << "retrieve model " << (m_solver.model_is_current()?"present":"absent") << "\n";); mdl = nullptr; auto ext = get_euf(); if (ext) @@ -655,8 +655,8 @@ private: return; if (m_fmls.size() > m_qhead) return; - TRACE("sat", m_solver.display_model(tout);); - CTRACE("sat", m_sat_mc, m_sat_mc->display(tout);); + TRACE(sat, m_solver.display_model(tout);); + CTRACE(sat, m_sat_mc, m_sat_mc->display(tout);); sat::model ll_m = m_solver.get_model(); mdl = alloc(model, m); if (m_sat_mc) @@ -680,12 +680,12 @@ private: } } - TRACE("sat", m_solver.display(tout);); + TRACE(sat, m_solver.display(tout);); if (m_sat_mc) (*m_sat_mc)(mdl); m_goal2sat.update_model(mdl); - TRACE("sat", model_smt2_pp(tout, m, *mdl, 0);); + TRACE(sat, model_smt2_pp(tout, m, *mdl, 0);); if (gparams::get_ref().get_bool("model_validate", false)) { IF_VERBOSE(1, verbose_stream() << "Verifying solution\n";); @@ -699,7 +699,7 @@ private: eval(f, tmp); if (m.limit().is_canceled()) return; - CTRACE("sat", !m.is_true(tmp), + CTRACE(sat, !m.is_true(tmp), tout << "Evaluation failed: " << mk_pp(f, m) << " to " << tmp << "\n"; model_smt2_pp(tout, m, *(mdl.get()), 0);); if (m.is_false(tmp)) { diff --git a/src/sat/sat_xor_finder.cpp b/src/sat/sat_xor_finder.cpp index a34d1b7ad..532e16fa3 100644 --- a/src/sat/sat_xor_finder.cpp +++ b/src/sat/sat_xor_finder.cpp @@ -57,7 +57,7 @@ namespace sat { SASSERT(c.size() > 2); unsigned filter = get_clause_filter(c); s.init_visited(); - TRACE("sat_xor", tout << c << "\n";); + TRACE(sat_xor, tout << c << "\n";); bool parity = false; unsigned mask = 0, i = 0; for (literal l : c) { @@ -117,7 +117,7 @@ namespace sat { s.set_external(l.var()); } if (parity == (lits.size() % 2 == 0)) lits[0].neg(); - TRACE("sat_xor", tout << parity << ": " << lits << "\n";); + TRACE(sat_xor, tout << parity << ": " << lits << "\n";); m_on_xor(lits); } @@ -137,7 +137,7 @@ namespace sat { m_missing.push_back(i); } } - TRACE("sat_xor", tout << l1 << " " << l2 << "\n";); + TRACE(sat_xor, tout << l1 << " " << l2 << "\n";); return update_combinations(c, parity, mask); } @@ -154,7 +154,7 @@ namespace sat { m_clauses_to_remove.push_back(&c2); c2.mark_used(); } - TRACE("sat_xor", tout << c2 << "\n";); + TRACE(sat_xor, tout << c2 << "\n";); // insert missing unsigned mask = 0; m_missing.reset(); @@ -192,7 +192,7 @@ namespace sat { // return true if xor clause is covered. unsigned sz = c.size(); for (unsigned i = 0; i < (1ul << sz); ++i) { - TRACE("sat_xor", tout << i << ": " << parity << " " << m_parity[sz][i] << " " << get_combination(i) << "\n";); + TRACE(sat_xor, tout << i << ": " << parity << " " << m_parity[sz][i] << " " << get_combination(i) << "\n";); if (parity == m_parity[sz][i] && !get_combination(i)) { return false; } diff --git a/src/sat/smt/arith_axioms.cpp b/src/sat/smt/arith_axioms.cpp index 11b03bd21..380208abd 100644 --- a/src/sat/smt/arith_axioms.cpp +++ b/src/sat/smt/arith_axioms.cpp @@ -104,7 +104,7 @@ namespace arith { if (a.is_zero(q)) { return; } - TRACE("arith", tout << expr_ref(p, m) << " " << expr_ref(q, m) << "\n";); + TRACE(arith, tout << expr_ref(p, m) << " " << expr_ref(q, m) << "\n";); // if q is zero, then idiv and mod are uninterpreted functions. expr_ref div(a.mk_idiv(p, q), m); expr_ref mod(a.mk_mod(p, q), m); @@ -551,7 +551,7 @@ namespace arith { force_push(); expr* e1 = var2expr(v1); expr* e2 = var2expr(v2); - TRACE("arith", tout << "new eq: v" << v1 << " v" << v2 << "\n";); + TRACE(arith, tout << "new eq: v" << v1 << " v" << v2 << "\n";); if (e1->get_id() > e2->get_id()) std::swap(e1, e2); @@ -572,7 +572,7 @@ namespace arith { } void solver::new_diseq_eh(euf::th_eq const& e) { - TRACE("artih", tout << mk_bounded_pp(e.eq(), m) << "\n"); + TRACE(artih, tout << mk_bounded_pp(e.eq(), m) << "\n"); ensure_column(e.v1()); ensure_column(e.v2()); m_delayed_eqs.push_back(std::make_pair(e, false)); @@ -637,7 +637,7 @@ namespace arith { add_def_constraint_and_equality(vi, lp::GE, rational::zero()); add_def_constraint_and_equality(vi, lp::LT, abs(r)); SASSERT(!is_infeasible()); - TRACE("arith", tout << term << "\n" << lp().constraints();); + TRACE(arith, tout << term << "\n" << lp().constraints();); } /** @@ -676,14 +676,14 @@ namespace arith { if (a.is_numeral(q, r2) && r2.is_pos()) { if (!a.is_bounded(n)) { - TRACE("arith", tout << "unbounded " << expr_ref(n, m) << "\n";); + TRACE(arith, tout << "unbounded " << expr_ref(n, m) << "\n";); continue; } theory_var v = internalize_def(n); lp::impq val_v = get_ivalue(v); if (val_v.y.is_zero() && val_v.x == div(r1.x, r2)) continue; - TRACE("arith", tout << get_value(v) << " != " << r1 << " div " << r2 << "\n";); + TRACE(arith, tout << get_value(v) << " != " << r1 << " div " << r2 << "\n";); rational div_r = div(r1.x, r2); // p <= q * div(r1, q) + q - 1 => div(p, q) <= div(r1, r2) // p >= q * div(r1, q) => div(r1, q) <= div(p, q) @@ -709,7 +709,7 @@ namespace arith { all_divs_valid = false; - TRACE("arith", tout << r1 << " div " << r2 << "\n";); + TRACE(arith, tout << r1 << " div " << r2 << "\n";); continue; } } diff --git a/src/sat/smt/arith_diagnostics.cpp b/src/sat/smt/arith_diagnostics.cpp index c408fbf96..3203bcc4a 100644 --- a/src/sat/smt/arith_diagnostics.cpp +++ b/src/sat/smt/arith_diagnostics.cpp @@ -255,8 +255,8 @@ namespace arith { cancel_eh eh(m.limit()); scoped_timer timer(1000, &eh); bool result = l_true != vs->check_sat(); - CTRACE("arith", !result, vs->display(tout)); - CTRACE("arith", !result, s().display(tout)); + CTRACE(arith, !result, vs->display(tout)); + CTRACE(arith, !result, s().display(tout)); SASSERT(result); return result; } diff --git a/src/sat/smt/arith_internalize.cpp b/src/sat/smt/arith_internalize.cpp index 5527b9871..6076cdfca 100644 --- a/src/sat/smt/arith_internalize.cpp +++ b/src/sat/smt/arith_internalize.cpp @@ -81,13 +81,13 @@ namespace arith { void solver::found_unsupported(expr* n) { ctx.push(value_trail(m_not_handled)); - TRACE("arith", tout << "unsupported " << mk_pp(n, m) << "\n";); + TRACE(arith, tout << "unsupported " << mk_pp(n, m) << "\n";); m_not_handled = n; } void solver::found_underspecified(expr* n) { if (a.is_underspecified(n)) { - TRACE("arith", tout << "Unhandled: " << mk_pp(n, m) << "\n";); + TRACE(arith, tout << "Unhandled: " << mk_pp(n, m) << "\n";); ctx.push(push_back_vector(m_underspecified)); m_underspecified.push_back(to_app(n)); } @@ -126,7 +126,7 @@ namespace arith { var = lp().add_var(v, is_int); add_def_constraint_and_equality(var, lp::GE, rational(c)); add_def_constraint_and_equality(var, lp::LE, rational(c)); - TRACE("arith", tout << "add " << cnst << ", var = " << var << "\n";); + TRACE(arith, tout << "add " << cnst << ", var = " << var << "\n";); return var; } @@ -321,7 +321,7 @@ namespace arith { } bool solver::internalize_atom(expr* atom) { - TRACE("arith", tout << mk_pp(atom, m) << "\n";); + TRACE(arith, tout << mk_pp(atom, m) << "\n";); expr* n1, *n2; rational r; lp_api::bound_kind k; @@ -378,7 +378,7 @@ namespace arith { return true; } else { - TRACE("arith", tout << "Could not internalize " << mk_pp(atom, m) << "\n";); + TRACE(arith, tout << "Could not internalize " << mk_pp(atom, m) << "\n";); found_unsupported(atom); return true; } @@ -394,7 +394,7 @@ namespace arith { updt_unassigned_bounds(v, +1); m_bounds_trail.push_back(v); m_bool_var2bound.insert(bv, b); - TRACE("arith_verbose", tout << "Internalized " << lit << ": " << mk_pp(atom, m) << " " << *b << "\n";); + TRACE(arith_verbose, tout << "Internalized " << lit << ": " << mk_pp(atom, m) << " " << *b << "\n";); m_new_bounds.push_back(b); //add_use_lists(b); return true; @@ -407,7 +407,7 @@ namespace arith { } theory_var solver::internalize_def(expr* term, scoped_internalize_state& st) { - TRACE("arith", tout << expr_ref(term, m) << "\n";); + TRACE(arith, tout << expr_ref(term, m) << "\n";); if (ctx.get_enode(term)) return mk_evar(term); @@ -432,7 +432,7 @@ namespace arith { void solver::internalize_args(app* t, bool force) { SASSERT(!m.is_bool(t)); - TRACE("arith", tout << mk_pp(t, m) << " " << force << " " << reflect(t) << "\n";); + TRACE(arith, tout << mk_pp(t, m) << " " << force << " " << reflect(t) << "\n";); if (!force && !reflect(t)) return; for (expr* arg : *t) @@ -497,7 +497,7 @@ namespace arith { theory_var v = mk_evar(n); vars.push_back(register_theory_var_in_lar_solver(v)); } - TRACE("arith", tout << "v" << v << " := " << mk_pp(t, m) << "\n" << vars << "\n";); + TRACE(arith, tout << "v" << v << " := " << mk_pp(t, m) << "\n" << vars << "\n";); m_solver->register_existing_terms(); ensure_nla(); m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.data()); @@ -507,7 +507,7 @@ namespace arith { theory_var solver::internalize_linearized_def(expr* term, scoped_internalize_state& st) { theory_var v = mk_evar(term); - TRACE("arith", tout << mk_bounded_pp(term, m) << " v" << v << "\n";); + TRACE(arith, tout << mk_bounded_pp(term, m) << " v" << v << "\n";); if (is_unit_var(st) && v == st.vars()[0]) return st.vars()[0]; @@ -524,7 +524,7 @@ namespace arith { else { vi = lp().add_term(m_left_side, v); SASSERT(lp().column_has_term(vi)); - TRACE("arith_verbose", + TRACE(arith_verbose, tout << "v" << v << " := " << mk_pp(term, m) << " slack: " << vi << " scopes: " << m_scopes.size() << "\n"; lp().print_term(lp().get_term(vi), tout) << "\n";); @@ -566,7 +566,7 @@ namespace arith { enode* solver::mk_enode(expr* e) { - TRACE("arith", tout << expr_ref(e, m) << "\n";); + TRACE(arith, tout << expr_ref(e, m) << "\n";); enode* n = ctx.get_enode(e); if (n) return n; @@ -588,7 +588,7 @@ namespace arith { if (e->is_attached_to(get_id())) return e->get_th_var(get_id()); theory_var v = mk_var(e); - TRACE("arith_verbose", tout << "v" << v << " " << mk_pp(n, m) << "\n";); + TRACE(arith_verbose, tout << "v" << v << " " << mk_pp(n, m) << "\n";); SASSERT(m_bounds.size() <= static_cast(v) || m_bounds[v].empty()); reserve_bounds(v); ctx.attach_th_var(e, this, v); diff --git a/src/sat/smt/arith_solver.cpp b/src/sat/smt/arith_solver.cpp index cd280d158..1632cd3e8 100644 --- a/src/sat/smt/arith_solver.cpp +++ b/src/sat/smt/arith_solver.cpp @@ -92,7 +92,7 @@ namespace arith { while (m_asserted_qhead < m_asserted.size() && !s().inconsistent() && m.inc()) { literal lit = m_asserted[m_asserted_qhead]; api_bound* b = nullptr; - CTRACE("arith", !m_bool_var2bound.contains(lit.var()), tout << "not found " << lit << "\n";); + CTRACE(arith, !m_bool_var2bound.contains(lit.var()), tout << "not found " << lit << "\n";); if (m_bool_var2bound.find(lit.var(), b)) assert_bound(lit.sign() == b->get_lit().sign(), *b); ++m_asserted_qhead; @@ -150,7 +150,7 @@ namespace arith { bool v_is_int = b.is_int(); literal lit2 = sat::null_literal; bool find_glb = (same_polarity == (k == lp_api::lower_t)); - TRACE("arith", tout << lit1 << " v" << v << " val " << val << " find_glb: " << find_glb << " is_true: " << is_true << " k: " << k << " is_lower: " << (k == lp_api::lower_t) << "\n";); + TRACE(arith, tout << lit1 << " v" << v << " val " << val << " find_glb: " << find_glb << " is_true: " << is_true << " k: " << k << " is_lower: " << (k == lp_api::lower_t) << "\n";); if (find_glb) { rational glb; api_bound* lb = nullptr; @@ -197,7 +197,7 @@ namespace arith { ++m_stats.m_bound_propagations2; reset_evidence(); m_core.push_back(lit1); - TRACE("arith", tout << lit2 << " <- " << m_core << "\n";); + TRACE(arith, tout << lit2 << " <- " << m_core << "\n";); arith_proof_hint* ph = nullptr; if (ctx.use_drat()) { m_arith_hint.set_type(ctx, hint_type::farkas_h); @@ -239,7 +239,7 @@ namespace arith { if (m_unassigned_bounds[v] == 0 && !should_refine_bounds()) return; - TRACE("arith", tout << "lp bound v" << v << " " << be.kind() << " " << be.m_bound << "\n";); + TRACE(arith, tout << "lp bound v" << v << " " << be.kind() << " " << be.m_bound << "\n";); lp_bounds const& bounds = m_bounds[v]; bool first = true; @@ -250,7 +250,7 @@ namespace arith { literal lit = is_bound_implied(be.kind(), be.m_bound, *b); if (lit == sat::null_literal) continue; - TRACE("arith", tout << "lp bound " << lit << " bound: " << *b << " first: " << first << "\n";); + TRACE(arith, tout << "lp bound " << lit << " bound: " << *b << " first: " << first << "\n";); lp().settings().stats().m_num_of_implied_bounds++; if (first) { @@ -259,9 +259,9 @@ namespace arith { m_explanation.clear(); lp().explain_implied_bound(be, m_bp); } - CTRACE("arith", m_unassigned_bounds[v] == 0, tout << "missed bound\n";); + CTRACE(arith, m_unassigned_bounds[v] == 0, tout << "missed bound\n";); updt_unassigned_bounds(v, -1); - TRACE("arith", for (auto lit : m_core) tout << lit << ": " << s().value(lit) << "\n";); + TRACE(arith, for (auto lit : m_core) tout << lit << ": " << s().value(lit) << "\n";); DEBUG_CODE(for (auto lit : m_core) { VERIFY(s().value(lit) == l_true); }); ++m_stats.m_bound_propagations1; assign(lit, m_core, m_eqs, explain(hint_type::bound_h, lit)); @@ -273,27 +273,27 @@ namespace arith { literal solver::is_bound_implied(lp::lconstraint_kind k, rational const& value, api_bound const& b) const { if ((k == lp::LE || k == lp::LT) && b.get_bound_kind() == lp_api::upper_t && value <= b.get_value()) { - TRACE("arith", tout << "v <= value <= b.get_value() => v <= b.get_value() \n";); + TRACE(arith, tout << "v <= value <= b.get_value() => v <= b.get_value() \n";); return b.get_lit(); } if ((k == lp::GE || k == lp::GT) && b.get_bound_kind() == lp_api::lower_t && b.get_value() <= value) { - TRACE("arith", tout << "b.get_value() <= value <= v => b.get_value() <= v \n";); + TRACE(arith, tout << "b.get_value() <= value <= v => b.get_value() <= v \n";); return b.get_lit(); } if (k == lp::LE && b.get_bound_kind() == lp_api::lower_t && value < b.get_value()) { - TRACE("arith", tout << "v <= value < b.get_value() => v < b.get_value()\n";); + TRACE(arith, tout << "v <= value < b.get_value() => v < b.get_value()\n";); return ~b.get_lit(); } if (k == lp::LT && b.get_bound_kind() == lp_api::lower_t && value <= b.get_value()) { - TRACE("arith", tout << "v < value <= b.get_value() => v < b.get_value()\n";); + TRACE(arith, tout << "v < value <= b.get_value() => v < b.get_value()\n";); return ~b.get_lit(); } if (k == lp::GE && b.get_bound_kind() == lp_api::upper_t && b.get_value() < value) { - TRACE("arith", tout << "b.get_value() < value <= v => b.get_value() < v\n";); + TRACE(arith, tout << "b.get_value() < value <= v => b.get_value() < v\n";); return ~b.get_lit(); } if (k == lp::GT && b.get_bound_kind() == lp_api::upper_t && b.get_value() <= value) { - TRACE("arith", tout << "b.get_value() <= value < v => b.get_value() < v\n";); + TRACE(arith, tout << "b.get_value() <= value < v => b.get_value() < v\n";); return ~b.get_lit(); } return sat::null_literal; @@ -306,7 +306,7 @@ namespace arith { } void solver::add_equality(lpvar j, rational const& k, lp::explanation const& exp) { - TRACE("arith", tout << "equality " << j << " " << k << "\n"); + TRACE(arith, tout << "equality " << j << " " << k << "\n"); theory_var v; if (k == 1) v = m_one_var; @@ -407,7 +407,7 @@ namespace arith { void solver::assert_bound(bool is_true, api_bound& b) { lp::constraint_index ci = b.get_constraint(is_true); lp().activate(ci); - TRACE("arith", tout << b << " " << is_infeasible() << "\n";); + TRACE(arith, tout << b << " " << is_infeasible() << "\n";); if (is_infeasible()) return; lp::lconstraint_kind k = bound2constraint_kind(b.is_int(), b.get_bound_kind(), is_true); @@ -445,7 +445,7 @@ namespace arith { } constraint_bound& b = vec[tv]; if (b.first == UINT_MAX || (is_lower ? b.second < v : b.second > v)) { - TRACE("arith", tout << "tighter bound " << tv << "\n";); + TRACE(arith, tout << "tighter bound " << tv << "\n";); m_history.push_back(vec[tv]); ctx.push(history_trail(vec, tv, m_history)); b.first = ci; @@ -468,7 +468,7 @@ namespace arith { } void solver::flush_bound_axioms() { - CTRACE("arith", !m_new_bounds.empty(), tout << "flush bound axioms\n";); + CTRACE(arith, !m_new_bounds.empty(), tout << "flush bound axioms\n";); while (!m_new_bounds.empty()) { lp_bounds atoms; @@ -483,7 +483,7 @@ namespace arith { --i; } } - CTRACE("arith_verbose", !atoms.empty(), + CTRACE(arith_verbose, !atoms.empty(), for (unsigned i = 0; i < atoms.size(); ++i) { atoms[i]->display(tout); tout << "\n"; }); @@ -611,7 +611,7 @@ namespace arith { if (!found_bad && value == get_phase(n->bool_var())) continue; - TRACE("arith", ctx.display_validation_failure(tout << *b << "\n", mdl, n)); + TRACE(arith, ctx.display_validation_failure(tout << *b << "\n", mdl, n)); IF_VERBOSE(0, ctx.display_validation_failure(verbose_stream() << *b << "\n", mdl, n)); UNREACHABLE(); } @@ -633,7 +633,7 @@ namespace arith { } else if (v != euf::null_theory_var) { rational r = get_value(v); - TRACE("arith", tout << mk_pp(o, m) << " v" << v << " := " << r << "\n";); + TRACE(arith, tout << mk_pp(o, m) << " v" << v << " := " << r << "\n";); SASSERT("integer variables should have integer values: " && (ctx.get_config().m_arith_ignore_int || !a.is_int(o) || r.is_int() || m_not_handled != nullptr || m.limit().is_canceled())); if (a.is_int(o) && !r.is_int()) r = floor(r); @@ -687,7 +687,7 @@ namespace arith { } void solver::push_core() { - TRACE("arith_verbose", tout << "push\n";); + TRACE(arith_verbose, tout << "push\n";); m_scopes.push_back(scope()); scope& sc = m_scopes.back(); sc.m_bounds_lim = m_bounds_trail.size(); @@ -700,7 +700,7 @@ namespace arith { } void solver::pop_core(unsigned num_scopes) { - TRACE("arith", tout << "pop " << num_scopes << "\n";); + TRACE(arith, tout << "pop " << num_scopes << "\n";); unsigned old_size = m_scopes.size() - num_scopes; del_bounds(m_scopes[old_size].m_bounds_lim); m_asserted.shrink(m_scopes[old_size].m_asserted_lim); @@ -710,7 +710,7 @@ namespace arith { m_new_bounds.reset(); if (m_nla) m_nla->pop(num_scopes); - TRACE("arith_verbose", tout << "num scopes: " << num_scopes << " new scope level: " << m_scopes.size() << "\n";); + TRACE(arith_verbose, tout << "num scopes: " << num_scopes << " new scope level: " << m_scopes.size() << "\n";); th_euf_solver::pop_core(num_scopes); } @@ -731,7 +731,7 @@ namespace arith { u_dependency* ci1 = nullptr, *ci2 = nullptr, *ci3 = nullptr, *ci4 = nullptr; theory_var v1 = lp().local_to_external(vi1); theory_var v2 = lp().local_to_external(vi2); - TRACE("arith", tout << "fixed: " << mk_pp(var2expr(v1), m) << " " << mk_pp(var2expr(v2), m) << "\n";); + TRACE(arith, tout << "fixed: " << mk_pp(var2expr(v1), m) << " " << mk_pp(var2expr(v2), m) << "\n";); // we expect lp() to ensure that none of these returns happen. if (is_equal(v1, v2)) @@ -773,7 +773,7 @@ namespace arith { if (lp().column_has_term(vi)) { theory_var v = lp().local_to_external(vi); rational val; - TRACE("arith", tout << lp().get_variable_name(vi) << " " << v << "\n";); + TRACE(arith, tout << lp().get_variable_name(vi) << " " << v << "\n";); if (v != euf::null_theory_var && a.is_numeral(var2expr(v), val) && bound == val) { dep = nullptr; return bound == val; @@ -804,7 +804,7 @@ namespace arith { } void solver::updt_unassigned_bounds(theory_var v, int inc) { - TRACE("arith_verbose", tout << "v" << v << " " << m_unassigned_bounds[v] << " += " << inc << "\n";); + TRACE(arith_verbose, tout << "v" << v << " " << m_unassigned_bounds[v] << " += " << inc << "\n";); ctx.push(vector_value_trail(m_unassigned_bounds, v)); m_unassigned_bounds[v] += inc; } @@ -831,7 +831,7 @@ namespace arith { void solver::init_model() { if (m.inc() && m_solver.get() && get_num_vars() > 0) { - TRACE("arith", display(tout << "update variable values\n");); + TRACE(arith, display(tout << "update variable values\n");); ctx.push(value_trail(m_model_is_initialized)); m_model_is_initialized = true; lp().init_model(); @@ -888,7 +888,7 @@ namespace arith { void solver::random_update() { if (m_nla) return; - TRACE("arith", tout << s().scope_lvl() << "\n"; tout.flush();); + TRACE(arith, tout << s().scope_lvl() << "\n"; tout.flush();); m_tmp_var_set.reset(); m_model_eqs.reset(); svector vars; @@ -925,7 +925,7 @@ namespace arith { if (delayed_assume_eqs()) return true; - TRACE("arith", display(tout);); + TRACE(arith, display(tout);); random_update(); m_model_eqs.reset(); theory_var sz = static_cast(get_num_vars()); @@ -941,7 +941,7 @@ namespace arith { if (!is_registered_var(v)) continue; theory_var other = m_model_eqs.insert_if_not_there(v); - TRACE("arith", tout << "insert: v" << v << " := " << get_value(v) << " found: v" << other << "\n";); + TRACE(arith, tout << "insert: v" << v << " := " << get_value(v) << " found: v" << other << "\n";); if (!is_equal(other, v)) m_assume_eq_candidates.push_back({ v, other }); } @@ -964,7 +964,7 @@ namespace arith { enode* n1 = var2enode(v1); enode* n2 = var2enode(v2); m_assume_eq_head++; - CTRACE("arith", + CTRACE(arith, is_eq(v1, v2) && n1->get_root() != n2->get_root(), tout << "assuming eq: v" << v1 << " = v" << v2 << "\n";); if (!is_eq(v1, v2)) @@ -1013,7 +1013,7 @@ namespace arith { get_infeasibility_explanation_and_set_conflict(); return sat::check_result::CR_CONTINUE; case l_undef: - TRACE("arith", tout << "check feasible is undef\n";); + TRACE(arith, tout << "check feasible is undef\n";); return sat::check_result::CR_CONTINUE; case l_true: break; @@ -1025,7 +1025,7 @@ namespace arith { auto st = sat::check_result::CR_DONE; bool int_undef = false; - TRACE("arith", ctx.display(tout);); + TRACE(arith, ctx.display(tout);); switch (check_lia()) { case l_true: @@ -1033,7 +1033,7 @@ namespace arith { case l_false: return sat::check_result::CR_CONTINUE; case l_undef: - TRACE("arith", tout << "check-lia giveup\n";); + TRACE(arith, tout << "check-lia giveup\n";); int_undef = true; st = sat::check_result::CR_CONTINUE; break; @@ -1049,7 +1049,7 @@ namespace arith { case l_false: return sat::check_result::CR_CONTINUE; case l_undef: - TRACE("arith", tout << "check-nra giveup\n";); + TRACE(arith, tout << "check-nra giveup\n";); st = sat::check_result::CR_GIVEUP; break; } @@ -1068,7 +1068,7 @@ namespace arith { if (ctx.get_config().m_arith_ignore_int && int_undef) return sat::check_result::CR_GIVEUP; if (m_not_handled != nullptr) { - TRACE("arith", tout << "unhandled operator " << mk_pp(m_not_handled, m) << "\n";); + TRACE(arith, tout << "unhandled operator " << mk_pp(m_not_handled, m) << "\n";); return sat::check_result::CR_GIVEUP; } return st; @@ -1083,8 +1083,8 @@ namespace arith { } else { m_todo_terms.push_back(std::make_pair(t, rational::one())); - TRACE("nl_value", tout << "v" << v << " " << t << "\n";); - TRACE("nl_value", tout << "v" << v << " := w" << t << "\n"; + TRACE(nl_value, tout << "v" << v << " " << t << "\n";); + TRACE(nl_value, tout << "v" << v << " := w" << t << "\n"; lp().print_term(lp().get_term(t), tout) << "\n";); m_nla->am().set(r, 0); @@ -1093,7 +1093,7 @@ namespace arith { t = m_todo_terms.back().first; m_todo_terms.pop_back(); lp::lar_term const& term = lp().get_term(t); - TRACE("nl_value", lp().print_term(term, tout) << "\n";); + TRACE(nl_value, lp().print_term(term, tout) << "\n";); scoped_anum r1(m_nla->am()); rational c1(0); m_nla->am().set(r1, c1.to_mpq()); @@ -1116,10 +1116,10 @@ namespace arith { } lbool solver::make_feasible() { - TRACE("pcs", tout << lp().constraints();); + TRACE(pcs, tout << lp().constraints();); auto status = lp().find_feasible_solution(); - TRACE("arith_verbose", display(tout);); - TRACE("arith", tout << status << "\n"); + TRACE(arith_verbose, display(tout);); + TRACE(arith, tout << status << "\n"); switch (status) { case lp::lp_status::INFEASIBLE: return l_false; @@ -1130,7 +1130,7 @@ namespace arith { return l_true; case lp::lp_status::TIME_EXHAUSTED: default: - TRACE("arith", tout << "status treated as inconclusive: " << status << "\n";); + TRACE(arith, tout << "status treated as inconclusive: " << status << "\n";); return l_undef; } } @@ -1147,7 +1147,7 @@ namespace arith { new_eq_eh(e); else if (is_eq(e.v1(), e.v2())) { mk_diseq_axiom(e.v1(), e.v2()); - TRACE("arith", tout << mk_bounded_pp(e.eq(), m) << " " << use_nra_model() << "\n"); + TRACE(arith, tout << mk_bounded_pp(e.eq(), m) << " " << use_nra_model() << "\n"); found_diseq = true; break; } @@ -1156,7 +1156,7 @@ namespace arith { } lbool solver::check_lia() { - TRACE("arith", ); + TRACE(arith, ); if (!m.inc()) return l_undef; lbool lia_check = l_undef; @@ -1173,7 +1173,7 @@ namespace arith { break; case lp::lia_move::branch: { - TRACE("arith", tout << "branch\n";); + TRACE(arith, tout << "branch\n";); app_ref b(m); bool u = m_lia->is_upper(); auto const& k = m_lia->offset(); @@ -1191,7 +1191,7 @@ namespace arith { break; } case lp::lia_move::cut: { - TRACE("arith", tout << "cut\n";); + TRACE(arith, tout << "cut\n";); ++m_stats.m_cuts; // m_explanation implies term <= k reset_evidence(); @@ -1207,16 +1207,16 @@ namespace arith { break; } case lp::lia_move::conflict: - TRACE("arith", tout << "conflict\n";); + TRACE(arith, tout << "conflict\n";); // ex contains unsat core set_conflict(hint_type::cut_h); return l_false; case lp::lia_move::undef: - TRACE("arith", tout << "lia undef\n";); + TRACE(arith, tout << "lia undef\n";); lia_check = l_undef; break; case lp::lia_move::continue_with_check: - TRACE("arith", tout << "continue-with-check\n"); + TRACE(arith, tout << "continue-with-check\n"); lia_check = l_false; break; default: @@ -1256,7 +1256,7 @@ namespace arith { for (auto ev : m_explanation) set_evidence(ev.ci()); - TRACE("arith_conflict", + TRACE(arith_conflict, tout << "Lemma - " << (is_conflict ? "conflict" : "propagation") << "\n"; for (literal c : m_core) tout << c << ": " << literal2expr(c) << " := " << s().value(c) << "\n"; for (auto p : m_eqs) tout << ctx.bpp(p.first) << " == " << ctx.bpp(p.second) << "\n";); @@ -1367,11 +1367,11 @@ namespace arith { rational g = gcd_reduce(coeffs); if (!g.is_one()) { if (lower_bound) { - TRACE("arith", tout << "lower: " << offset << " / " << g << " = " << offset / g << " >= " << ceil(offset / g) << "\n";); + TRACE(arith, tout << "lower: " << offset << " / " << g << " = " << offset / g << " >= " << ceil(offset / g) << "\n";); offset = ceil(offset / g); } else { - TRACE("arith", tout << "upper: " << offset << " / " << g << " = " << offset / g << " <= " << floor(offset / g) << "\n";); + TRACE(arith, tout << "upper: " << offset << " / " << g << " = " << offset / g << " <= " << floor(offset / g) << "\n";); offset = floor(offset / g); } } @@ -1382,7 +1382,7 @@ namespace arith { for (auto& kv : coeffs) kv.m_value.neg(); } - // CTRACE("arith", is_int, + // CTRACE(arith, is_int, // lp().print_term(term, tout << "term: ") << "\n"; // tout << "offset: " << offset << " gcd: " << g << "\n";); @@ -1393,7 +1393,7 @@ namespace arith { else atom = a.mk_le(t, a.mk_numeral(offset, is_int)); - TRACE("arith", tout << t << ": " << atom << "\n"; + TRACE(arith, tout << t << ": " << atom << "\n"; lp().print_term(term, tout << "bound atom: ") << (lower_bound ? " >= " : " <= ") << k << "\n";); mk_literal(atom); return atom; @@ -1404,7 +1404,7 @@ namespace arith { } void solver::term2coeffs(lp::lar_term const& term, u_map& coeffs, rational const& coeff) { - TRACE("arith", lp().print_term(term, tout) << "\n";); + TRACE(arith, lp().print_term(term, tout) << "\n";); for (lp::lar_term::ival ti : term) { theory_var w; auto tv = ti.j(); @@ -1417,7 +1417,7 @@ namespace arith { else { w = lp().local_to_external(tv); SASSERT(w >= 0); - TRACE("arith", tout << tv << ": " << w << "\n";); + TRACE(arith, tout << tv << ": " << w << "\n";); } rational c0(0); coeffs.find(w, c0); @@ -1493,17 +1493,17 @@ namespace arith { else lit = ctx.expr2literal(mk_bound(ineq.term(), ineq.rs(), is_lower)); - TRACE("arith", tout << "is_lower: " << is_lower << " sign " << sign << " " << ctx.literal2expr(lit) << "\n";); + TRACE(arith, tout << "is_lower: " << is_lower << " sign " << sign << " " << ctx.literal2expr(lit) << "\n";); return sign ? ~lit : lit; } lbool solver::check_nla() { if (!m.inc()) { - TRACE("arith", tout << "canceled\n";); + TRACE(arith, tout << "canceled\n";); return l_undef; } - CTRACE("arith", !m_nla, tout << "no nla\n";); + CTRACE(arith, !m_nla, tout << "no nla\n";); if (!m_nla) return l_true; if (!m_nla->need_check()) @@ -1519,7 +1519,7 @@ namespace arith { case l_undef: break; } - TRACE("arith", tout << "nla " << r << "\n"); + TRACE(arith, tout << "nla " << r << "\n"); return r; } diff --git a/src/sat/smt/arith_value.cpp b/src/sat/smt/arith_value.cpp index bb301808e..fb66bdaef 100644 --- a/src/sat/smt/arith_value.cpp +++ b/src/sat/smt/arith_value.cpp @@ -55,7 +55,7 @@ namespace arith { lo = lo1, is_strict = is_strict1; found = true; } - CTRACE("arith_value", !found, tout << "value not found for " << mk_pp(e, m) << "\n";); + CTRACE(arith_value, !found, tout << "value not found for " << mk_pp(e, m) << "\n";); return found; } @@ -74,7 +74,7 @@ namespace arith { hi = hi1, is_strict = is_strict1; found = true; } - CTRACE("arith_value", !found, tout << "value not found for " << mk_pp(e, m) << "\n";); + CTRACE(arith_value, !found, tout << "value not found for " << mk_pp(e, m) << "\n";); return found; } @@ -109,7 +109,7 @@ namespace arith { if (m_thr && m_thr->get_value(next, val)) return true; next = next->get_next(); } while (next != n); - TRACE("arith_value", tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); + TRACE(arith_value, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); return false; } diff --git a/src/sat/smt/array_axioms.cpp b/src/sat/smt/array_axioms.cpp index 6a08cf76e..662314992 100644 --- a/src/sat/smt/array_axioms.cpp +++ b/src/sat/smt/array_axioms.cpp @@ -34,7 +34,7 @@ namespace array { void solver::push_axiom(axiom_record const& r) { unsigned idx = m_axiom_trail.size(); m_axiom_trail.push_back(r); - TRACE("array", display(tout, r) << " " << m_axioms.contains(idx) << "\n";); + TRACE(array, display(tout, r) << " " << m_axioms.contains(idx) << "\n";); if (m_axioms.contains(idx)) m_axiom_trail.pop_back(); else { @@ -79,7 +79,7 @@ namespace array { expr* child = r.n->get_expr(); SASSERT(can_beta_reduce(r.n)); - TRACE("array", tout << "default-axiom: " << mk_bounded_pp(child, m, 2) << "\n";); + TRACE(array, tout << "default-axiom: " << mk_bounded_pp(child, m, 2) << "\n";); if (a.is_const(child)) return assert_default_const_axiom(to_app(child)); else if (a.is_store(child)) @@ -101,7 +101,7 @@ namespace array { r.select->get_arg(0)->get_root() != r.n->get_root() && !r.is_delayed() && m_enable_delay; - TRACE("array", display(tout << "select-axiom: " << (should_delay ? "delay " : ""), r) << "\n";); + TRACE(array, display(tout << "select-axiom: " << (should_delay ? "delay " : ""), r) << "\n";); if (should_delay) { IF_VERBOSE(11, verbose_stream() << "delay: " << mk_bounded_pp(child, m) << " " << mk_bounded_pp(select, m) << "\n"); @@ -131,7 +131,7 @@ namespace array { * n := store(a, i, v) */ bool solver::assert_store_axiom(app* e) { - TRACE("array", tout << "store-axiom: " << mk_bounded_pp(e, m) << "\n";); + TRACE(array, tout << "store-axiom: " << mk_bounded_pp(e, m) << "\n";); ++m_stats.m_num_store_axiom; SASSERT(a.is_store(e)); unsigned num_args = e->get_num_args(); @@ -182,7 +182,7 @@ namespace array { euf::enode* s1 = e_internalize(sel1); euf::enode* s2 = e_internalize(sel2); - TRACE("array", + TRACE(array, tout << "select-store " << ctx.bpp(s1) << " " << ctx.bpp(s1->get_root()) << "\n"; tout << "select-store " << ctx.bpp(s2) << " " << ctx.bpp(s2->get_root()) << "\n";); @@ -228,7 +228,7 @@ namespace array { new_prop = true; } ++m_stats.m_num_select_store_axiom; - TRACE("array", tout << "select-stored " << new_prop << "\n";); + TRACE(array, tout << "select-stored " << new_prop << "\n";); return new_prop; } @@ -270,7 +270,7 @@ namespace array { expr_ref sel2(a.mk_select(args2), m); literal lit1 = eq_internalize(e1, e2); literal lit2 = eq_internalize(sel1, sel2); - TRACE("array", tout << "extensionality-axiom: " << mk_bounded_pp(e1, m) << " == " << mk_bounded_pp(e2, m) << "\n" << lit1 << " " << ~lit2 << "\n";); + TRACE(array, tout << "extensionality-axiom: " << mk_bounded_pp(e1, m) << " == " << mk_bounded_pp(e2, m) << "\n" << lit1 << " " << ~lit2 << "\n";); return add_clause(lit1, ~lit2); } @@ -465,7 +465,7 @@ namespace array { expr_ref alpha(a.mk_select(args), m); expr_ref beta(alpha); rewrite(beta); - TRACE("array", tout << alpha << " == " << beta << "\n";); + TRACE(array, tout << alpha << " == " << beta << "\n";); return ctx.propagate(e_internalize(alpha), e_internalize(beta), array_axiom()); } @@ -473,7 +473,7 @@ namespace array { \brief assert n1 = n2 => forall vars . (n1 vars) = (n2 vars) */ bool solver::assert_congruent_axiom(expr* e1, expr* e2) { - TRACE("array", tout << "congruence-axiom: " << mk_bounded_pp(e1, m) << " " << mk_bounded_pp(e2, m) << "\n";); + TRACE(array, tout << "congruence-axiom: " << mk_bounded_pp(e1, m) << " " << mk_bounded_pp(e2, m) << "\n";); ++m_stats.m_num_congruence_axiom; sort* srt = e1->get_sort(); unsigned dimension = get_array_arity(srt); @@ -638,20 +638,20 @@ namespace array { euf::enode * n = var2enode(i); if (!is_array(n)) continue; - CTRACE("array", !ctx.is_relevant(n), tout << "not relevant: " << ctx.bpp(n) << "\n"); + CTRACE(array, !ctx.is_relevant(n), tout << "not relevant: " << ctx.bpp(n) << "\n"); if (!ctx.is_relevant(n)) continue; euf::enode * r = n->get_root(); if (r->is_marked1()) continue; // arrays used as indices in other arrays have to be treated as shared issue #3532, #3529 - CTRACE("array", !ctx.is_shared(r) && !is_shared_arg(r), tout << "not shared: " << ctx.bpp(r) << "\n"); + CTRACE(array, !ctx.is_shared(r) && !is_shared_arg(r), tout << "not shared: " << ctx.bpp(r) << "\n"); if (ctx.is_shared(r) || is_shared_arg(r)) roots.push_back(r->get_th_var(get_id())); r->mark1(); to_unmark.push_back(r); } - TRACE("array", tout << "collecting shared vars...\n"; for (auto v : roots) tout << ctx.bpp(var2enode(v)) << "\n";); + TRACE(array, tout << "collecting shared vars...\n"; for (auto v : roots) tout << ctx.bpp(var2enode(v)) << "\n";); for (auto* n : to_unmark) n->unmark1(); } diff --git a/src/sat/smt/array_internalize.cpp b/src/sat/smt/array_internalize.cpp index 9e41be3bb..225d5d932 100644 --- a/src/sat/smt/array_internalize.cpp +++ b/src/sat/smt/array_internalize.cpp @@ -23,7 +23,7 @@ namespace array { sat::literal solver::internalize(expr* e, bool sign, bool root) { SASSERT(m.is_bool(e)); if (!visit_rec(m, e, sign, root)) { - TRACE("array", tout << mk_pp(e, m) << "\n";); + TRACE(array, tout << mk_pp(e, m) << "\n";); return sat::null_literal; } auto lit = expr2literal(e); diff --git a/src/sat/smt/array_model.cpp b/src/sat/smt/array_model.cpp index aa986d87f..dfc4ad871 100644 --- a/src/sat/smt/array_model.cpp +++ b/src/sat/smt/array_model.cpp @@ -129,7 +129,7 @@ namespace array { args.reset(); for (unsigned i = 1; i < p->num_args(); ++i) { if (!values.get(p->get_arg(i)->get_root_id())) { - TRACE("array", tout << ctx.bpp(p->get_arg(i)) << "\n"); + TRACE(array, tout << ctx.bpp(p->get_arg(i)) << "\n"); } SASSERT(values.get(p->get_arg(i)->get_root_id())); } @@ -138,7 +138,7 @@ namespace array { fi->insert_entry(args.data(), value); } - TRACE("array", tout << "array-as-function " << ctx.bpp(n) << " := " << mk_pp(f, m) << "\n" << "default " << mk_pp(fi->get_else(), m) << "\n";); + TRACE(array, tout << "array-as-function " << ctx.bpp(n) << " := " << mk_pp(f, m) << "\n" << "default " << mk_pp(fi->get_else(), m) << "\n";); parameter p(f); values.set(n->get_expr_id(), m.mk_app(get_id(), OP_AS_ARRAY, 1, &p)); } @@ -282,7 +282,7 @@ namespace array { theory_var w = get_th_var(n->get_arg(0)); SASSERT(w != euf::null_theory_var); mg_merge(v, get_representative(w)); - TRACE("array", tout << "merge: " << ctx.bpp(n) << " " << v << " " << w << "\n";); + TRACE(array, tout << "merge: " << ctx.bpp(n) << " " << v << " " << w << "\n";); } else if (a.is_default(e)) { theory_var w = get_th_var(n->get_arg(0)); @@ -294,7 +294,7 @@ namespace array { void solver::set_default(theory_var v, euf::enode* n) { v = mg_find(v); - CTRACE("array", !m_defaults[v], tout << "set default: " << v << " " << ctx.bpp(n) << "\n";); + CTRACE(array, !m_defaults[v], tout << "set default: " << v << " " << ctx.bpp(n) << "\n";); if (!m_defaults[v]) m_defaults[v] = n; } @@ -343,7 +343,7 @@ namespace array { if (!m_defaults[u]) m_defaults[u] = m_defaults[v]; - CTRACE("array", m_defaults[v], + CTRACE(array, m_defaults[v], tout << ctx.bpp(m_defaults[v]->get_root()) << "\n"; tout << ctx.bpp(m_defaults[u]->get_root()) << "\n"; ); diff --git a/src/sat/smt/array_solver.cpp b/src/sat/smt/array_solver.cpp index 1343577d9..dca1b3f51 100644 --- a/src/sat/smt/array_solver.cpp +++ b/src/sat/smt/array_solver.cpp @@ -150,7 +150,7 @@ namespace array { void solver::merge_eh(theory_var v1, theory_var v2, theory_var, theory_var) { euf::enode* n1 = var2enode(v1); euf::enode* n2 = var2enode(v2); - TRACE("array", tout << "merge: " << ctx.bpp(n1) << " == " << ctx.bpp(n2) << "\n";); + TRACE(array, tout << "merge: " << ctx.bpp(n1) << " == " << ctx.bpp(n2) << "\n";); SASSERT(n1->get_root() == n2->get_root()); SASSERT(v1 == find(v1)); expr* e1 = n1->get_expr(); @@ -179,8 +179,8 @@ namespace array { v_child = find(v_child); ctx.push_vec(get_var_data(v_child).m_parent_selects, select); euf::enode* child = var2enode(v_child); - TRACE("array", tout << "v" << v_child << " - " << ctx.bpp(select) << " " << ctx.bpp(child) << " prop: " << should_prop_upward(get_var_data(v_child)) << "\n";); - TRACE("array", tout << "can beta reduce " << can_beta_reduce(child) << "\n";); + TRACE(array, tout << "v" << v_child << " - " << ctx.bpp(select) << " " << ctx.bpp(child) << " prop: " << should_prop_upward(get_var_data(v_child)) << "\n";); + TRACE(array, tout << "can beta reduce " << can_beta_reduce(child) << "\n";); if (can_beta_reduce(child)) push_axiom(select_axiom(select, child)); propagate_parent_select_axioms(v_child); diff --git a/src/sat/smt/bv_delay_internalize.cpp b/src/sat/smt/bv_delay_internalize.cpp index 7047ad2cb..af3c4abe9 100644 --- a/src/sat/smt/bv_delay_internalize.cpp +++ b/src/sat/smt/bv_delay_internalize.cpp @@ -132,7 +132,7 @@ namespace bv { if (r1 == r2) return true; - TRACE("bv", tout << mk_bounded_pp(e, m) << " evaluates to " << r1 << " arguments: " << args << "\n";); + TRACE(bv, tout << mk_bounded_pp(e, m) << " evaluates to " << r1 << " arguments: " << args << "\n";); // check x*0 = 0 if (!check_mul_zero(e, args, r1, r2)) return false; @@ -207,7 +207,7 @@ namespace bv { }; auto add_inv = [&](expr* s) { inv = invert(s, n); - TRACE("bv", tout << "enforce " << inv << "\n";); + TRACE(bv, tout << "enforce " << inv << "\n";); add_unit(eq_internalize(inv, n)); }; bool ok = true; @@ -280,14 +280,14 @@ namespace bv { expr_ref mul1(m.mk_app(n->get_decl(), arg_values[0], n->get_arg(1)), m); set_delay_internalize(mul1, internalize_mode::init_bits_only_i); add_unit(eq_internalize(mul1, n->get_arg(1))); - TRACE("bv", tout << mul1 << "\n";); + TRACE(bv, tout << mul1 << "\n";); return false; } if (bv.is_one(arg_values[1])) { expr_ref mul1(m.mk_app(n->get_decl(), n->get_arg(0), arg_values[1]), m); set_delay_internalize(mul1, internalize_mode::init_bits_only_i); add_unit(eq_internalize(mul1, n->get_arg(0))); - TRACE("bv", tout << mul1 << "\n";); + TRACE(bv, tout << mul1 << "\n";); return false; } return true; diff --git a/src/sat/smt/bv_internalize.cpp b/src/sat/smt/bv_internalize.cpp index c791f1cae..438e806f0 100644 --- a/src/sat/smt/bv_internalize.cpp +++ b/src/sat/smt/bv_internalize.cpp @@ -90,7 +90,7 @@ namespace bv { m_wpos.push_back(0); m_zero_one_bits.push_back(zero_one_bits()); ctx.attach_th_var(n, this, r); - TRACE("bv", tout << "mk-var: v" << r << " " << n->get_expr_id() << " " << mk_bounded_pp(n->get_expr(), m) << "\n";); + TRACE(bv, tout << "mk-var: v" << r << " " << n->get_expr_id() << " " << mk_bounded_pp(n->get_expr(), m) << "\n";); return r; } @@ -240,7 +240,7 @@ namespace bv { } void solver::mk_bits(theory_var v) { - TRACE("bv", tout << "v" << v << "@" << s().scope_lvl() << "\n";); + TRACE(bv, tout << "v" << v << "@" << s().scope_lvl() << "\n";); expr* e = var2expr(v); unsigned bv_size = get_bv_size(v); m_bits[v].reset(); @@ -248,7 +248,7 @@ namespace bv { expr_ref b2b(bv.mk_bit2bool(e, i), m); m_bits[v].push_back(sat::null_literal); sat::literal lit = ctx.internalize(b2b, false, false); - TRACE("bv", tout << "add-bit: " << lit << " " << literal2expr(lit) << "\n";); + TRACE(bv, tout << "add-bit: " << lit << " " << literal2expr(lit) << "\n";); if (m_bits[v].back() == sat::null_literal) m_bits[v].back() = lit; SASSERT(m_bits[v].back() == lit); @@ -293,7 +293,7 @@ namespace bv { SASSERT(l == mk_true() || ~l == mk_true()); bool is_true = l == mk_true(); zero_one_bits& bits = m_zero_one_bits[v]; - TRACE("bv", tout << "register v" << v << " " << l << " " << mk_true() << "\n";); + TRACE(bv, tout << "register v" << v << " " << l << " " << mk_true() << "\n";); bits.push_back(zero_one_bit(v, idx, is_true)); } @@ -303,7 +303,7 @@ namespace bv { void solver::add_bit(theory_var v, literal l) { unsigned idx = m_bits[v].size(); m_bits[v].push_back(l); - TRACE("bv", tout << "add-bit: v" << v << "[" << idx << "] " << l << " " << literal2expr(l) << "@" << s().scope_lvl() << "\n";); + TRACE(bv, tout << "add-bit: v" << v << "[" << idx << "] " << l << " " << literal2expr(l) << "@" << s().scope_lvl() << "\n";); SASSERT(m_num_scopes == 0); s().set_external(l.var()); euf::enode* n = bool_var2enode(l.var()); @@ -346,7 +346,7 @@ namespace bv { unsigned i = 0; for (expr* bit : bits) { sat::literal lit = ctx.internalize(bit, false, false); - TRACE("bv", tout << "set " << m_bits[v][i] << " == " << lit << "\n";); + TRACE(bv, tout << "set " << m_bits[v][i] << " == " << lit << "\n";); add_clause(~lit, m_bits[v][i]); add_clause(lit, ~m_bits[v][i]); ++i; @@ -589,7 +589,7 @@ namespace bv { bits.swap(new_bits); } init_bits(e, bits); - TRACE("bv_verbose", tout << arg_bits << " " << bits << " " << new_bits << "\n";); + TRACE(bv_verbose, tout << arg_bits << " " << bits << " " << new_bits << "\n";); } void solver::internalize_novfl(app* n, std::function& fn) { @@ -675,7 +675,7 @@ namespace bv { sat::literal lit0 = m_bits[v_arg][idx]; if (lit0 == sat::null_literal) { m_bits[v_arg][idx] = lit; - TRACE("bv", tout << "add-bit: " << lit << " " << literal2expr(lit) << "\n";); + TRACE(bv, tout << "add-bit: " << lit << " " << literal2expr(lit) << "\n";); atom* a = new (get_region()) atom(lit.var()); a->m_occs = new (get_region()) var_pos_occ(v_arg, idx); insert_bv2a(lit.var(), a); @@ -760,7 +760,7 @@ namespace bv { expr_ref oe = mk_var_eq(v1, v2); literal oeq = ctx.internalize(oe, false, false); unsigned sz = m_bits[v1].size(); - TRACE("bv", tout << "ackerman-eq: " << s().scope_lvl() << " " << oe << "\n";); + TRACE(bv, tout << "ackerman-eq: " << s().scope_lvl() << " " << oe << "\n";); literal_vector eqs; eqs.push_back(oeq); for (unsigned i = 0; i < sz; ++i) { @@ -771,7 +771,7 @@ namespace bv { add_clause(eq, ~oeq); eqs.push_back(~eq); } - TRACE("bv", for (auto l : eqs) tout << mk_bounded_pp(literal2expr(l), m) << " "; tout << "\n";); + TRACE(bv, for (auto l : eqs) tout << mk_bounded_pp(literal2expr(l), m) << " "; tout << "\n";); euf::th_proof_hint* ph = ctx.mk_smt_clause(name(), eqs.size(), eqs.data()); s().mk_clause(eqs, sat::status::th(true, m.get_basic_family_id(), ph)); } diff --git a/src/sat/smt/bv_solver.cpp b/src/sat/smt/bv_solver.cpp index f898d5cd8..a17e1dd31 100644 --- a/src/sat/smt/bv_solver.cpp +++ b/src/sat/smt/bv_solver.cpp @@ -88,7 +88,7 @@ namespace bv { m_fixed_var_table.insert(key, v1); else if (n1->get_root() != var2enode(v2)->get_root()) { SASSERT(get_bv_size(v1) == get_bv_size(v2)); - TRACE("bv", tout << "detected equality: v" << v1 << " = v" << v2 << "\n" << pp(v1) << pp(v2);); + TRACE(bv, tout << "detected equality: v" << v1 << " = v" << v2 << "\n" << pp(v1) << pp(v2);); m_stats.m_num_bit2eq++; add_fixed_eq(v1, v2); ctx.propagate(n1, var2enode(v2), mk_bit2eq_justification(v1, v2)); @@ -134,11 +134,11 @@ namespace bv { unsigned idx = (i + wpos) % sz; if (s().value(bits[idx]) == l_undef) { wpos = idx; - TRACE("bv", tout << "moved wpos of v" << v << " to " << wpos << "\n";); + TRACE(bv, tout << "moved wpos of v" << v << " to " << wpos << "\n";); return false; } } - TRACE("bv", tout << "v" << v << " is a fixed variable.\n";); + TRACE(bv, tout << "v" << v << " is a fixed variable.\n";); fixed_var_eh(v); return true; } @@ -162,7 +162,7 @@ namespace bv { */ void solver::mk_new_diseq_axiom(theory_var v1, theory_var v2, unsigned idx) { SASSERT(m_bits[v1][idx] == ~m_bits[v2][idx]); - TRACE("bv", tout << "found new diseq axiom\n" << pp(v1) << pp(v2);); + TRACE(bv, tout << "found new diseq axiom\n" << pp(v1) << pp(v2);); m_stats.m_num_diseq_static++; expr_ref eq(m.mk_eq(var2expr(v1), var2expr(v2)), m); add_unit(~ctx.internalize(eq, false, false)); @@ -201,7 +201,7 @@ namespace bv { void solver::new_eq_eh(euf::th_eq const& eq) { force_push(); - TRACE("bv", tout << "new eq " << mk_bounded_pp(var2expr(eq.v1()), m) << " == " << mk_bounded_pp(var2expr(eq.v2()), m) << "\n";); + TRACE(bv, tout << "new eq " << mk_bounded_pp(var2expr(eq.v1()), m) << " == " << mk_bounded_pp(var2expr(eq.v2()), m) << "\n";); if (is_bv(eq.v1())) { m_find.merge(eq.v1(), eq.v2()); VERIFY(eq.is_eq()); @@ -244,7 +244,7 @@ namespace bv { if (s().is_probing()) return; - TRACE("bv", tout << "diff: " << v1 << " != " << v2 << " @" << s().scope_lvl() << "\n";); + TRACE(bv, tout << "diff: " << v1 << " != " << v2 << " @" << s().scope_lvl() << "\n";); unsigned sz = m_bits[v1].size(); if (sz == 1) return; @@ -303,7 +303,7 @@ namespace bv { euf::enode_pair solver::get_justification_eq(size_t j) { auto& c = bv_justification::from_index(j); - TRACE("bv", display_constraint(tout, j) << "\n";); + TRACE(bv, display_constraint(tout, j) << "\n";); switch (c.m_kind) { case bv_justification::kind_t::eq2bit: UNREACHABLE(); @@ -325,7 +325,7 @@ namespace bv { void solver::get_antecedents(literal l, sat::ext_justification_idx idx, literal_vector& r, bool probing) { auto& c = bv_justification::from_index(idx); - TRACE("bv", display_constraint(tout, idx) << "\n";); + TRACE(bv, display_constraint(tout, idx) << "\n";); switch (c.m_kind) { case bv_justification::kind_t::eq2bit: SASSERT(s().value(c.m_antecedent) == l_true); @@ -523,7 +523,7 @@ namespace bv { void solver::asserted(literal l) { atom* a = get_bv2a(l.var()); - TRACE("bv", tout << "asserted: " << l << "\n";); + TRACE(bv, tout << "asserted: " << l << "\n";); if (a) { force_push(); m_prop_queue.push_back(propagation_item(a)); @@ -589,7 +589,7 @@ namespace bv { literal bit1 = m_bits[v1][idx]; lbool val = s().value(bit1); - TRACE("bv", tout << "propagating v" << v1 << " #" << var2enode(v1)->get_expr_id() << "[" << idx << "] = " << val << "\n";); + TRACE(bv, tout << "propagating v" << v1 << " #" << var2enode(v1)->get_expr_id() << "[" << idx << "] = " << val << "\n";); if (val == l_undef) return false; @@ -600,7 +600,7 @@ namespace bv { for (theory_var v2 = m_find.next(v1); v2 != v1; v2 = m_find.next(v2)) { literal bit2 = m_bits[v2][idx]; SASSERT(m_bits[v1][idx] != ~m_bits[v2][idx]); - TRACE("bv", tout << "propagating #" << var2enode(v2)->get_expr_id() << "[" << idx << "] = " << s().value(bit2) << "\n";); + TRACE(bv, tout << "propagating #" << var2enode(v2)->get_expr_id() << "[" << idx << "] = " << s().value(bit2) << "\n";); if (val == l_false) bit2.neg(); @@ -651,7 +651,7 @@ namespace bv { } void solver::push_core() { - TRACE("bv", tout << "push: " << get_num_vars() << "@" << m_prop_queue_lim.size() << "\n";); + TRACE(bv, tout << "push: " << get_num_vars() << "@" << m_prop_queue_lim.size() << "\n";); th_euf_solver::push_core(); m_prop_queue_lim.push_back(m_prop_queue.size()); } @@ -666,7 +666,7 @@ namespace bv { m_bits.shrink(old_sz); m_wpos.shrink(old_sz); m_zero_one_bits.shrink(old_sz); - TRACE("bv", tout << "num vars " << old_sz << "@" << m_prop_queue_lim.size() << "\n";); + TRACE(bv, tout << "num vars " << old_sz << "@" << m_prop_queue_lim.size() << "\n";); } void solver::simplify() { @@ -724,7 +724,7 @@ namespace bv { assert_ackerman(v, w); } } - TRACE("bv", tout << "infer new equations for bit-vectors that are now equal\n";); + TRACE(bv, tout << "infer new equations for bit-vectors that are now equal\n";); } void solver::clauses_modifed() {} @@ -886,10 +886,10 @@ namespace bv { void solver::merge_eh(theory_var r1, theory_var r2, theory_var v1, theory_var v2) { - TRACE("bv", tout << "merging: v" << v1 << " #" << var2enode(v1)->get_expr_id() << " v" << v2 << " #" << var2enode(v2)->get_expr_id() << "\n";); + TRACE(bv, tout << "merging: v" << v1 << " #" << var2enode(v1)->get_expr_id() << " v" << v2 << " #" << var2enode(v2)->get_expr_id() << "\n";); if (!merge_zero_one_bits(r1, r2)) { - TRACE("bv", tout << "conflict detected\n";); + TRACE(bv, tout << "conflict detected\n";); return; // conflict was detected } SASSERT(m_bits[v1].size() == m_bits[v2].size()); @@ -899,7 +899,7 @@ namespace bv { for (unsigned idx = 0; !s().inconsistent() && idx < sz; idx++) { literal bit1 = m_bits[v1][idx]; literal bit2 = m_bits[v2][idx]; - CTRACE("bv", bit1 == ~bit2, tout << pp(v1) << pp(v2) << "idx: " << idx << "\n";); + CTRACE(bv, bit1 == ~bit2, tout << pp(v1) << pp(v2) << "idx: " << idx << "\n";); if (bit1 == ~bit2) { mk_new_diseq_axiom(v1, v2, idx); return; @@ -907,10 +907,10 @@ namespace bv { SASSERT(bit1 != ~bit2); lbool val1 = s().value(bit1); lbool val2 = s().value(bit2); - TRACE("bv", tout << "merge v" << v1 << " " << bit1 << ":= " << val1 << " " << bit2 << ":= " << val2 << "\n";); + TRACE(bv, tout << "merge v" << v1 << " " << bit1 << ":= " << val1 << " " << bit2 << ":= " << val2 << "\n";); if (val1 == val2) continue; - CTRACE("bv", (val1 != l_undef && val2 != l_undef), tout << "inconsistent "; tout << pp(v1) << pp(v2) << "idx: " << idx << "\n";); + CTRACE(bv, (val1 != l_undef && val2 != l_undef), tout << "inconsistent "; tout << pp(v1) << pp(v2) << "idx: " << idx << "\n";); if (val1 == l_false) assign_bit(~bit2, v1, v2, idx, ~bit1, true); else if (val1 == l_true) @@ -927,7 +927,7 @@ namespace bv { sat::constraint_base::initialize(mem, this); auto* constraint = new (sat::constraint_base::ptr2mem(mem)) bv_justification(v1, v2, c, a); auto jst = sat::justification::mk_ext_justification(s().scope_lvl(), constraint->to_index()); - TRACE("bv", tout << jst << " " << constraint << "\n"); + TRACE(bv, tout << jst << " " << constraint << "\n"); return jst; } diff --git a/src/sat/smt/dt_solver.cpp b/src/sat/smt/dt_solver.cpp index 0b3ca2a99..1d4dc7c67 100644 --- a/src/sat/smt/dt_solver.cpp +++ b/src/sat/smt/dt_solver.cpp @@ -119,7 +119,7 @@ namespace dt { where acc_i are the accessors of constructor c. */ void solver::assert_is_constructor_axiom(enode* n, func_decl* c, literal antecedent) { - TRACE("dt", tout << mk_pp(c, m) << " " << ctx.bpp(n) << "\n";); + TRACE(dt, tout << mk_pp(c, m) << " " << ctx.bpp(n) << "\n";); m_stats.m_assert_cnstr++; expr* e = n->get_expr(); SASSERT(dt.is_constructor(c)); @@ -159,7 +159,7 @@ namespace dt { SASSERT(is_recognizer(r)); SASSERT(dt.get_recognizer_constructor(r->get_decl()) == c->get_decl()); SASSERT(c->get_root() == r->get_arg(0)->get_root()); - TRACE("dt", tout << ctx.bpp(c) << "\n" << ctx.bpp(r) << "\n";); + TRACE(dt, tout << ctx.bpp(c) << "\n" << ctx.bpp(r) << "\n";); literal l = ctx.enode2literal(r); SASSERT(s().value(l) == l_false); clear_mark(); @@ -254,7 +254,7 @@ namespace dt { SASSERT(!d->m_constructor); SASSERT(!recognizer || ctx.value(recognizer) == l_false || !is_final); - TRACE("dt", tout << ctx.bpp(n) << " non_rec_c: " << non_rec_c->get_name() << " #rec: " << d->m_recognizers.size() << "\n";); + TRACE(dt, tout << ctx.bpp(n) << " non_rec_c: " << non_rec_c->get_name() << " #rec: " << d->m_recognizers.size() << "\n";); if (!recognizer && non_rec_c->get_arity() == 0) { sat::literal eq = eq_internalize(n->get_expr(), m.mk_const(non_rec_c)); @@ -332,7 +332,7 @@ namespace dt { * */ void solver::apply_sort_cnstr(enode* n, sort* s) { - TRACE("dt", tout << "apply_sort_cnstr: #" << ctx.bpp(n) << "\n";); + TRACE(dt, tout << "apply_sort_cnstr: #" << ctx.bpp(n) << "\n";); force_push(); if (!is_attached_to_var(n)) mk_var(n); @@ -348,7 +348,7 @@ namespace dt { enode* n = bool_var2enode(lit.var()); if (!is_recognizer(n)) return; - TRACE("dt", tout << "assigning recognizer: #" << n->get_expr_id() << " " << ctx.bpp(n) << "\n";); + TRACE(dt, tout << "assigning recognizer: #" << n->get_expr_id() << " " << ctx.bpp(n) << "\n";); SASSERT(n->num_args() == 1); enode* arg = n->get_arg(0); theory_var tv = arg->get_th_var(get_id()); @@ -369,7 +369,7 @@ namespace dt { } void solver::add_recognizer(theory_var v, enode* recognizer) { - TRACE("dt", tout << "add recognizer " << v << " " << mk_pp(recognizer->get_expr(), m) << "\n";); + TRACE(dt, tout << "add recognizer " << v << " " << mk_pp(recognizer->get_expr(), m) << "\n";); v = m_find.find(v); var_data* d = m_var_data[v]; sort* s = recognizer->get_decl()->get_domain(0); @@ -384,7 +384,7 @@ namespace dt { return; lbool val = ctx.value(recognizer); - TRACE("dt", tout << "adding recognizer to v" << v << " rec: #" << recognizer->get_expr_id() << " val: " << val << "\n";); + TRACE(dt, tout << "adding recognizer to v" << v << " rec: #" << recognizer->get_expr_id() << " val: " << val << "\n";); // do nothing... // If recognizer assignment was already processed, then @@ -423,7 +423,7 @@ namespace dt { return; } - CTRACE("dt", d->m_recognizers.empty(), ctx.display(tout);); + CTRACE(dt, d->m_recognizers.empty(), ctx.display(tout);); SASSERT(!d->m_recognizers.empty()); m_lits.reset(); enode_pair_vector eqs; @@ -449,7 +449,7 @@ namespace dt { } ++idx; } - TRACE("dt", tout << "propagate " << num_unassigned << " eqs: " << eqs.size() << "\n";); + TRACE(dt, tout << "propagate " << num_unassigned << " eqs: " << eqs.size() << "\n";); if (num_unassigned == 0) { auto* ph = ctx.mk_smt_hint(name(), m_lits, eqs); ctx.set_conflict(euf::th_explain::conflict(*this, m_lits, eqs, ph)); @@ -488,7 +488,7 @@ namespace dt { var_data* d2 = m_var_data[v2]; auto* con1 = d1->m_constructor; auto* con2 = d2->m_constructor; - TRACE("dt", tout << "merging v" << v1 << " v" << v2 << "\n" << ctx.bpp(var2enode(v1)) << " == " << ctx.bpp(var2enode(v2)) << " " << ctx.bpp(con1) << " " << ctx.bpp(con2) << "\n";); + TRACE(dt, tout << "merging v" << v1 << " v" << v2 << "\n" << ctx.bpp(var2enode(v1)) << " == " << ctx.bpp(var2enode(v2)) << " " << ctx.bpp(con1) << " " << ctx.bpp(con2) << "\n";); if (con1 && con2 && con1->get_decl() != con2->get_decl()) ctx.set_conflict(euf::th_explain::conflict(*this, con1, con2, ctx.mk_smt_hint(name(), con1, con2))); else if (con2 && !con1) { @@ -598,7 +598,7 @@ namespace dt { // explain the cycle root -> ... -> app -> root void solver::occurs_check_explain(enode* app, enode* root) { - TRACE("dt", tout << "occurs_check_explain " << ctx.bpp(app) << " <-> " << ctx.bpp(root) << "\n";); + TRACE(dt, tout << "occurs_check_explain " << ctx.bpp(app) << " <-> " << ctx.bpp(root) << "\n";); // first: explain that root=v, given that app=cstor(...,v,...) @@ -616,7 +616,7 @@ namespace dt { if (app != root) m_used_eqs.push_back(enode_pair(app, root)); - TRACE("dt", + TRACE(dt, tout << "occurs_check\n"; for (enode_pair const& p : m_used_eqs) tout << ctx.bpp(p.first) << " - " << ctx.bpp(p.second) << " ";); } @@ -685,7 +685,7 @@ namespace dt { a3 = cons(v3, a1) */ bool solver::occurs_check(enode* n) { - TRACE("dt_verbose", tout << "occurs check: " << ctx.bpp(n) << "\n";); + TRACE(dt_verbose, tout << "occurs check: " << ctx.bpp(n) << "\n";); m_stats.m_occurs_check++; bool res = false; @@ -700,7 +700,7 @@ namespace dt { if (oc_cycle_free(app)) continue; - TRACE("dt_verbose", tout << "occurs check loop: " << ctx.bpp(app) << (op == ENTER ? " enter" : " exit") << "\n";); + TRACE(dt_verbose, tout << "occurs check loop: " << ctx.bpp(app) << (op == ENTER ? " enter" : " exit") << "\n";); switch (op) { case ENTER: @@ -716,7 +716,7 @@ namespace dt { if (res) { clear_mark(); ctx.set_conflict(euf::th_explain::conflict(*this, m_used_eqs, ctx.mk_smt_hint(name(), m_used_eqs))); - TRACE("dt", tout << "occurs check conflict: " << ctx.bpp(n) << "\n";); + TRACE(dt, tout << "occurs check conflict: " << ctx.bpp(n) << "\n";); } return res; } @@ -783,7 +783,7 @@ namespace dt { if (v == euf::null_theory_var) return false; euf::enode* con = m_var_data[m_find.find(v)]->m_constructor; - TRACE("dt", display(tout) << ctx.bpp(n) << " con: " << ctx.bpp(con) << "\n";); + TRACE(dt, display(tout) << ctx.bpp(n) << " con: " << ctx.bpp(con) << "\n";); if (con->num_args() == 0) dep.insert(n, nullptr); for (enode* arg : euf::enode_args(con)) diff --git a/src/sat/smt/euf_ackerman.cpp b/src/sat/smt/euf_ackerman.cpp index 906120314..67a98b2f6 100644 --- a/src/sat/smt/euf_ackerman.cpp +++ b/src/sat/smt/euf_ackerman.cpp @@ -124,7 +124,7 @@ namespace euf { return; if (!enable_cc(a, b)) return; - TRACE("ack", tout << "conflict eh: " << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n";); + TRACE(ack, tout << "conflict eh: " << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n";); insert(a, b); gc(); } @@ -136,7 +136,7 @@ namespace euf { return; if (!enable_eq(a, b, c)) return; - TRACE("ack", tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << "\n";); + TRACE(ack, tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << "\n";); insert(a, b, c); gc(); } @@ -144,7 +144,7 @@ namespace euf { void ackerman::used_cc_eh(app* a, app* b) { if (ctx.m_drating) return; - TRACE("ack", tout << "used cc: " << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n";); + TRACE(ack, tout << "used cc: " << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n";); SASSERT(a->get_decl() == b->get_decl()); SASSERT(a->get_num_args() == b->get_num_args()); if (!enable_cc(a, b)) @@ -191,7 +191,7 @@ namespace euf { void ackerman::add_cc(expr* _a, expr* _b) { app* a = to_app(_a); app* b = to_app(_b); - TRACE("ack", tout << mk_pp(a, m) << " " << mk_pp(b, m) << "\n";); + TRACE(ack, tout << mk_pp(a, m) << " " << mk_pp(b, m) << "\n";); sat::literal_vector lits; unsigned sz = a->get_num_args(); @@ -216,7 +216,7 @@ namespace euf { expr_ref eq1(ctx.mk_eq(a, c), m); expr_ref eq2(ctx.mk_eq(b, c), m); expr_ref eq3(ctx.mk_eq(a, b), m); - TRACE("ack", tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << "\n";); + TRACE(ack, tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << "\n";); lits[0] = ~ctx.mk_literal(eq1); lits[1] = ~ctx.mk_literal(eq2); lits[2] = ctx.mk_literal(eq3); diff --git a/src/sat/smt/euf_internalize.cpp b/src/sat/smt/euf_internalize.cpp index 602364e7d..74c20abb0 100644 --- a/src/sat/smt/euf_internalize.cpp +++ b/src/sat/smt/euf_internalize.cpp @@ -63,7 +63,7 @@ namespace euf { SASSERT(n->bool_var() != sat::null_bool_var); return literal(n->bool_var(), sign); } - TRACE("euf", tout << "non-bool\n";); + TRACE(euf, tout << "non-bool\n";); return sat::null_literal; } if (si.is_bool_op(e)) { @@ -171,7 +171,7 @@ namespace euf { lit = lit2; } - TRACE("euf", tout << "attach b" << v << " " << mk_bounded_pp(e, m) << "\n";); + TRACE(euf, tout << "attach b" << v << " " << mk_bounded_pp(e, m) << "\n";); m_bool_var2expr.reserve(v + 1, nullptr); if (m_bool_var2expr[v] && m_egraph.find(e)) { if (m_egraph.find(e)->bool_var() != v) { @@ -190,7 +190,7 @@ namespace euf { enode* n = m_egraph.find(e); if (!n) n = mk_enode(e, 0, nullptr); - CTRACE("euf", n->bool_var() != sat::null_bool_var && n->bool_var() != v, display(tout << bpp(n) << " " << n->bool_var() << " vs " << v << "\n")); + CTRACE(euf, n->bool_var() != sat::null_bool_var && n->bool_var() != v, display(tout << bpp(n) << " " << n->bool_var() << " vs " << v << "\n")); SASSERT(n->bool_var() == sat::null_bool_var || n->bool_var() == v); m_egraph.set_bool_var(n, v); if (si.is_bool_op(e)) diff --git a/src/sat/smt/euf_invariant.cpp b/src/sat/smt/euf_invariant.cpp index c227148a3..671039716 100644 --- a/src/sat/smt/euf_invariant.cpp +++ b/src/sat/smt/euf_invariant.cpp @@ -53,7 +53,7 @@ namespace euf { !m.is_bool(n->get_app()->get_arg(0)) && (n->get_arg(0)->get_root() == n->get_arg(1)->get_root())) { enable_trace("euf"); - TRACE("euf", display(tout << n->get_expr_id() << ": " << mk_pp(n->get_expr(), m) << "\n" + TRACE(euf, display(tout << n->get_expr_id() << ": " << mk_pp(n->get_expr(), m) << "\n" << "#" << n->get_arg(0)->get_expr_id() << " == #" << n->get_arg(1)->get_expr_id() << " r: " << n->get_arg(0)->get_root_id() << "\n"); ); UNREACHABLE(); diff --git a/src/sat/smt/euf_model.cpp b/src/sat/smt/euf_model.cpp index 9739249db..2d665fadf 100644 --- a/src/sat/smt/euf_model.cpp +++ b/src/sat/smt/euf_model.cpp @@ -48,7 +48,7 @@ namespace euf { else value = factory.get_fresh_value(srt); (void)s; - TRACE("model", tout << s.bpp(r) << " := " << value << "\n";); + TRACE(model, tout << s.bpp(r) << " := " << value << "\n";); values.set(id, value); expr_ref_vector* vals = nullptr; if (!sort2values.find(srt, vals)) { @@ -77,7 +77,7 @@ namespace euf { } void solver::update_model(model_ref& mdl, bool validate) { - TRACE("model", tout << "create model\n";); + TRACE(model, tout << "create model\n";); if (m_qmodel) { mdl = m_qmodel; return; @@ -95,7 +95,7 @@ namespace euf { values2model(deps, mdl); for (auto* mb : m_solvers) mb->finalize_model(*mdl); - TRACE("model", tout << "created model " << *mdl << "\n";); + TRACE(model, tout << "created model " << *mdl << "\n";); if (validate) validate_model(*mdl); } @@ -137,7 +137,7 @@ namespace euf { for (enode* n : fresh_values) n->unmark1(); - TRACE("model", + TRACE(model, for (auto * t : deps.deps()) { auto* v = deps.get_dep(t); if (v) { @@ -151,7 +151,7 @@ namespace euf { void solver::dependencies2values(user_sort& us, deps_t& deps, model_ref& mdl) { for (enode* n : deps.top_sorted()) { - TRACE("model", tout << bpp(n->get_root()) << "\n"); + TRACE(model, tout << bpp(n->get_root()) << "\n"); unsigned id = n->get_root_id(); if (m_values.get(id, nullptr)) continue; @@ -228,7 +228,7 @@ namespace euf { if (m.is_bool(e) && is_uninterp_const(e) && mdl->get_const_interp(f)) continue; expr* v = m_values.get(n->get_root_id()); - CTRACE("euf", !v, tout << "no value for " << mk_pp(e, m) << "\n";); + CTRACE(euf, !v, tout << "no value for " << mk_pp(e, m) << "\n";); if (!v) continue; unsigned arity = f->get_arity(); @@ -245,13 +245,13 @@ namespace euf { enode* earg = get_enode(arg); expr* val = m_values.get(earg->get_root_id()); args.push_back(val); - CTRACE("euf", !val, tout << "no value for " << bpp(earg) << "\n" << bpp(n) << "\n"; display(tout);); + CTRACE(euf, !val, tout << "no value for " << bpp(earg) << "\n" << bpp(n) << "\n"; display(tout);); SASSERT(val); } SASSERT(args.size() == arity); if (!fi->get_entry(args.data())) fi->insert_new_entry(args.data(), v); - TRACE("euf", tout << bpp(n) << " " << f->get_name() << "\n"; + TRACE(euf, tout << bpp(n) << " " << f->get_name() << "\n"; for (expr* arg : args) tout << mk_pp(arg, m) << " "; tout << "\n -> " << mk_pp(v, m) << "\n"; for (euf::enode* arg : euf::enode_args(n)) tout << bpp(arg) << " "; @@ -279,7 +279,7 @@ namespace euf { for (enode* n : m_egraph.nodes()) if (n->is_root() && m_values.get(n->get_expr_id())) m_values2root.insert(m_values.get(n->get_expr_id()), n); - TRACE("model", + TRACE(model, for (auto const& kv : m_values2root) tout << mk_bounded_pp(kv.m_key, m) << "\n -> " << bpp(kv.m_value) << "\n";); @@ -337,7 +337,7 @@ namespace euf { return; model_evaluator ev(mdl); ev.set_model_completion(true); - TRACE("model", + TRACE(model, for (enode* n : m_egraph.nodes()) { if (!is_relevant(n)) continue; @@ -365,8 +365,8 @@ namespace euf { continue; if (!tt && !mdl.is_true(e)) continue; - CTRACE("euf", first, display_validation_failure(tout, mdl, n);); - CTRACE("euf", first, display(tout)); + CTRACE(euf, first, display_validation_failure(tout, mdl, n);); + CTRACE(euf, first, display(tout)); IF_VERBOSE(0, display_validation_failure(verbose_stream(), mdl, n);); (void)first; first = false; diff --git a/src/sat/smt/euf_proof.cpp b/src/sat/smt/euf_proof.cpp index 099019c6e..6f240a88d 100644 --- a/src/sat/smt/euf_proof.cpp +++ b/src/sat/smt/euf_proof.cpp @@ -118,7 +118,7 @@ namespace euf { void solver::log_antecedents(literal l, literal_vector const& r, th_proof_hint* hint) { SASSERT(hint && use_drat()); - TRACE("euf", log_antecedents(tout, l, r); tout << mk_pp(hint->get_hint(*this), m) << "\n"); + TRACE(euf, log_antecedents(tout, l, r); tout << mk_pp(hint->get_hint(*this), m) << "\n"); literal_vector lits; for (literal lit : r) lits.push_back(~lit); @@ -368,7 +368,7 @@ namespace euf { } void solver::on_clause(unsigned n, literal const* lits, sat::status st) { - TRACE("euf_verbose", tout << "on-clause " << n << "\n"); + TRACE(euf_verbose, tout << "on-clause " << n << "\n"); on_lemma(n, lits, st); on_proof(n, lits, st); on_check(n, lits, st); diff --git a/src/sat/smt/euf_relevancy.cpp b/src/sat/smt/euf_relevancy.cpp index 73fe49506..dec0d11f4 100644 --- a/src/sat/smt/euf_relevancy.cpp +++ b/src/sat/smt/euf_relevancy.cpp @@ -73,7 +73,7 @@ namespace euf { if (!m_enabled) return; flush(); - TRACE("relevancy", tout << "root " << sat::literal_vector(n, lits) << "\n"); + TRACE(relevancy, tout << "root " << sat::literal_vector(n, lits) << "\n"); sat::literal true_lit = sat::null_literal; for (unsigned i = 0; i < n; ++i) { if (ctx.s().value(lits[i]) == l_true) { @@ -102,7 +102,7 @@ namespace euf { if (!m_enabled) return; flush(); - TRACE("relevancy", tout << "def " << sat::literal_vector(n, lits) << "\n"); + TRACE(relevancy, tout << "def " << sat::literal_vector(n, lits) << "\n"); for (unsigned i = 0; i < n; ++i) { if (ctx.s().value(lits[i]) == l_false && is_relevant(lits[i])) { add_root(n, lits); @@ -163,7 +163,7 @@ namespace euf { } void relevancy::asserted(sat::literal lit) { - TRACE("relevancy", tout << "asserted " << lit << " relevant " << is_relevant(lit) << "\n"); + TRACE(relevancy, tout << "asserted " << lit << " relevant " << is_relevant(lit) << "\n"); if (!m_enabled) return; flush(); @@ -210,7 +210,7 @@ namespace euf { } void relevancy::merge(euf::enode* root, euf::enode* other) { - TRACE("relevancy", tout << "merge #" << ctx.bpp(root) << " " << is_relevant(root) << " #" << ctx.bpp(other) << " " << is_relevant(other) << "\n"); + TRACE(relevancy, tout << "merge #" << ctx.bpp(root) << " " << is_relevant(root) << " #" << ctx.bpp(other) << " " << is_relevant(other) << "\n"); if (is_relevant(root)) mark_relevant(other); else if (is_relevant(other)) @@ -223,13 +223,13 @@ namespace euf { flush(); if (is_relevant(n)) return; - TRACE("relevancy", tout << "mark #" << ctx.bpp(n) << "\n"); + TRACE(relevancy, tout << "mark #" << ctx.bpp(n) << "\n"); m_trail.push_back(std::make_pair(update::add_queue, 0)); m_queue.push_back(std::make_pair(sat::null_literal, n)); } void relevancy::mark_relevant(sat::literal lit) { - TRACE("relevancy", tout << "mark " << lit << " " << is_relevant(lit) << " " << ctx.s().value(lit) << " lim: " << m_lim.size() << "\n"); + TRACE(relevancy, tout << "mark " << lit << " " << is_relevant(lit) << " " << ctx.s().value(lit) << " lim: " << m_lim.size() << "\n"); if (!m_enabled) return; flush(); @@ -250,7 +250,7 @@ namespace euf { void relevancy::propagate_relevant(sat::literal lit) { SASSERT(m_num_scopes == 0); - TRACE("relevancy", tout << "propagate " << lit << " lim: " << m_lim.size() << "\n"); + TRACE(relevancy, tout << "propagate " << lit << " lim: " << m_lim.size() << "\n"); SASSERT(ctx.s().value(lit) == l_true); SASSERT(is_relevant(lit)); euf::enode* n = ctx.bool_var2enode(lit.var()); @@ -276,7 +276,7 @@ namespace euf { m_roots[idx] = true; } next: - TRACE("relevancy", tout << "propagate " << lit << " " << true_lit << " " << m_roots[idx] << "\n"); + TRACE(relevancy, tout << "propagate " << lit << " " << true_lit << " " << m_roots[idx] << "\n"); ; } } @@ -286,7 +286,7 @@ namespace euf { while (!m_todo.empty()) { n = m_todo.back(); m_todo.pop_back(); - TRACE("relevancy", tout << "propagate #" << ctx.bpp(n) << " lim: " << m_lim.size() << "\n"); + TRACE(relevancy, tout << "propagate #" << ctx.bpp(n) << " lim: " << m_lim.size() << "\n"); if (n->is_relevant()) continue; m_stack.push_back(n); diff --git a/src/sat/smt/euf_solver.cpp b/src/sat/smt/euf_solver.cpp index fbb1025b7..1d9a72f79 100644 --- a/src/sat/smt/euf_solver.cpp +++ b/src/sat/smt/euf_solver.cpp @@ -190,7 +190,7 @@ namespace euf { void solver::init_search() { if (get_config().m_sls_enable) add_solver(alloc(sls::solver, *this)); - TRACE("before_search", s().display(tout);); + TRACE(before_search, s().display(tout);); m_reason_unknown.clear(); for (auto* s : m_solvers) s->init_search(); @@ -310,7 +310,7 @@ namespace euf { } m_egraph.end_explain(); - CTRACE("euf", probing, tout << "explain " << l << " <- " << r << "\n"); + CTRACE(euf, probing, tout << "explain " << l << " <- " << r << "\n"); unsigned j = 0; for (auto lit : r) if (s().lvl(lit) > 0) @@ -413,7 +413,7 @@ namespace euf { lbool val = ante->value(); SASSERT(val != l_undef); literal ante_lit(v, val == l_false); - TRACE("euf", tout << "explain " << bpp(n) << " by " << bpp(ante) << "\n"); + TRACE(euf, tout << "explain " << bpp(n) << " by " << bpp(ante) << "\n"); m_explain.push_back(to_ptr(ante_lit)); } break; @@ -448,7 +448,7 @@ namespace euf { if (!m_relevancy.is_relevant(l)) return; expr* e = m_bool_var2expr.get(l.var(), nullptr); - TRACE("euf", tout << "asserted: " << l << "@" << s().scope_lvl() << " := " << mk_bounded_pp(e, m) << "\n";); + TRACE(euf, tout << "asserted: " << l << "@" << s().scope_lvl() << " := " << mk_bounded_pp(e, m) << "\n";); if (!e) return; euf::enode* n = m_egraph.find(e); @@ -571,7 +571,7 @@ namespace euf { } unsigned lvl = s().scope_lvl(); - CTRACE("euf", s().value(lit) != l_true, tout << lit << " " << s().value(lit) << "@" << lvl << " " << mk_bounded_pp(a, m) << " = " << mk_bounded_pp(b, m) << "\n";); + CTRACE(euf, s().value(lit) != l_true, tout << lit << " " << s().value(lit) << "@" << lvl << " " << mk_bounded_pp(a, m) << " = " << mk_bounded_pp(b, m) << "\n";); if (s().value(lit) == l_false && m_ackerman && a && b) m_ackerman->cg_conflict_eh(a, b); switch (s().value(lit)) { @@ -646,8 +646,8 @@ namespace euf { sat::check_result solver::check() { ++m_stats.m_final_checks; - TRACE("euf", s().display(tout);); - TRACE("final_check", s().display(tout);); + TRACE(euf, s().display(tout);); + TRACE(final_check, s().display(tout);); bool give_up = false; bool cont = false; @@ -658,7 +658,7 @@ namespace euf { auto apply_solver = [&](th_solver* e) { switch (e->check()) { case sat::check_result::CR_CONTINUE: cont = true; break; - case sat::check_result::CR_GIVEUP: m_reason_unknown = "incomplete theory " + e->name().str(); TRACE("euf", tout << "give up " << e->name() << "\n"); give_up = true; break; + case sat::check_result::CR_GIVEUP: m_reason_unknown = "incomplete theory " + e->name().str(); TRACE(euf, tout << "give up " << e->name() << "\n"); give_up = true; break; default: break; } }; @@ -688,7 +688,7 @@ namespace euf { return sat::check_result::CR_CONTINUE; if (cont) return sat::check_result::CR_CONTINUE; - TRACE("after_search", s().display(tout);); + TRACE(after_search, s().display(tout);); if (give_up) return sat::check_result::CR_GIVEUP; if (m_qsolver && m_config.m_arith_ignore_int) @@ -705,17 +705,17 @@ namespace euf { if (!m.is_bool(n->get_expr()) || !is_shared(n)) continue; if (n->value() == l_true && n->cgc_enabled() && !m.is_true(n->get_root()->get_expr())) { - TRACE("euf", tout << "merge " << bpp(n) << "\n"); + TRACE(euf, tout << "merge " << bpp(n) << "\n"); m_egraph.merge(n, mk_true(), to_ptr(sat::literal(n->bool_var()))); merged = true; } if (n->value() == l_false && n->cgc_enabled() && !m.is_false(n->get_root()->get_expr())) { - TRACE("euf", tout << "merge " << bpp(n) << "\n"); + TRACE(euf, tout << "merge " << bpp(n) << "\n"); m_egraph.merge(n, mk_false(), to_ptr(~sat::literal(n->bool_var()))); merged = true; } } - CTRACE("euf", merged, tout << "shared bools merged\n"); + CTRACE(euf, merged, tout << "shared bools merged\n"); return merged; } @@ -747,7 +747,7 @@ namespace euf { m_var_trail.shrink(sc.m_var_lim); m_scopes.shrink(m_scopes.size() - n); SASSERT(m_egraph.num_scopes() == m_scopes.size()); - TRACE("euf_verbose", display(tout << "pop to: " << m_scopes.size() << "\n");); + TRACE(euf_verbose, display(tout << "pop to: " << m_scopes.size() << "\n");); } void solver::user_push() { @@ -792,10 +792,10 @@ namespace euf { for (auto const& [e, generation, v] : m_reinit) replay.m.insert(e, v); - TRACE("euf", for (auto const& kv : replay.m) tout << "b" << kv.m_value << "\n";); + TRACE(euf, for (auto const& kv : replay.m) tout << "b" << kv.m_value << "\n";); for (auto const& [e, generation, v] : m_reinit) { scoped_generation _sg(*this, generation); - TRACE("euf", tout << "replay: b" << v << " #" << e->get_id() << " " << mk_bounded_pp(e, m) << " " << si.is_bool_op(e) << "\n";); + TRACE(euf, tout << "replay: b" << v << " #" << e->get_id() << " " << mk_bounded_pp(e, m) << " " << si.is_bool_op(e) << "\n";); sat::literal lit; if (si.is_bool_op(e)) lit = literal(replay.m[e], false); @@ -823,7 +823,7 @@ namespace euf { for (auto const& [e, generation, v] : m_reinit) if (si.is_bool_op(e)) relevancy_reinit(e); - TRACE("euf", display(tout << "replay done\n");); + TRACE(euf, display(tout << "replay done\n");); } /** @@ -832,7 +832,7 @@ namespace euf { * is not supported, we just disable relevancy. */ void solver::relevancy_reinit(expr* e) { - TRACE("euf", tout << "internalize again " << mk_pp(e, m) << "\n";); + TRACE(euf, tout << "internalize again " << mk_pp(e, m) << "\n";); if (to_app(e)->get_family_id() != m.get_basic_family_id()) { disable_relevancy(e); return; @@ -1040,7 +1040,7 @@ namespace euf { ok = false; (void)ok; - TRACE("euf", tout << ok << " " << l << " -> " << r << "\n";); + TRACE(euf, tout << ok << " " << l << " -> " << r << "\n";); // roots cannot be eliminated as long as the egraph contains the expressions. return false; } diff --git a/src/sat/smt/fpa_solver.cpp b/src/sat/smt/fpa_solver.cpp index 1de72d80b..699724b30 100644 --- a/src/sat/smt/fpa_solver.cpp +++ b/src/sat/smt/fpa_solver.cpp @@ -47,17 +47,17 @@ namespace fpa { expr_ref solver::convert(expr* e) { expr_ref res(m); expr* ccnv; - TRACE("t_fpa", tout << "converting " << mk_ismt2_pp(e, m) << "\n";); + TRACE(t_fpa, tout << "converting " << mk_ismt2_pp(e, m) << "\n";); if (m_conversions.find(e, ccnv)) { res = ccnv; - TRACE("t_fpa_detail", tout << "cached:" << "\n"; + TRACE(t_fpa_detail, tout << "cached:" << "\n"; tout << mk_ismt2_pp(e, m) << "\n" << " -> " << "\n" << mk_ismt2_pp(res, m) << "\n";); } else { res = m_rw.convert(m_th_rw, e); - TRACE("t_fpa_detail", tout << "converted; caching:" << "\n"; + TRACE(t_fpa_detail, tout << "converted; caching:" << "\n"; tout << mk_ismt2_pp(e, m) << "\n" << " -> " << "\n" << mk_ismt2_pp(res, m) << "\n";); m_conversions.insert(e, res); @@ -92,7 +92,7 @@ namespace fpa { void solver::attach_new_th_var(enode* n) { theory_var v = mk_var(n); ctx.attach_th_var(n, this, v); - TRACE("t_fpa", tout << "new theory var: " << mk_ismt2_pp(n->get_expr(), m) << " := " << v << "\n";); + TRACE(t_fpa, tout << "new theory var: " << mk_ismt2_pp(n->get_expr(), m) << " := " << v << "\n";); } sat::literal solver::internalize(expr* e, bool sign, bool root) { @@ -132,14 +132,14 @@ namespace fpa { n = mk_enode(e, false); SASSERT(!n->is_attached_to(get_id())); attach_new_th_var(n); - TRACE("fp", tout << "post: " << mk_bounded_pp(e, m) << "\n";); + TRACE(fp, tout << "post: " << mk_bounded_pp(e, m) << "\n";); m_nodes.push_back(std::tuple(n, sign, root)); ctx.push(push_back_trail(m_nodes)); return true; } void solver::apply_sort_cnstr(enode* n, sort* s) { - TRACE("t_fpa", tout << "apply sort cnstr for: " << mk_ismt2_pp(n->get_expr(), m) << "\n";); + TRACE(t_fpa, tout << "apply sort cnstr for: " << mk_ismt2_pp(n->get_expr(), m) << "\n";); SASSERT(s->get_family_id() == get_id()); SASSERT(m_fpa_util.is_float(s) || m_fpa_util.is_rm(s)); SASSERT(m_fpa_util.is_float(n->get_expr()) || m_fpa_util.is_rm(n->get_expr())); @@ -210,7 +210,7 @@ namespace fpa { } void solver::activate(expr* n) { - TRACE("t_fpa", tout << "relevant_eh for: " << mk_ismt2_pp(n, m) << "\n";); + TRACE(t_fpa, tout << "relevant_eh for: " << mk_ismt2_pp(n, m) << "\n";); mpf_manager& mpfm = m_fpa_util.fm(); @@ -264,13 +264,13 @@ namespace fpa { if (fu.is_bvwrap(xe) || fu.is_bvwrap(ye)) return; - TRACE("t_fpa", tout << "new eq: " << x << " = " << y << "\n"; + TRACE(t_fpa, tout << "new eq: " << x << " = " << y << "\n"; tout << mk_ismt2_pp(xe, m) << "\n" << " = " << "\n" << mk_ismt2_pp(ye, m) << "\n";); expr_ref xc = convert(xe); expr_ref yc = convert(ye); - TRACE("t_fpa_detail", tout << "xc = " << mk_ismt2_pp(xc, m) << "\n" << + TRACE(t_fpa_detail, tout << "xc = " << mk_ismt2_pp(xc, m) << "\n" << "yc = " << mk_ismt2_pp(yc, m) << "\n";); expr_ref c(m); @@ -300,7 +300,7 @@ namespace fpa { void solver::asserted(sat::literal l) { expr* e = ctx.bool_var2expr(l.var()); - TRACE("t_fpa", tout << "assign_eh for: " << l << "\n" << mk_ismt2_pp(e, m) << "\n";); + TRACE(t_fpa, tout << "assign_eh for: " << l << "\n" << mk_ismt2_pp(e, m) << "\n";); sat::literal c = mk_literal(convert(e)); sat::literal_vector conds = mk_side_conditions(); @@ -354,7 +354,7 @@ namespace fpa { value = m_fpa_util.mk_pzero(ebits, sbits); } values.set(n->get_root_id(), value); - TRACE("t_fpa", tout << ctx.bpp(n) << " := " << value << "\n";); + TRACE(t_fpa, tout << ctx.bpp(n) << " := " << value << "\n";); } bool solver::add_dep(euf::enode* n, top_sort& dep) { diff --git a/src/sat/smt/intblast_solver.cpp b/src/sat/smt/intblast_solver.cpp index 1a3a646d7..0e3fa6ecb 100644 --- a/src/sat/smt/intblast_solver.cpp +++ b/src/sat/smt/intblast_solver.cpp @@ -40,7 +40,7 @@ namespace intblast { euf::theory_var solver::mk_var(euf::enode* n) { auto r = euf::th_euf_solver::mk_var(n); ctx.attach_th_var(n, this, r); - TRACE("bv", tout << "mk-var: v" << r << " " << ctx.bpp(n) << "\n";); + TRACE(bv, tout << "mk-var: v" << r << " " << ctx.bpp(n) << "\n";); return r; } @@ -52,7 +52,7 @@ namespace intblast { sat::literal lit = expr2literal(e); if (sign) lit.neg(); - TRACE("bv", tout << mk_pp(e, m) << " -> " << literal2expr(lit) << "\n"); + TRACE(bv, tout << mk_pp(e, m) << " -> " << literal2expr(lit) << "\n"); return lit; } @@ -365,7 +365,7 @@ namespace intblast { for (expr* e : todo) m_translator.translate_expr(e); - TRACE("bv", + TRACE(bv, for (expr* e : es) tout << mk_pp(e, m) << "\n->\n" << mk_pp(m_translator.translated(e), m) << "\n"; ); @@ -500,7 +500,7 @@ namespace intblast { value = bv.mk_numeral(r, bv.get_bv_size(n->get_expr())); } values.set(n->get_root_id(), value); - TRACE("model", tout << "add_value " << ctx.bpp(n) << " := " << value << "\n"); + TRACE(model, tout << "add_value " << ctx.bpp(n) << " := " << value << "\n"); } void solver::finalize_model(model& mdl) { diff --git a/src/sat/smt/pb_card.cpp b/src/sat/smt/pb_card.cpp index 30120cb73..eaa994b67 100644 --- a/src/sat/smt/pb_card.cpp +++ b/src/sat/smt/pb_card.cpp @@ -124,7 +124,7 @@ namespace pb { if (!is_watched(s, root)) watch_literal(s, root); if (!is_pure() && !is_watched(s, ~root)) watch_literal(s, ~root); } - TRACE("ba", display(tout << "init watch: ", s, true);); + TRACE(ba, display(tout << "init watch: ", s, true);); SASSERT(root == sat::null_literal || s.value(root) == l_true); unsigned j = 0, sz = c.size(), bound = c.k(); // put the non-false literals into the head. diff --git a/src/sat/smt/pb_internalize.cpp b/src/sat/smt/pb_internalize.cpp index 391b643f5..b7873f7ba 100644 --- a/src/sat/smt/pb_internalize.cpp +++ b/src/sat/smt/pb_internalize.cpp @@ -125,7 +125,7 @@ namespace pb { bool_var v = s().add_var(true); literal lit(v, sign); add_pb_ge(v, false, wlits, k.get_unsigned()); - TRACE("ba", tout << "root: " << root << " lit: " << lit << "\n";); + TRACE(ba, tout << "root: " << root << " lit: " << lit << "\n";); return lit; } } @@ -152,7 +152,7 @@ namespace pb { sat::bool_var v = s().add_var(true); sat::literal lit(v, sign); add_pb_ge(v, false, wlits, k.get_unsigned()); - TRACE("goal2sat", tout << "root: " << root << " lit: " << lit << "\n";); + TRACE(goal2sat, tout << "root: " << root << " lit: " << lit << "\n";); return lit; } } @@ -217,7 +217,7 @@ namespace pb { add_at_least(v, lits, k.get_unsigned()); si.cache(t, lit); if (sign) lit.neg(); - TRACE("ba", tout << "root: " << root << " lit: " << lit << "\n";); + TRACE(ba, tout << "root: " << root << " lit: " << lit << "\n";); return lit; } } diff --git a/src/sat/smt/pb_pb.cpp b/src/sat/smt/pb_pb.cpp index 6665e19f0..a2cb20a89 100644 --- a/src/sat/smt/pb_pb.cpp +++ b/src/sat/smt/pb_pb.cpp @@ -178,7 +178,7 @@ namespace pb { // SASSERT(validate_watch(p, sat::null_literal)); - TRACE("ba", display(tout << "init watch: ", s, true);); + TRACE(ba, display(tout << "init watch: ", s, true);); // slack is tight: @@ -245,7 +245,7 @@ namespace pb { return false; unsigned sum = 0; - TRACE("ba", display(tout << "validate: " << alit << "\n", s, true);); + TRACE(ba, display(tout << "validate: " << alit << "\n", s, true);); for (wliteral wl : *this) { literal l = wl.second; lbool val = s.value(l); diff --git a/src/sat/smt/pb_solver.cpp b/src/sat/smt/pb_solver.cpp index 6dbc5a99d..823ad97aa 100644 --- a/src/sat/smt/pb_solver.cpp +++ b/src/sat/smt/pb_solver.cpp @@ -34,7 +34,7 @@ namespace pb { void solver::set_conflict(constraint& c, literal lit) { m_stats.m_num_conflicts++; - TRACE("pb", display(tout, c, true); ); + TRACE(pb, display(tout, c, true); ); if (!validate_conflict(c)) { IF_VERBOSE(0, display(verbose_stream(), c, true)); UNREACHABLE(); @@ -56,7 +56,7 @@ namespace pb { default: m_stats.m_num_propagations++; m_num_propagations_since_pop++; - //TRACE("pb", tout << "#prop: " << m_stats.m_num_propagations << " - " << c.lit() << " => " << lit << "\n";); + //TRACE(pb, tout << "#prop: " << m_stats.m_num_propagations << " - " << c.lit() << " => " << lit << "\n";); SASSERT(validate_unit_propagation(c, lit)); assign(lit, sat::justification::mk_ext_justification(s().scope_lvl(), c.cindex())); break; @@ -69,7 +69,7 @@ namespace pb { void solver::simplify(constraint& p) { SASSERT(s().at_base_lvl()); if (p.lit() != sat::null_literal && value(p.lit()) == l_false) { - TRACE("pb", tout << "pb: flip sign " << p << "\n";); + TRACE(pb, tout << "pb: flip sign " << p << "\n";); IF_VERBOSE(2, verbose_stream() << "sign is flipped " << p << "\n";); return; } @@ -280,7 +280,7 @@ namespace pb { */ lbool solver::add_assign(pbc& p, literal alit) { BADLOG(display(verbose_stream() << "assign: " << alit << " watch: " << p.num_watch() << " size: " << p.size(), p, true)); - TRACE("pb", display(tout << "assign: " << alit << "\n", p, true);); + TRACE(pb, display(tout << "assign: " << alit << "\n", p, true);); SASSERT(!inconsistent()); unsigned sz = p.size(); unsigned bound = p.k(); @@ -348,7 +348,7 @@ namespace pb { SASSERT(validate_watch(p, sat::null_literal)); BADLOG(display(verbose_stream() << "conflict: " << alit << " watch: " << p.num_watch() << " size: " << p.size(), p, true)); SASSERT(bound <= slack); - TRACE("pb", tout << "conflict " << alit << "\n";); + TRACE(pb, tout << "conflict " << alit << "\n";); set_conflict(p, alit); return l_false; } @@ -372,7 +372,7 @@ namespace pb { // if (slack < bound + m_a_max) { BADLOG(verbose_stream() << "slack " << slack << " " << bound << " " << m_a_max << "\n";); - TRACE("pb", tout << p << "\n"; for(auto j : m_pb_undef) tout << j << " "; tout << "\n";); + TRACE(pb, tout << p << "\n"; for(auto j : m_pb_undef) tout << j << " "; tout << "\n";); for (unsigned index1 : m_pb_undef) { if (index1 == num_watch) { index1 = index; @@ -389,7 +389,7 @@ namespace pb { SASSERT(validate_watch(p, alit)); // except that alit is still watched. - TRACE("pb", display(tout << "assign: " << alit << "\n", p, true);); + TRACE(pb, display(tout << "assign: " << alit << "\n", p, true);); BADLOG(verbose_stream() << "unwatch " << alit << " watch: " << p.num_watch() << " size: " << p.size() << " slack: " << p.slack() << " " << inconsistent() << "\n"); @@ -497,7 +497,7 @@ namespace pb { bool_var v = l.var(); SASSERT(v != sat::null_bool_var); m_coeffs.reserve(v + 1, 0); - TRACE("ba_verbose", tout << l << " " << offset << "\n";); + TRACE(ba_verbose, tout << l << " " << offset << "\n";); int64_t coeff0 = m_coeffs[v]; if (coeff0 == 0) { @@ -547,7 +547,7 @@ namespace pb { literal l = literal(v, c1 < 0); c1 = std::abs(c1); unsigned c = static_cast(c1); - // TRACE("pb", tout << l << " " << c << "\n";); + // TRACE(pb, tout << l << " " << c << "\n";); m_overflow |= c != c1; return wliteral(c, l); } @@ -638,7 +638,7 @@ namespace pb { m_bound = 0; literal consequent = s().m_not_l; sat::justification js = s().m_conflict; - TRACE("pb", tout << consequent << " " << js << "\n";); + TRACE(pb, tout << consequent << " " << js << "\n";); bool unique_max; m_conflict_lvl = s().get_max_lvl(consequent, js, unique_max); if (m_conflict_lvl == 0) { @@ -666,8 +666,8 @@ namespace pb { goto process_next_resolvent; } - DEBUG_CODE(TRACE("sat_verbose", display(tout, m_A););); - TRACE("pb", tout << "process consequent: " << consequent << " : "; s().display_justification(tout, js) << "\n";); + DEBUG_CODE(TRACE(sat_verbose, display(tout, m_A););); + TRACE(pb, tout << "process consequent: " << consequent << " : "; s().display_justification(tout, js) << "\n";); SASSERT(offset > 0); if (_debug_conflict) { @@ -729,7 +729,7 @@ namespace pb { inc_bound(offset); inc_coeff(consequent, offset); get_antecedents(consequent, p, m_lemma); - TRACE("pb", display(tout, p, true); tout << m_lemma << "\n";); + TRACE(pb, display(tout, p, true); tout << m_lemma << "\n";); if (_debug_conflict) { verbose_stream() << consequent << " "; verbose_stream() << "antecedents: " << m_lemma << "\n"; @@ -754,7 +754,7 @@ namespace pb { active2pb(m_C); VERIFY(validate_resolvent()); m_A = m_C; - TRACE("pb", display(tout << "conflict: ", m_A););); + TRACE(pb, display(tout << "conflict: ", m_A););); cut(); @@ -781,7 +781,7 @@ namespace pb { SASSERT(lvl(v) == m_conflict_lvl); s().reset_mark(v); --idx; - TRACE("sat_verbose", tout << "Unmark: v" << v << "\n";); + TRACE(sat_verbose, tout << "Unmark: v" << v << "\n";); --m_num_marks; js = s().m_justification[v]; offset = get_abs_coeff(v); @@ -875,7 +875,7 @@ namespace pb { } } ineq.divide(c); - TRACE("pb", display(tout << "var: " << v << " " << c << ": ", ineq, true);); + TRACE(pb, display(tout << "var: " << v << " " << c << ": ", ineq, true);); } void solver::round_to_one(bool_var w) { @@ -893,7 +893,7 @@ namespace pb { SASSERT(validate_lemma()); divide(c); SASSERT(validate_lemma()); - TRACE("pb", active2pb(m_B); display(tout, m_B, true);); + TRACE(pb, active2pb(m_B); display(tout, m_B, true);); } void solver::divide(unsigned c) { @@ -923,14 +923,14 @@ namespace pb { } void solver::resolve_with(ineq const& ineq) { - TRACE("pb", display(tout, ineq, true);); + TRACE(pb, display(tout, ineq, true);); inc_bound(ineq.m_k); - TRACE("pb", tout << "bound: " << m_bound << "\n";); + TRACE(pb, tout << "bound: " << m_bound << "\n";); for (unsigned i = ineq.size(); i-- > 0; ) { literal l = ineq.lit(i); inc_coeff(l, static_cast(ineq.coeff(i))); - TRACE("pb", tout << "bound: " << m_bound << " lit: " << l << " coeff: " << ineq.coeff(i) << "\n";); + TRACE(pb, tout << "bound: " << m_bound << " lit: " << l << " coeff: " << ineq.coeff(i) << "\n";); } } @@ -983,11 +983,11 @@ namespace pb { consequent.neg(); process_antecedent(consequent, 1); } - TRACE("pb", tout << consequent << " " << js << "\n";); + TRACE(pb, tout << consequent << " " << js << "\n";); unsigned idx = s().m_trail.size() - 1; do { - TRACE("pb", s().display_justification(tout << "process consequent: " << consequent << " : ", js) << "\n"; + TRACE(pb, s().display_justification(tout << "process consequent: " << consequent << " : ", js) << "\n"; if (consequent != sat::null_literal) { active2pb(m_A); display(tout, m_A, true); } ); @@ -1049,7 +1049,7 @@ namespace pb { } else { SASSERT(k > c); - TRACE("pb", tout << "visited: " << l << "\n";); + TRACE(pb, tout << "visited: " << l << "\n";); k -= c; } } @@ -1098,7 +1098,7 @@ namespace pb { } } if (idx == 0) { - TRACE("pb", tout << "there is no consequent\n";); + TRACE(pb, tout << "there is no consequent\n";); goto bail_out; } --idx; @@ -1111,7 +1111,7 @@ namespace pb { js = s().m_justification[v]; } while (m_num_marks > 0 && !m_overflow); - TRACE("pb", active2pb(m_A); display(tout, m_A, true);); + TRACE(pb, active2pb(m_A); display(tout, m_A, true);); // TBD: check if this is useful if (!m_overflow && consequent != sat::null_literal) { @@ -1123,7 +1123,7 @@ namespace pb { } bail_out: - TRACE("pb", tout << "bail " << m_overflow << "\n";); + TRACE(pb, tout << "bail " << m_overflow << "\n";); if (m_overflow) { ++m_stats.m_num_overflow; m_overflow = false; @@ -1179,23 +1179,23 @@ namespace pb { } } if (slack >= 0) { - TRACE("pb", tout << "slack is non-negative\n";); + TRACE(pb, tout << "slack is non-negative\n";); IF_VERBOSE(20, verbose_stream() << "(sat.card slack: " << slack << " skipped: " << num_skipped << ")\n";); return false; } if (m_overflow) { - TRACE("pb", tout << "overflow\n";); + TRACE(pb, tout << "overflow\n";); return false; } if (m_lemma[0] == sat::null_literal) { if (m_lemma.size() == 1) { s().set_conflict(sat::justification(0)); } - TRACE("pb", tout << "no asserting literal\n";); + TRACE(pb, tout << "no asserting literal\n";); return false; } - TRACE("pb", tout << m_lemma << "\n";); + TRACE(pb, tout << m_lemma << "\n";); if (get_config().m_drat && m_solver) { s().m_drat.add(m_lemma, sat::status::th(true, get_id())); @@ -1204,7 +1204,7 @@ namespace pb { s().m_lemma.reset(); s().m_lemma.append(m_lemma); for (unsigned i = 1; i < m_lemma.size(); ++i) { - CTRACE("pb", s().is_marked(m_lemma[i].var()), tout << "marked: " << m_lemma[i] << "\n";); + CTRACE(pb, s().is_marked(m_lemma[i].var()), tout << "marked: " << m_lemma[i] << "\n";); s().mark(m_lemma[i].var()); } return true; @@ -1550,7 +1550,7 @@ namespace pb { } void solver::get_antecedents(literal l, pbc const& p, literal_vector& r) { - TRACE("pb", display(tout << l << " level: " << s().scope_lvl() << " ", p, true);); + TRACE(pb, display(tout << l << " level: " << s().scope_lvl() << " ", p, true);); SASSERT(p.lit() == sat::null_literal || value(p.lit()) == l_true); if (p.lit() != sat::null_literal) { @@ -1602,7 +1602,7 @@ namespace pb { if (j < p.num_watch()) { j = p.num_watch(); } - CTRACE("pb", coeff == 0, display(tout << l << " coeff: " << coeff << "\n", p, true);); + CTRACE(pb, coeff == 0, display(tout << l << " coeff: " << coeff << "\n", p, true);); if (_debug_conflict) { IF_VERBOSE(0, verbose_stream() << "coeff " << coeff << "\n";); @@ -1653,7 +1653,7 @@ namespace pb { for (unsigned i = 0; !found && i < c.k(); ++i) { found = c[i] == l; } - CTRACE("pb",!found, s().display(tout << l << ":" << c << "\n");); + CTRACE(pb,!found, s().display(tout << l << ":" << c << "\n");); SASSERT(found);); VERIFY(c.lit() == sat::null_literal || value(c.lit()) != l_false); @@ -1693,7 +1693,7 @@ namespace pb { } void solver::remove_constraint(constraint& c, char const* reason) { - TRACE("pb", display(tout << "remove ", c, true) << " " << reason << "\n";); + TRACE(pb, display(tout << "remove ", c, true) << " " << reason << "\n";); IF_VERBOSE(21, display(verbose_stream() << "remove " << reason << " ", c, true);); c.nullify_tracking_literal(*this); clear_watch(c); @@ -1868,7 +1868,7 @@ namespace pb { } void solver::gc_half(char const* st_name) { - TRACE("pb", tout << "gc\n";); + TRACE(pb, tout << "gc\n";); unsigned sz = m_learned.size(); unsigned new_sz = sz/2; unsigned removed = 0; @@ -1915,7 +1915,7 @@ namespace pb { // literal is assigned to false. unsigned sz = c.size(); unsigned bound = c.k(); - TRACE("pb", tout << "assign: " << c.lit() << ": " << ~alit << "@" << lvl(~alit) << " " << c << "\n";); + TRACE(pb, tout << "assign: " << c.lit() << ": " << ~alit << "@" << lvl(~alit) << " " << c << "\n";); SASSERT(0 < bound && bound <= sz); if (bound == sz) { @@ -1953,7 +1953,7 @@ namespace pb { // conflict if (bound != index && value(c[bound]) == l_false) { - TRACE("pb", tout << "conflict " << c[bound] << " " << alit << "\n";); + TRACE(pb, tout << "conflict " << c[bound] << " " << alit << "\n";); if (c.lit() != sat::null_literal && value(c.lit()) == l_undef) { if (index + 1 < bound) c.swap(index, bound - 1); assign(c, ~c.lit()); @@ -1967,7 +1967,7 @@ namespace pb { c.swap(index, bound); } - // TRACE("pb", tout << "no swap " << index << " " << alit << "\n";); + // TRACE(pb, tout << "no swap " << index << " " << alit << "\n";); // there are no literals to swap with, // prepare for unit propagation by swapping the false literal into // position bound. Then literals in positions 0..bound-1 have to be @@ -2002,7 +2002,7 @@ namespace pb { } void solver::pop(unsigned n) { - TRACE("sat_verbose", tout << "pop:" << n << "\n";); + TRACE(sat_verbose, tout << "pop:" << n << "\n";); unsigned new_lim = m_constraint_to_reinit_lim.size() - n; m_constraint_to_reinit_last_sz = m_constraint_to_reinit_lim[new_lim]; m_constraint_to_reinit_lim.shrink(new_lim); @@ -2333,7 +2333,7 @@ namespace pb { } if (!all_units) { - TRACE("pb", tout << "replacing by pb: " << c << "\n";); + TRACE(pb, tout << "replacing by pb: " << c << "\n";); m_wlits.reset(); for (unsigned i = 0; i < sz; ++i) { m_wlits.push_back(wliteral(coeffs[i], c[i])); @@ -2898,13 +2898,13 @@ namespace pb { SASSERT(&c1 != &c2); if (subsumes(c1, c2, slit)) { if (slit.empty()) { - TRACE("pb", tout << "subsume cardinality\n" << c1 << "\n" << c2 << "\n";); + TRACE(pb, tout << "subsume cardinality\n" << c1 << "\n" << c2 << "\n";); remove_constraint(c2, "subsumed"); ++m_stats.m_num_pb_subsumes; set_non_learned(c1); } else { - TRACE("pb", tout << "self subsume cardinality\n";); + TRACE(pb, tout << "self subsume cardinality\n";); IF_VERBOSE(11, verbose_stream() << "self-subsume cardinality\n"; verbose_stream() << c1 << "\n"; @@ -2936,7 +2936,7 @@ namespace pb { // self-subsumption is TBD } else { - TRACE("pb", tout << "remove\n" << c1 << "\n" << c2 << "\n";); + TRACE(pb, tout << "remove\n" << c1 << "\n" << c2 << "\n";); removed_clauses.push_back(&c2); ++m_stats.m_num_clause_subsumes; set_non_learned(c1); @@ -3268,7 +3268,7 @@ namespace pb { val += wl.first; } } - CTRACE("pb", val >= 0, active2pb(m_A); display(tout, m_A, true);); + CTRACE(pb, val >= 0, active2pb(m_A); display(tout, m_A, true);); return val < 0; } @@ -3281,7 +3281,7 @@ namespace pb { if (!is_false(wl.second)) k += wl.first; } - CTRACE("pb", k > 0, display(tout, ineq, true);); + CTRACE(pb, k > 0, display(tout, ineq, true);); return k <= 0; } @@ -3340,7 +3340,7 @@ namespace pb { return nullptr; } constraint* c = add_pb_ge(sat::null_literal, m_wlits, m_bound, true); - TRACE("pb", if (c) display(tout, *c, true);); + TRACE(pb, if (c) display(tout, *c, true);); ++m_stats.m_num_lemmas; return c; } @@ -3528,7 +3528,7 @@ namespace pb { s0.assign_scoped(l2); s0.assign_scoped(l3); lbool is_sat = s0.check(); - TRACE("pb", s0.display(tout << "trying sat encoding");); + TRACE(pb, s0.display(tout << "trying sat encoding");); if (is_sat == l_false) return true; IF_VERBOSE(0, @@ -3639,11 +3639,11 @@ namespace pb { bool solver::validate_conflict(literal_vector const& lits, ineq& p) { for (literal l : lits) { if (value(l) != l_false) { - TRACE("pb", tout << "literal " << l << " is not false\n";); + TRACE(pb, tout << "literal " << l << " is not false\n";); return false; } if (!p.contains(l)) { - TRACE("pb", tout << "lemma contains literal " << l << " not in inequality\n";); + TRACE(pb, tout << "lemma contains literal " << l << " not in inequality\n";); return false; } } @@ -3654,7 +3654,7 @@ namespace pb { value += coeff; } } - CTRACE("pb", value >= p.m_k, tout << "slack: " << value << " bound " << p.m_k << "\n"; + CTRACE(pb, value >= p.m_k, tout << "slack: " << value << " bound " << p.m_k << "\n"; display(tout, p); tout << lits << "\n";); return value < p.m_k; diff --git a/src/sat/smt/q_ematch.cpp b/src/sat/smt/q_ematch.cpp index f2988c9c2..f56f10b7d 100644 --- a/src/sat/smt/q_ematch.cpp +++ b/src/sat/smt/q_ematch.cpp @@ -157,7 +157,7 @@ namespace q { SASSERT(is_forall(r)); for (expr* d : m_new_defs) m_qs.add_unit(m_qs.mk_literal(d)); - CTRACE("q", r != q, tout << mk_pp(q, m) << " -->\n" << r << "\n" << m_new_defs << "\n";); + CTRACE(q, r != q, tout << mk_pp(q, m) << " -->\n" << r << "\n" << m_new_defs << "\n";); return quantifier_ref(to_quantifier(r), m); } @@ -191,7 +191,7 @@ namespace q { }; void ematch::on_merge(euf::enode* root, euf::enode* other) { - TRACE("q", tout << "on-merge " << ctx.bpp(root) << " " << ctx.bpp(other) << "\n";); + TRACE(q, tout << "on-merge " << ctx.bpp(root) << " " << ctx.bpp(other) << "\n";); SASSERT(root->get_root() == other->get_root()); unsigned root_id = root->get_expr_id(); unsigned other_id = other->get_expr_id(); @@ -331,7 +331,7 @@ namespace q { binding* b = alloc_binding(c, pat, _binding, max_generation, min_gen, max_gen); if (!b) return; - TRACE("q", b->display(ctx, tout << "on-binding " << mk_pp(q, m) << "\n") << "\n";); + TRACE(q, b->display(ctx, tout << "on-binding " << mk_pp(q, m) << "\n") << "\n";); if (propagate(false, _binding, max_generation, c, new_propagation)) @@ -576,7 +576,7 @@ namespace q { }; void ematch::add(quantifier* _q) { - TRACE("q", tout << "add " << mk_pp(_q, m) << "\n"); + TRACE(q, tout << "add " << mk_pp(_q, m) << "\n"); scoped_ptr c = clausify(_q); quantifier* q = c->q(); if (m_q2clauses.contains(q)) @@ -598,9 +598,9 @@ namespace q { app * mp = to_app(q->get_pattern(i)); SASSERT(m.is_pattern(mp)); bool unary = (mp->get_num_args() == 1); - TRACE("q", tout << "adding:\n" << expr_ref(mp, m) << "\n"); + TRACE(q, tout << "adding:\n" << expr_ref(mp, m) << "\n"); if (!unary && j >= num_eager_multi_patterns) { - TRACE("q", tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n";); + TRACE(q, tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n";); if (!m_lazy_mam) m_lazy_mam = euf::mam::mk(ctx, *this); m_lazy_mam->add_pattern(q, mp); @@ -675,7 +675,7 @@ namespace q { } bool ematch::operator()() { - TRACE("q", m_mam->display(tout);); + TRACE(q, m_mam->display(tout);); if (propagate(false)) return true; if (m_lazy_mam) @@ -692,11 +692,11 @@ namespace q { for (unsigned i = 0; i < m_clauses.size(); ++i) if (m_clauses[i]->m_bindings) { IF_VERBOSE(0, verbose_stream() << "missed propagation " << i << "\n"); - TRACE("q", display(tout << "missed propagation\n")); + TRACE(q, display(tout << "missed propagation\n")); break; } - TRACE("q", tout << "no more propagation\n";); + TRACE(q, tout << "no more propagation\n";); return false; } diff --git a/src/sat/smt/q_eval.cpp b/src/sat/smt/q_eval.cpp index 35bdc4285..9038f3434 100644 --- a/src/sat/smt/q_eval.cpp +++ b/src/sat/smt/q_eval.cpp @@ -47,7 +47,7 @@ namespace q { unsigned lim = m_indirect_nodes.size(); lit l = c[i]; lbool cmp = compare(n, binding, l.lhs, l.rhs, evidence); - TRACE("q", tout << l.lhs << " ~~ " << l.rhs << " is " << cmp << "\n";); + TRACE(q, tout << l.lhs << " ~~ " << l.rhs << " is " << cmp << "\n";); switch (cmp) { case l_false: m_indirect_nodes.shrink(lim); @@ -93,7 +93,7 @@ namespace q { euf::enode* tr = tn ? tn->get_root() : tn; if (sn != sr) evidence.push_back(euf::enode_pair(sn, sr)), sn = sr; if (tn != tr) evidence.push_back(euf::enode_pair(tn, tr)), tn = tr; - TRACE("q", tout << mk_pp(s, m) << " ~~ " << mk_pp(t, m) << "\n"; + TRACE(q, tout << mk_pp(s, m) << " ~~ " << mk_pp(t, m) << "\n"; tout << ctx.bpp(sn) << " " << ctx.bpp(tn) << "\n";); lbool c; @@ -237,7 +237,7 @@ namespace q { if (a->get_root() != b->get_root()) return nullptr; - TRACE("q", tout << "evidence " << ctx.bpp(a) << " " << ctx.bpp(b) << "\n"); + TRACE(q, tout << "evidence " << ctx.bpp(a) << " " << ctx.bpp(b) << "\n"); evidence.push_back(euf::enode_pair(a, b)); } m_indirect_nodes.push_back(n); diff --git a/src/sat/smt/q_mbi.cpp b/src/sat/smt/q_mbi.cpp index 881515f37..ec9b1a0a6 100644 --- a/src/sat/smt/q_mbi.cpp +++ b/src/sat/smt/q_mbi.cpp @@ -197,7 +197,7 @@ namespace q { expr_ref_vector eqs(m); add_domain_bounds(mdl, qb); auto proj = solver_project(mdl, qb, eqs, false); - CTRACE("q", !proj, tout << "could not project " << qb.mbody << " " << eqs << "\n" << mdl); + CTRACE(q, !proj, tout << "could not project " << qb.mbody << " " << eqs << "\n" << mdl); if (!proj) return false; add_instantiation(q, proj); @@ -234,7 +234,7 @@ namespace q { if (is_exists(q)) qlit.neg(); ctx.rewrite(proj); - TRACE("q", tout << "project: " << proj << "\n";); + TRACE(q, tout << "project: " << proj << "\n";); IF_VERBOSE(11, verbose_stream() << "mbi:\n" << mk_pp(q, m) << "\n" << proj << "\n"); ++m_stats.m_num_instantiations; unsigned generation = ctx.get_max_generation(proj); @@ -280,7 +280,7 @@ namespace q { mbody = subst(mbody, result->vars); if (is_forall(q)) mbody = mk_not(m, mbody); - TRACE("q", tout << "specialize " << mbody << "\n";); + TRACE(q, tout << "specialize " << mbody << "\n";); return result; } @@ -319,7 +319,7 @@ namespace q { app_ref_vector vars(qb.vars); bool fmls_extracted = false; m_defs.reset(); - TRACE("q", + TRACE(q, tout << "Project\n"; tout << fmls << "\n"; tout << "model\n"; @@ -337,13 +337,13 @@ namespace q { app* v = vars.get(i); auto* p = get_plugin(v); if (p && !fmls_extracted) { - TRACE("q", tout << "domain eqs\n" << qb.domain_eqs << "\n";); + TRACE(q, tout << "domain eqs\n" << qb.domain_eqs << "\n";); fmls.append(qb.domain_eqs); eliminate_nested_vars(fmls, qb); for (expr* e : fmls) if (!m_model->is_true(e)) { - TRACE("q", tout << "not true: " << mk_pp(e, m) << " := " << (*m_model)(e) << "\n"); + TRACE(q, tout << "not true: " << mk_pp(e, m) << " := " << (*m_model)(e) << "\n"); return expr_ref(nullptr, m); } mbp::project_plugin proj(m); @@ -357,21 +357,21 @@ namespace q { return expr_ref(m); } else if (!(*p)(*m_model, vars, fmls)) { - TRACE("q", tout << "theory projection failed - use value\n"); + TRACE(q, tout << "theory projection failed - use value\n"); } } for (app* v : vars) { expr_ref term(m); expr_ref val = (*m_model)(v); term = replace_model_value(val); - TRACE("euf", tout << "replaced model value " << term << "\nfrom\n" << val << "\n"); + TRACE(euf, tout << "replaced model value " << term << "\nfrom\n" << val << "\n"); rep.insert(v, term); if (ctx.use_drat()) m_defs.push_back({expr_ref(v, m), term}); eqs.push_back(m.mk_eq(v, val)); } rep(fmls); - TRACE("q", tout << "generated formulas\n" << fmls << "\ngenerated eqs:\n" << eqs << "\n"; + TRACE(q, tout << "generated formulas\n" << fmls << "\ngenerated eqs:\n" << eqs << "\n"; for (auto const& [v,t] : m_defs) tout << v << " := " << t << "\n"); return mk_and(fmls); } @@ -436,7 +436,7 @@ namespace q { void mbqi::assert_expr(expr* e) { expr_ref _e(e, m); - TRACE("q", tout << _e << "\n"); + TRACE(q, tout << _e << "\n"); m_solver->assert_expr(e); } diff --git a/src/sat/smt/q_model_fixer.cpp b/src/sat/smt/q_model_fixer.cpp index 38f38ee0a..b092f62f3 100644 --- a/src/sat/smt/q_model_fixer.cpp +++ b/src/sat/smt/q_model_fixer.cpp @@ -70,7 +70,7 @@ namespace q { if (univ.empty()) return; - TRACE("q", tout << "start: " << mdl << "\n";); + TRACE(q, tout << "start: " << mdl << "\n";); m_dependencies.reset(); m_projection_data.reset(); m_projection_pinned.reset(); @@ -96,7 +96,7 @@ namespace q { if (fi->is_partial()) fi->set_else(mdl.get_some_value(f->get_range())); } - TRACE("q", tout << "end: " << mdl << "\n";); + TRACE(q, tout << "end: " << mdl << "\n";); } quantifier_macro_info* model_fixer::operator()(quantifier* q) { @@ -252,7 +252,7 @@ namespace q { expr* model_fixer::invert_app(app* t, expr* value) { euf::enode* r = nullptr; auto& v2r = ctx.values2root(); - TRACE("q", + TRACE(q, tout << "invert-app " << mk_pp(t, m) << " =\n" << mk_pp(value, m) << "\n"; if (v2r.find(value, r)) tout << "inverse " << mk_pp(r->get_expr(), m) << "\n"; @@ -273,7 +273,7 @@ namespace q { */ void model_fixer::invert_arg(app* t, unsigned i, expr* value, expr_ref_vector& lits) { - TRACE("q", tout << "invert-arg " << mk_pp(t, m) << " " << i << " " << mk_pp(value, m) << "\n";); + TRACE(q, tout << "invert-arg " << mk_pp(t, m) << " " << i << " " << mk_pp(value, m) << "\n";); auto const* md = get_projection_data(t->get_decl(), i); if (!md) return; @@ -326,7 +326,7 @@ namespace q { * restrict arg_i of t := f(...,arg_i,...) to be one of terms from the ground instantiations of f. */ expr_ref model_fixer::restrict_arg(app* t, unsigned i) { - TRACE("q", tout << "restrict-arg " << mk_pp(t, m) << " " << i << "\n";); + TRACE(q, tout << "restrict-arg " << mk_pp(t, m) << " " << i << "\n";); auto const* md = get_projection_data(t->get_decl(), i); if (!md) return expr_ref(m.mk_true(), m); diff --git a/src/sat/smt/q_queue.cpp b/src/sat/smt/q_queue.cpp index 95aff5e4d..38572c8cf 100644 --- a/src/sat/smt/q_queue.cpp +++ b/src/sat/smt/q_queue.cpp @@ -41,7 +41,7 @@ namespace q { } void queue::setup() { - TRACE("q", tout << "qi_cost: " << m_params.m_qi_cost << "\n";); + TRACE(q, tout << "qi_cost: " << m_params.m_qi_cost << "\n";); if (!m_parser.parse_string(m_params.m_qi_cost.c_str(), m_cost_function)) { warning_msg("invalid cost function '%s', switching to default one", m_params.m_qi_cost.c_str()); VERIFY(m_parser.parse_string("(+ weight generation)", m_cost_function)); @@ -105,7 +105,7 @@ namespace q { m_vals[SCOPE] = static_cast(ctx.s().num_scopes()); m_vals[NESTED_QUANTIFIERS] = static_cast(stat->get_num_nested_quantifiers()); m_vals[CS_FACTOR] = static_cast(stat->get_case_split_factor()); - TRACE("q_detail", for (unsigned i = 0; i < m_vals.size(); i++) { tout << m_vals[i] << " "; } tout << "\n";); + TRACE(q_detail, for (unsigned i = 0; i < m_vals.size(); i++) { tout << m_vals[i] << " "; } tout << "\n";); } float queue::get_cost(binding& f) { @@ -196,11 +196,11 @@ namespace q { instantiate(curr); else if (m_params.m_qi_promote_unsat && l_false == em.evaluate(f.nodes(), *f.c)) { // do not delay instances that produce a conflict. - TRACE("q", tout << "promoting instance that produces a conflict\n" << mk_pp(f.q(), m) << "\n";); + TRACE(q, tout << "promoting instance that produces a conflict\n" << mk_pp(f.q(), m) << "\n";); instantiate(curr); } else { - TRACE("q", tout << "delaying quantifier instantiation... " << f << "\n" << mk_pp(f.q(), m) << "\ncost: " << curr.m_cost << "\n";); + TRACE(q, tout << "delaying quantifier instantiation... " << f << "\n" << mk_pp(f.q(), m) << "\ncost: " << curr.m_cost << "\n";); m_delayed_entries.push_back(curr); ctx.push(push_back_vector>(m_delayed_entries)); } @@ -227,7 +227,7 @@ namespace q { bool init = false; cost_limit = 0.0; for (entry & e : m_delayed_entries) { - TRACE("q", tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";); + TRACE(q, tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";); if (!e.m_instantiated && e.m_cost <= m_params.m_qi_lazy_threshold && (!init || e.m_cost < cost_limit)) { init = true; cost_limit = e.m_cost; diff --git a/src/sat/smt/q_solver.cpp b/src/sat/smt/q_solver.cpp index ed6cb643b..d48374081 100644 --- a/src/sat/smt/q_solver.cpp +++ b/src/sat/smt/q_solver.cpp @@ -357,7 +357,7 @@ namespace q { } void solver::log_instantiation(unsigned n, sat::literal const* lits, justification* j) { - TRACE("q", for (unsigned i = 0; i < n; ++i) tout << literal2expr(lits[i]) << "\n";); + TRACE(q, for (unsigned i = 0; i < n; ++i) tout << literal2expr(lits[i]) << "\n";); if (get_config().m_instantiations2console) { ctx.on_instantiation(n, lits, j ? j->m_clause.num_decls() : 0, j ? j->m_binding : nullptr); } diff --git a/src/sat/smt/recfun_solver.cpp b/src/sat/smt/recfun_solver.cpp index 63a790eea..89688a037 100644 --- a/src/sat/smt/recfun_solver.cpp +++ b/src/sat/smt/recfun_solver.cpp @@ -20,7 +20,7 @@ Author: #include "sat/smt/euf_solver.h" -#define TRACEFN(x) TRACE("recfun", tout << x << '\n';) +#define TRACEFN(x) TRACE(recfun, tout << x << '\n';) namespace recfun { @@ -236,7 +236,7 @@ namespace recfun { force_push(); SASSERT(m.is_bool(e)); if (!visit_rec(m, e, sign, root)) { - TRACE("array", tout << mk_pp(e, m) << "\n";); + TRACE(array, tout << mk_pp(e, m) << "\n";); return sat::null_literal; } auto lit = expr2literal(e); diff --git a/src/sat/smt/sat_th.h b/src/sat/smt/sat_th.h index 8228f1ce4..86a719d18 100644 --- a/src/sat/smt/sat_th.h +++ b/src/sat/smt/sat_th.h @@ -198,7 +198,7 @@ namespace euf { virtual void push_core(); virtual void pop_core(unsigned n); void force_push() { - CTRACE("euf_verbose", m_num_scopes > 0, tout << "push-core " << m_num_scopes << "\n";); + CTRACE(euf_verbose, m_num_scopes > 0, tout << "push-core " << m_num_scopes << "\n";); for (; m_num_scopes > 0; --m_num_scopes) push_core(); } diff --git a/src/sat/smt/specrel_solver.cpp b/src/sat/smt/specrel_solver.cpp index 064e19904..ce321c113 100644 --- a/src/sat/smt/specrel_solver.cpp +++ b/src/sat/smt/specrel_solver.cpp @@ -52,11 +52,11 @@ namespace specrel { } void solver::new_eq_eh(euf::th_eq const& eq) { - TRACE("specrel", tout << "new-eq\n"); + TRACE(specrel, tout << "new-eq\n"); if (eq.is_eq()) { auto* p = ctx.get_egraph().get_plugin(sp.get_family_id()); p->merge_eh(var2enode(eq.v1()), var2enode(eq.v2())); - TRACE("specrel", tout << eq.v1() << " " << eq.v2() << "\n"); + TRACE(specrel, tout << eq.v1() << " " << eq.v2() << "\n"); } } @@ -103,7 +103,7 @@ namespace specrel { n = mk_enode(term); SASSERT(!n->is_attached_to(get_id())); mk_var(n); - TRACE("specrel", tout << ctx.bpp(n) << "\n"); + TRACE(specrel, tout << ctx.bpp(n) << "\n"); return true; } diff --git a/src/sat/smt/user_solver.cpp b/src/sat/smt/user_solver.cpp index a4273744b..22a51cc19 100644 --- a/src/sat/smt/user_solver.cpp +++ b/src/sat/smt/user_solver.cpp @@ -325,7 +325,7 @@ namespace user_solver { sat::literal solver::internalize(expr* e, bool sign, bool root) { if (!visit_rec(m, e, sign, root)) { - TRACE("array", tout << mk_pp(e, m) << "\n";); + TRACE(array, tout << mk_pp(e, m) << "\n";); return sat::null_literal; } sat::literal lit = ctx.expr2literal(e); diff --git a/src/sat/smt/xor_solver.d b/src/sat/smt/xor_solver.d index 8930b4ad9..6b333dcca 100644 --- a/src/sat/smt/xor_solver.d +++ b/src/sat/smt/xor_solver.d @@ -31,7 +31,7 @@ namespace sat { lbool ba_solver::add_assign(xr& x, literal alit) { // literal is assigned unsigned sz = x.size(); - TRACE("ba", tout << "assign: " << ~alit << "@" << lvl(~alit) << " " << x << "\n"; display(tout, x, true); ); + TRACE(ba, tout << "assign: " << ~alit << "@" << lvl(~alit) << " " << x << "\n"; display(tout, x, true); ); VERIFY(x.lit() == null_literal); SASSERT(value(alit) != l_undef); @@ -47,7 +47,7 @@ namespace sat { // alit gets unwatched by propagate_core because we return l_undef x.watch_literal(*this, lit); x.watch_literal(*this, ~lit); - TRACE("ba", tout << "swap in: " << lit << " " << x << "\n";); + TRACE(ba, tout << "swap in: " << lit << " " << x << "\n";); return l_undef; } } @@ -188,7 +188,7 @@ namespace sat { unsigned level = lvl(l); bool_var v = l.var(); SASSERT(js.get_kind() == justification::EXT_JUSTIFICATION); - TRACE("ba", tout << l << ": " << js << "\n"; + TRACE(ba, tout << l << ": " << js << "\n"; for (unsigned i = 0; i <= index; ++i) tout << s().m_trail[i] << " "; tout << "\n"; s().display_units(tout); ); @@ -196,10 +196,10 @@ namespace sat { unsigned num_marks = 0; while (true) { - TRACE("ba", tout << "process: " << l << " " << js << "\n";); + TRACE(ba, tout << "process: " << l << " " << js << "\n";); if (js.get_kind() == justification::EXT_JUSTIFICATION) { constraint& c = index2constraint(js.get_ext_justification_idx()); - TRACE("ba", tout << c << "\n";); + TRACE(ba, tout << c << "\n";); if (!c.is_xr()) { r.push_back(l); } @@ -213,7 +213,7 @@ namespace sat { literal lit(value(x[i]) == l_true ? x[i] : ~x[i]); inc_parity(lit.var()); if (lvl(lit) == level) { - TRACE("ba", tout << "mark: " << lit << "\n";); + TRACE(ba, tout << "mark: " << lit << "\n";); ++num_marks; } else { @@ -259,7 +259,7 @@ namespace sat { reset_parity(lit.var()); } m_parity_trail.reset(); - TRACE("ba", tout << r << "\n";); + TRACE(ba, tout << r << "\n";); } void ba_solver::pre_simplify() { @@ -290,7 +290,7 @@ namespace sat { void ba_solver::get_antecedents(literal l, xr const& x, literal_vector& r) { if (x.lit() != null_literal) r.push_back(x.lit()); - // TRACE("ba", display(tout << l << " ", x, true);); + // TRACE(ba, display(tout << l << " ", x, true);); SASSERT(x.lit() == null_literal || value(x.lit()) == l_true); SASSERT(x[0].var() == l.var() || x[1].var() == l.var()); if (x[0].var() == l.var()) { diff --git a/src/sat/tactic/goal2sat.cpp b/src/sat/tactic/goal2sat.cpp index 005e5e035..bf0853c20 100644 --- a/src/sat/tactic/goal2sat.cpp +++ b/src/sat/tactic/goal2sat.cpp @@ -150,7 +150,7 @@ struct goal2sat::imp : public sat::sat_internalizer { } void mk_clause(unsigned n, sat::literal * lits, euf::th_proof_hint* ph) { - TRACE("goal2sat", tout << "mk_clause: "; for (unsigned i = 0; i < n; i++) tout << lits[i] << " "; tout << "\n";); + TRACE(goal2sat, tout << "mk_clause: "; for (unsigned i = 0; i < n; i++) tout << lits[i] << " "; tout << "\n";); if (relevancy_enabled()) ensure_euf()->add_aux(n, lits); m_solver.add_clause(n, lits, mk_status(ph)); @@ -172,7 +172,7 @@ struct goal2sat::imp : public sat::sat_internalizer { } void mk_root_clause(unsigned n, sat::literal * lits, euf::th_proof_hint* ph = nullptr) { - TRACE("goal2sat", tout << "mk_root_clause: "; for (unsigned i = 0; i < n; i++) tout << lits[i] << " "; tout << "\n";); + TRACE(goal2sat, tout << "mk_root_clause: "; for (unsigned i = 0; i < n; i++) tout << lits[i] << " "; tout << "\n";); if (relevancy_enabled()) ensure_euf()->add_root(n, lits); m_solver.add_clause(n, lits, ph ? mk_status(ph) : sat::status::input()); @@ -324,7 +324,7 @@ struct goal2sat::imp : public sat::sat_internalizer { bool ext = m_default_external || !is_uninterp_const(t) || m_interface_vars.contains(t); if (ext) m_solver.set_external(v); - TRACE("sat", tout << "new_var: " << v << ": " << mk_bounded_pp(t, m, 2) << " " << is_uninterp_const(t) << "\n";); + TRACE(sat, tout << "new_var: " << v << ": " << mk_bounded_pp(t, m, 2) << " " << is_uninterp_const(t) << "\n";); } } else { @@ -396,7 +396,7 @@ struct goal2sat::imp : public sat::sat_internalizer { convert_euf(t, root, sign); return true; } - TRACE("goal2sat_not_handled", tout << mk_ismt2_pp(t, m) << "\n";); + TRACE(goal2sat_not_handled, tout << mk_ismt2_pp(t, m) << "\n";); std::ostringstream strm; strm << mk_ismt2_pp(t, m); throw_op_not_handled(strm.str()); @@ -408,7 +408,7 @@ struct goal2sat::imp : public sat::sat_internalizer { } void convert_or(app * t, bool root, bool sign) { - TRACE("goal2sat", tout << "convert_or:\n" << mk_bounded_pp(t, m, 2) << " root " << root << " stack " << m_result_stack.size() << "\n";); + TRACE(goal2sat, tout << "convert_or:\n" << mk_bounded_pp(t, m, 2) << " root " << root << " stack " << m_result_stack.size() << "\n";); unsigned num = t->get_num_args(); SASSERT(num <= m_result_stack.size()); unsigned old_sz = m_result_stack.size() - num; @@ -459,7 +459,7 @@ struct goal2sat::imp : public sat::sat_internalizer { } void convert_and(app * t, bool root, bool sign) { - TRACE("goal2sat", tout << "convert_and:\n" << mk_bounded_pp(t, m, 2) << " root: " << root << " result stack: " << m_result_stack.size() << "\n";); + TRACE(goal2sat, tout << "convert_and:\n" << mk_bounded_pp(t, m, 2) << " root: " << root << " result stack: " << m_result_stack.size() << "\n";); unsigned num = t->get_num_args(); unsigned old_sz = m_result_stack.size() - num; @@ -685,7 +685,7 @@ struct goal2sat::imp : public sat::sat_internalizer { void convert_euf(expr* e, bool root, bool sign) { SASSERT(m_euf); - TRACE("goal2sat", tout << "convert-euf " << mk_bounded_pp(e, m, 2) << " root " << root << "\n";); + TRACE(goal2sat, tout << "convert-euf " << mk_bounded_pp(e, m, 2) << " root " << root << "\n";); euf::solver* euf = ensure_euf(); sat::literal lit; { @@ -783,7 +783,7 @@ struct goal2sat::imp : public sat::sat_internalizer { }; void process(expr* n, bool is_root) { - TRACE("goal2sat", tout << "process-begin " << mk_bounded_pp(n, m, 2) + TRACE(goal2sat, tout << "process-begin " << mk_bounded_pp(n, m, 2) << " root: " << is_root << " result-stack: " << m_result_stack.size() << " frame-stack: " << m_frame_stack.size() << "\n";); @@ -803,7 +803,7 @@ struct goal2sat::imp : public sat::sat_internalizer { app * t = _fr.m_t; bool root = _fr.m_root; bool sign = _fr.m_sign; - TRACE("goal2sat_bug", tout << "result stack\n"; + TRACE(goal2sat_bug, tout << "result stack\n"; tout << "ref-count: " << t->get_ref_count() << "\n"; tout << mk_bounded_pp(t, m, 3) << " root: " << root << " sign: " << sign << "\n"; tout << m_result_stack << "\n";); @@ -822,16 +822,16 @@ struct goal2sat::imp : public sat::sat_internalizer { m_frame_stack[fsz - 1].m_idx++; if (!visit(arg, false, false)) goto loop; - TRACE("goal2sat_bug", tout << "visit " << mk_bounded_pp(arg, m, 2) << " result stack: " << m_result_stack.size() << "\n";); + TRACE(goal2sat_bug, tout << "visit " << mk_bounded_pp(arg, m, 2) << " result stack: " << m_result_stack.size() << "\n";); } - TRACE("goal2sat_bug", tout << "converting\n"; + TRACE(goal2sat_bug, tout << "converting\n"; tout << mk_bounded_pp(t, m, 2) << " root: " << root << " sign: " << sign << "\n"; tout << m_result_stack << "\n";); SASSERT(m_frame_stack.size() > sz); convert(t, root, sign); m_frame_stack.pop_back(); } - TRACE("goal2sat", tout + TRACE(goal2sat, tout << "done process: " << mk_bounded_pp(n, m, 3) << " frame-stack: " << m_frame_stack.size() << " result-stack: " << m_result_stack.size() << "\n";); @@ -843,11 +843,11 @@ struct goal2sat::imp : public sat::sat_internalizer { unsigned sz = m_result_stack.size(); (void)sz; SASSERT(n->get_ref_count() > 0); - TRACE("goal2sat", tout << "internalize " << mk_bounded_pp(n, m, 2) << "\n";); + TRACE(goal2sat, tout << "internalize " << mk_bounded_pp(n, m, 2) << "\n";); process(n, false); SASSERT(m_result_stack.size() == sz + 1); sat::literal result = m_result_stack.back(); - TRACE("goal2sat", tout << "done internalize " << result << " " << mk_bounded_pp(n, m, 2) << "\n";); + TRACE(goal2sat, tout << "done internalize " << result << " " << mk_bounded_pp(n, m, 2) << "\n";); m_result_stack.pop_back(); if (!result.sign() && m_map.to_bool_var(n) == sat::null_bool_var) { force_push(); @@ -889,9 +889,9 @@ struct goal2sat::imp : public sat::sat_internalizer { void process(expr * n) { flet _top(m_top_level, true); VERIFY(m_result_stack.empty()); - TRACE("goal2sat", tout << "assert: " << mk_bounded_pp(n, m, 3) << "\n";); + TRACE(goal2sat, tout << "assert: " << mk_bounded_pp(n, m, 3) << "\n";); process(n, true); - CTRACE("goal2sat", !m_result_stack.empty(), tout << m_result_stack << "\n";); + CTRACE(goal2sat, !m_result_stack.empty(), tout << m_result_stack << "\n";); SASSERT(m_result_stack.empty()); } @@ -980,7 +980,7 @@ struct goal2sat::imp : public sat::sat_internalizer { } f = m.mk_or(fmls); } - TRACE("goal2sat", tout << mk_bounded_pp(f, m, 2) << "\n";); + TRACE(goal2sat, tout << mk_bounded_pp(f, m, 2) << "\n";); process(f); skip_dep: ; diff --git a/src/sat/tactic/sat2goal.cpp b/src/sat/tactic/sat2goal.cpp index ead71f2ad..7d9c5f4b3 100644 --- a/src/sat/tactic/sat2goal.cpp +++ b/src/sat/tactic/sat2goal.cpp @@ -140,9 +140,9 @@ void sat2goal::mc::operator()(sat::model& md) { void sat2goal::mc::operator()(model_ref & md) { // apply externalized model converter - CTRACE("sat_mc", m_gmc, m_gmc->display(tout << "before sat_mc\n"); model_v2_pp(tout, *md);); + CTRACE(sat_mc, m_gmc, m_gmc->display(tout << "before sat_mc\n"); model_v2_pp(tout, *md);); if (m_gmc) (*m_gmc)(md); - CTRACE("sat_mc", m_gmc, m_gmc->display(tout << "after sat_mc\n"); model_v2_pp(tout, *md);); + CTRACE(sat_mc, m_gmc, m_gmc->display(tout << "after sat_mc\n"); model_v2_pp(tout, *md);); } @@ -161,7 +161,7 @@ void sat2goal::mc::insert(sat::bool_var v, expr * atom, bool aux) { if (is_uninterp_const(atom)) m_gmc->hide(to_app(atom)->get_decl()); } - TRACE("sat_mc", tout << "insert " << v << "\n";); + TRACE(sat_mc, tout << "insert " << v << "\n";); } expr_ref sat2goal::mc::lit2expr(sat::literal l) { diff --git a/src/sat/tactic/sat_tactic.cpp b/src/sat/tactic/sat_tactic.cpp index 10711d0bd..9ebeff7e6 100644 --- a/src/sat/tactic/sat_tactic.cpp +++ b/src/sat/tactic/sat_tactic.cpp @@ -60,13 +60,13 @@ class sat_tactic : public tactic { fail_if_proof_generation("sat", g); bool produce_models = g->models_enabled(); bool produce_core = g->unsat_core_enabled(); - TRACE("before_sat_solver", g->display(tout);); + TRACE(before_sat_solver, g->display(tout);); g->elim_redundancies(); atom2bool_var map(m); obj_map dep2asm; sat::literal_vector assumptions; m_goal2sat(*g, m_params, *m_solver, map, dep2asm); - TRACE("sat", tout << "interpreted_atoms: " << m_goal2sat.has_interpreted_funs() << "\n"; + TRACE(sat, tout << "interpreted_atoms: " << m_goal2sat.has_interpreted_funs() << "\n"; func_decl_ref_vector funs(m); m_goal2sat.get_interpreted_funs(funs); for (func_decl* f : funs) @@ -85,10 +85,10 @@ class sat_tactic : public tactic { CASSERT("sat_solver", m_solver->check_invariant()); IF_VERBOSE(TACTIC_VERBOSITY_LVL, m_solver->display_status(verbose_stream());); - TRACE("sat_dimacs", m_solver->display_dimacs(tout);); + TRACE(sat_dimacs, m_solver->display_dimacs(tout);); dep2assumptions(dep2asm, assumptions); lbool r = m_solver->check(assumptions.size(), assumptions.data()); - TRACE("sat", tout << "result of checking: " << r << " "; + TRACE(sat, tout << "result of checking: " << r << " "; if (r == l_undef) tout << m_solver->get_reason_unknown(); tout << "\n"; if (m_goal2sat.has_interpreted_funs()) tout << "has interpreted\n";); if (r == l_undef) @@ -112,7 +112,7 @@ class sat_tactic : public tactic { if (produce_models) { model_ref md = alloc(model, m); sat::model const & ll_m = m_solver->get_model(); - TRACE("sat_tactic", for (unsigned i = 0; i < ll_m.size(); i++) tout << i << ":" << ll_m[i] << " "; tout << "\n";); + TRACE(sat_tactic, for (unsigned i = 0; i < ll_m.size(); i++) tout << i << ":" << ll_m[i] << " "; tout << "\n";); for (auto const& kv : map) { expr * n = kv.m_key; sat::bool_var v = kv.m_value; @@ -121,7 +121,7 @@ class sat_tactic : public tactic { app* a = to_app(n); if (!is_uninterp_const(a)) continue; - TRACE("sat_tactic", tout << "extracting value of " << mk_ismt2_pp(n, m) << "\nvar: " << v << "\n";); + TRACE(sat_tactic, tout << "extracting value of " << mk_ismt2_pp(n, m) << "\nvar: " << v << "\n";); switch (sat::value_at(v, ll_m)) { case l_true: md->register_decl(a->get_decl(), m.mk_true()); @@ -141,7 +141,7 @@ class sat_tactic : public tactic { IF_VERBOSE(0, verbose_stream() << "failed to validate: " << mk_pp(f, m) << "\n";); m_goal2sat.update_model(md); - TRACE("sat_tactic", model_v2_pp(tout, *md);); + TRACE(sat_tactic, model_v2_pp(tout, *md);); g->add(model2model_converter(md.get())); } } @@ -248,10 +248,10 @@ public: catch (z3_exception& ex) { (void)ex; proc.m_solver->collect_statistics(m_stats); - TRACE("sat", tout << ex.what() << "\n";); + TRACE(sat, tout << ex.what() << "\n";); throw; } - TRACE("sat_stats", m_stats.display_smt2(tout);); + TRACE(sat_stats, m_stats.display_smt2(tout);); } void cleanup() override { diff --git a/src/shell/datalog_frontend.cpp b/src/shell/datalog_frontend.cpp index b3dfbc78a..5025483e7 100644 --- a/src/shell/datalog_frontend.cpp +++ b/src/shell/datalog_frontend.cpp @@ -164,7 +164,7 @@ unsigned read_datalog(char const * file) { //all rules were added ctx.close(); - TRACE("dl_compiler", ctx.display(tout);); + TRACE(dl_compiler, ctx.display(tout);); datalog::rule_set original_rules(ctx.get_rules()); @@ -193,7 +193,7 @@ unsigned read_datalog(char const * file) { datalog::compiler::compile(ctx, ctx.get_rules(), rules_code, termination_code); - TRACE("dl_compiler", rules_code.display(ex_ctx, tout);); + TRACE(dl_compiler, rules_code.display(ex_ctx, tout);); rules_code.make_annotations(ex_ctx); @@ -232,7 +232,7 @@ unsigned read_datalog(char const * file) { } while (early_termination); - TRACE("dl_compiler", ctx.display(tout); + TRACE(dl_compiler, ctx.display(tout); rules_code.display(ex_ctx, tout);); if (ctx.output_tuples()) { diff --git a/src/smt/arith_eq_adapter.cpp b/src/smt/arith_eq_adapter.cpp index b77a38927..d5bdc21a2 100644 --- a/src/smt/arith_eq_adapter.cpp +++ b/src/smt/arith_eq_adapter.cpp @@ -44,7 +44,7 @@ namespace smt { void undo() override { m_already_processed.erase(m_n1, m_n2); - TRACE("arith_eq_adapter_profile", tout << "del #" << m_n1->get_owner_id() << " #" << m_n2->get_owner_id() << "\n";); + TRACE(arith_eq_adapter_profile, tout << "del #" << m_n1->get_owner_id() << " #" << m_n2->get_owner_id() << "\n";); } }; @@ -83,7 +83,7 @@ namespace smt { if (n1 == n2) return; ast_manager & m = get_manager(); - TRACE("arith_eq_adapter_mk_axioms", tout << "#" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n"; + TRACE(arith_eq_adapter_mk_axioms, tout << "#" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n"; tout << mk_ismt2_pp(n1->get_expr(), m) << "\n" << mk_ismt2_pp(n2->get_expr(), m) << "\n";); if (n1->get_owner_id() > n2->get_owner_id()) std::swap(n1, n2); @@ -105,7 +105,7 @@ namespace smt { return; } - CTRACE("arith_eq_adapter_relevancy", !(ctx.is_relevant(n1) && ctx.is_relevant(n2)), + CTRACE(arith_eq_adapter_relevancy, !(ctx.is_relevant(n1) && ctx.is_relevant(n2)), tout << "is_relevant(n1): #" << n1->get_owner_id() << " " << ctx.is_relevant(n1) << "\n"; tout << "is_relevant(n2): #" << n2->get_owner_id() << " " << ctx.is_relevant(n2) << "\n"; tout << pp(n1, get_manager()) << "\n"; @@ -119,12 +119,12 @@ namespace smt { if (m_already_processed.find(n1, n2, d)) return; - TRACE("arith_eq_adapter_profile", tout << "mk #" << n1->get_owner_id() << " #" << n2->get_owner_id() << " " << + TRACE(arith_eq_adapter_profile, tout << "mk #" << n1->get_owner_id() << " #" << n2->get_owner_id() << " " << m_already_processed.size() << " " << ctx.get_scope_level() << "\n";); m_stats.m_num_eq_axioms++; - TRACE("arith_eq_adapter_profile_detail", + TRACE(arith_eq_adapter_profile_detail, tout << "mk_detail " << mk_bounded_pp(n1->get_expr(), m, 5) << " " << mk_bounded_pp(n2->get_expr(), m, 5) << "\n";); @@ -132,7 +132,7 @@ namespace smt { t1_eq_t2 = ctx.mk_eq_atom(t1, t2); SASSERT(!m.is_false(t1_eq_t2)); - TRACE("arith_eq_adapter_bug", tout << mk_bounded_pp(t1_eq_t2, m) << "\n" + TRACE(arith_eq_adapter_bug, tout << mk_bounded_pp(t1_eq_t2, m) << "\n" << mk_bounded_pp(t1, m) << "\n" << mk_bounded_pp(t2, m) << "\n";); @@ -176,19 +176,19 @@ namespace smt { le = m_util.mk_le(s, zero); ge = m_util.mk_ge(s, zero); } - TRACE("arith_eq_adapter_perf", + TRACE(arith_eq_adapter_perf, tout << mk_ismt2_pp(t1_eq_t2, m) << "\n" << mk_ismt2_pp(le, m) << "\n" << mk_ismt2_pp(ge, m) << "\n";); ctx.push_trail(already_processed_trail(m_already_processed, n1, n2)); m_already_processed.insert(n1, n2, data(t1_eq_t2, le, ge)); - TRACE("arith_eq_adapter_profile", tout << "insert #" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";); + TRACE(arith_eq_adapter_profile, tout << "insert #" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";); ctx.internalize(t1_eq_t2, true); literal t1_eq_t2_lit(ctx.get_bool_var(t1_eq_t2)); - TRACE("interface_eq", + TRACE(interface_eq, tout << "core should try true phase first for the equality: " << t1_eq_t2_lit << "\n"; tout << "#" << n1->get_owner_id() << " == #" << n2->get_owner_id() << "\n"; tout << "try_true_first: " << ctx.try_true_first(t1_eq_t2_lit.var()) << "\n";); - TRACE("arith_eq_adapter_bug", + TRACE(arith_eq_adapter_bug, tout << "le: " << mk_ismt2_pp(le, m) << "\nge: " << mk_ismt2_pp(ge, m) << "\n";); ctx.internalize(le, true); ctx.internalize(ge, true); @@ -210,13 +210,13 @@ namespace smt { ctx.mk_th_axiom(tid, ~t1_eq_t2_lit, le_lit, m_proof_hint.size(), m_proof_hint.data()); ctx.mk_th_axiom(tid, ~t1_eq_t2_lit, ge_lit, m_proof_hint.size(), m_proof_hint.data()); ctx.mk_th_axiom(tid, t1_eq_t2_lit, ~le_lit, ~ge_lit, m_proof_hint.size(), m_proof_hint.data()); - TRACE("arith_eq_adapter", tout << "internalizing: " + TRACE(arith_eq_adapter, tout << "internalizing: " << " " << mk_pp(le, m) << ": " << le_lit << " " << mk_pp(ge, m) << ": " << ge_lit << " " << mk_pp(t1_eq_t2, m) << ": " << t1_eq_t2_lit << "\n";); if (m_owner.get_fparams().m_arith_add_binary_bounds) { - TRACE("arith_eq_adapter", tout << "adding binary bounds...\n";); + TRACE(arith_eq_adapter, tout << "adding binary bounds...\n";); ctx.mk_th_axiom(tid, le_lit, ge_lit, m_proof_hint.size(), m_proof_hint.data()); } if (ctx.relevancy()) { @@ -228,17 +228,17 @@ namespace smt { n1->get_iscope_lvl() <= ctx.get_base_level() && n2->get_iscope_lvl() <= ctx.get_base_level()) { m_restart_pairs.push_back(enode_pair(n1, n2)); } - TRACE("arith_eq_adapter_detail", ctx.display(tout);); + TRACE(arith_eq_adapter_detail, ctx.display(tout);); } void arith_eq_adapter::new_eq_eh(theory_var v1, theory_var v2) { - TRACE("arith_eq_adapter", tout << "v" << v1 << " = v" << v2 << " #" << get_enode(v1)->get_owner_id() << " = #" << get_enode(v2)->get_owner_id() << "\n";); - TRACE("arith_eq_adapter_bug", tout << mk_bounded_pp(get_enode(v1)->get_expr(), get_manager()) << "\n" << mk_bounded_pp(get_enode(v2)->get_expr(), get_manager()) << "\n";); + TRACE(arith_eq_adapter, tout << "v" << v1 << " = v" << v2 << " #" << get_enode(v1)->get_owner_id() << " = #" << get_enode(v2)->get_owner_id() << "\n";); + TRACE(arith_eq_adapter_bug, tout << mk_bounded_pp(get_enode(v1)->get_expr(), get_manager()) << "\n" << mk_bounded_pp(get_enode(v2)->get_expr(), get_manager()) << "\n";); mk_axioms(get_enode(v1), get_enode(v2)); } void arith_eq_adapter::new_diseq_eh(theory_var v1, theory_var v2) { - TRACE("arith_eq_adapter", tout << "v" << v1 << " != v" << v2 << " #" << get_enode(v1)->get_owner_id() << " != #" << get_enode(v2)->get_owner_id() << "\n";); + TRACE(arith_eq_adapter, tout << "v" << v1 << " != v" << v2 << " #" << get_enode(v1)->get_owner_id() << " != #" << get_enode(v2)->get_owner_id() << "\n";); mk_axioms(get_enode(v1), get_enode(v2)); } @@ -247,7 +247,7 @@ namespace smt { } void arith_eq_adapter::reset_eh() { - TRACE("arith_eq_adapter", tout << "reset\n";); + TRACE(arith_eq_adapter, tout << "reset\n";); m_already_processed .reset(); m_restart_pairs .reset(); m_stats .reset(); @@ -255,13 +255,13 @@ namespace smt { void arith_eq_adapter::restart_eh() { context & ctx = get_context(); - TRACE("arith_eq_adapter", tout << "restart\n";); + TRACE(arith_eq_adapter, tout << "restart\n";); enode_pair_vector tmp(m_restart_pairs); m_restart_pairs.reset(); for (auto const& p : tmp) { if (ctx.inconsistent()) break; - TRACE("arith_eq_adapter", tout << "creating arith_eq_adapter axioms at the base level #" << p.first->get_owner_id() << " #" << + TRACE(arith_eq_adapter, tout << "creating arith_eq_adapter axioms at the base level #" << p.first->get_owner_id() << " #" << p.second->get_owner_id() << "\n";); mk_axioms(p.first, p.second); } diff --git a/src/smt/arith_eq_solver.cpp b/src/smt/arith_eq_solver.cpp index c47880ce5..387d10862 100644 --- a/src/smt/arith_eq_solver.cpp +++ b/src/smt/arith_eq_solver.cpp @@ -161,7 +161,7 @@ bool arith_eq_solver::solve_integer_equation( bool& is_fresh ) { - TRACE("arith_eq_solver", print_row(tout << "solving: ", values); ); + TRACE(arith_eq_solver, print_row(tout << "solving: ", values); ); // // perform one step of the omega test equality elimination. // @@ -198,7 +198,7 @@ bool arith_eq_solver::solve_integer_equation( return false; gcd_normalize(values); if (!gcd_test(values)) { - TRACE("arith_eq_solver", print_row(tout << "not sat\n", values);); + TRACE(arith_eq_solver, print_row(tout << "not sat\n", values);); return false; } index = find_abs_min(values); @@ -232,7 +232,7 @@ bool arith_eq_solver::solve_integer_equation( values[index] = m; } - TRACE("arith_eq_solver", + TRACE(arith_eq_solver, tout << "solved at index " << index << ": "; print_row(tout, values); ); @@ -248,7 +248,7 @@ void arith_eq_solver::substitute( ) { SASSERT(1 <= index && index < s.size()); - TRACE("arith_eq_solver", + TRACE(arith_eq_solver, tout << "substitute " << index << ":\n"; print_row(tout, r); print_row(tout, s); @@ -318,7 +318,7 @@ void arith_eq_solver::substitute( } - TRACE("arith_eq_solver", + TRACE(arith_eq_solver, tout << "result: "; print_row(tout, r); ); @@ -343,7 +343,7 @@ bool arith_eq_solver::solve_integer_equations_units( ) { - TRACE("arith_eq_solver", print_rows(tout << "solving:\n", rows);); + TRACE(arith_eq_solver, print_rows(tout << "solving:\n", rows);); unsigned_vector todo, done; @@ -353,7 +353,7 @@ bool arith_eq_solver::solve_integer_equations_units( gcd_normalize(r); if (!gcd_test(r)) { unsat_row = r; - TRACE("arith_eq_solver", print_row(tout << "input is unsat: ", unsat_row); ); + TRACE(arith_eq_solver, print_row(tout << "input is unsat: ", unsat_row); ); return false; } } @@ -362,7 +362,7 @@ bool arith_eq_solver::solve_integer_equations_units( gcd_normalize(r); if (!gcd_test(r)) { unsat_row = r; - TRACE("arith_eq_solver", print_row(tout << "unsat: ", unsat_row); ); + TRACE(arith_eq_solver, print_row(tout << "unsat: ", unsat_row); ); return false; } unsigned index = find_abs_min(r); @@ -391,7 +391,7 @@ bool arith_eq_solver::solve_integer_equations_units( } } - TRACE("arith_eq_solver", + TRACE(arith_eq_solver, tout << ((done.size()<=1)?"solved ":"incomplete check ") << done.size() << "\n"; for (unsigned i = 0; i < done.size(); ++i) { print_row(tout, rows[done[i]]); @@ -433,7 +433,7 @@ bool arith_eq_solver::solve_integer_equations_omega( gcd_normalize(unsat_row); // invert the substitution for every index that is fresh. - TRACE("arith_eq_solver", + TRACE(arith_eq_solver, tout << "unsat:\n"; print_row(tout, unsat_row); for (unsigned l = 0; l + 1< rows_solved.size(); ++l) { @@ -474,7 +474,7 @@ bool arith_eq_solver::solve_integer_equations_omega( } gcd_normalize(unsat_row); - TRACE("arith_eq_solver", + TRACE(arith_eq_solver, tout << "gcd: "; print_row(tout, solved_row); print_row(tout, unsat_row); @@ -482,7 +482,7 @@ bool arith_eq_solver::solve_integer_equations_omega( } if (gcd_test(unsat_row)) { - TRACE("arith_eq_solver", tout << "missed pure explanation\n";); + TRACE(arith_eq_solver, tout << "missed pure explanation\n";); return true; } SASSERT(!gcd_test(unsat_row)); @@ -541,7 +541,7 @@ bool arith_eq_solver::solve_integer_equations_gcd( gcd_normalize(r); if (!gcd_test(r)) { unsat_row = r; - TRACE("arith_eq_solver", print_row(tout << "input is unsat: ", unsat_row); ); + TRACE(arith_eq_solver, print_row(tout << "input is unsat: ", unsat_row); ); return false; } } @@ -613,7 +613,7 @@ bool arith_eq_solver::solve_integer_equations_gcd( gcd_normalize(r); if (!gcd_test(r)) { unsat_row = r; - TRACE("arith_eq_solver", print_row(tout << "unsat: ", unsat_row); ); + TRACE(arith_eq_solver, print_row(tout << "unsat: ", unsat_row); ); return false; } } @@ -621,7 +621,7 @@ bool arith_eq_solver::solve_integer_equations_gcd( } } - TRACE("arith_eq_solver", + TRACE(arith_eq_solver, tout << ((live.size()<=1)?"solved ":"incomplete check ") << live.size() << "\n"; for (unsigned l : live) print_row(tout, rows[l]); ); diff --git a/src/smt/diff_logic.h b/src/smt/diff_logic.h index 4628721ab..320950683 100644 --- a/src/smt/diff_logic.h +++ b/src/smt/diff_logic.h @@ -312,7 +312,7 @@ private: typename assignment_stack::iterator begin = m_assignment_stack.begin(); while (it != begin) { --it; - TRACE("dl_bug", tout << "undo assignment: " << it->get_var() << " " << it->get_old_value() << "\n";); + TRACE(dl_bug, tout << "undo assignment: " << it->get_var() << " " << it->get_old_value() << "\n";); m_assignment[it->get_var()] = it->get_old_value(); } m_assignment_stack.reset(); @@ -368,7 +368,7 @@ private: SASSERT(m_gamma[target].is_neg()); acc_assignment(target, gamma); - TRACE("arith", display(tout << id << " " << gamma << "\n"); + TRACE(arith, display(tout << id << " " << gamma << "\n"); display_edge(tout, last_e); ); @@ -411,7 +411,7 @@ private: } break; case DL_PROCESSED: - TRACE("arith", display_edge(tout << "processed twice: ", e);); + TRACE(arith, display_edge(tout << "processed twice: ", e);); // if two edges with the same source/target occur in the graph. break; default: @@ -469,7 +469,7 @@ public: // The graph does not have control over the ids assigned by the theory. // That is init_var receives the id as an argument. void init_var(dl_var v) { - TRACE("dl_bug", tout << "init_var " << v << "\n";); + TRACE(dl_bug, tout << "init_var " << v << "\n";); if (static_cast(v) < m_out_edges.size() && (!m_out_edges[v].empty() || !m_in_edges[v].empty())) { return; } @@ -487,7 +487,7 @@ public: } m_assignment[v].reset(); SASSERT(static_cast(v) < m_heap.get_bounds()); - TRACE("dl_bug", tout << "init_var " << v << ", m_assignment[v]: " << m_assignment[v] << "\n";); + TRACE(dl_bug, tout << "init_var " << v << ", m_assignment[v]: " << m_assignment[v] << "\n";); SASSERT(m_assignment[v].is_zero()); SASSERT(m_out_edges[v].empty()); SASSERT(m_in_edges[v].empty()); @@ -501,7 +501,7 @@ public: edge_id new_id = m_edges.size(); m_edges.push_back(edge(source, target, weight, m_timestamp, ex)); m_activity.push_back(0); - TRACE("dl_bug", tout << "creating edge:\n"; display_edge(tout, m_edges.back());); + TRACE(dl_bug, tout << "creating edge:\n"; display_edge(tout, m_edges.back());); m_out_edges[source].push_back(new_id); m_in_edges[target].push_back(new_id); return new_id; @@ -604,7 +604,7 @@ public: numeral const& weight = e2.get_weight(); numeral delta = weight - potential + potentials[j]; if (delta.is_nonneg() && (gamma + delta).is_neg()) { - TRACE("diff_logic_traverse", tout << "Reducing path by "; + TRACE(diff_logic_traverse, tout << "Reducing path by "; display_edge(tout, e2); tout << "gamma: " << gamma << " weight: " << weight << "\n"; tout << "enabled: " << e2.is_enabled() << "\n"; @@ -620,7 +620,7 @@ public: break; } else { - TRACE("diff_logic_traverse", display_edge(tout << "skipping: ", e2);); + TRACE(diff_logic_traverse, display_edge(tout << "skipping: ", e2);); } } } @@ -632,7 +632,7 @@ public: } while (e_id != last_id); - TRACE("diff_logic_traverse", { + TRACE(diff_logic_traverse, { tout << "Num conflicts: " << num_conflicts << "\n"; tout << "Resulting path:\n"; for (unsigned i = 0; i < edges.size(); ++i) { @@ -886,7 +886,7 @@ public: unsigned to_delete = num_edges - old_num_edges; for (unsigned i = 0; i < to_delete; i++) { const edge & e = m_edges.back(); - TRACE("dl_bug", tout << "deleting edge:\n"; display_edge(tout, e);); + TRACE(dl_bug, tout << "deleting edge:\n"; display_edge(tout, e);); dl_var source = e.get_source(); dl_var target = e.get_target(); SASSERT(static_cast(m_edges.size()) - 1 == m_out_edges[source].back()); @@ -957,7 +957,7 @@ private: // m_assignment[v] += inc // This method also stores the old value of v in the assignment stack. void acc_assignment(dl_var v, const numeral & inc) { - TRACE("dl_bug", tout << "update v: " << v << " += " << inc << " m_assignment[v] " << m_assignment[v] << "\n";); + TRACE(dl_bug, tout << "update v: " << v << " += " << inc << " m_assignment[v] " << m_assignment[v] << "\n";); m_assignment_stack.push_back(assignment_trail(v, m_assignment[v])); m_assignment[v] += inc; } @@ -1109,7 +1109,7 @@ public: edge_id id; SASSERT(get_edge_id(current, next, id) || get_edge_id(next, current, id));); if (!discovered.contains(next) && !explored.contains(next)) { - TRACE("diff_logic", tout << "thread[" << prev << "] --> " << next << std::endl;); + TRACE(diff_logic, tout << "thread[" << prev << "] --> " << next << std::endl;); threads[prev] = next; prev = next; discovered.insert(next); @@ -1150,7 +1150,7 @@ public: edge_id id; SASSERT(get_edge_id(current, next, id) || get_edge_id(next, current, id));); if (!visited.contains(next)) { - TRACE("diff_logic", tout << "parents[" << next << "] --> " << current << std::endl;); + TRACE(diff_logic, tout << "parents[" << next << "] --> " << current << std::endl;); parents[next] = current; depths[next] = depths[current] + 1; visited.insert(next); @@ -1206,7 +1206,7 @@ public: dfs(v, scc_id); } } - TRACE("eq_scc", + TRACE(eq_scc, for (dl_var v = 0; v < n; v++) { tout << "$" << v << " -> " << scc_id[v] << "\n"; }); @@ -1311,13 +1311,13 @@ private: unsigned pred = (i>0)?(i-1):(num_edges-1); edge const& e1 = m_edges[edges[pred]]; if (e.get_target() != e1.get_source()) { - TRACE("check_explanation", display_edge(tout, e); display_edge(tout, e1); ); + TRACE(check_explanation, display_edge(tout, e); display_edge(tout, e1); ); return false; } w += e.get_weight(); } if (w.is_nonneg()) { - TRACE("check_explanation", tout << "weight: " << w << "\n";); + TRACE(check_explanation, tout << "weight: " << w << "\n";); return false; } return true; @@ -1331,7 +1331,7 @@ private: potential0 += m_edges[edges[i]].get_weight(); if (potential0 != potentials[i] || nodes[i] != m_edges[edges[i]].get_source()) { - TRACE("diff_logic_traverse", tout << "checking index " << i << " "; + TRACE(diff_logic_traverse, tout << "checking index " << i << " "; tout << "potential: " << potentials[i] << " "; display_edge(tout, m_edges[edges[i]]); ); @@ -1397,7 +1397,7 @@ public: bfs_elem & curr = bfs_todo[head]; int parent_idx = head; dl_var v = curr.m_var; - TRACE("dl_bfs", tout << "processing: " << v << "\n";); + TRACE(dl_bfs, tout << "processing: " << v << "\n";); edge_id_vector & edges = m_out_edges[v]; for (edge_id e_id : edges) { edge & e = m_edges[e_id]; @@ -1406,13 +1406,13 @@ public: continue; } set_gamma(e, gamma); - TRACE("dl_bfs", display_edge(tout << "processing edge: ", e) << " gamma: " << gamma << "\n";); + TRACE(dl_bfs, display_edge(tout << "processing edge: ", e) << " gamma: " << gamma << "\n";); if (is_connected(gamma, zero_edge, e, timestamp)) { dl_var curr_target = e.get_target(); - TRACE("dl_bfs", tout << "curr_target: " << curr_target << ", mark: " << bfs_mark[curr_target] << "\n";); + TRACE(dl_bfs, tout << "curr_target: " << curr_target << ", mark: " << bfs_mark[curr_target] << "\n";); if (curr_target == target) { - TRACE("dl_bfs", tout << "found path\n";); - TRACE("dl_eq_bug", tout << "path: " << source << " --> " << target << "\n"; + TRACE(dl_bfs, tout << "found path\n";); + TRACE(dl_eq_bug, tout << "path: " << source << " --> " << target << "\n"; display_edge(tout, e); int tmp_parent_idx = parent_idx; while (true) { @@ -1426,7 +1426,7 @@ public: tmp_parent_idx = curr.m_parent_idx; } }); - TRACE("dl_eq_bug", display_edge(tout, e);); + TRACE(dl_eq_bug, display_edge(tout, e);); f(e.get_explanation()); while (true) { SASSERT(parent_idx >= 0); @@ -1436,7 +1436,7 @@ public: } else { edge & e = m_edges[curr.m_edge_id]; - TRACE("dl_eq_bug", display_edge(tout, e);); + TRACE(dl_eq_bug, display_edge(tout, e);); f(e.get_explanation()); parent_idx = curr.m_parent_idx; } @@ -1556,7 +1556,7 @@ private: state.m_heap.insert(source); state.m_heap.insert(target); unsigned num_relevant = 1; - TRACE("diff_logic", display(tout); ); + TRACE(diff_logic, display(tout); ); while (!state.m_heap.empty() && num_relevant > 0) { @@ -1574,7 +1574,7 @@ private: else { m_mark[source] = DL_PROP_PROCESSED_IRRELEVANT; } - TRACE("diff_logic", tout << "source: " << source << "\n";); + TRACE(diff_logic, tout << "source: " << source << "\n";); for (edge_id e_id : edges[source]) { edge const& e = m_edges[e_id]; @@ -1587,7 +1587,7 @@ private: if (!e.is_enabled()) { continue; } - TRACE("diff_logic", display_edge(tout, e);); + TRACE(diff_logic, display_edge(tout, e);); target = is_fw?e.get_target():e.get_source(); delta = get_reduced_weight(state, source, e); SASSERT(delta >= state.m_delta[source]); @@ -1624,12 +1624,12 @@ private: break; } case DL_PROP_PROCESSED_RELEVANT: - TRACE("diff_logic", tout << delta << " ?> " << state.m_delta[target] << "\n";); + TRACE(diff_logic, tout << delta << " ?> " << state.m_delta[target] << "\n";); SASSERT(delta >= state.m_delta[target]); SASSERT(!(delta == state.m_delta[target] && source_mark == DL_PROP_IRRELEVANT)); break; case DL_PROP_PROCESSED_IRRELEVANT: - TRACE("diff_logic", tout << delta << " ?> " << state.m_delta[target] << "\n";); + TRACE(diff_logic, tout << delta << " ?> " << state.m_delta[target] << "\n";); SASSERT(delta >= state.m_delta[target]); break; default: @@ -1656,7 +1656,7 @@ private: } } - TRACE("diff_logic", { + TRACE(diff_logic, { tout << (is_fw?"is_fw":"is_bw") << ": "; for (unsigned i = 0; i < state.m_visited.size(); ++i) { tout << state.m_visited[i] << " "; @@ -1678,7 +1678,7 @@ private: dl_var b = e0.get_target(); numeral n0 = m_assignment[b] - m_assignment[a] - e0.get_weight(); vector const& edges = m_out_edges; - TRACE("diff_logic", tout << "$" << a << " a:" << m_assignment[a] << " $" << b << " b: " << m_assignment[b] + TRACE(diff_logic, tout << "$" << a << " a:" << m_assignment[a] << " $" << b << " b: " << m_assignment[b] << " e0: " << e0.get_weight() << " n0: " << n0 << "\n"; display_edge(tout, e0); ); @@ -1696,7 +1696,7 @@ private: numeral n2 = n1 + tgt.m_delta[d] + m_assignment[d]; if (tgt.contains(d) && n2 <= e1.get_weight()) { - TRACE("diff_logic", + TRACE(diff_logic, tout << "$" << c << " delta_c: " << src.m_delta[c] << " c: " << m_assignment[c] << "\n"; tout << "$" << d << " delta_d: " << src.m_delta[d] << " d: " << m_assignment[d] << " n2: " << n2 << " e1: " << e1.get_weight() << "\n"; @@ -1717,7 +1717,7 @@ public: m_fw.m_visited.reset(); m_bw.m_visited.reset(); if (!subsumed.empty()) { - TRACE("diff_logic", + TRACE(diff_logic, display(tout); tout << "subsumed\n"; for (unsigned i = 0; i < subsumed.size(); ++i) { @@ -1844,7 +1844,7 @@ public: m_heap.insert(src2); m_visited.push_back(src2); - TRACE("diff_logic", + TRACE(diff_logic, display_edge(tout << "bridge: ", e1); display_edge(tout << "subsumed: ", e2); display(tout); ); @@ -1853,7 +1853,7 @@ public: SASSERT(!m_heap.empty()); dl_var v = m_heap.erase_min(); m_mark[v] = DL_PROCESSED; - TRACE("diff_logic", tout << v << "\n";); + TRACE(diff_logic, tout << v << "\n";); for (edge_id e_id : m_out_edges[v]) { edge const& e = m_edges[e_id]; @@ -1867,7 +1867,7 @@ public: } m_gamma[w] = gamma; m_parent[w] = e_id; - TRACE("diff_logic", tout << w << " : " << gamma << " " << e2.get_weight() << "\n";); + TRACE(diff_logic, tout << w << " : " << gamma << " " << e2.get_weight() << "\n";); if (w == dst2 && gamma <= e2.get_weight()) { // found path. reset_marks(); diff --git a/src/smt/dyn_ack.cpp b/src/smt/dyn_ack.cpp index 84b28a7a5..3a80908bd 100644 --- a/src/smt/dyn_ack.cpp +++ b/src/smt/dyn_ack.cpp @@ -94,8 +94,8 @@ namespace smt { lits.push_back(eq); SASSERT(lits.size() >= 2); app_ref lemma(m.mk_or(lits), m); - TRACE("dyn_ack", tout << lemma << "\n";); - TRACE("dyn_ack", tout << false_pr << "\n";); + TRACE(dyn_ack, tout << lemma << "\n";); + TRACE(dyn_ack, tout << false_pr << "\n";); return m.mk_lemma(false_pr, lemma); } @@ -211,7 +211,7 @@ namespace smt { } unsigned num_occs = 0; if (m_app_pair2num_occs.find(n1, n2, num_occs)) { - TRACE("dyn_ack", tout << "used_cg_eh:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\nnum_occs: " << num_occs << "\n";); + TRACE(dyn_ack, tout << "used_cg_eh:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\nnum_occs: " << num_occs << "\n";); num_occs++; } else { @@ -227,7 +227,7 @@ namespace smt { SASSERT(m_app_pair2num_occs.find(n1, n2, num_occs2) && num_occs == num_occs2); #endif if (num_occs == m_params.m_dack_threshold) { - TRACE("dyn_ack", tout << "found candidate:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\nnum_occs: " << num_occs << "\n";); + TRACE(dyn_ack, tout << "found candidate:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\nnum_occs: " << num_occs << "\n";); m_to_instantiate.push_back(p); } } @@ -238,7 +238,7 @@ namespace smt { } if (n1->get_id() > n2->get_id()) std::swap(n1,n2); - TRACE("dyn_ack", + TRACE(dyn_ack, tout << mk_pp(n1, m) << " = " << mk_pp(n2, m) << " = " << mk_pp(r, m) << "\n";); app_triple tr(n1, n2, r); if (m_triple.m_instantiated.contains(tr)) { @@ -246,7 +246,7 @@ namespace smt { } unsigned num_occs = 0; if (m_triple.m_app2num_occs.find(n1, n2, r, num_occs)) { - TRACE("dyn_ack", tout << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n" + TRACE(dyn_ack, tout << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n" << mk_pp(r, m) << "\n" << "\nnum_occs: " << num_occs << "\n";); num_occs++; } @@ -264,7 +264,7 @@ namespace smt { SASSERT(m_triple.m_app2num_occs.find(n1, n2, r, num_occs2) && num_occs == num_occs2); #endif if (num_occs == m_params.m_dack_threshold) { - TRACE("dyn_ack", tout << "found candidate:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) + TRACE(dyn_ack, tout << "found candidate:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n" << mk_pp(r, m) << "\nnum_occs: " << num_occs << "\n";); m_triple.m_to_instantiate.push_back(tr); @@ -293,7 +293,7 @@ namespace smt { }; void dyn_ack_manager::gc() { - TRACE("dyn_ack", tout << "dyn_ack GC\n";); + TRACE(dyn_ack, tout << "dyn_ack GC\n";); m_to_instantiate.reset(); m_qhead = 0; svector::iterator it = m_app_pairs.begin(); @@ -302,7 +302,7 @@ namespace smt { for (; it != end; ++it) { app_pair & p = *it; if (m_instantiated.contains(p)) { - TRACE("dyn_ack", tout << "1) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";); + TRACE(dyn_ack, tout << "1) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";); m.dec_ref(p.first); m.dec_ref(p.second); SASSERT(!m_app_pair2num_occs.contains(p.first, p.second)); @@ -317,7 +317,7 @@ namespace smt { // SASSERT(num_occs > 0); num_occs = static_cast(num_occs * m_params.m_dack_gc_inv_decay); if (num_occs <= 1) { - TRACE("dyn_ack", tout << "2) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";); + TRACE(dyn_ack, tout << "2) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";); m_app_pair2num_occs.erase(p.first, p.second); m.dec_ref(p.first); m.dec_ref(p.second); @@ -396,7 +396,7 @@ namespace smt { app_ref eq(m.mk_eq(n1, n2), m); m_context.internalize(eq, true); literal l = m_context.get_literal(eq); - TRACE("dyn_ack", tout << "eq:\n" << mk_pp(eq, m) << "\nliteral: "; + TRACE(dyn_ack, tout << "eq:\n" << mk_pp(eq, m) << "\nliteral: "; m_context.display_literal(tout, l); tout << "\n";); return l; } @@ -407,8 +407,8 @@ namespace smt { SASSERT(n1->get_num_args() == n2->get_num_args()); SASSERT(n1 != n2); m_context.m_stats.m_num_dyn_ack++; - TRACE("dyn_ack_inst", tout << "dyn_ack: " << n1->get_id() << " " << n2->get_id() << "\n";); - TRACE("dyn_ack", tout << "expanding Ackermann's rule for:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n";); + TRACE(dyn_ack_inst, tout << "dyn_ack: " << n1->get_id() << " " << n2->get_id() << "\n";); + TRACE(dyn_ack, tout << "expanding Ackermann's rule for:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n";); unsigned num_args = n1->get_num_args(); literal_buffer lits; for (unsigned i = 0; i < num_args; i++) { @@ -436,7 +436,7 @@ namespace smt { dealloc(del_eh); return; } - TRACE("dyn_ack_clause", tout << "new clause:\n"; m_context.display_clause_detail(tout, cls); tout << "\n";); + TRACE(dyn_ack_clause, tout << "new clause:\n"; m_context.display_clause_detail(tout, cls); tout << "\n";); m_clause2app_pair.insert(cls, p); } @@ -462,8 +462,8 @@ namespace smt { SASSERT(m_params.m_dack != dyn_ack_strategy::DACK_DISABLED); SASSERT(n1 != n2 && n1 != r && n2 != r); ctx.m_stats.m_num_dyn_ack++; - TRACE("dyn_ack_inst", tout << "dyn_ack: " << n1->get_id() << " " << n2->get_id() << " " << r->get_id() << "\n";); - TRACE("dyn_ack", tout << "expanding Ackermann's rule for:\n" << mk_pp(n1, m) << "\n" + TRACE(dyn_ack_inst, tout << "dyn_ack: " << n1->get_id() << " " << n2->get_id() << " " << r->get_id() << "\n";); + TRACE(dyn_ack, tout << "expanding Ackermann's rule for:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n" << mk_pp(r, m) << "\n"; ); @@ -495,7 +495,7 @@ namespace smt { dealloc(del_eh); return; } - TRACE("dyn_ack_clause", ctx.display_clause_detail(tout << "new clause:\n", cls); tout << "\n";); + TRACE(dyn_ack_clause, ctx.display_clause_detail(tout << "new clause:\n", cls); tout << "\n";); m_triple.m_clause2apps.insert(cls, tr); } @@ -521,7 +521,7 @@ namespace smt { }; void dyn_ack_manager::gc_triples() { - TRACE("dyn_ack", tout << "dyn_ack GC\n";); + TRACE(dyn_ack, tout << "dyn_ack GC\n";); m_triple.m_to_instantiate.reset(); m_triple.m_qhead = 0; svector::iterator it = m_triple.m_apps.begin(); @@ -530,7 +530,7 @@ namespace smt { for (; it != end; ++it) { app_triple & p = *it; if (m_triple.m_instantiated.contains(p)) { - TRACE("dyn_ack", tout << "1) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";); + TRACE(dyn_ack, tout << "1) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";); m.dec_ref(p.first); m.dec_ref(p.second); m.dec_ref(p.third); @@ -546,7 +546,7 @@ namespace smt { // SASSERT(num_occs > 0); num_occs = static_cast(num_occs * m_params.m_dack_gc_inv_decay); if (num_occs <= 1) { - TRACE("dyn_ack", tout << "2) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";); + TRACE(dyn_ack, tout << "2) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";); m_triple.m_app2num_occs.erase(p.first, p.second, p.third); m.dec_ref(p.first); m.dec_ref(p.second); diff --git a/src/smt/expr_context_simplifier.cpp b/src/smt/expr_context_simplifier.cpp index eefb29458..852da2f11 100644 --- a/src/smt/expr_context_simplifier.cpp +++ b/src/smt/expr_context_simplifier.cpp @@ -167,7 +167,7 @@ void expr_context_simplifier::clean_trail(unsigned old_lim) { } void expr_context_simplifier::insert_context(expr* e, bool polarity) { - TRACE("expr_context_simplifier", tout << mk_pp(e, m_manager) << "\n";); + TRACE(expr_context_simplifier, tout << mk_pp(e, m_manager) << "\n";); if (m_manager.is_not(e)) { e = to_app(e)->get_arg(0); polarity = !polarity; @@ -181,7 +181,7 @@ void expr_context_simplifier::insert_context(expr* e, bool polarity) { bool expr_context_simplifier::insert_arg(bool is_and, expr* arg, expr_ref_vector& args) { expr_ref tmp(m_manager); reduce_rec(arg, tmp); - TRACE("expr_context_simplifier", tout << mk_pp(arg, m_manager) << " -> " << mk_pp(tmp.get(), m_manager) << "\n";); + TRACE(expr_context_simplifier, tout << mk_pp(arg, m_manager) << " -> " << mk_pp(tmp.get(), m_manager) << "\n";); if (is_true(tmp.get()) && is_and) { // skip. } @@ -431,7 +431,7 @@ void expr_strong_context_simplifier::simplify_basic(expr* fml, expr_ref& result) cache.insert(e, std::make_pair(pos, r)); } - TRACE("expr_context_simplifier", + TRACE(expr_context_simplifier, tout << mk_pp(e, m_manager) << " checked: " << checked << " cached: " @@ -707,7 +707,7 @@ void expr_strong_context_simplifier::simplify_model_based(expr* fml, expr_ref& r cache.insert(e, std::make_pair(pos, r)); } - TRACE("expr_context_simplifier", + TRACE(expr_context_simplifier, tout << mk_pp(e, m_manager) << " checked: " << checked << " cached: " diff --git a/src/smt/fingerprints.cpp b/src/smt/fingerprints.cpp index ac13999d0..9b0ee3374 100644 --- a/src/smt/fingerprints.cpp +++ b/src/smt/fingerprints.cpp @@ -89,10 +89,10 @@ namespace smt { for (unsigned i = 0; i < num_args; i++) d->m_args[i] = d->m_args[i]->get_root(); if (m_set.contains(d)) { - TRACE("fingerprint_bug", tout << "failed: " << *d;); + TRACE(fingerprint_bug, tout << "failed: " << *d;); return nullptr; } - TRACE("fingerprint_bug", tout << "inserting @" << m_scopes.size() << " " << *d;); + TRACE(fingerprint_bug, tout << "inserting @" << m_scopes.size() << " " << *d;); fingerprint * f = new (m_region) fingerprint(m_region, data, data_hash, def, num_args, d->m_args); m_fingerprints.push_back(f); m_defs.push_back(def); @@ -136,7 +136,7 @@ namespace smt { m_fingerprints.shrink(old_size); m_defs.shrink(old_size); m_scopes.shrink(new_lvl); - TRACE("fingerprint_bug", tout << "pop @" << m_scopes.size() << "\n";); + TRACE(fingerprint_bug, tout << "pop @" << m_scopes.size() << "\n";); } void fingerprint_set::display(std::ostream & out) const { @@ -162,7 +162,7 @@ namespace smt { if (f->get_arg(i)->get_root() != args[i]->get_root()) break; if (i == num_args) { - TRACE("missing_instance_detail", tout << "found instance data: " << data << "=" << *f;); + TRACE(missing_instance_detail, tout << "found instance data: " << data << "=" << *f;); return true; } } diff --git a/src/smt/mam.cpp b/src/smt/mam.cpp index 48d243771..3030bda4d 100644 --- a/src/smt/mam.cpp +++ b/src/smt/mam.cpp @@ -913,7 +913,7 @@ namespace { for (unsigned reg : m_todo) { expr * p = m_registers[reg]; SASSERT(!is_quantifier(p)); - TRACE("mam", tout << "lin: " << reg << " " << get_check_mark(reg) << " " << is_var(p) << "\n";); + TRACE(mam, tout << "lin: " << reg << " " << get_check_mark(reg) << " " << is_var(p) << "\n";); if (is_var(p)) { unsigned var_id = to_var(p)->get_idx(); if (m_vars[var_id] != -1) @@ -1273,7 +1273,7 @@ namespace { return nullptr; // it is unlikely we will find a compatible node } if (curr_compatibility > max_compatibility) { - TRACE("mam", tout << "better child " << best_child << " -> " << curr_child << "\n";); + TRACE(mam, tout << "better child " << best_child << " -> " << curr_child << "\n";); best_child = curr_child; max_compatibility = curr_compatibility; } @@ -1482,16 +1482,16 @@ namespace { for (;;) { m_compatible.reset(); m_incompatible.reset(); - TRACE("mam_compiler_detail", tout << "processing head: " << *head << "\n";); + TRACE(mam_compiler_detail, tout << "processing head: " << *head << "\n";); instruction * curr = head->m_next; instruction * last = head; while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) { - TRACE("mam_compiler_detail", tout << "processing instr: " << *curr << "\n";); + TRACE(mam_compiler_detail, tout << "processing instr: " << *curr << "\n";); switch (curr->m_opcode) { case BIND1: case BIND2: case BIND3: case BIND4: case BIND5: case BIND6: case BINDN: { bind* bnd = static_cast(curr); if (is_compatible(bnd)) { - TRACE("mam_compiler_detail", tout << "compatible\n";); + TRACE(mam_compiler_detail, tout << "compatible\n";); unsigned ireg = bnd->m_ireg; SASSERT(m_todo.contains(ireg)); m_todo.erase(ireg); @@ -1506,7 +1506,7 @@ namespace { } } else { - TRACE("mam_compiler_detail", tout << "incompatible\n";); + TRACE(mam_compiler_detail, tout << "incompatible\n";); m_incompatible.push_back(curr); } break; @@ -1514,7 +1514,7 @@ namespace { case CHECK: { check* chk = static_cast(curr); if (is_compatible(chk)) { - TRACE("mam_compiler_detail", tout << "compatible\n";); + TRACE(mam_compiler_detail, tout << "compatible\n";); unsigned reg = chk->m_reg; SASSERT(m_todo.contains(reg)); m_todo.erase(reg); @@ -1522,7 +1522,7 @@ namespace { m_compatible.push_back(curr); } else if (m_use_filters && is_semi_compatible(chk)) { - TRACE("mam_compiler_detail", tout << "semi compatible\n";); + TRACE(mam_compiler_detail, tout << "semi compatible\n";); unsigned reg = chk->m_reg; enode * n1 = chk->m_enode; // n1->has_lbl_hash may be false, even @@ -1550,14 +1550,14 @@ namespace { m_incompatible.push_back(curr); } else { - TRACE("mam_compiler_detail", tout << "incompatible " << chk->m_reg << "\n";); + TRACE(mam_compiler_detail, tout << "incompatible " << chk->m_reg << "\n";); m_incompatible.push_back(curr); } break; } case COMPARE: if (is_compatible(static_cast(curr))) { - TRACE("mam_compiler_detail", tout << "compatible\n";); + TRACE(mam_compiler_detail, tout << "compatible\n";); unsigned reg1 = static_cast(curr)->m_reg1; unsigned reg2 = static_cast(curr)->m_reg2; SASSERT(m_todo.contains(reg2)); @@ -1573,7 +1573,7 @@ namespace { m_compatible.push_back(curr); } else { - TRACE("mam_compiler_detail", tout << "incompatible\n";); + TRACE(mam_compiler_detail, tout << "incompatible\n";); m_incompatible.push_back(curr); } break; @@ -1594,8 +1594,8 @@ namespace { SASSERT(m_use_filters); if (is_compatible(flt)) { unsigned reg = flt->m_reg; - TRACE("mam_compiler_detail", tout << "compatible " << reg << "\n";); - CTRACE("mam_compiler_bug", !m_todo.contains(reg), { + TRACE(mam_compiler_detail, tout << "compatible " << reg << "\n";); + CTRACE(mam_compiler_bug, !m_todo.contains(reg), { for (unsigned t : m_todo) { tout << t << " "; } tout << "\nregisters:\n"; unsigned i = 0; @@ -1612,8 +1612,8 @@ namespace { } else if (is_semi_compatible(flt)) { unsigned reg = flt->m_reg; - TRACE("mam_compiler_detail", tout << "semi compatible " << reg << "\n";); - CTRACE("mam_compiler_bug", !m_todo.contains(reg), { + TRACE(mam_compiler_detail, tout << "semi compatible " << reg << "\n";); + CTRACE(mam_compiler_bug, !m_todo.contains(reg), { for (unsigned t : m_todo) { tout << t << " "; } tout << "\nregisters:\n"; unsigned i = 0; @@ -1623,7 +1623,7 @@ namespace { }); SASSERT(m_todo.contains(reg)); unsigned h = get_pat_lbl_hash(reg); - TRACE("mam_lbl_bug", + TRACE(mam_lbl_bug, tout << "curr_set: " << flt->m_lbl_set << "\n"; tout << "new hash: " << h << "\n";); set_check_mark(reg, CHECK_SET); @@ -1642,13 +1642,13 @@ namespace { } } else { - TRACE("mam_compiler_detail", tout << "incompatible\n";); + TRACE(mam_compiler_detail, tout << "incompatible\n";); m_incompatible.push_back(curr); } break; } default: - TRACE("mam_compiler_detail", tout << "incompatible\n";); + TRACE(mam_compiler_detail, tout << "incompatible\n";); m_incompatible.push_back(curr); break; } @@ -1656,7 +1656,7 @@ namespace { curr = curr->m_next; } - TRACE("mam_compiler", tout << *head << " " << head << "\n"; + TRACE(mam_compiler, tout << *head << " " << head << "\n"; tout << "m_compatible.size(): " << m_compatible.size() << "\n"; tout << "m_incompatible.size(): " << m_incompatible.size() << "\n";); @@ -1668,7 +1668,7 @@ namespace { SASSERT(curr->m_opcode == CHOOSE); choose * first_child = static_cast(curr); choose * best_child = find_best_child(first_child); - TRACE("mam", tout << "best child " << best_child << "\n";); + TRACE(mam, tout << "best child " << best_child << "\n";); if (best_child == nullptr) { // There is no compatible child // Suppose the sequence is: @@ -1753,7 +1753,7 @@ namespace { init(r, qa, mp, first_idx); linearise(r->m_root, first_idx); r->m_num_choices = m_num_choices; - TRACE("mam_compiler", tout << "new tree for:\n" << mk_pp(mp, m) << "\n" << *r;); + TRACE(mam_compiler, tout << "new tree for:\n" << mk_pp(mp, m) << "\n" << *r;); return r; } @@ -1771,21 +1771,21 @@ namespace { return; } m_is_tmp_tree = is_tmp_tree; - TRACE("mam_compiler", tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";); - TRACE("mam_bug", tout << "before insertion\n" << *tree << "\n";); + TRACE(mam_compiler, tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";); + TRACE(mam_bug, tout << "before insertion\n" << *tree << "\n";); if (!is_tmp_tree) m_ct_manager.save_num_regs(tree); init(tree, qa, mp, first_idx); m_num_choices = tree->m_num_choices; insert(tree->m_root, first_idx); - TRACE("mam_bug", + TRACE(mam_bug, tout << "m_num_choices: " << m_num_choices << "\n";); if (m_num_choices > tree->m_num_choices) { if (!is_tmp_tree) m_ct_manager.save_num_choices(tree); tree->m_num_choices = m_num_choices; } - TRACE("mam_bug", + TRACE(mam_bug, tout << "m_num_choices: " << m_num_choices << "\n"; tout << "new tree:\n" << *tree; tout << "todo "; @@ -1877,7 +1877,7 @@ namespace { void update_max_generation(enode * n, enode * prev) { m_max_generation = std::max(m_max_generation, n->get_generation()); - if (m.has_trace_stream() || is_trace_enabled("causality")) + if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) m_used_enodes.push_back(std::make_tuple(prev, n)); } @@ -1996,7 +1996,7 @@ namespace { } void init(code_tree * t) { - TRACE("mam_bug", tout << "preparing to match tree:\n" << *t << "\n";); + TRACE(mam_bug, tout << "preparing to match tree:\n" << *t << "\n";); m_registers.reserve(t->get_num_regs(), nullptr); m_bindings.reserve(t->get_num_regs(), nullptr); if (m_backtrack_stack.size() < t->get_num_choices()) @@ -2004,12 +2004,12 @@ namespace { } bool execute(code_tree * t) { - TRACE("trigger_bug", tout << "execute for code tree:\n"; t->display(tout);); + TRACE(trigger_bug, tout << "execute for code tree:\n"; t->display(tout);); init(t); #define CLEANUP for (enode* app : t->get_candidates()) if (app->is_marked()) app->unset_mark(); if (t->filter_candidates()) { for (enode* app : t->get_candidates()) { - TRACE("trigger_bug", tout << "candidate\n" << mk_ismt2_pp(app->get_expr(), m) << "\n";); + TRACE(trigger_bug, tout << "candidate\n" << mk_ismt2_pp(app->get_expr(), m) << "\n";); if (!app->is_marked() && app->is_cgr()) { if (m_context.resource_limits_exceeded() || !execute_core(t, app)) { CLEANUP; @@ -2023,9 +2023,9 @@ namespace { } else { for (enode* app : t->get_candidates()) { - TRACE("trigger_bug", tout << "candidate\n" << mk_ismt2_pp(app->get_expr(), m) << "\n";); + TRACE(trigger_bug, tout << "candidate\n" << mk_ismt2_pp(app->get_expr(), m) << "\n";); if (app->is_cgr()) { - TRACE("trigger_bug", tout << "is_cgr\n";); + TRACE(trigger_bug, tout << "is_cgr\n";); // scoped_suspend_rlimit susp(m.limit(), false); if (m_context.resource_limits_exceeded() || !execute_core(t, app)) return false; @@ -2188,7 +2188,7 @@ namespace { bp.m_old_max_generation = m_max_generation; bp.m_old_used_enodes_size = m_used_enodes.size(); if (best_v == nullptr) { - TRACE("mam_bug", tout << "m_top: " << m_top << ", m_backtrack_stack.size(): " << m_backtrack_stack.size() << "\n"; + TRACE(mam_bug, tout << "m_top: " << m_top << ", m_backtrack_stack.size(): " << m_backtrack_stack.size() << "\n"; tout << *c << "\n";); bp.m_to_recycle = nullptr; bp.m_it = m_context.begin_enodes_of(lbl); @@ -2273,7 +2273,7 @@ namespace { #endif bool interpreter::execute_core(code_tree * t, enode * n) { - TRACE("trigger_bug", tout << "interpreter::execute_core\n"; t->display(tout); tout << "\nenode\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";); + TRACE(trigger_bug, tout << "interpreter::execute_core\n"; t->display(tout); tout << "\nenode\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";); unsigned since_last_check = 0; #ifdef _PROFILE_MAM @@ -2287,7 +2287,7 @@ namespace { t->inc_counter(); #endif // It doesn't make sense to process an irrelevant enode. - TRACE("mam_execute_core", tout << "EXEC " << t->get_root_lbl()->get_name() << "\n";); + TRACE(mam_execute_core, tout << "EXEC " << t->get_root_lbl()->get_name() << "\n";); SASSERT(m_context.is_relevant(n)); m_pattern_instances.reset(); m_min_top_generation.reset(); @@ -2295,7 +2295,7 @@ namespace { m_pattern_instances.push_back(n); m_max_generation = n->get_generation(); - if (m.has_trace_stream() || is_trace_enabled("causality")) { + if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) { m_used_enodes.reset(); m_used_enodes.push_back(std::make_tuple(nullptr, n)); // null indicates that n was matched against the trigger at the top-level } @@ -2309,7 +2309,7 @@ namespace { if (!m_pc) goto backtrack; - TRACE("mam_int", display_pc_info(tout);); + TRACE(mam_int, display_pc_info(tout);); #ifdef _PROFILE_MAM const_cast(m_pc)->m_counter++; @@ -2397,7 +2397,7 @@ namespace { goto backtrack; // We will use the common root when instantiating the quantifier => log the necessary equalities - if (m.has_trace_stream() || is_trace_enabled("causality")) { + if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) { m_used_enodes.push_back(std::make_tuple(m_n1, m_n1->get_root())); m_used_enodes.push_back(std::make_tuple(m_n2, m_n2->get_root())); } @@ -2417,7 +2417,7 @@ namespace { goto backtrack; // we used the equality m_n1 = m_n2 for the match and need to make sure it ends up in the log - if (m.has_trace_stream() || is_trace_enabled("causality")) { + if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) { m_used_enodes.push_back(std::make_tuple(m_n1, m_n2)); } @@ -2465,7 +2465,7 @@ namespace { m_app = get_first_f_app(static_cast(m_pc)->m_label, static_cast(m_pc)->m_num_args, m_n1); \ if (!m_app) \ goto backtrack; \ - TRACE("mam_int", tout << "bind candidate: " << mk_pp(m_app->get_expr(), m) << "\n";); \ + TRACE(mam_int, tout << "bind candidate: " << mk_pp(m_app->get_expr(), m) << "\n";); \ m_backtrack_stack[m_top].m_instr = m_pc; \ m_backtrack_stack[m_top].m_old_max_generation = m_curr_max_generation; \ m_backtrack_stack[m_top].m_old_used_enodes_size = m_curr_used_enodes_size; \ @@ -2603,7 +2603,7 @@ namespace { if (m_n1 == 0 || !m_context.is_relevant(m_n1)) \ goto backtrack; \ update_max_generation(m_n1, nullptr); \ - if (m.has_trace_stream() || is_trace_enabled("causality")) { \ + if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) { \ for (unsigned i = 0; i < static_cast(m_pc)->m_num_args; ++i) { \ m_used_enodes.push_back(std::make_tuple(m_n1->get_arg(i), m_n1->get_arg(i)->get_root())); \ } \ @@ -2615,7 +2615,7 @@ namespace { #define SET_VAR(IDX) \ m_args[IDX] = m_registers[static_cast(m_pc)->m_iregs[IDX]]; \ if (m_use_filters && static_cast(m_pc)->m_lbl_set.empty_intersection(m_args[IDX]->get_root()->get_plbls())) { \ - TRACE("trigger_bug", tout << "m_args[IDX]->get_root():\n" << mk_ismt2_pp(m_args[IDX]->get_root()->get_expr(), m) << "\n"; \ + TRACE(trigger_bug, tout << "m_args[IDX]->get_root():\n" << mk_ismt2_pp(m_args[IDX]->get_root()->get_expr(), m) << "\n"; \ tout << "cgr set: "; static_cast(m_pc)->m_lbl_set.display(tout); tout << "\n"; \ tout << "node set: "; m_args[IDX]->get_root()->get_plbls().display(tout); tout << "\n";); \ goto backtrack; \ @@ -2679,7 +2679,7 @@ namespace { if (m_app == nullptr) goto backtrack; m_pattern_instances.push_back(m_app); - TRACE("mam_int", tout << "continue candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); + TRACE(mam_int, tout << "continue candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); for (unsigned i = 0; i < m_num_args; i++) m_registers[m_oreg+i] = m_app->get_arg(i); m_pc = m_pc->m_next; @@ -2688,9 +2688,9 @@ namespace { } backtrack: - TRACE("mam_int", tout << "backtracking.\n";); + TRACE(mam_int, tout << "backtracking.\n";); if (m_top == 0) { - TRACE("mam_int", tout << "no more alternatives.\n";); + TRACE(mam_int, tout << "no more alternatives.\n";); #ifdef _PROFILE_MAM t->get_watch().stop(); #endif @@ -2699,10 +2699,10 @@ namespace { backtrack_point & bp = m_backtrack_stack[m_top - 1]; m_max_generation = bp.m_old_max_generation; - if (m.has_trace_stream() || is_trace_enabled("causality")) + if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) m_used_enodes.shrink(bp.m_old_used_enodes_size); - TRACE("mam_int", tout << "backtrack top: " << bp.m_instr << " " << *(bp.m_instr) << "\n";); + TRACE(mam_int, tout << "backtrack top: " << bp.m_instr << " " << *(bp.m_instr) << "\n";); #ifdef _PROFILE_MAM if (bp.m_instr->m_opcode != CHOOSE) // CHOOSE has a different status. It is a control flow backtracking. const_cast(bp.m_instr)->m_counter++; @@ -2729,7 +2729,7 @@ namespace { switch (bp.m_instr->m_opcode) { case CHOOSE: m_pc = static_cast(bp.m_instr)->m_alt; - TRACE("mam_int", tout << "alt: " << m_pc << "\n";); + TRACE(mam_int, tout << "alt: " << m_pc << "\n";); SASSERT(m_pc != 0); m_top--; goto main_loop; @@ -2742,7 +2742,7 @@ namespace { goto backtrack; \ } \ bp.m_curr = m_app; \ - TRACE("mam_int", tout << "bind next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); \ + TRACE(mam_int, tout << "bind next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); \ m_oreg = m_b->m_oreg BBIND_COMMON(); @@ -2822,7 +2822,7 @@ namespace { m_pattern_instances.push_back(m_app); // continue succeeded update_max_generation(m_app, nullptr); // null indicates a top-level match - TRACE("mam_int", tout << "continue next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); + TRACE(mam_int, tout << "continue next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); m_num_args = c->m_num_args; m_oreg = c->m_oreg; for (unsigned i = 0; i < m_num_args; i++) @@ -2929,7 +2929,7 @@ namespace { } DEBUG_CODE(m_trees[lbl_id]->get_patterns().push_back(mp); m_trail_stack.push(push_back_trail(m_trees[lbl_id]->get_patterns()));); - TRACE("trigger_bug", tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout);); + TRACE(trigger_bug, tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout);); } void reset() { @@ -3155,7 +3155,7 @@ namespace { void add_candidate(code_tree * t, enode * app) { if (t != nullptr) { - TRACE("mam_candidate", tout << "adding candidate:\n" << mk_ll_pp(app->get_expr(), m);); + TRACE(mam_candidate, tout << "adding candidate:\n" << mk_ll_pp(app->get_expr(), m);); if (!t->has_candidates()) m_to_match.push_back(t); t->add_candidate(app); @@ -3187,8 +3187,8 @@ namespace { void update_clbls(func_decl * lbl) { unsigned lbl_id = lbl->get_small_id(); m_is_clbl.reserve(lbl_id+1, false); - TRACE("trigger_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";); - TRACE("mam_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";); + TRACE(trigger_bug, tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";); + TRACE(mam_bug, tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";); if (m_is_clbl[lbl_id]) return; m_trail_stack.push(set_bitvector_trail(m_is_clbl, lbl_id)); @@ -3197,7 +3197,7 @@ namespace { for (enode* app : m_context.enodes_of(lbl)) { if (m_context.is_relevant(app)) { update_lbls(app, h); - TRACE("mam_bug", tout << "updating labels of: #" << app->get_owner_id() << "\n"; + TRACE(mam_bug, tout << "updating labels of: #" << app->get_owner_id() << "\n"; tout << "new_elem: " << h << "\n"; tout << "lbls: " << app->get_lbls() << "\n"; tout << "r.lbls: " << app->get_root()->get_lbls() << "\n";); @@ -3213,10 +3213,10 @@ namespace { if (!r_plbls.may_contain(elem)) { m_trail_stack.push(value_trail(r_plbls)); r_plbls.insert(elem); - TRACE("trigger_bug", tout << "updating plabels of:\n" << mk_ismt2_pp(c->get_root()->get_expr(), m) << "\n"; + TRACE(trigger_bug, tout << "updating plabels of:\n" << mk_ismt2_pp(c->get_root()->get_expr(), m) << "\n"; tout << "new_elem: " << static_cast(elem) << "\n"; tout << "plbls: " << c->get_root()->get_plbls() << "\n";); - TRACE("mam_bug", tout << "updating plabels of: #" << c->get_root()->get_owner_id() << "\n"; + TRACE(mam_bug, tout << "updating plabels of: #" << c->get_root()->get_owner_id() << "\n"; tout << "new_elem: " << static_cast(elem) << "\n"; tout << "plbls: " << c->get_root()->get_plbls() << "\n";); @@ -3227,9 +3227,9 @@ namespace { void update_plbls(func_decl * lbl) { unsigned lbl_id = lbl->get_small_id(); m_is_plbl.reserve(lbl_id+1, false); - TRACE("trigger_bug", tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << ", lbl_id: " << lbl_id << "\n"; + TRACE(trigger_bug, tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << ", lbl_id: " << lbl_id << "\n"; tout << "mam: " << this << "\n";); - TRACE("mam_bug", tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << "\n";); + TRACE(mam_bug, tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << "\n";); if (m_is_plbl[lbl_id]) return; m_trail_stack.push(set_bitvector_trail(m_is_plbl, lbl_id)); @@ -3343,7 +3343,7 @@ namespace { m_trail_stack.push(set_ptr_trail(m_pc[h1][h2])); m_pc[h1][h2] = mk_path_tree(p, qa, mp); } - TRACE("mam_path_tree_updt", + TRACE(mam_path_tree_updt, tout << "updated path tree:\n"; m_pc[h1][h2]->display(tout, 2);); } @@ -3381,7 +3381,7 @@ namespace { m_pp[h1][h2].second = mk_path_tree(p2, qa, mp); } } - TRACE("mam_path_tree_updt", + TRACE(mam_path_tree_updt, tout << "updated path tree:\n"; SASSERT(h1 <= h2); m_pp[h1][h2].first->display(tout, 2); @@ -3445,7 +3445,7 @@ namespace { update_plbls(plbl); if (!n->has_lbl_hash()) n->set_lbl_hash(m_context); - TRACE("mam_bug", + TRACE(mam_bug, tout << "updating pc labels " << plbl->get_name() << " " << static_cast(n->get_lbl_hash()) << "\n"; tout << "#" << n->get_owner_id() << " " << n->get_root()->get_lbls() << "\n"; @@ -3455,7 +3455,7 @@ namespace { } func_decl * clbl = to_app(child)->get_decl(); - TRACE("mam_bug", tout << "updating pc labels " << plbl->get_name() << " " << clbl->get_name() << "\n";); + TRACE(mam_bug, tout << "updating pc labels " << plbl->get_name() << " " << clbl->get_name() << "\n";); update_plbls(plbl); update_clbls(clbl); update_pc(m_lbl_hasher(plbl), m_lbl_hasher(clbl), new_path, qa, mp); @@ -3467,7 +3467,7 @@ namespace { \brief Update inverted path index. */ void update_filters(quantifier * qa, app * mp) { - TRACE("mam_bug", tout << "updating filters using:\n" << mk_pp(mp, m) << "\n";); + TRACE(mam_bug, tout << "updating filters using:\n" << mk_pp(mp, m) << "\n";); unsigned num_vars = qa->get_num_decls(); if (num_vars >= m_var_paths.size()) m_var_paths.resize(num_vars+1); @@ -3539,7 +3539,7 @@ namespace { #ifdef _PROFILE_PATH_TREE t->m_counter++; #endif - TRACE("mam_path_tree", + TRACE(mam_path_tree, tout << "processing:\n"; t->display(tout, 2);); enode_vector * v = t->m_todo; @@ -3584,7 +3584,7 @@ namespace { std::cout << "Avg2. " << static_cast(total_sz2)/static_cast(counter2) << ", Max2. " << max_sz2 << "\n"; #endif - TRACE("mam_path_tree", tout << "processing: #" << curr_child->get_owner_id() << "\n";); + TRACE(mam_path_tree, tout << "processing: #" << curr_child->get_owner_id() << "\n";); enode_vector::const_iterator it2 = curr_child->begin_parents(); enode_vector::const_iterator end2 = curr_child->end_parents(); for (; it2 != end2; ++it2) { @@ -3602,8 +3602,8 @@ namespace { bool is_flat_assoc = lbl->is_flat_associative(); enode * curr_parent_root = curr_parent->get_root(); enode * curr_parent_cg = curr_parent->get_cg(); - TRACE("mam_path_tree", tout << "processing parent:\n" << mk_pp(curr_parent->get_expr(), m) << "\n";); - TRACE("mam_path_tree", tout << "parent is marked: " << curr_parent->is_marked() << "\n";); + TRACE(mam_path_tree, tout << "processing parent:\n" << mk_pp(curr_parent->get_expr(), m) << "\n";); + TRACE(mam_path_tree, tout << "parent is marked: " << curr_parent->is_marked() << "\n";); if (filter.may_contain(m_lbl_hasher(lbl)) && !curr_parent->is_marked() && (curr_parent_cg == curr_parent || !is_eq(curr_parent_cg, curr_parent_root)) && @@ -3631,7 +3631,7 @@ namespace { is_eq(curr_tree->m_ground_arg, curr_parent->get_arg(curr_tree->m_ground_arg_idx)) )) { if (curr_tree->m_code) { - TRACE("mam_path_tree", tout << "found candidate " << expr_ref(curr_parent->get_expr(), m) << "\n";); + TRACE(mam_path_tree, tout << "found candidate " << expr_ref(curr_parent->get_expr(), m) << "\n";); add_candidate(curr_tree->m_code, curr_parent); } if (curr_tree->m_first_child) { @@ -3680,8 +3680,8 @@ namespace { void process_pp(enode * r1, enode * r2) { approx_set & plbls1 = r1->get_plbls(); approx_set & plbls2 = r2->get_plbls(); - TRACE("incremental_matcher", tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";); - TRACE("mam_info", tout << "pp: " << plbls1.size() * plbls2.size() << "\n";); + TRACE(incremental_matcher, tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";); + TRACE(mam_info, tout << "pp: " << plbls1.size() * plbls2.size() << "\n";); if (!plbls1.empty() && !plbls2.empty()) { for (unsigned plbl1 : plbls1) { if (m_context.get_cancel_flag()) { @@ -3735,7 +3735,7 @@ namespace { } void match_new_patterns() { - TRACE("mam_new_pat", tout << "matching new patterns:\n";); + TRACE(mam_new_pat, tout << "matching new patterns:\n";); m_tmp_trees_to_delete.reset(); for (auto const& kv : m_new_patterns) { if (m_context.get_cancel_flag()) { @@ -3780,7 +3780,7 @@ namespace { unsigned num_patterns = mp->get_num_args(); for (unsigned i = 0; i < num_patterns; i++) { app * pat = to_app(mp->get_arg(i)); - TRACE("mam_pat", tout << mk_ismt2_pp(qa, m) << "\npat:\n" << mk_ismt2_pp(pat, m) << "\n";); + TRACE(mam_pat, tout << mk_ismt2_pp(qa, m) << "\npat:\n" << mk_ismt2_pp(pat, m) << "\n";); SASSERT(!pat->is_ground()); todo.push_back(pat); } @@ -3827,8 +3827,8 @@ namespace { void add_pattern(quantifier * qa, app * mp) override { SASSERT(m.is_pattern(mp)); - TRACE("trigger_bug", tout << "adding pattern\n" << mk_ismt2_pp(qa, m) << "\n" << mk_ismt2_pp(mp, m) << "\n";); - TRACE("mam_bug", tout << "adding pattern\n" << mk_pp(qa, m) << "\n" << mk_pp(mp, m) << "\n";); + TRACE(trigger_bug, tout << "adding pattern\n" << mk_ismt2_pp(qa, m) << "\n" << mk_ismt2_pp(mp, m) << "\n";); + TRACE(mam_bug, tout << "adding pattern\n" << mk_pp(qa, m) << "\n" << mk_pp(mp, m) << "\n";); // Z3 checks if a pattern is ground or not before solving. // Ground patterns are discarded. // However, the simplifier may turn a non-ground pattern into a ground one. @@ -3886,7 +3886,7 @@ namespace { } void match() override { - TRACE("trigger_bug", tout << "match\n"; display(tout);); + TRACE(trigger_bug, tout << "match\n"; display(tout);); for (code_tree* t : m_to_match) { SASSERT(t->has_candidates()); if (!m_interpreter.execute(t)) @@ -3919,7 +3919,7 @@ namespace { #ifdef Z3DEBUG bool check_missing_instances() override { - TRACE("missing_instance", tout << "checking for missing instances...\n";); + TRACE(missing_instance, tout << "checking for missing instances...\n";); flet l(m_check_missing_instances, true); rematch(false); return true; @@ -3927,11 +3927,11 @@ namespace { #endif void on_match(quantifier * qa, app * pat, unsigned num_bindings, enode * const * bindings, unsigned max_generation, vector> & used_enodes) override { - TRACE("trigger_bug", tout << "found match " << mk_pp(qa, m) << "\n";); + TRACE(trigger_bug, tout << "found match " << mk_pp(qa, m) << "\n";); #ifdef Z3DEBUG if (m_check_missing_instances) { if (!m_context.slow_contains_instance(qa, num_bindings, bindings)) { - TRACE("missing_instance", + TRACE(missing_instance, tout << "qa:\n" << mk_ll_pp(qa, m) << "\npat:\n" << mk_ll_pp(pat, m); for (unsigned i = 0; i < num_bindings; i++) tout << "#" << bindings[i]->get_expr_id() << "\n" << mk_ll_pp(bindings[i]->get_expr(), m) << "\n"; @@ -3958,23 +3958,23 @@ namespace { // This method is invoked when n becomes relevant. // If lazy == true, then n is not added to the list of candidate enodes for matching. That is, the method just updates the lbls. void relevant_eh(enode * n, bool lazy) override { - TRACE("trigger_bug", tout << "relevant_eh:\n" << mk_ismt2_pp(n->get_expr(), m) << "\n"; + TRACE(trigger_bug, tout << "relevant_eh:\n" << mk_ismt2_pp(n->get_expr(), m) << "\n"; tout << "mam: " << this << "\n";); - TRACE("mam", tout << "relevant_eh: #" << enode_pp(n, m_context) << "\n";); + TRACE(mam, tout << "relevant_eh: #" << enode_pp(n, m_context) << "\n";); if (n->has_lbl_hash()) update_lbls(n, n->get_lbl_hash()); if (n->get_num_args() > 0) { func_decl * lbl = n->get_decl(); unsigned h = m_lbl_hasher(lbl); - TRACE("trigger_bug", tout << "lbl: " << lbl->get_name() << " is_clbl(lbl): " << is_clbl(lbl) + TRACE(trigger_bug, tout << "lbl: " << lbl->get_name() << " is_clbl(lbl): " << is_clbl(lbl) << ", is_plbl(lbl): " << is_plbl(lbl) << ", h: " << h << "\n"; tout << "lbl_id: " << lbl->get_small_id() << "\n";); if (is_clbl(lbl)) update_lbls(n, h); if (is_plbl(lbl)) update_children_plbls(n, h); - TRACE("mam_bug", tout << "adding relevant candidate:\n" << mk_ll_pp(n->get_expr(), m) << "\n";); + TRACE(mam_bug, tout << "adding relevant candidate:\n" << mk_ll_pp(n->get_expr(), m) << "\n";); if (!lazy) add_candidate(n); } @@ -3988,9 +3988,9 @@ namespace { flet l1(m_r1, r1); flet l2(m_r2, r2); - TRACE("mam", tout << "add_eq_eh: #" << r1->get_owner_id() << " #" << r2->get_owner_id() << "\n";); - TRACE("mam_inc_bug_detail", m_context.display(tout);); - TRACE("mam_inc_bug", + TRACE(mam, tout << "add_eq_eh: #" << r1->get_owner_id() << " #" << r2->get_owner_id() << "\n";); + TRACE(mam_inc_bug_detail, m_context.display(tout);); + TRACE(mam_inc_bug, tout << "before:\n#" << r1->get_owner_id() << " #" << r2->get_owner_id() << "\n"; tout << "r1.lbls: " << r1->get_lbls() << "\n"; tout << "r2.lbls: " << r2->get_lbls() << "\n"; @@ -4010,7 +4010,7 @@ namespace { m_trail_stack.push(value_trail(r2_plbls)); r2_lbls |= r1_lbls; r2_plbls |= r1_plbls; - TRACE("mam_inc_bug", + TRACE(mam_inc_bug, tout << "after:\n"; tout << "r1.lbls: " << r1->get_lbls() << "\n"; tout << "r2.lbls: " << r2->get_lbls() << "\n"; diff --git a/src/smt/old_interval.cpp b/src/smt/old_interval.cpp index c4d49d00a..1cebba3e6 100644 --- a/src/smt/old_interval.cpp +++ b/src/smt/old_interval.cpp @@ -319,13 +319,13 @@ interval & interval::operator*=(interval const & other) { v_dependency * c_d = other.m_lower_dep; v_dependency * d_d = other.m_upper_dep; - TRACE("interval_bug", tout << "operator*= " << *this << " " << other << "\n";); + TRACE(interval_bug, tout << "operator*= " << *this << " " << other << "\n";); if (is_N()) { if (other.is_N()) { // x <= b <= 0, y <= d <= 0 --> b*d <= x*y // a <= x <= b <= 0, c <= y <= d <= 0 --> x*y <= a*c (we can use the fact that x or y is always negative (i.e., b is neg or d is neg)) - TRACE("interval_bug", tout << "(N, N)\n";); + TRACE(interval_bug, tout << "(N, N)\n";); ext_numeral new_lower = b * d; ext_numeral new_upper = a * c; // if b = 0 (and the interval is closed), then the lower bound is closed @@ -339,7 +339,7 @@ interval & interval::operator*=(interval const & other) { else if (other.is_M()) { // a <= x <= b <= 0, y <= d, d > 0 --> a*d <= x*y (uses the fact that b is not positive) // a <= x <= b <= 0, c <= y, c < 0 --> x*y <= a*c (uses the fact that b is not positive) - TRACE("interval_bug", tout << "(N, M)\n";); + TRACE(interval_bug, tout << "(N, M)\n";); ext_numeral new_lower = a * d; SASSERT(new_lower.is_neg()); ext_numeral new_upper = a * c; SASSERT(new_upper.is_pos()); m_lower_open = a_o || d_o; @@ -352,7 +352,7 @@ interval & interval::operator*=(interval const & other) { else { // a <= x <= b <= 0, 0 <= c <= y <= d --> a*d <= x*y (uses the fact that x is neg (b is not positive) or y is pos (c is not negative)) // x <= b <= 0, 0 <= c <= y --> x*y <= b*c - TRACE("interval_bug", tout << "(N, P)\n";); + TRACE(interval_bug, tout << "(N, P)\n";); SASSERT(other.is_P()); ext_numeral new_lower = a * d; ext_numeral new_upper = b * c; @@ -369,7 +369,7 @@ interval & interval::operator*=(interval const & other) { if (other.is_N()) { // b > 0, x <= b, c <= y <= d <= 0 --> b*c <= x*y (uses the fact that d is not positive) // a < 0, a <= x, c <= y <= d <= 0 --> x*y <= a*c (uses the fact that d is not positive) - TRACE("interval_bug", tout << "(M, N)\n";); + TRACE(interval_bug, tout << "(M, N)\n";); ext_numeral new_lower = b * c; SASSERT(new_lower.is_neg()); ext_numeral new_upper = a * c; SASSERT(new_upper.is_pos()); m_lower_open = b_o || c_o; SASSERT(b.is_pos() && c.is_neg()); @@ -380,7 +380,7 @@ interval & interval::operator*=(interval const & other) { m_upper_dep = m_upper.is_infinite() ? nullptr : join(a_d, c_d, d_d); } else if (other.is_M()) { - TRACE("interval_bug", tout << "(M, M)\n";); + TRACE(interval_bug, tout << "(M, M)\n";); SASSERT(!a.is_zero() && !b.is_zero() && !c.is_zero() && !d.is_zero()); ext_numeral ad = a*d; SASSERT(!ad.is_zero()); ext_numeral bc = b*c; SASSERT(!bc.is_zero()); @@ -412,7 +412,7 @@ interval & interval::operator*=(interval const & other) { else { // a < 0, a <= x, 0 <= c <= y <= d --> a*d <= x*y (uses the fact that c is not negative) // b > 0, x <= b, 0 <= c <= y <= d --> x*y <= b*d (uses the fact that c is not negative) - TRACE("interval_bug", tout << "(M, P)\n";); + TRACE(interval_bug, tout << "(M, P)\n";); SASSERT(other.is_P()); ext_numeral new_lower = a * d; SASSERT(new_lower.is_neg()); ext_numeral new_upper = b * d; SASSERT(new_upper.is_pos()); @@ -429,7 +429,7 @@ interval & interval::operator*=(interval const & other) { if (other.is_N()) { // 0 <= a <= x <= b, c <= y <= d <= 0 --> x*y <= b*c (uses the fact that x is pos (a is not neg) or y is neg (d is not pos)) // 0 <= a <= x, y <= d <= 0 --> a*d <= x*y - TRACE("interval_bug", tout << "(P, N)\n";); + TRACE(interval_bug, tout << "(P, N)\n";); ext_numeral new_lower = b * c; ext_numeral new_upper = a * d; bool is_P0_old = is_P0(); // cache the value of is_P0(), since it may be affected by the next update. @@ -443,7 +443,7 @@ interval & interval::operator*=(interval const & other) { else if (other.is_M()) { // 0 <= a <= x <= b, c <= y --> b*c <= x*y (uses the fact that a is not negative) // 0 <= a <= x <= b, y <= d --> x*y <= b*d (uses the fact that a is not negative) - TRACE("interval_bug", tout << "(P, M)\n";); + TRACE(interval_bug, tout << "(P, M)\n";); ext_numeral new_lower = b * c; SASSERT(new_lower.is_neg()); ext_numeral new_upper = b * d; SASSERT(new_upper.is_pos()); m_lower_open = b_o || c_o; @@ -456,7 +456,7 @@ interval & interval::operator*=(interval const & other) { else { // 0 <= a <= x, 0 <= c <= y --> a*c <= x*y // x <= b, y <= d --> x*y <= b*d (uses the fact that x is pos (a is not negative) or y is pos (c is not negative)) - TRACE("interval_bug", tout << "(P, P)\n";); + TRACE(interval_bug, tout << "(P, P)\n";); SASSERT(other.is_P()); ext_numeral new_lower = a * c; ext_numeral new_upper = b * d; @@ -468,8 +468,8 @@ interval & interval::operator*=(interval const & other) { m_upper_dep = m_upper.is_infinite() ? nullptr : join_opt(b_d, d_d, a_d, c_d); } } - TRACE("interval_bug", tout << "operator*= result: " << *this << "\n";); - CTRACE("interval", !(!(contains_zero1 || contains_zero2) || contains_zero()), + TRACE(interval_bug, tout << "operator*= result: " << *this << "\n";); + CTRACE(interval, !(!(contains_zero1 || contains_zero2) || contains_zero()), tout << "contains_zero1: " << contains_zero1 << ", contains_zero2: " << contains_zero2 << ", contains_zero(): " << contains_zero() << "\n";); SASSERT(!(contains_zero1 || contains_zero2) || contains_zero()); return *this; @@ -484,7 +484,7 @@ bool interval::empty() const { } bool interval::contains_zero() const { - TRACE("interval_zero_bug", tout << "contains_zero info: " << *this << "\n"; + TRACE(interval_zero_bug, tout << "contains_zero info: " << *this << "\n"; tout << "m_lower.is_neg(): " << m_lower.is_neg() << "\n"; tout << "m_lower.is_zero: " << m_lower.is_zero() << "\n"; tout << "m_lower_open: " << m_lower_open << "\n"; @@ -568,7 +568,7 @@ interval & interval::operator/=(interval const & other) { SASSERT(!other.contains_zero()); if (is_zero()) { // 0/other = 0 if other != 0 - TRACE("interval", other.display_with_dependencies(tout);); + TRACE(interval, other.display_with_dependencies(tout);); if (other.m_lower.is_pos() || (other.m_lower.is_zero() && other.m_lower_open)) { // other.lower > 0 // x in ([0, 0] / [other.lo, other.up]), for other.lo > 0 @@ -625,10 +625,10 @@ void interval::expt(unsigned n) { else { // [l, u]^n = [0, max{l^n, u^n}] otherwise // we need both bounds to justify upper bound - TRACE("interval", tout << "before: " << m_lower << " " << m_upper << " " << n << "\n";); + TRACE(interval, tout << "before: " << m_lower << " " << m_upper << " " << n << "\n";); m_lower.expt(n); m_upper.expt(n); - TRACE("interval", tout << "after: " << m_lower << " " << m_upper << "\n";); + TRACE(interval, tout << "after: " << m_lower << " " << m_upper << "\n";); if (m_lower > m_upper || (m_lower == m_upper && !m_lower_open && m_upper_open)) { m_upper = m_lower; m_upper_open = m_lower_open; diff --git a/src/smt/params/smt_params.cpp b/src/smt/params/smt_params.cpp index bfa310866..f54f129c3 100644 --- a/src/smt/params/smt_params.cpp +++ b/src/smt/params/smt_params.cpp @@ -370,7 +370,7 @@ void smt_params::setup_QF_AUFLIA(static_features const& st) { throw default_exception("Benchmark has real variables but it is marked as QF_AUFLIA (arrays, uninterpreted functions and linear integer arithmetic)."); m_nnf_cnf = false; if (st.m_num_clauses == st.m_num_units) { - TRACE("QF_AUFLIA", tout << "using relevancy: 0\n";); + TRACE(QF_AUFLIA, tout << "using relevancy: 0\n";); m_relevancy_lvl = 0; m_phase_selection = PS_ALWAYS_FALSE; } diff --git a/src/smt/proto_model/proto_model.cpp b/src/smt/proto_model/proto_model.cpp index 90214a4be..f3e4f5206 100644 --- a/src/smt/proto_model/proto_model.cpp +++ b/src/smt/proto_model/proto_model.cpp @@ -89,14 +89,14 @@ expr * proto_model::mk_some_interp_for(func_decl * d) { bool proto_model::eval(expr * e, expr_ref & result, bool model_completion) { m_eval.set_model_completion(model_completion); m_eval.set_expand_array_equalities(false); - TRACE("model_evaluator", model_v2_pp(tout, *this, true);); + TRACE(model_evaluator, model_v2_pp(tout, *this, true);); try { m_eval(e, result); return true; } catch (model_evaluator_exception & ex) { (void)ex; - TRACE("model_evaluator", tout << ex.what() << "\n";); + TRACE(model_evaluator, tout << ex.what() << "\n";); return false; } } @@ -128,7 +128,7 @@ void proto_model::cleanup_func_interp(expr_ref_vector& trail, func_interp * fi, } expr* proto_model::cleanup_expr(expr_ref_vector& trail, expr* fi_else, func_decl_set& found_aux_fs) { - TRACE("model_bug", tout << "cleaning up:\n" << mk_pp(fi_else, m) << "\n";); + TRACE(model_bug, tout << "cleaning up:\n" << mk_pp(fi_else, m) << "\n";); trail.reset(); obj_map cache; ptr_buffer todo; @@ -170,7 +170,7 @@ expr* proto_model::cleanup_expr(expr_ref_vector& trail, expr* fi_else, func_decl } func_decl * f = t->get_decl(); if (m_aux_decls.contains(f)) { - TRACE("model_bug", tout << f->get_name() << "\n";); + TRACE(model_bug, tout << f->get_name() << "\n";); found_aux_fs.insert(f); } new_t = m_rewrite.mk_app(f, args.size(), args.data()); @@ -210,7 +210,7 @@ void proto_model::remove_aux_decls_not_in_set(ptr_vector & decls, fun by their interpretations. */ void proto_model::cleanup() { - TRACE("model_bug", model_v2_pp(tout, *this);); + TRACE(model_bug, model_v2_pp(tout, *this);); func_decl_set found_aux_fs; expr_ref_vector trail(m); ptr_buffer finterps; @@ -227,7 +227,7 @@ void proto_model::cleanup() { register_decl(d, r); } } - // TRACE("model_bug", model_v2_pp(tout, *this);); + // TRACE(model_bug, model_v2_pp(tout, *this);); // remove auxiliary declarations that are not used. if (found_aux_fs.size() != m_aux_decls.size()) { remove_aux_decls_not_in_set(m_decls, found_aux_fs); @@ -235,13 +235,13 @@ void proto_model::cleanup() { for (func_decl* faux : m_aux_decls) { if (!found_aux_fs.contains(faux)) { - TRACE("cleanup_bug", tout << "eliminating " << faux->get_name() << " " << faux->get_ref_count() << "\n";); + TRACE(cleanup_bug, tout << "eliminating " << faux->get_name() << " " << faux->get_ref_count() << "\n";); unregister_decl(faux); } } m_aux_decls.swap(found_aux_fs); } - TRACE("model_bug", model_v2_pp(tout, *this);); + TRACE(model_bug, model_v2_pp(tout, *this);); } value_factory * proto_model::get_factory(family_id fid) { @@ -371,7 +371,7 @@ void proto_model::complete_partial_funcs(bool use_fresh) { } model * proto_model::mk_model() { - TRACE("proto_model", model_v2_pp(tout << "mk_model\n", *this);); + TRACE(proto_model, model_v2_pp(tout << "mk_model\n", *this);); model * mdl = alloc(model, m); for (auto const& kv : m_interp) { @@ -388,7 +388,7 @@ model * proto_model::mk_model() { unsigned sz = get_num_uninterpreted_sorts(); for (unsigned i = 0; i < sz; i++) { sort * s = get_uninterpreted_sort(i); - TRACE("proto_model", tout << "copying uninterpreted sorts...\n" << mk_pp(s, m) << "\n";); + TRACE(proto_model, tout << "copying uninterpreted sorts...\n" << mk_pp(s, m) << "\n";); ptr_vector const& buf = get_universe(s); mdl->register_usort(s, buf.size(), buf.data()); } diff --git a/src/smt/qi_queue.cpp b/src/smt/qi_queue.cpp index 006ee398a..b8835e8fe 100644 --- a/src/smt/qi_queue.cpp +++ b/src/smt/qi_queue.cpp @@ -44,7 +44,7 @@ namespace smt { } void qi_queue::setup() { - TRACE("qi_cost", tout << "qi_cost: " << m_params.m_qi_cost << "\n";); + TRACE(qi_cost, tout << "qi_cost: " << m_params.m_qi_cost << "\n";); if (!m_parser.parse_string(m_params.m_qi_cost.c_str(), m_cost_function)) { // it is not reasonable to abort here during the creation of smt::context just because an invalid option was provided. // throw default_exception("invalid cost function %s", m_params.m_qi_cost.c_str()); @@ -113,7 +113,7 @@ namespace smt { m_vals[SCOPE] = static_cast(m_context.get_scope_level()); m_vals[NESTED_QUANTIFIERS] = static_cast(stat->get_num_nested_quantifiers()); m_vals[CS_FACTOR] = static_cast(stat->get_case_split_factor()); - TRACE("qi_queue_detail", for (unsigned i = 0; i < m_vals.size(); i++) { tout << m_vals[i] << " "; } tout << "\n";); + TRACE(qi_queue_detail, for (unsigned i = 0; i < m_vals.size(); i++) { tout << m_vals[i] << " "; } tout << "\n";); return stat; } @@ -136,14 +136,14 @@ namespace smt { void qi_queue::insert(fingerprint * f, app * pat, unsigned generation, unsigned min_top_generation, unsigned max_top_generation) { quantifier * q = static_cast(f->get_data()); float cost = get_cost(q, pat, generation, min_top_generation, max_top_generation); - TRACE("qi_queue_detail", + TRACE(qi_queue_detail, tout << "new instance of " << q->get_qid() << ", weight " << q->get_weight() << ", generation: " << generation << ", scope_level: " << m_context.get_scope_level() << ", cost: " << cost << "\n"; for (unsigned i = 0; i < f->get_num_args(); i++) { tout << "#" << f->get_arg(i)->get_expr_id() << " d:" << f->get_arg(i)->get_expr()->get_depth() << " "; } tout << "\n";); - TRACE("new_entries_bug", tout << "[qi:insert]\n";); + TRACE(new_entries_bug, tout << "[qi:insert]\n";); m_new_entries.push_back(entry(f, cost, generation)); } @@ -166,11 +166,11 @@ namespace smt { } else if (m_params.m_qi_promote_unsat && m_checker.is_unsat(qa->get_expr(), f->get_num_args(), f->get_args())) { // do not delay instances that produce a conflict. - TRACE("qi_unsat", tout << "promoting instance that produces a conflict\n" << mk_pp(qa, m) << "\n";); + TRACE(qi_unsat, tout << "promoting instance that produces a conflict\n" << mk_pp(qa, m) << "\n";); instantiate(curr); } else { - TRACE("qi_queue", tout << "delaying quantifier instantiation... " << f << "\n" << mk_pp(qa, m) << "\ncost: " << curr.m_cost << "\n";); + TRACE(qi_queue, tout << "delaying quantifier instantiation... " << f << "\n" << mk_pp(qa, m) << "\ncost: " << curr.m_cost << "\n";); m_delayed_entries.push_back(curr); } @@ -183,7 +183,7 @@ namespace smt { } } m_new_entries.reset(); - TRACE("new_entries_bug", tout << "[qi:instantiate]\n";); + TRACE(new_entries_bug, tout << "[qi:instantiate]\n";); } void qi_queue::display_instance_profile(fingerprint * f, quantifier * q, unsigned num_bindings, enode * const * bindings, unsigned proof_id, unsigned generation) { @@ -208,22 +208,22 @@ namespace smt { ent.m_instantiated = true; - TRACE("qi_queue_profile", tout << q->get_qid() << ", gen: " << generation << " " << *f << " cost: " << ent.m_cost << "\n";); + TRACE(qi_queue_profile, tout << q->get_qid() << ", gen: " << generation << " " << *f << " cost: " << ent.m_cost << "\n";); q::quantifier_stat * stat = m_qm.get_stat(q); if (m_checker.is_sat(q->get_expr(), num_bindings, bindings)) { - TRACE("checker", tout << "instance already satisfied\n";); + TRACE(checker, tout << "instance already satisfied\n";); // we log the "dummy" instantiations separately from "instance" - STRACE("dummy", tout << "### " << static_cast(f) <<", " << q->get_qid() << "\n";); - STRACE("dummy", tout << "Instance already satisfied (dummy)\n";); + STRACE(dummy, tout << "### " << static_cast(f) <<", " << q->get_qid() << "\n";); + STRACE(dummy, tout << "Instance already satisfied (dummy)\n";); // a dummy instantiation is still an instantiation. // in this way smt.qi.profile=true coincides with the axiom profiler stat->inc_num_instances_checker_sat(); return; } - STRACE("instance", tout << "### " << static_cast(f) <<", " << q->get_qid() << "\n";); + STRACE(instance, tout << "### " << static_cast(f) <<", " << q->get_qid() << "\n";); auto* ebindings = m_subst(q, num_bindings); for (unsigned i = 0; i < num_bindings; ++i) @@ -231,14 +231,14 @@ namespace smt { expr_ref instance = m_subst(); - TRACE("qi_queue", tout << "new instance:\n" << mk_pp(instance, m) << "\n";); + TRACE(qi_queue, tout << "new instance:\n" << mk_pp(instance, m) << "\n";); expr_ref s_instance(m); proof_ref pr(m); m_context.get_rewriter()(instance, s_instance, pr); - TRACE("qi_queue_bug", tout << "new instance after simplification:\n" << s_instance << "\n";); + TRACE(qi_queue_bug, tout << "new instance after simplification:\n" << s_instance << "\n";); if (m.is_true(s_instance)) { - STRACE("instance", tout << "Instance reduced to true\n";); + STRACE(instance, tout << "Instance reduced to true\n";); stat -> inc_num_instances_simplify_true(); if (m.has_trace_stream()) { display_instance_profile(f, q, num_bindings, bindings, pr ? pr->get_id() : 0, generation); @@ -258,7 +258,7 @@ namespace smt { std::cout << instance << "\n"; #endif - TRACE("qi_queue", tout << "simplified instance:\n" << s_instance << "\n";); + TRACE(qi_queue, tout << "simplified instance:\n" << s_instance << "\n";); stat->inc_num_instances(); if (stat->get_num_instances() % m_params.m_qi_profile_freq == 0) { m_qm.display_stats(verbose_stream(), q); @@ -321,7 +321,7 @@ namespace smt { pr1 = m.mk_app(symbol("inst"), args.size(), args.data(), m.mk_proof_sort()); m_instances.push_back(pr1); } - TRACE("qi_queue", tout << mk_pp(lemma, m) << "\n#" << lemma->get_id() << ":=\n" << mk_ll_pp(lemma, m);); + TRACE(qi_queue, tout << mk_pp(lemma, m) << "\n#" << lemma->get_id() << ":=\n" << mk_ll_pp(lemma, m);); m_stats.m_num_instances++; unsigned gen = get_new_gen(q, generation, ent.m_cost); display_instance_profile(f, q, num_bindings, bindings, proof_id, gen); @@ -345,10 +345,10 @@ namespace smt { } } if (true_child && has_unassigned) { - TRACE("qi_queue_profile_detail", tout << "missed:\n" << mk_ll_pp(s_instance, m) << "\n#" << true_child->get_id() << "\n";); + TRACE(qi_queue_profile_detail, tout << "missed:\n" << mk_ll_pp(s_instance, m) << "\n#" << true_child->get_id() << "\n";); num_useless++; if (num_useless % 10 == 0) { - TRACE("qi_queue_profile", tout << "num useless: " << num_useless << "\n";); + TRACE(qi_queue_profile, tout << "num useless: " << num_useless << "\n";); } } } @@ -360,7 +360,7 @@ namespace smt { } void qi_queue::push_scope() { - TRACE("new_entries_bug", tout << "[qi:push-scope]\n";); + TRACE(new_entries_bug, tout << "[qi:push-scope]\n";); m_scopes.push_back(scope()); SASSERT(m_context.inconsistent() || m_new_entries.empty()); scope & s = m_scopes.back(); @@ -381,7 +381,7 @@ namespace smt { m_instances.shrink(s.m_instances_lim); m_new_entries.reset(); m_scopes.shrink(new_lvl); - TRACE("new_entries_bug", tout << "[qi:pop-scope]\n";); + TRACE(new_entries_bug, tout << "[qi:pop-scope]\n";); } void qi_queue::reset() { @@ -397,7 +397,7 @@ namespace smt { } bool qi_queue::final_check_eh() { - TRACE("qi_queue", display_delayed_instances_stats(tout); tout << "lazy threshold: " << m_params.m_qi_lazy_threshold + TRACE(qi_queue, display_delayed_instances_stats(tout); tout << "lazy threshold: " << m_params.m_qi_lazy_threshold << ", scope_level: " << m_context.get_scope_level() << "\n";); if (m_params.m_qi_conservative_final_check) { @@ -406,19 +406,19 @@ namespace smt { unsigned sz = m_delayed_entries.size(); for (unsigned i = 0; i < sz; i++) { entry & e = m_delayed_entries[i]; - TRACE("qi_queue", tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";); + TRACE(qi_queue, tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";); if (!e.m_instantiated && e.m_cost <= m_params.m_qi_lazy_threshold && (!init || e.m_cost < min_cost)) { init = true; min_cost = e.m_cost; } } - TRACE("qi_queue_min_cost", tout << "min_cost: " << min_cost << ", scope_level: " << m_context.get_scope_level() << "\n";); + TRACE(qi_queue_min_cost, tout << "min_cost: " << min_cost << ", scope_level: " << m_context.get_scope_level() << "\n";); bool result = true; for (unsigned i = 0; i < sz; i++) { entry & e = m_delayed_entries[i]; - TRACE("qi_queue", tout << e.m_qb << ", cost: " << e.m_cost << " min-cost: " << min_cost << ", instantiated: " << e.m_instantiated << "\n";); + TRACE(qi_queue, tout << e.m_qb << ", cost: " << e.m_cost << " min-cost: " << min_cost << ", instantiated: " << e.m_instantiated << "\n";); if (!e.m_instantiated && e.m_cost <= min_cost) { - TRACE("qi_queue", + TRACE(qi_queue, tout << "lazy quantifier instantiation...\n" << mk_pp(static_cast(e.m_qb->get_data()), m) << "\ncost: " << e.m_cost << "\n";); result = false; m_instantiated_trail.push_back(i); @@ -432,9 +432,9 @@ namespace smt { bool result = true; for (unsigned i = 0; i < m_delayed_entries.size(); i++) { entry & e = m_delayed_entries[i]; - TRACE("qi_queue", tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";); + TRACE(qi_queue, tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";); if (!e.m_instantiated && e.m_cost <= m_params.m_qi_lazy_threshold) { - TRACE("qi_queue", + TRACE(qi_queue, tout << "lazy quantifier instantiation...\n" << mk_pp(static_cast(e.m_qb->get_data()), m) << "\ncost: " << e.m_cost << "\n";); result = false; m_instantiated_trail.push_back(i); diff --git a/src/smt/seq_eq_solver.cpp b/src/smt/seq_eq_solver.cpp index 7ac82eff7..490c9daf3 100644 --- a/src/smt/seq_eq_solver.cpp +++ b/src/smt/seq_eq_solver.cpp @@ -35,7 +35,7 @@ bool theory_seq::solve_eqs(unsigned i) { ++m_stats.m_num_reductions; change = true; } - TRACE("seq_verbose", display_equations(tout);); + TRACE(seq_verbose, display_equations(tout);); } return change || m_new_propagation || ctx.inconsistent(); } @@ -51,13 +51,13 @@ bool theory_seq::solve_eq(unsigned idx) { if (!canonize(e.ls, ls, dep2, change)) return false; if (!canonize(e.rs, rs, dep2, change)) return false; dependency* deps = m_dm.mk_join(dep2, e.dep()); - TRACE("seq_verbose", + TRACE(seq_verbose, tout << e.ls << " = " << e.rs << " ==> "; tout << ls << " = " << rs << "\n"; display_deps(tout, deps);); if (!ctx.inconsistent() && simplify_eq(ls, rs, deps)) { - TRACE("seq", tout << "simplified\n";); + TRACE(seq, tout << "simplified\n";); return true; } @@ -74,7 +74,7 @@ bool theory_seq::solve_eq(unsigned idx) { return false; } - TRACE("seq_verbose", tout << ls << " = " << rs << "\n";); + TRACE(seq_verbose, tout << ls << " = " << rs << "\n";); if (!ctx.inconsistent() && solve_nth_eq(ls, rs, deps)) { return true; } @@ -83,7 +83,7 @@ bool theory_seq::solve_eq(unsigned idx) { } if (!ctx.inconsistent() && change) { // The propagation step from arithmetic state (e.g. length offset) to length constraints - TRACE("seq", tout << "inserting equality\n";); + TRACE(seq, tout << "inserting equality\n";); m_eqs.set(idx, depeq(m_eq_id++, ls, rs, deps)); } return false; @@ -145,13 +145,13 @@ bool theory_seq::has_len_offset(expr_ref_vector const& ls, expr_ref_vector const enode* root2 = get_root(len_r_fst); if (root1 == root2) { - TRACE("seq", tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << ")\n";); + TRACE(seq, tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << ")\n";); offset = 0; return true; } if (m_offset_eq.find(root1, root2, offset)) { - TRACE("seq", tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << " " << offset << ")\n";); + TRACE(seq, tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << " " << offset << ")\n";); return true; } return false; @@ -191,8 +191,8 @@ bool theory_seq::len_based_split(depeq const& e) { if (!has_len_offset(ls, rs, offset)) return false; - TRACE("seq", tout << "split based on length\n";); - TRACE("seq", display_equation(tout, e);); + TRACE(seq, tout << "split based on length\n";); + TRACE(seq, display_equation(tout, e);); sort* srt = ls[0]->get_sort(); expr_ref x11 = expr_ref(ls[0], m); expr_ref x12 = mk_concat(ls.size()-1, ls.data()+1, srt); @@ -242,22 +242,22 @@ bool theory_seq::len_based_split(depeq const& e) { */ bool theory_seq::branch_variable() { if (branch_ternary_variable()) { - TRACE("seq", tout << "branch_ternary_variable\n";); + TRACE(seq, tout << "branch_ternary_variable\n";); return true; } if (branch_quat_variable()) { - TRACE("seq", tout << "branch_quat_variable\n";); + TRACE(seq, tout << "branch_quat_variable\n";); return true; } bool turn = ctx.get_random_value() % 2 == 0; for (unsigned i = 0; i < 2; ++i, turn = !turn) { if (turn && branch_variable_mb()) { - TRACE("seq", tout << "branch_variable_mb\n";); + TRACE(seq, tout << "branch_variable_mb\n";); return true; } if (!turn && branch_variable_eq()) { - TRACE("seq", tout << "branch_variable_eq\n";); + TRACE(seq, tout << "branch_variable_eq\n";); return true; } } @@ -288,7 +288,7 @@ bool theory_seq::branch_variable_mb() { for (const auto& elem : len1) l1 += elem; for (const auto& elem : len2) l2 += elem; if (l1 == l2 && split_lengths(e.dep(), e.ls, e.rs, len1, len2)) { - TRACE("seq", tout << "split lengths\n";); + TRACE(seq, tout << "split lengths\n";); change = true; break; } @@ -360,11 +360,11 @@ bool theory_seq::split_lengths(dependency* dep, Y = bs.back(); bs.pop_back(); if (!is_var(Y) && !m_util.str.is_unit(Y)) { - TRACE("seq", tout << "TBD: non variable or unit split: " << Y << "\n";); + TRACE(seq, tout << "TBD: non variable or unit split: " << Y << "\n";); return false; } if (X == Y) { - TRACE("seq", tout << "Cycle: " << X << "\n";); + TRACE(seq, tout << "Cycle: " << X << "\n";); return false; } if (lenY.is_zero()) { @@ -408,7 +408,7 @@ bool theory_seq::split_lengths(dependency* dep, SASSERT(is_var(Y)); expr_ref Y1 = m_sk.mk_left(X, b, Y); expr_ref Y2 = m_sk.mk_right(X, b, Y); - TRACE("seq", tout << Y1 << "\n" << Y2 << "\n" << ls << "\n" << rs << "\n";); + TRACE(seq, tout << Y1 << "\n" << Y2 << "\n" << ls << "\n" << rs << "\n";); expr_ref bY1 = mk_concat(b, Y1); expr_ref Y1Y2 = mk_concat(Y1, Y2); propagate_eq(dep, lits, X, bY1, true); @@ -421,7 +421,7 @@ bool theory_seq::split_lengths(dependency* dep, bool theory_seq::branch_binary_variable() { for (auto const& e : m_eqs) { if (branch_binary_variable(e)) { - TRACE("seq", display_equation(tout, e);); + TRACE(seq, display_equation(tout, e);); return true; } } @@ -477,7 +477,7 @@ bool theory_seq::branch_binary_variable(depeq const& e) { // |x| > |ys| => x = ys ++ y1, y = y1 ++ y2, y2 = xs expr_ref Y1 = m_sk.mk_left(x, y); expr_ref Y2 = m_sk.mk_right(x, y); - TRACE("seq", tout << Y1 << "\n" << Y2 << "\n";); + TRACE(seq, tout << Y1 << "\n" << Y2 << "\n";); ys.push_back(Y1); expr_ref ysY1 = mk_concat(ys); expr_ref xsE = mk_concat(xs); @@ -503,7 +503,7 @@ bool theory_seq::branch_unit_variable() { break; } } - CTRACE("seq", result, tout << "branch unit variable\n";); + CTRACE(seq, result, tout << "branch unit variable\n";); return result; } @@ -704,17 +704,17 @@ bool theory_seq::branch_quat_variable(depeq const& e) { if (xs == ys) { literal lit = mk_eq(mk_len(x1), mk_len(y1), false); if (ctx.get_assignment(lit) == l_undef) { - TRACE("seq", tout << mk_pp(x1, m) << " = " << mk_pp(y1, m) << "?\n";); + TRACE(seq, tout << mk_pp(x1, m) << " = " << mk_pp(y1, m) << "?\n";); ctx.mark_as_relevant(lit); return true; } else if (ctx.get_assignment(lit) == l_true) { - TRACE("seq", tout << mk_pp(x1, m) << " = " << mk_pp(y1, m) << "\n";); + TRACE(seq, tout << mk_pp(x1, m) << " = " << mk_pp(y1, m) << "\n";); propagate_eq(dep, lit, x1, y1, true); propagate_eq(dep, lit, x2, y2, true); return true; } - TRACE("seq", tout << mk_pp(x1, m) << " != " << mk_pp(y1, m) << "\n";); + TRACE(seq, tout << mk_pp(x1, m) << " != " << mk_pp(y1, m) << "\n";); lits.push_back(~lit); } @@ -722,19 +722,19 @@ bool theory_seq::branch_quat_variable(depeq const& e) { literal lit2 = m_ax.mk_ge(mk_sub(mk_len(y1), mk_len(x1)), xs.size()); literal lit3 = m_ax.mk_ge(mk_sub(mk_len(x1), mk_len(y1)), ys.size()); if (ctx.get_assignment(lit1) == l_undef) { - TRACE("seq", tout << mk_pp(x1, m) << " <= " << mk_pp(y1, m) << "?\n";); + TRACE(seq, tout << mk_pp(x1, m) << " <= " << mk_pp(y1, m) << "?\n";); ctx.mark_as_relevant(lit1); return true; } if (ctx.get_assignment(lit1) == l_true) { - TRACE("seq", tout << mk_pp(x1, m) << " <= " << mk_pp(y1, m) << "\n";); + TRACE(seq, tout << mk_pp(x1, m) << " <= " << mk_pp(y1, m) << "\n";); if (ctx.get_assignment(lit2) == l_undef) { ctx.mark_as_relevant(lit2); return true; } } else { - TRACE("seq", tout << mk_pp(x1, m) << " >\n" << mk_pp(y1, m) << "\n";); + TRACE(seq, tout << mk_pp(x1, m) << " >\n" << mk_pp(y1, m) << "\n";); if (ctx.get_assignment(lit3) == l_undef) { ctx.mark_as_relevant(lit3); return true; @@ -800,7 +800,7 @@ bool theory_seq::branch_variable_eq() { depeq const& e = m_eqs[k]; if (branch_variable_eq(e)) { - TRACE("seq", tout << "branch variable\n";); + TRACE(seq, tout << "branch variable\n";); return true; } } @@ -810,7 +810,7 @@ bool theory_seq::branch_variable_eq() { bool theory_seq::branch_variable_eq(depeq const& e) { unsigned id = e.id(); unsigned s = find_branch_start(2*id); - TRACE("seq", tout << s << " " << id << ": " << e.ls << " = " << e.rs << "\n";); + TRACE(seq, tout << s << " " << id << ": " << e.ls << " = " << e.rs << "\n";); bool found = find_branch_candidate(s, e.dep(), e.ls, e.rs); insert_branch_start(2*id, s); if (!found) { @@ -844,13 +844,13 @@ bool theory_seq::find_branch_candidate(unsigned& start, dependency* dep, expr_re return false; } - TRACE("seq", tout << mk_pp(l, m) << ": " << ctx.get_scope_level() << " - start:" << start << "\n";); + TRACE(seq, tout << mk_pp(l, m) << ": " << ctx.get_scope_level() << " - start:" << start << "\n";); expr_ref v0(m); v0 = m_util.str.mk_empty(l->get_sort()); if (can_be_equal(ls.size() - 1, ls.data() + 1, rs.size(), rs.data())) { if (assume_equality(l, v0)) { - TRACE("seq", tout << mk_pp(l, m) << " " << v0 << "\n";); + TRACE(seq, tout << mk_pp(l, m) << " " << v0 << "\n";); return true; } } @@ -866,7 +866,7 @@ bool theory_seq::find_branch_candidate(unsigned& start, dependency* dep, expr_re } v0 = mk_concat(j + 1, rs.data()); if (assume_equality(l, v0)) { - TRACE("seq", tout << mk_pp(l, m) << " " << v0 << "\n";); + TRACE(seq, tout << mk_pp(l, m) << " " << v0 << "\n";); ++start; return true; } @@ -893,7 +893,7 @@ bool theory_seq::find_branch_candidate(unsigned& start, dependency* dep, expr_re } } set_conflict(dep, lits); - TRACE("seq", + TRACE(seq, tout << "start: " << start << "\n"; for (literal lit : lits) { ctx.display_literal_verbose(tout << lit << ": ", lit) << "\n"; @@ -946,21 +946,21 @@ bool theory_seq::assume_equality(expr* l, expr* r) { enode* n1 = ensure_enode(l); enode* n2 = ensure_enode(r); if (n1->get_root() == n2->get_root()) { - TRACE("seq", tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " roots eq\n";); + TRACE(seq, tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " roots eq\n";); return false; } if (ctx.is_diseq(n1, n2)) { - TRACE("seq", tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " is_diseq\n";); + TRACE(seq, tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " is_diseq\n";); return false; } ctx.mark_as_relevant(n1); ctx.mark_as_relevant(n2); if (!ctx.assume_eq(n1, n2)) { - TRACE("seq", tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " can't assume\n";); + TRACE(seq, tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " can't assume\n";); return false; } lbool res = ctx.get_assignment(mk_eq(l, r, false)); - TRACE("seq", tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " literal assigned " << res << "\n";); + TRACE(seq, tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " literal assigned " << res << "\n";); return res != l_false; } @@ -975,7 +975,7 @@ bool theory_seq::propagate_length_coherence(expr* e) { if (!lower_bound2(e, lo) || !lo.is_pos() || lo >= rational(2048)) { return false; } - TRACE("seq", tout << "Unsolved " << mk_pp(e, m); + TRACE(seq, tout << "Unsolved " << mk_pp(e, m); if (!lower_bound2(e, lo)) lo = -rational::one(); if (!upper_bound(mk_len(e), hi)) hi = -rational::one(); tout << " lo: " << lo << " hi: " << hi << "\n"; @@ -1097,7 +1097,7 @@ bool theory_seq::reduce_length_eq() { for (unsigned i = 0; !ctx.inconsistent() && i < m_eqs.size(); ++i) { depeq const& e = m_eqs[(i + start) % m_eqs.size()]; if (reduce_length_eq(e.ls, e.rs, e.dep())) { - TRACE("seq", tout << "reduce length eq\n";); + TRACE(seq, tout << "reduce length eq\n";); return true; } } @@ -1159,7 +1159,7 @@ bool theory_seq::solve_nth_eq(expr_ref_vector const& ls, expr_ref_vector const& if (!idx_is_zero) rs1.push_back(m_sk.mk_pre(s, idx)); rs1.push_back(m_util.str.mk_unit(rhs)); rs1.push_back(m_sk.mk_post(s, idx1)); - TRACE("seq", tout << ls1 << "\n"; tout << rs1 << "\n";); + TRACE(seq, tout << ls1 << "\n"; tout << rs1 << "\n";); m_eqs.push_back(depeq(m_eq_id++, ls1, rs1, deps)); return true; } @@ -1229,7 +1229,7 @@ bool theory_seq::find_better_rep(expr_ref_vector const& ls, expr_ref_vector cons // Offset = 0, No change if (l_fst && get_root(len_l_fst) == root2) { - TRACE("seq", tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst, m) << ")\n";); + TRACE(seq, tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst, m) << ")\n";); return false; } @@ -1252,7 +1252,7 @@ bool theory_seq::find_better_rep(expr_ref_vector const& ls, expr_ref_vector cons if (l_fst && ctx.e_internalized(len_l_fst)) { enode * root1 = get_root(len_l_fst); if (m_offset_eq.contains(root1, root2)) { - TRACE("seq", tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << ")\n";); + TRACE(seq, tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << ")\n";); return false; } } diff --git a/src/smt/seq_ne_solver.cpp b/src/smt/seq_ne_solver.cpp index 7dfe7d208..4afabb896 100644 --- a/src/smt/seq_ne_solver.cpp +++ b/src/smt/seq_ne_solver.cpp @@ -36,7 +36,7 @@ bool theory_seq::solve_nqs(unsigned i) { bool theory_seq::solve_ne(unsigned idx) { - TRACE("seq", display_disequation(tout << "solve: ", m_nqs[idx]);); + TRACE(seq, display_disequation(tout << "solve: ", m_nqs[idx]);); unsigned num_undef_lits = 0; return (!check_ne_literals(idx, num_undef_lits)) @@ -50,7 +50,7 @@ bool theory_seq::check_ne_literals(unsigned idx, unsigned& num_undef_lits) { for (literal lit : n.lits()) { switch (ctx.get_assignment(lit)) { case l_false: - TRACE("seq", display_disequation(tout << "has false literal\n", n); + TRACE(seq, display_disequation(tout << "has false literal\n", n); ctx.display_literal_verbose(tout, lit); tout << "\n" << lit << " " << ctx.is_relevant(lit) << "\n"; display(tout); @@ -101,13 +101,13 @@ bool theory_seq::propagate_ne2lit(unsigned idx) { lits.reset(); lits.push_back(~diseq); dep = dep1; - TRACE("seq", tout << "conflict explained\n";); + TRACE(seq, tout << "conflict explained\n";); } } set_conflict(dep, lits); } else { - TRACE("seq", tout << "propagate: " << undef_lit << "\n";); + TRACE(seq, tout << "propagate: " << undef_lit << "\n";); propagate_lit(n.dep(), lits.size(), lits.data(), ~undef_lit); } return true; @@ -167,7 +167,7 @@ bool theory_seq::reduce_ne(unsigned idx) { new_deps = m_dm.mk_join(deps, new_deps); bool is_sat = m_seq_rewrite.reduce_eq(ls, rs, eqs, change); - TRACE("seq", display_disequation(tout << "reduced\n", n); + TRACE(seq, display_disequation(tout << "reduced\n", n); tout << p.first << " -> " << ls << "\n"; tout << p.second << " -> " << rs << "\n"; tout << eqs << "\n"; @@ -178,7 +178,7 @@ bool theory_seq::reduce_ne(unsigned idx) { } if (!change) { - TRACE("seq", tout << "no change " << p.first << " " << p.second << "\n";); + TRACE(seq, tout << "no change " << p.first << " " << p.second << "\n";); if (updated) { new_eqs.push_back(p); } @@ -194,7 +194,7 @@ bool theory_seq::reduce_ne(unsigned idx) { if (!ls.empty() || !rs.empty()) { new_eqs.push_back(decomposed_eq(ls, rs)); } - TRACE("seq", + TRACE(seq, tout << "num eqs: " << eqs.size() << "\n"; tout << "num new eqs: " << new_eqs.size() << "\n"; tout << eqs << "\n"; @@ -229,9 +229,9 @@ bool theory_seq::reduce_ne(unsigned idx) { } if (updated) { - TRACE("seq", display_disequation(tout, n);); + TRACE(seq, display_disequation(tout, n);); m_nqs.set(idx, ne(n.l(), n.r(), new_eqs, new_lits, new_deps)); - TRACE("seq", display_disequation(tout << "updated:\n", m_nqs[idx]);); + TRACE(seq, display_disequation(tout << "updated:\n", m_nqs[idx]);); } return false; } @@ -275,7 +275,7 @@ lbool theory_seq::branch_nq(ne const& n) { ctx.mark_as_relevant(eq_len); switch (ctx.get_assignment(eq_len)) { case l_false: - TRACE("seq", + TRACE(seq, display_disequation(tout, n); ctx.display_literal_smt2(tout << "lengths are different: ", eq_len) << "\n";); return l_true; @@ -304,7 +304,7 @@ lbool theory_seq::branch_nq(ne const& n) { ctx.mark_as_relevant(eq_head); switch (ctx.get_assignment(eq_head)) { case l_false: - TRACE("seq", ctx.display_literal_smt2(tout << "heads are different: ", eq_head) << "\n";); + TRACE(seq, ctx.display_literal_smt2(tout << "heads are different: ", eq_head) << "\n";); return l_true; case l_undef: return l_undef; diff --git a/src/smt/seq_offset_eq.cpp b/src/smt/seq_offset_eq.cpp index a1f3426b8..893c455d9 100644 --- a/src/smt/seq_offset_eq.cpp +++ b/src/smt/seq_offset_eq.cpp @@ -55,7 +55,7 @@ void seq_offset_eq::len_offset(expr* e, int val) { if (match_x_minus_y(e, x, y) && ctx.e_internalized(x) && ctx.e_internalized(y)) { - TRACE("seq", tout << "eqc: " << mk_pp(e, m) << "\n";); + TRACE(seq, tout << "eqc: " << mk_pp(e, m) << "\n";); enode* r1 = th.get_root(x); enode* r2 = th.get_root(y); for (enode* n1 : *r1) { @@ -71,7 +71,7 @@ void seq_offset_eq::len_offset(expr* e, int val) { m_offset_equalities.insert(r1, r2, val); m_has_offset_equality.insert(r1); m_has_offset_equality.insert(r2); - TRACE("seq", tout << "a length pair: " << mk_pp(e1, m) << ", " << mk_pp(e2, m) << "\n";); + TRACE(seq, tout << "a length pair: " << mk_pp(e1, m) << ", " << mk_pp(e2, m) << "\n";); return; } return; @@ -84,7 +84,7 @@ void seq_offset_eq::prop_arith_to_len_offset() { rational val; for (enode* n : th.get_context().enodes()) { if (a.is_numeral(n->get_expr(), val) && val.is_int32() && INT_MIN < val.get_int32()) { - TRACE("seq", tout << "offset: " << mk_pp(n->get_expr(), m) << "\n";); + TRACE(seq, tout << "offset: " << mk_pp(n->get_expr(), m) << "\n";); enode *next = n->get_next(); while (next != n) { len_offset(next->get_expr(), val.get_int32()); diff --git a/src/smt/seq_regex.cpp b/src/smt/seq_regex.cpp index 55c3d7edd..64487a21e 100644 --- a/src/smt/seq_regex.cpp +++ b/src/smt/seq_regex.cpp @@ -95,8 +95,8 @@ namespace smt { expr* e = ctx.bool_var2expr(lit.var()); VERIFY(str().is_in_re(e, s, r)); - TRACE("seq_regex", tout << "propagate in RE: " << lit.sign() << " " << mk_pp(e, m) << std::endl;); - STRACE("seq_regex_brief", tout << "PIR(" << mk_pp(s, m) << "," + TRACE(seq_regex, tout << "propagate in RE: " << lit.sign() << " " << mk_pp(e, m) << std::endl;); + STRACE(seq_regex_brief, tout << "PIR(" << mk_pp(s, m) << "," << state_str(r) << ") ";); // convert negative negative membership literals to positive @@ -114,16 +114,16 @@ namespace smt { } if (coallesce_in_re(lit)) { - TRACE("seq_regex", tout + TRACE(seq_regex, tout << "simplified conjunctions to an intersection" << std::endl;); - STRACE("seq_regex_brief", tout << "coallesce_in_re ";); + STRACE(seq_regex_brief, tout << "coallesce_in_re ";); return; } if (is_string_equality(lit)) { - TRACE("seq_regex", tout + TRACE(seq_regex, tout << "simplified regex using string equality" << std::endl;); - STRACE("seq_regex_brief", tout << "string_eq ";); + STRACE(seq_regex_brief, tout << "string_eq ";); return; } @@ -139,10 +139,10 @@ namespace smt { if (!re().is_full_seq(s_approx)) { r = re().mk_inter(r, s_approx); _r_temp_owner = r; - TRACE("seq_regex", tout + TRACE(seq_regex, tout << "get_overapprox_regex(" << mk_pp(s, m) << ") = " << mk_pp(s_approx, m) << std::endl;); - STRACE("seq_regex_brief", tout + STRACE(seq_regex_brief, tout << "overapprox=" << state_str(r) << " ";); } } @@ -151,7 +151,7 @@ namespace smt { expr_ref acc(sk().mk_accept(s, zero, r), m); literal acc_lit = th.mk_literal(acc); - TRACE("seq", tout << "propagate " << acc << "\n";); + TRACE(seq, tout << "propagate " << acc << "\n";); //th.propagate_lit(nullptr, 1, &lit, acc_lit); th.add_axiom(~lit, acc_lit); @@ -211,7 +211,7 @@ namespace smt { //if the minlength of the regex is UINT_MAX then the regex is a deadend if (re().is_empty(r) || info.min_length == UINT_MAX) { - STRACE("seq_regex_brief", tout << "(empty) ";); + STRACE(seq_regex_brief, tout << "(empty) ";); th.add_axiom(~lit); return true; } @@ -219,7 +219,7 @@ namespace smt { if (info.interpreted) { update_state_graph(r); if (m_state_graph.is_dead(get_state_id(r))) { - STRACE("seq_regex_brief", tout << "(dead) ";); + STRACE(seq_regex_brief, tout << "(dead) ";); th.add_axiom(~lit); return true; } @@ -258,9 +258,9 @@ namespace smt { unsigned idx = 0; VERIFY(sk().is_accept(e, s, i, idx, r)); - TRACE("seq_regex", tout << "propagate accept: " + TRACE(seq_regex, tout << "propagate accept: " << mk_pp(e, m) << std::endl;); - STRACE("seq_regex_brief", tout << std::endl + STRACE(seq_regex_brief, tout << std::endl << "PA(" << mk_pp(s, m) << "@" << idx << "," << state_str(r) << ") ";); @@ -268,11 +268,11 @@ namespace smt { return; if (block_unfolding(lit, idx)) { - STRACE("seq_regex_brief", tout << "(blocked) ";); + STRACE(seq_regex_brief, tout << "(blocked) ";); return; } - STRACE("seq_regex_brief", tout << "(unfold) ";); + STRACE(seq_regex_brief, tout << "(unfold) ";); // Rule 1: use min_length to prune search unsigned min_len = re().min_length(r); @@ -287,10 +287,10 @@ namespace smt { if (min_len == 0) { expr_ref is_nullable = is_nullable_wrapper(r); if (m.is_false(is_nullable)) { - STRACE("seq_regex", tout + STRACE(seq_regex, tout << "Warning: min_length returned 0 for non-nullable regex" << std::endl;); - STRACE("seq_regex_brief", tout + STRACE(seq_regex_brief, tout << " (Warning: min_length returned 0 for" << " non-nullable regex)";); // since nullable(r) = false: @@ -299,10 +299,10 @@ namespace smt { } else if (!m.is_true(is_nullable)) { // is_nullable did not simplify - STRACE("seq_regex", tout + STRACE(seq_regex, tout << "Warning: is_nullable did not simplify to true or false" << std::endl;); - STRACE("seq_regex_brief", tout + STRACE(seq_regex_brief, tout << " (Warning: is_nullable did not simplify)";); literal is_nullable_lit = th.mk_literal(is_nullable); ctx.mark_as_relevant(is_nullable_lit); @@ -319,7 +319,7 @@ namespace smt { expr_ref s_i = th.mk_nth(s, i); expr_ref deriv(m); deriv = mk_derivative_wrapper(s_i, r); - STRACE("seq_regex", tout + STRACE(seq_regex, tout << "mk_derivative_wrapper: " << re().to_str(deriv) << std::endl;); expr_ref accept_deriv(m); accept_deriv = mk_deriv_accept(s, idx + 1, deriv); @@ -415,14 +415,14 @@ namespace smt { and derivative calls. */ expr_ref seq_regex::is_nullable_wrapper(expr* r) { - STRACE("seq_regex", tout << "nullable: " << mk_pp(r, m) << std::endl;); + STRACE(seq_regex, tout << "nullable: " << mk_pp(r, m) << std::endl;); expr_ref result = seq_rw().is_nullable(r); //TODO: rewrite seems unnecessary here rewrite(result); - STRACE("seq_regex", tout << "nullable result: " << mk_pp(result, m) << std::endl;); - STRACE("seq_regex_brief", tout << "n(" << state_str(r) << ")=" + STRACE(seq_regex, tout << "nullable result: " << mk_pp(result, m) << std::endl;); + STRACE(seq_regex_brief, tout << "n(" << state_str(r) << ")=" << mk_pp(result, m) << " ";); return result; @@ -433,7 +433,7 @@ namespace smt { This will create a cached entry for the generic derivative of r that is independent of ele. */ expr_ref seq_regex::mk_derivative_wrapper(expr* ele, expr* r) { - STRACE("seq_regex", tout << "derivative(" << mk_pp(ele, m) << "): " << mk_pp(r, m) << std::endl;); + STRACE(seq_regex, tout << "derivative(" << mk_pp(ele, m) << "): " << mk_pp(r, m) << std::endl;); // Uses canonical variable (:var 0) for the derivative element // Substitute (:var 0) with the actual element @@ -441,8 +441,8 @@ namespace smt { var_subst subst(m); der = subst(der, ele); - STRACE("seq_regex", tout << "derivative result: " << mk_pp(der, m) << std::endl;); - STRACE("seq_regex_brief", tout << "d(" << state_str(r) << ")=" + STRACE(seq_regex, tout << "derivative result: " << mk_pp(der, m) << std::endl;); + STRACE(seq_regex_brief, tout << "d(" << state_str(r) << ")=" << state_str(der) << " ";); //TODO: simplify der further, if ele implies further simplifications @@ -451,8 +451,8 @@ namespace smt { } void seq_regex::propagate_eq(expr* r1, expr* r2) { - TRACE("seq_regex", tout << "propagate EQ: " << mk_pp(r1, m) << ", " << mk_pp(r2, m) << std::endl;); - STRACE("seq_regex_brief", tout << "PEQ ";); + TRACE(seq_regex, tout << "propagate EQ: " << mk_pp(r1, m) << ", " << mk_pp(r2, m) << std::endl;); + STRACE(seq_regex_brief, tout << "PEQ ";); sort* seq_sort = nullptr; VERIFY(u().is_re(r1, seq_sort)); @@ -473,8 +473,8 @@ namespace smt { } void seq_regex::propagate_ne(expr* r1, expr* r2) { - TRACE("seq_regex", tout << "propagate NEQ: " << mk_pp(r1, m) << ", " << mk_pp(r2, m) << std::endl;); - STRACE("seq_regex_brief", tout << "PNEQ ";); + TRACE(seq_regex, tout << "propagate NEQ: " << mk_pp(r1, m) << ", " << mk_pp(r2, m) << std::endl;); + STRACE(seq_regex_brief, tout << "PNEQ ";); sort* seq_sort = nullptr; VERIFY(u().is_re(r1, seq_sort)); expr_ref r = symmetric_diff(r1, r2); @@ -509,8 +509,8 @@ namespace smt { return; - TRACE("seq_regex", tout << "propagate nonempty: " << mk_pp(e, m) << std::endl;); - STRACE("seq_regex_brief", tout + TRACE(seq_regex, tout << "propagate nonempty: " << mk_pp(e, m) << std::endl;); + STRACE(seq_regex_brief, tout << std::endl << "PNE(" << expr_id_str(e) << "," << state_str(r) << "," << expr_id_str(u) << "," << expr_id_str(n) << ") ";); @@ -577,7 +577,7 @@ namespace smt { expr* econd = nullptr, *e1 = nullptr, *e2 = nullptr; if (!re_to_accept.contains(e)) { // First visit: add children - STRACE("seq_regex_verbose", tout << "1";); + STRACE(seq_regex_verbose, tout << "1";); if (m.is_ite(e, econd, e1, e2) || re().is_union(e, e1, e2)) { to_visit.push_back(e1); @@ -588,7 +588,7 @@ namespace smt { } else if (re_to_accept.find(e) == nullptr) { // Second visit: set value - STRACE("seq_regex_verbose", tout << "2";); + STRACE(seq_regex_verbose, tout << "2";); to_visit.pop_back(); if (m.is_ite(e, econd, e1, e2)) { expr* b1 = re_to_accept.find(e1); @@ -619,13 +619,13 @@ namespace smt { _temp_bool_owner.push_back(acc_leaf); re_to_accept.find(e) = acc_leaf; - STRACE("seq_regex_verbose", tout + STRACE(seq_regex_verbose, tout << "mk_deriv_accept: added accept leaf: " << mk_pp(acc_leaf, m) << std::endl;); } } else { - STRACE("seq_regex_verbose", tout << "3";); + STRACE(seq_regex_verbose, tout << "3";); // Remaining visits: skip to_visit.pop_back(); } @@ -734,8 +734,8 @@ namespace smt { VERIFY(sk().is_is_empty(e, r, u, n)); expr_ref is_nullable = is_nullable_wrapper(r); - TRACE("seq_regex", tout << "propagate empty: " << mk_pp(e, m) << std::endl;); - STRACE("seq_regex_brief", tout + TRACE(seq_regex, tout << "propagate empty: " << mk_pp(e, m) << std::endl;); + STRACE(seq_regex_brief, tout << std::endl << "PE(" << expr_id_str(e) << "," << state_str(r) << "," << expr_id_str(u) << "," << expr_id_str(n) << ") ";); @@ -787,9 +787,9 @@ namespace smt { m_state_to_expr.push_back(e); unsigned new_id = m_state_to_expr.size(); m_expr_to_state.insert(e, new_id); - STRACE("seq_regex_brief", tout << "new(" << expr_id_str(e) + STRACE(seq_regex_brief, tout << "new(" << expr_id_str(e) << ")=" << state_str(e) << " ";); - STRACE("seq_regex", tout + STRACE(seq_regex, tout << "New state ID: " << new_id << " = " << mk_pp(e, m) << std::endl;); SASSERT(get_expr_from_id(new_id) == e); @@ -820,21 +820,21 @@ namespace smt { unsigned r_id = get_state_id(r); if (m_state_graph.is_done(r_id)) return false; if (m_state_graph.get_size() >= m_max_state_graph_size) { - STRACE("seq_regex", tout << "Warning: ignored state graph update -- max size of seen states reached!" << std::endl;); - STRACE("seq_regex_brief", tout << "(MAX SIZE REACHED) ";); + STRACE(seq_regex, tout << "Warning: ignored state graph update -- max size of seen states reached!" << std::endl;); + STRACE(seq_regex_brief, tout << "(MAX SIZE REACHED) ";); return false; } - STRACE("seq_regex", tout << "Updating state graph for regex " + STRACE(seq_regex, tout << "Updating state graph for regex " << mk_pp(r, m) << ") ";); - STRACE("state_graph", + STRACE(state_graph, if (!m_state_graph.is_seen(r_id)) tout << std::endl << "state(" << r_id << ") = " << re().to_str(r) << std::endl << "info(" << r_id << ") = " << re().get_info(r) << std::endl;); // Add state m_state_graph.add_state(r_id); - STRACE("seq_regex", tout << "Updating state graph for regex " + STRACE(seq_regex, tout << "Updating state graph for regex " << mk_pp(r, m) << ") " << std::endl;); - STRACE("seq_regex_brief", tout << std::endl << "USG(" + STRACE(seq_regex_brief, tout << std::endl << "USG(" << state_str(r) << ") ";); expr_ref r_nullable = is_nullable_wrapper(r); if (m.is_true(r_nullable)) { @@ -843,14 +843,14 @@ namespace smt { else { // Add edges to all derivatives expr_ref_vector derivatives(m); - STRACE("seq_regex_verbose", tout + STRACE(seq_regex_verbose, tout << "getting all derivs: " << r_id << " " << std::endl;); get_derivative_targets(r, derivatives); for (auto const& dr: derivatives) { unsigned dr_id = get_state_id(dr); - STRACE("seq_regex_verbose", tout + STRACE(seq_regex_verbose, tout << std::endl << " traversing deriv: " << dr_id << " ";); - STRACE("state_graph", + STRACE(state_graph, if (!m_state_graph.is_seen(dr_id)) tout << "state(" << dr_id << ") = " << re().to_str(dr) << std::endl << "info(" << dr_id << ") = " << re().get_info(dr) << std::endl;); // Add state @@ -861,9 +861,9 @@ namespace smt { m_state_graph.mark_done(r_id); } - STRACE("seq_regex", m_state_graph.display(tout);); - STRACE("seq_regex_brief", tout << std::endl;); - STRACE("seq_regex_brief", m_state_graph.display(tout);); + STRACE(seq_regex, m_state_graph.display(tout);); + STRACE(seq_regex_brief, tout << std::endl;); + STRACE(seq_regex_brief, m_state_graph.display(tout);); return true; } diff --git a/src/smt/smt_arith_value.cpp b/src/smt/smt_arith_value.cpp index a05c05bbf..068f401a0 100644 --- a/src/smt/smt_arith_value.cpp +++ b/src/smt/smt_arith_value.cpp @@ -53,7 +53,7 @@ namespace smt { next = next->get_next(); } while (n != next); - CTRACE("arith_value", !found, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); + CTRACE(arith_value, !found, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); return found; } @@ -73,7 +73,7 @@ namespace smt { next = next->get_next(); } while (n != next); - CTRACE("arith_value", !found, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); + CTRACE(arith_value, !found, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); return found; } @@ -85,7 +85,7 @@ namespace smt { if (m_tha) return m_tha->get_upper(n, up, is_strict); if (m_thi) return m_thi->get_upper(n, up, is_strict); if (m_thr) return m_thr->get_upper(n, up, is_strict); - TRACE("arith_value", tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); + TRACE(arith_value, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); return false; } @@ -97,7 +97,7 @@ namespace smt { if (m_tha) return m_tha->get_lower(n, up, is_strict); if (m_thi) return m_thi->get_lower(n, up, is_strict); if (m_thr) return m_thr->get_lower(n, up, is_strict); - TRACE("arith_value", tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); + TRACE(arith_value, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); return false; } @@ -109,7 +109,7 @@ namespace smt { if (m_tha && m_tha->get_value(n, _val) && a.is_numeral(_val, val)) return true; if (m_thi && m_thi->get_value(n, _val) && a.is_numeral(_val, val)) return true; if (m_thr && m_thr->get_value(n, val)) return true; - TRACE("arith_value", tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); + TRACE(arith_value, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); return false; } @@ -126,7 +126,7 @@ namespace smt { next = next->get_next(); } while (next != n); - TRACE("arith_value", tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); + TRACE(arith_value, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";); return false; } diff --git a/src/smt/smt_case_split_queue.cpp b/src/smt/smt_case_split_queue.cpp index 711e3de3a..73f1cda55 100644 --- a/src/smt/smt_case_split_queue.cpp +++ b/src/smt/smt_case_split_queue.cpp @@ -122,7 +122,7 @@ namespace { if (m_context.get_random_value() < static_cast(m_params.m_random_var_freq * random_gen::max_value())) { next = m_context.get_random_value() % m_context.get_num_b_internalized(); - TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";); + TRACE(random_split, tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";); if (m_context.get_assignment(next) == l_undef) return; } @@ -401,7 +401,7 @@ namespace { s.m_head_old = m_head; s.m_queue2_trail = m_queue2.size(); s.m_head2_old = m_head2; - TRACE("case_split", tout << "head: " << m_head << "\n";); + TRACE(case_split, tout << "head: " << m_head << "\n";); } void pop_scope(unsigned num_scopes) override { @@ -414,7 +414,7 @@ namespace { m_head2 = s.m_head2_old; m_scopes.shrink(new_lvl); SASSERT(m_head <= m_queue.size()); - TRACE("case_split", display(tout); tout << "head: " << m_head << "\n";); + TRACE(case_split, display(tout); tout << "head: " << m_head << "\n";); } void next_case_split_core(ptr_vector & queue, unsigned & head, bool_var & next, lbool & phase) { @@ -441,19 +441,19 @@ namespace { if (m_manager.has_trace_stream()) { m_manager.trace_stream() << "[decide-and-or] #" << curr->get_id() << " #" << undef_child->get_id() << "\n"; } - TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";); + TRACE(case_split, tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";); literal l = m_context.get_literal(undef_child); next = l.var(); phase = l.sign() ? l_false : l_true; - TRACE("case_split", display(tout);); + TRACE(case_split, display(tout);); return; } } else if (val == l_undef) { SASSERT(intern && m_context.get_bool_var(curr) == next); - TRACE("case_split", tout << "found candidate: #" << curr->get_id() << "\n";); + TRACE(case_split, tout << "found candidate: #" << curr->get_id() << "\n";); phase = l_undef; - TRACE("case_split", display(tout);); + TRACE(case_split, display(tout);); return; } } @@ -597,7 +597,7 @@ namespace { scope & s = m_scopes.back(); s.m_queue_trail = m_queue.size(); s.m_head_old = m_head; - TRACE("case_split", tout << "head: " << m_head << "\n";); + TRACE(case_split, tout << "head: " << m_head << "\n";); } void pop_scope(unsigned num_scopes) override { @@ -608,7 +608,7 @@ namespace { m_head = s.m_head_old; m_scopes.shrink(new_lvl); SASSERT(m_head <= m_queue.size()); - TRACE("case_split", display(tout); tout << "head: " << m_head << "\n";); + TRACE(case_split, display(tout); tout << "head: " << m_head << "\n";); } void next_case_split_core(bool_var & next, lbool & phase) { @@ -632,19 +632,19 @@ namespace { if ((is_or && val == l_true) || (is_and && val == l_false)) { expr * undef_child = nullptr; if (!has_child_assigned_to(m_context, to_app(curr), val, undef_child, m_params.m_rel_case_split_order)) { - TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";); + TRACE(case_split, tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";); literal l = m_context.get_literal(undef_child); next = l.var(); phase = l.sign() ? l_false : l_true; - TRACE("case_split", display(tout);); + TRACE(case_split, display(tout);); return; } } else if (val == l_undef) { SASSERT(intern && m_context.get_bool_var(curr) == next); - TRACE("case_split", tout << "found candidate: #" << curr->get_id() << "\n";); + TRACE(case_split, tout << "found candidate: #" << curr->get_id() << "\n";); phase = l_undef; - TRACE("case_split", display(tout);); + TRACE(case_split, display(tout);); return; } } @@ -654,7 +654,7 @@ namespace { void next_case_split(bool_var & next, lbool & phase) override { if (m_context.get_random_value() < static_cast(0.02 * random_gen::max_value())) { next = m_context.get_random_value() % m_context.get_num_b_internalized(); - TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";); + TRACE(random_split, tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";); if (m_context.get_assignment(next) == l_undef) return; } @@ -844,7 +844,7 @@ namespace { s.m_queue2_trail = m_queue2.size(); s.m_generation = m_current_generation; s.m_goal = m_current_goal; - TRACE("case_split", tout << "head: " << m_head << "\n";); + TRACE(case_split, tout << "head: " << m_head << "\n";); } void pop_scope(unsigned num_scopes) override { @@ -857,7 +857,7 @@ namespace { m_current_goal = s.m_goal; for (unsigned i = s.m_queue2_trail; i < m_queue2.size(); i++) { - //TRACE("case_split", tout << "ld[" << i << "] = " << m_queue2[i].m_last_decided << " cont " << + //TRACE(case_split, tout << "ld[" << i << "] = " << m_queue2[i].m_last_decided << " cont " << SASSERT((m_queue2[i].m_last_decided == -1) == m_priority_queue2.contains(i)); if (m_priority_queue2.contains(i)) m_priority_queue2.erase(i); @@ -877,7 +877,7 @@ namespace { m_queue2.shrink(s.m_queue2_trail); m_scopes.shrink(new_lvl); SASSERT(m_head <= m_queue.size()); - TRACE("case_split", display(tout); tout << "head: " << m_head << "\n";); + TRACE(case_split, display(tout); tout << "head: " << m_head << "\n";); } void next_case_split_core(expr * curr, bool_var & next, lbool & phase) { @@ -900,19 +900,19 @@ namespace { if (m_manager.has_trace_stream()) { m_manager.trace_stream() << "[decide-and-or] #" << curr->get_id() << " #" << undef_child->get_id() << "\n"; } - TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";); + TRACE(case_split, tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";); literal l = m_context.get_literal(undef_child); next = l.var(); phase = l.sign() ? l_false : l_true; - TRACE("case_split", display(tout);); + TRACE(case_split, display(tout);); return; } } else if (val == l_undef) { SASSERT(intern && m_context.get_bool_var(curr) == next); - TRACE("case_split", tout << "found candidate: #" << curr->get_id() << "\n";); + TRACE(case_split, tout << "found candidate: #" << curr->get_id() << "\n";); phase = l_undef; - TRACE("case_split", display(tout);); + TRACE(case_split, display(tout);); return; } next = null_bool_var; @@ -932,7 +932,7 @@ namespace { while (!m_priority_queue2.empty()) { unsigned idx = static_cast(m_priority_queue2.erase_min()); - TRACE("case_split", tout << "q " << m_queue2.size() << " idx " << idx << "\n"; ); + TRACE(case_split, tout << "q " << m_queue2.size() << " idx " << idx << "\n"; ); SASSERT(idx < m_queue2.size()); queue_entry & e = m_queue2[idx]; SASSERT(e.m_last_decided == -1); @@ -989,7 +989,7 @@ namespace { if (!m_manager.is_label_lit(lablit)) return; - TRACE("case_split", tout << "Found goal\n" << mk_pp(e, m_manager) << "\n"; ); + TRACE(case_split, tout << "Found goal\n" << mk_pp(e, m_manager) << "\n"; ); set_goal(e); } @@ -1189,7 +1189,7 @@ namespace { if (m_context.get_random_value() < threshold) { SASSERT(m_context.get_num_b_internalized() > 0); next = m_context.get_random_value() % m_context.get_num_b_internalized(); - TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";); + TRACE(random_split, tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";); if (m_context.get_assignment(next) == l_undef) return; } @@ -1209,7 +1209,7 @@ namespace { } void add_theory_aware_branching_info(bool_var v, double priority, lbool phase) override { - TRACE("theory_aware_branching", tout << "Add theory-aware branching information for l#" << v << ": priority=" << priority << std::endl;); + TRACE(theory_aware_branching, tout << "Add theory-aware branching information for l#" << v << ": priority=" << priority << std::endl;); m_theory_vars.insert(v); m_theory_var_phase.insert(v, phase); m_theory_var_priority.insert(v, priority); diff --git a/src/smt/smt_cg_table.cpp b/src/smt/smt_cg_table.cpp index 774ca6b87..8f35229fc 100644 --- a/src/smt/smt_cg_table.cpp +++ b/src/smt/smt_cg_table.cpp @@ -217,7 +217,7 @@ namespace smt { return enode_bool_pair(n_prime, false); case BINARY: n_prime = UNTAG(binary_table*, t)->insert_if_not_there(n); - TRACE("cg_table", tout << "insert: " << n->get_owner_id() << " " << cg_binary_hash()(n) << " inserted: " << (n == n_prime) << " " << n_prime->get_owner_id() << "\n"; + TRACE(cg_table, tout << "insert: " << n->get_owner_id() << " " << cg_binary_hash()(n) << " inserted: " << (n == n_prime) << " " << n_prime->get_owner_id() << "\n"; display_binary(tout, t); tout << "contains_ptr: " << contains_ptr(n) << "\n";); return enode_bool_pair(n_prime, false); case BINARY_COMM: @@ -238,7 +238,7 @@ namespace smt { UNTAG(unary_table*, t)->erase(n); break; case BINARY: - TRACE("cg_table", tout << "erase: " << n->get_owner_id() << " " << cg_binary_hash()(n) << " contains: " << contains_ptr(n) << "\n";); + TRACE(cg_table, tout << "erase: " << n->get_owner_id() << " " << cg_binary_hash()(n) << " contains: " << contains_ptr(n) << "\n";); UNTAG(binary_table*, t)->erase(n); break; case BINARY_COMM: diff --git a/src/smt/smt_clause_proof.cpp b/src/smt/smt_clause_proof.cpp index 5cb3729ab..bc4105e13 100644 --- a/src/smt/smt_clause_proof.cpp +++ b/src/smt/smt_clause_proof.cpp @@ -96,7 +96,7 @@ namespace smt { justification* j = c.get_justification(); auto st = kind2st(c.get_kind()); auto pr = justification2proof(st, j); - CTRACE("mk_clause", pr.get(), tout << mk_bounded_pp(pr, m, 4) << "\n";); + CTRACE(mk_clause, pr.get(), tout << mk_bounded_pp(pr, m, 4) << "\n";); update(c, st, pr, simp_lits); } @@ -105,7 +105,7 @@ namespace smt { return; auto st = kind2st(k); auto pr = justification2proof(st, j); - CTRACE("mk_clause", pr.get(), tout << mk_bounded_pp(pr, m, 4) << "\n";); + CTRACE(mk_clause, pr.get(), tout << mk_bounded_pp(pr, m, 4) << "\n";); m_lits.reset(); for (unsigned i = 0; i < n; ++i) m_lits.push_back(ctx.literal2expr(lits[i])); @@ -189,7 +189,7 @@ namespace smt { } void clause_proof::update(status st, expr_ref_vector& v, proof* p) { - TRACE("clause_proof", tout << m_trail.size() << " " << st << " " << v << "\n";); + TRACE(clause_proof, tout << m_trail.size() << " " << st << " " << v << "\n";); if (ctx.get_fparams().m_clause_proof) m_trail.push_back(info(st, v, p)); if (m_on_clause_eh) @@ -237,7 +237,7 @@ namespace smt { } proof_ref clause_proof::get_proof(bool inconsistent) { - TRACE("context", tout << "get-proof " << ctx.get_fparams().m_clause_proof << "\n";); + TRACE(context, tout << "get-proof " << ctx.get_fparams().m_clause_proof << "\n";); if (!ctx.get_fparams().m_clause_proof) return proof_ref(m); expr_ref_vector ps(m); diff --git a/src/smt/smt_conflict_resolution.cpp b/src/smt/smt_conflict_resolution.cpp index 90877a963..e85137028 100644 --- a/src/smt/smt_conflict_resolution.cpp +++ b/src/smt/smt_conflict_resolution.cpp @@ -102,7 +102,7 @@ namespace smt { */ void conflict_resolution::eq_justification2literals(enode * lhs, enode * rhs, eq_justification js) { SASSERT(m_antecedents); - TRACE("conflict_", + TRACE(conflict_, ast_manager& m = get_manager(); tout << mk_pp(lhs->get_expr(), m) << " = " << mk_pp(rhs->get_expr(), m); switch (js.get_kind()) { @@ -125,7 +125,7 @@ namespace smt { mark_justification(js.get_justification()); break; case eq_justification::CONGRUENCE: { - CTRACE("dyn_ack_target", !lhs->is_eq(), tout << "dyn_ack_target2: " << lhs->get_owner_id() << " " << rhs->get_owner_id() << "\n";); + CTRACE(dyn_ack_target, !lhs->is_eq(), tout << "dyn_ack_target2: " << lhs->get_owner_id() << " " << rhs->get_owner_id() << "\n";); m_dyn_ack_manager.used_cg_eh(lhs->get_expr(), rhs->get_expr()); unsigned num_args = lhs->get_num_args(); SASSERT(num_args == rhs->get_num_args()); @@ -313,7 +313,7 @@ namespace smt { bool_var var = antecedent.var(); unsigned lvl = m_ctx.get_assign_level(var); SASSERT(var < m_ctx.get_num_bool_vars()); - TRACE("conflict_", tout << "processing antecedent (level " << lvl << "):"; + TRACE(conflict_, tout << "processing antecedent (level " << lvl << "):"; m_ctx.display_literal(tout, antecedent); m_ctx.display_detailed_literal(tout << " ", antecedent) << "\n";); @@ -351,7 +351,7 @@ namespace smt { for (literal l : antecedents) process_antecedent(l, num_marks); (void)consequent; - TRACE("conflict_smt2", + TRACE(conflict_smt2, for (literal& l : antecedents) { l.neg(); SASSERT(m_ctx.get_assignment(l) == l_false); @@ -384,7 +384,7 @@ namespace smt { Return false if the conflict cannot be resolved (it is at the search level). */ bool conflict_resolution::initialize_resolve(b_justification conflict, literal not_l, b_justification & js, literal & consequent) { - TRACE("conflict_detail", m_ctx.display(tout);); + TRACE(conflict_detail, m_ctx.display(tout);); m_lemma.reset(); m_lemma_atoms.reset(); SASSERT(m_ctx.get_search_level() >= m_ctx.get_base_level()); @@ -395,7 +395,7 @@ namespace smt { m_conflict_lvl = get_max_lvl(consequent, js); - TRACE("conflict_bug", + TRACE(conflict_bug, tout << "conflict_lvl: " << m_conflict_lvl << " scope_lvl: " << m_ctx.get_scope_level() << " base_lvl: " << m_ctx.get_base_level() << " search_lvl: " << m_ctx.get_search_level() << "\n"; tout << "js.kind: " << js.get_kind() << "\n"; @@ -410,8 +410,8 @@ namespace smt { // triggered by an axiom or justification proof wrapper, this two kinds // of justification are considered level zero. if (m_conflict_lvl <= m_ctx.get_search_level()) { - TRACE("conflict", tout << "problem is unsat\n";); - TRACE("conflict", m_ctx.display(tout);); + TRACE(conflict, tout << "problem is unsat\n";); + TRACE(conflict, m_ctx.display(tout);); if (m.proofs_enabled()) mk_conflict_proof(conflict, not_l); if (m_ctx.tracking_assumptions()) @@ -419,7 +419,7 @@ namespace smt { return false; } - TRACE("conflict", tout << "conflict_lvl: " << m_conflict_lvl << "\n";); + TRACE(conflict, tout << "conflict_lvl: " << m_conflict_lvl << "\n";); SASSERT(!m_assigned_literals.empty()); @@ -440,16 +440,16 @@ namespace smt { void conflict_resolution::finalize_resolve(b_justification conflict, literal not_l) { unmark_justifications(0); - TRACE("conflict", m_ctx.display_literals(tout << "before minimization:\n", m_lemma) << "\n" << m_lemma << "\n";); + TRACE(conflict, m_ctx.display_literals(tout << "before minimization:\n", m_lemma) << "\n" << m_lemma << "\n";); - TRACE("conflict_verbose",m_ctx.display_literals_verbose(tout << "before minimization:\n", m_lemma) << "\n";); + TRACE(conflict_verbose,m_ctx.display_literals_verbose(tout << "before minimization:\n", m_lemma) << "\n";); if (m_params.m_minimize_lemmas) minimize_lemma(); - TRACE("conflict", m_ctx.display_literals(tout << "after minimization:\n", m_lemma) << "\n";); - TRACE("conflict_verbose", m_ctx.display_literals_verbose(tout << "after minimization:\n", m_lemma) << "\n";); - TRACE("conflict_bug", m_ctx.display_literals_verbose(tout, m_lemma) << "\n";); + TRACE(conflict, m_ctx.display_literals(tout << "after minimization:\n", m_lemma) << "\n";); + TRACE(conflict_verbose, m_ctx.display_literals_verbose(tout << "after minimization:\n", m_lemma) << "\n";); + TRACE(conflict_bug, m_ctx.display_literals_verbose(tout, m_lemma) << "\n";); literal_vector::iterator it = m_lemma.begin(); literal_vector::iterator end = m_lemma.end(); @@ -470,7 +470,7 @@ namespace smt { } } - TRACE("conflict", + TRACE(conflict, tout << "new scope level: " << m_new_scope_lvl << "\n"; tout << "intern. scope level: " << m_lemma_iscope_lvl << "\n"; tout << "lemma: " << m_lemma << "\n";); @@ -489,7 +489,7 @@ namespace smt { unsigned idx = skip_literals_above_conflict_level(); - TRACE("conflict", m_ctx.display_literal_verbose(tout, not_l); m_ctx.display(tout << " ", conflict);); + TRACE(conflict, m_ctx.display_literal_verbose(tout, not_l); m_ctx.display(tout << " ", conflict);); // save space for first uip m_lemma.push_back(null_literal); @@ -497,7 +497,7 @@ namespace smt { unsigned num_marks = 0; if (not_l != null_literal) { - TRACE("conflict", tout << "not_l: "; m_ctx.display_literal_verbose(tout, not_l) << "\n";); + TRACE(conflict, tout << "not_l: "; m_ctx.display_literal_verbose(tout, not_l) << "\n";); process_antecedent(not_l, num_marks); } @@ -509,7 +509,7 @@ namespace smt { get_manager().trace_stream() << "\n"; } - TRACE("conflict", tout << "processing consequent id: " << idx << " lit: " << consequent << " "; m_ctx.display_literal(tout, consequent); + TRACE(conflict, tout << "processing consequent id: " << idx << " lit: " << consequent << " "; m_ctx.display_literal(tout, consequent); m_ctx.display_literal_verbose(tout << " ", consequent) << "\n"; tout << "num_marks: " << num_marks << ", js kind: " << js.get_kind() << " level: " << m_ctx.get_assign_level(consequent) << "\n"; ); @@ -517,7 +517,7 @@ namespace smt { switch (js.get_kind()) { case b_justification::CLAUSE: { clause * cls = js.get_clause(); - TRACE("conflict_smt2", m_ctx.display_clause_smt2(tout, *cls);); + TRACE(conflict_smt2, m_ctx.display_clause_smt2(tout, *cls);); if (cls->is_lemma()) cls->inc_clause_activity(); unsigned num_lits = cls->get_num_literals(); @@ -545,7 +545,7 @@ namespace smt { break; } case b_justification::BIN_CLAUSE: - TRACE("conflict_smt2", m_ctx.display_literals_smt2(tout, consequent, ~js.get_literal()) << "\n";); + TRACE(conflict_smt2, m_ctx.display_literals_smt2(tout, consequent, ~js.get_literal()) << "\n";); SASSERT(consequent.var() != js.get_literal().var()); process_antecedent(js.get_literal(), num_marks); break; @@ -562,7 +562,7 @@ namespace smt { literal l = m_assigned_literals[idx]; if (m_ctx.is_marked(l.var())) break; - CTRACE("conflict", m_ctx.get_assign_level(l) != m_conflict_lvl && m_ctx.get_assign_level(l) != m_ctx.get_base_level(), + CTRACE(conflict, m_ctx.get_assign_level(l) != m_conflict_lvl && m_ctx.get_assign_level(l) != m_ctx.get_base_level(), tout << "assign_level(l): " << m_ctx.get_assign_level(l) << ", conflict_lvl: "; tout << m_conflict_lvl << ", l: "; m_ctx.display_literal_verbose(tout, l); tout << "\n"; @@ -584,12 +584,12 @@ namespace smt { } while (num_marks > 0); - TRACE("conflict", tout << "FUIP: "; m_ctx.display_literal(tout, consequent)<< "\n";); + TRACE(conflict, tout << "FUIP: "; m_ctx.display_literal(tout, consequent)<< "\n";); m_lemma[0] = ~consequent; m_lemma_atoms.set(0, m_ctx.bool_var2expr(consequent.var())); - TRACE("conflict_smt2", m_ctx.display_literals_smt2(tout << "lemma:", m_lemma) << "\n";); + TRACE(conflict_smt2, m_ctx.display_literals_smt2(tout << "lemma:", m_lemma) << "\n";); // TODO: // @@ -761,7 +761,7 @@ namespace smt { m_lemma .shrink(j); m_lemma_atoms.shrink(j); m_ctx.m_stats.m_num_minimized_lits += sz - j; - TRACE("conflict", tout << "lemma: " << m_lemma << "\n";); + TRACE(conflict, tout << "lemma: " << m_lemma << "\n";); } /** @@ -771,7 +771,7 @@ namespace smt { proof * conflict_resolution::get_proof(enode * n1, enode * n2) { proof * pr; if (m_eq2proof.find(n1, n2, pr)) { - TRACE("proof_gen_bug", tout << "eq2_pr_cached: #" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";); + TRACE(proof_gen_bug, tout << "eq2_pr_cached: #" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";); return pr; } m_todo_pr.push_back(tp_elem(n1, n2)); @@ -802,7 +802,7 @@ namespace smt { return pr; } if (!is_eq || (f1 != n2_owner && f2 != n2_owner)) { - CTRACE("norm_eq_proof_bug", !m_ctx.is_true(n2) && !m_ctx.is_false(n2), + CTRACE(norm_eq_proof_bug, !m_ctx.is_true(n2) && !m_ctx.is_false(n2), tout << "n1: #" << n1->get_owner_id() << ", n2: #" << n2->get_owner_id() << "\n"; if (fact->get_num_args() == 2) { tout << "fact(0): #" << f1->get_id() << ", fact(1): #" << f2->get_id() << "\n"; @@ -820,7 +820,7 @@ namespace smt { m_new_proofs.push_back(pr); return pr; } - TRACE("norm_eq_proof", + TRACE(norm_eq_proof, tout << mk_bounded_pp(pr, m, 4) << "\n"; tout << mk_bounded_pp(n1_owner, m) << "\n"; tout << mk_bounded_pp(n2_owner, m) << "\n"; @@ -848,7 +848,7 @@ namespace smt { case eq_justification::AXIOM: return m.mk_hypothesis(m.mk_eq(n1->get_expr(), n2->get_expr())); case eq_justification::EQUATION: - TRACE("proof_gen_bug", tout << js.get_literal() << "\n"; m_ctx.display_literal_info(tout, js.get_literal());); + TRACE(proof_gen_bug, tout << js.get_literal() << "\n"; m_ctx.display_literal_info(tout, js.get_literal());); return norm_eq_proof(n1, n2, get_proof(js.get_literal())); case eq_justification::JUSTIFICATION: return norm_eq_proof(n1, n2, get_proof(js.get_justification())); @@ -887,7 +887,7 @@ namespace smt { m_new_proofs.push_back(pr1); } else { - TRACE("comm_proof_bug", tout << "e1: #" << e1->get_id() << " e2: #" << e2->get_id() << "\n" << mk_bounded_pp(e1, m, 10) << + TRACE(comm_proof_bug, tout << "e1: #" << e1->get_id() << " e2: #" << e2->get_id() << "\n" << mk_bounded_pp(e1, m, 10) << "\n" << mk_bounded_pp(e2, m, 10) << "\n";); // SASSERT(e1 == e2); } @@ -927,7 +927,7 @@ namespace smt { proof * conflict_resolution::get_proof(literal l) { proof * pr; if (m_lit2proof.find(l, pr)) { - TRACE("proof_gen_bug", tout << "lit2pr_cached: #" << l << " " << pr << " " << pr->get_id() << "\n";); + TRACE(proof_gen_bug, tout << "lit2pr_cached: #" << l << " " << pr << " " << pr->get_id() << "\n";); return pr; } m_todo_pr.push_back(tp_elem(l)); @@ -944,7 +944,7 @@ namespace smt { static unsigned invocation_counter = 0; invocation_counter++; #define DUMP_AFTER_NUM_INVOCATIONS 213473 - CTRACE("get_proof_bug_after", invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, tout << "START get_proof\n";); + CTRACE(get_proof_bug_after, invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, tout << "START get_proof\n";); #endif // l is a hypothesis: if it is marked, and the justification for the variable l.var() is js. // we need the second condition, because the core builds proofs as: @@ -978,9 +978,9 @@ namespace smt { proof * pr = get_proof(js); ptr_buffer prs; bool visited = pr != nullptr; - TRACE("get_proof_bug", if (pr != 0) tout << js->get_name() << "\n";); - CTRACE("get_proof_bug_after", invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) tout << js->get_name() << "\n";); - CTRACE("get_proof_bug_after", invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) js->display_debug_info(*this, tout);); + TRACE(get_proof_bug, if (pr != 0) tout << js->get_name() << "\n";); + CTRACE(get_proof_bug_after, invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) tout << js->get_name() << "\n";); + CTRACE(get_proof_bug_after, invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) js->display_debug_info(*this, tout);); prs.push_back(pr); unsigned num_lits = cls->get_num_literals(); unsigned i = 0; @@ -1008,7 +1008,7 @@ namespace smt { return nullptr; expr_ref l_exr(m); m_ctx.literal2expr(l, l_exr); - TRACE("get_proof_bug", + TRACE(get_proof_bug, tout << "clause:\n"; for (unsigned i = 0; i < num_lits; i++) { tout << cls->get_literal(i).index() << "\n"; @@ -1021,7 +1021,7 @@ namespace smt { tout << mk_pp(m.get_fact(prs[i]), m) << "\n"; } tout << "consequent:\n" << mk_pp(l_exr, m) << "\n";); - CTRACE("get_proof_bug_after", + CTRACE(get_proof_bug_after, invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, tout << "clause, num_lits: " << num_lits << ":\n"; for (unsigned i = 0; i < num_lits; i++) { @@ -1035,11 +1035,11 @@ namespace smt { tout << mk_pp(m.get_fact(prs[i]), m) << "\n"; } tout << "consequent:\n" << mk_pp(l_exr, m) << "\n";); - TRACE("get_proof", + TRACE(get_proof, tout << l.index() << " " << true_literal.index() << " " << false_literal.index() << " "; m_ctx.display_literal(tout, l); tout << " --->\n"; tout << mk_ll_pp(l_exr, m);); - CTRACE("get_proof_bug_after", + CTRACE(get_proof_bug_after, invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, tout << l.index() << " " << true_literal.index() << " " << false_literal.index() << " "; m_ctx.display_literal(tout, l); tout << " --->\n"; @@ -1061,17 +1061,17 @@ namespace smt { proof * conflict_resolution::get_proof(justification * js) { proof * pr; if (m_js2proof.find(js, pr)) { - TRACE("proof_gen_bug", tout << "js2pr_cached: #" << js << " " << pr << " " << pr->get_id() << "\n";); + TRACE(proof_gen_bug, tout << "js2pr_cached: #" << js << " " << pr << " " << pr->get_id() << "\n";); return pr; } SASSERT(js != nullptr); - TRACE("proof_gen_bug", tout << js << "\n";); + TRACE(proof_gen_bug, tout << js << "\n";); m_todo_pr.push_back(tp_elem(js)); return nullptr; } void conflict_resolution::reset() { - TRACE("proof_gen_bug", tout << "reset_caches\n";); + TRACE(proof_gen_bug, tout << "reset_caches\n";); m_new_proofs.reset(); m_todo_pr.reset(); m_eq2proof.reset(); @@ -1086,7 +1086,7 @@ namespace smt { if (m_ctx.is_marked(l.var()) && m_ctx.get_justification(l.var()) == js) return true; SASSERT(js.get_kind() != b_justification::BIN_CLAUSE); - CTRACE("visit_b_justification_bug", js.get_kind() == b_justification::AXIOM, tout << "l: " << l << "\n"; m_ctx.display(tout);); + CTRACE(visit_b_justification_bug, js.get_kind() == b_justification::AXIOM, tout << "l: " << l << "\n"; m_ctx.display(tout);); if (js.get_kind() == b_justification::AXIOM) return true; @@ -1122,10 +1122,10 @@ namespace smt { SASSERT(!m_lit2proof.contains(l)); proof * pr = get_proof(l, js); SASSERT(pr); - TRACE("proof_gen_bug", tout << "lit2pr_saved: #" << l << " " << pr << " " << pr->get_id() << "\n";); + TRACE(proof_gen_bug, tout << "lit2pr_saved: #" << l << " " << pr << " " << pr->get_id() << "\n";); m_lit2proof.insert(l, pr); m_trail.push_back(pr); - TRACE("mk_proof", + TRACE(mk_proof, tout << mk_bounded_pp(m_ctx.bool_var2expr(l.var()), m, 10) << "\n"; tout << "storing proof for: "; m_ctx.display_literal(tout, l); tout << "\n"; tout << mk_ll_pp(pr, m);); @@ -1247,7 +1247,7 @@ namespace smt { if (prs1.size() == 1) pr = prs1[0]; else { - TRACE("mk_transitivity", + TRACE(mk_transitivity, unsigned sz = prs1.size(); for (unsigned i = 0; i < sz; i++) { tout << mk_ll_pp(prs1[i], m) << "\n"; @@ -1255,14 +1255,14 @@ namespace smt { pr = m.mk_transitivity(prs1.size(), prs1.data(), lhs->get_expr(), rhs->get_expr()); } m_new_proofs.push_back(pr); - TRACE("proof_gen_bug", tout << "eq2pr_saved: #" << lhs->get_owner_id() << " #" << rhs->get_owner_id() << "\n";); + TRACE(proof_gen_bug, tout << "eq2pr_saved: #" << lhs->get_owner_id() << " #" << rhs->get_owner_id() << "\n";); m_eq2proof.insert(lhs, rhs, pr); } void conflict_resolution::mk_conflict_proof(b_justification conflict, literal not_l) { SASSERT(conflict.get_kind() != b_justification::BIN_CLAUSE); SASSERT(not_l == null_literal || conflict.get_kind() == b_justification::AXIOM || conflict.get_kind() == b_justification::JUSTIFICATION); - TRACE("mk_conflict_proof", m_ctx.display_literals(tout << "lemma literals:", m_lemma) << "\n";); + TRACE(mk_conflict_proof, m_ctx.display_literals(tout << "lemma literals:", m_lemma) << "\n";); reset(); for (literal lit : m_lemma) m_ctx.set_mark(lit.var()); @@ -1300,7 +1300,7 @@ namespace smt { if (pr) { m_todo_pr.pop_back(); m_new_proofs.push_back(pr); - TRACE("proof_gen_bug", tout << "js2pr_saved: #" << js << "\n";); + TRACE(proof_gen_bug, tout << "js2pr_saved: #" << js << "\n";); m_trail.push_back(pr); m_js2proof.insert(js, pr); } @@ -1354,14 +1354,14 @@ namespace smt { m_lemma_proof = pr; else m_lemma_proof = m.mk_lemma(pr, fact); - TRACE("mk_conflict_proof", tout << mk_pp(m_lemma_proof, m) << "\n";); + TRACE(mk_conflict_proof, tout << mk_pp(m_lemma_proof, m) << "\n";); m_new_proofs.reset(); reset(); } void conflict_resolution::process_antecedent_for_unsat_core(literal antecedent) { bool_var var = antecedent.var(); - CTRACE("conflict", !m_ctx.is_marked(var), tout << "processing antecedent: "; + CTRACE(conflict, !m_ctx.is_marked(var), tout << "processing antecedent: "; m_ctx.display_literal_info(tout << antecedent << " ", antecedent); tout << "\n";); @@ -1406,13 +1406,13 @@ namespace smt { } while (true) { - TRACE("unsat_core_trail", tout << consequent << ", idx: " << idx << " " << js.get_kind() << "\n"; + TRACE(unsat_core_trail, tout << consequent << ", idx: " << idx << " " << js.get_kind() << "\n"; m_ctx.display_literal_smt2(tout, consequent) << "\n"; ); switch (js.get_kind()) { case b_justification::CLAUSE: { clause * cls = js.get_clause(); - TRACE("unsat_core_bug", m_ctx.display_clause_detail(tout, cls);); + TRACE(unsat_core_bug, m_ctx.display_clause_detail(tout, cls);); unsigned num_lits = cls->get_num_literals(); unsigned i = 0; if (consequent != false_literal) { @@ -1453,7 +1453,7 @@ namespace smt { } while (idx >= 0) { literal l = m_assigned_literals[idx]; - CTRACE("unsat_core_bug", m_ctx.is_marked(l.var()), tout << "l: " << l << ", get_assign_level(l): " << m_ctx.get_assign_level(l) << "\n";); + CTRACE(unsat_core_bug, m_ctx.is_marked(l.var()), tout << "l: " << l << ", get_assign_level(l): " << m_ctx.get_assign_level(l) << "\n";); if (m_ctx.get_assign_level(l) < search_lvl) goto end_unsat_core; if (m_ctx.is_marked(l.var())) @@ -1473,7 +1473,7 @@ namespace smt { } end_unsat_core: - TRACE("unsat_core", tout << "assumptions:\n"; m_ctx.display_literals(tout, m_assumptions); tout << "\n";); + TRACE(unsat_core, tout << "assumptions:\n"; m_ctx.display_literals(tout, m_assumptions); tout << "\n";); reset_unmark_and_justifications(0, 0); } diff --git a/src/smt/smt_conflict_resolution.h b/src/smt/smt_conflict_resolution.h index 87ad19771..0d645f76f 100644 --- a/src/smt/smt_conflict_resolution.h +++ b/src/smt/smt_conflict_resolution.h @@ -125,7 +125,7 @@ namespace smt { std::swap(n1, n2); enode_pair p(n1, n2); if (m_already_processed_eqs.insert_if_not_there(p)) { - TRACE("conflict_detail_verbose", tout << "marking eq #" << p.first->get_owner_id() << " = #" << + TRACE(conflict_detail_verbose, tout << "marking eq #" << p.first->get_owner_id() << " = #" << p.second->get_owner_id() << "\n";); m_todo_eqs.push_back(p); SASSERT(m_already_processed_eqs.contains(p)); diff --git a/src/smt/smt_consequences.cpp b/src/smt/smt_consequences.cpp index fe2bd7149..7ea89b0df 100644 --- a/src/smt/smt_consequences.cpp +++ b/src/smt/smt_consequences.cpp @@ -52,7 +52,7 @@ namespace smt { expr_ref fml(m); if (lit == true_literal) return; expr* e = bool_var2expr(lit.var()); - TRACE("context", tout << mk_pp(e, m) << "\n";); + TRACE(context, tout << mk_pp(e, m) << "\n";); index_set s; if (assumptions.contains(lit.var())) { s.insert(lit.var()); @@ -99,7 +99,7 @@ namespace smt { void context::justify(literal lit, index_set& s) { (void)m; auto add_antecedent = [&](literal l) { - CTRACE("context", !m_antecedents.contains(l.var()), + CTRACE(context, !m_antecedents.contains(l.var()), tout << "untracked literal: " << l << " " << mk_pp(bool_var2expr(l.var()), m) << "\n";); if (m_antecedents.contains(l.var())) { @@ -167,7 +167,7 @@ namespace smt { expr* v = kv.m_value; if (m.is_bool(k)) { literal lit = get_literal(k); - TRACE("context", + TRACE(context, tout << "checking " << mk_pp(k, m) << " " << mk_pp(v, m) << " " << get_assignment(lit) << "\n"; display(tout); @@ -214,7 +214,7 @@ namespace smt { // next rounds. // unsigned context::extract_fixed_eqs(expr_ref_vector& conseq) { - TRACE("context", tout << "extract fixed consequences\n";); + TRACE(context, tout << "extract fixed consequences\n";); auto are_equal = [&](expr* k, expr* v) { return e_internalized(k) && e_internalized(v) && @@ -245,7 +245,7 @@ namespace smt { literal lit = mk_diseq(k, v); literals.push_back(~lit); mk_clause(literals.size(), literals.data(), nullptr); - TRACE("context", display_literals_verbose(tout, literals.size(), literals.data());); + TRACE(context, display_literals_verbose(tout, literals.size(), literals.data());); } } for (expr* e : to_delete) { @@ -339,7 +339,7 @@ namespace smt { lbool is_sat = check(assumptions.size(), assumptions.data()); if (is_sat != l_true) { - TRACE("context", tout << is_sat << "\n";); + TRACE(context, tout << is_sat << "\n";); return is_sat; } if (m_qmanager->has_quantifiers()) { @@ -347,14 +347,14 @@ namespace smt { return l_undef; } - TRACE("context", display(tout);); + TRACE(context, display(tout);); model_ref mdl; get_model(mdl); expr_ref_vector trail(m); model_evaluator eval(*mdl.get()); expr_ref val(m); - TRACE("context", model_pp(tout, *mdl);); + TRACE(context, model_pp(tout, *mdl);); for (expr* v : vars) { eval(v, val); if (m.is_value(val)) { @@ -368,7 +368,7 @@ namespace smt { unsigned num_units = 0; extract_fixed_consequences(num_units, _assumptions, conseq); app_ref eq(m); - TRACE("context", + TRACE(context, tout << "vars: " << vars.size() << "\n"; tout << "lits: " << num_units << "\n";); pop_to_base_lvl(); @@ -432,14 +432,14 @@ namespace smt { m_not_l = null_literal; } if (is_sat == l_true) { - TRACE("context", display(tout);); + TRACE(context, display(tout);); delete_unfixed(unfixed); } extract_fixed_consequences(num_units, _assumptions, conseq); num_fixed_eqs += extract_fixed_eqs(conseq); IF_VERBOSE(1, display_consequence_progress(verbose_stream(), num_iterations, m_var2val.size(), conseq.size(), unfixed.size(), num_fixed_eqs);); - TRACE("context", display_consequence_progress(tout, num_iterations, m_var2val.size(), conseq.size(), + TRACE(context, display_consequence_progress(tout, num_iterations, m_var2val.size(), conseq.size(), unfixed.size(), num_fixed_eqs);); } @@ -644,7 +644,7 @@ namespace smt { for (expr* a : assumptions) { assert_expr(a); } - TRACE("context", tout << "checking fixed: " << mk_pp(c, m) << "\n";); + TRACE(context, tout << "checking fixed: " << mk_pp(c, m) << "\n";); tmp = m.mk_not(c); assert_expr(tmp); VERIFY(check() != l_true); @@ -655,7 +655,7 @@ namespace smt { push(); for (expr* a : assumptions) assert_expr(a); - TRACE("context", tout << "checking unfixed: " << mk_pp(uf, m) << "\n";); + TRACE(context, tout << "checking unfixed: " << mk_pp(uf, m) << "\n";); lbool is_sat = check(); SASSERT(is_sat != l_false); if (is_sat == l_true) { diff --git a/src/smt/smt_context.cpp b/src/smt/smt_context.cpp index a47009bce..811abbd97 100644 --- a/src/smt/smt_context.cpp +++ b/src/smt/smt_context.cpp @@ -182,7 +182,7 @@ namespace smt { dst_ctx.copy_user_propagator(src_ctx, true); - TRACE("smt_context", + TRACE(smt_context, src_ctx.display(tout); dst_ctx.display(tout);); } @@ -287,12 +287,12 @@ namespace smt { } d.m_phase_available = true; d.m_phase = !l.sign(); - TRACE("assign_core", tout << (decision?"decision: ":"propagating: ") << l << " "; + TRACE(assign_core, tout << (decision?"decision: ":"propagating: ") << l << " "; display_literal_smt2(tout, l) << "\n"; tout << "relevant: " << is_relevant_core(l) << " level: " << m_scope_lvl << " is atom " << d.is_atom() << "\n"; display(tout, j); ); - TRACE("phase_selection", tout << "saving phase, is_pos: " << d.m_phase << " l: " << l << "\n";); + TRACE(phase_selection, tout << "saving phase, is_pos: " << d.m_phase << " l: " << l << "\n";); if (d.is_atom() && (relevancy_lvl() == 0 || (relevancy_lvl() == 1 && !d.is_quantifier()) || is_relevant_core(l))) { m_atom_propagation_queue.push_back(l); @@ -345,7 +345,7 @@ namespace smt { watch_list::clause_iterator end = w.end_clause(); for(; it != end; ++it) { clause * cls = *it; - CTRACE("bcp_bug", cls->get_literal(0) != not_l && cls->get_literal(1) != not_l, display_clause_detail(tout, cls); + CTRACE(bcp_bug, cls->get_literal(0) != not_l && cls->get_literal(1) != not_l, display_clause_detail(tout, cls); tout << "not_l: "; display_literal(tout, not_l); tout << " " << not_l << "\n";); SASSERT(cls->get_literal(0) == not_l || cls->get_literal(1) == not_l); if (cls->get_literal(0) == not_l) { @@ -440,7 +440,7 @@ namespace smt { theory * t = get_theory(th); if (t->get_enode(lhs)->is_interpreted() && t->get_enode(rhs)->is_interpreted()) return; - TRACE("add_diseq", + TRACE(add_diseq, tout << "#" << t->get_enode(lhs)->get_owner_id() << " != " << "#" << t->get_enode(rhs)->get_owner_id() << "\n";); @@ -473,8 +473,8 @@ namespace smt { scoped_suspend_rlimit _suspend_cancel(m.limit()); try { - TRACE("add_eq", tout << "assigning: #" << n1->get_owner_id() << " = #" << n2->get_owner_id() << "\n";); - TRACE("add_eq_detail", tout << "assigning\n" << enode_pp(n1, *this) << "\n" << enode_pp(n2, *this) << "\n"; + TRACE(add_eq, tout << "assigning: #" << n1->get_owner_id() << " = #" << n2->get_owner_id() << "\n";); + TRACE(add_eq_detail, tout << "assigning\n" << enode_pp(n1, *this) << "\n" << enode_pp(n2, *this) << "\n"; tout << "kind: " << js.get_kind() << "\n";); SASSERT(n1->get_sort() == n2->get_sort()); @@ -483,13 +483,13 @@ namespace smt { enode * r2 = n2->get_root(); if (r1 == r2) { - TRACE("add_eq", tout << "redundant constraint.\n";); + TRACE(add_eq, tout << "redundant constraint.\n";); return; } IF_VERBOSE(20, verbose_stream() << "merge " << mk_bounded_pp(n1->get_expr(), m) << " " << mk_bounded_pp(n2->get_expr(), m) << "\n"); if (r1->is_interpreted() && r2->is_interpreted()) { - TRACE("add_eq", tout << "interpreted roots conflict.\n";); + TRACE(add_eq, tout << "interpreted roots conflict.\n";); set_conflict(mk_justification(eq_conflict_justification(n1, n2, js))); return; } @@ -507,7 +507,7 @@ namespace smt { std::swap(r1, r2); } - TRACE("add_eq", tout << "merging: #" << r1->get_owner_id() << " #" << r2->get_owner_id() << + TRACE(add_eq, tout << "merging: #" << r1->get_owner_id() << " #" << r2->get_owner_id() << " n1: #" << n1->get_owner_id() << "\n";); // It is necessary to propagate relevancy to other elements of @@ -573,7 +573,7 @@ namespace smt { catch (...) { // Restore trail size since procedure was interrupted in the middle. // If the add_eq_trail remains on the trail stack, then Z3 may crash when the destructor is invoked. - TRACE("add_eq", tout << "add_eq interrupted. This is unsafe " << m.limit().is_canceled() << "\n";); + TRACE(add_eq, tout << "add_eq interrupted. This is unsafe " << m.limit().is_canceled() << "\n";); m_trail_stack.shrink(old_trail_size); throw; } @@ -586,8 +586,8 @@ namespace smt { void context::remove_parents_from_cg_table(enode * r1) { // Remove parents from the congruence table for (enode * parent : enode::parents(r1)) { - CTRACE("add_eq", !parent->is_marked() && parent->is_cgc_enabled() && parent->is_true_eq() && m_cg_table.contains_ptr(parent), tout << parent->get_owner_id() << "\n";); - CTRACE("add_eq", !parent->is_marked() && parent->is_cgc_enabled() && !parent->is_true_eq() && parent->is_cgr() && !m_cg_table.contains_ptr(parent), + CTRACE(add_eq, !parent->is_marked() && parent->is_cgc_enabled() && parent->is_true_eq() && m_cg_table.contains_ptr(parent), tout << parent->get_owner_id() << "\n";); + CTRACE(add_eq, !parent->is_marked() && parent->is_cgc_enabled() && !parent->is_true_eq() && parent->is_cgr() && !m_cg_table.contains_ptr(parent), tout << "cgr !contains " << parent->get_owner_id() << " " << mk_pp(parent->get_decl(), m) << "\n"; for (enode* n : enode::args(parent)) tout << n->get_root()->get_owner_id() << " " << n->get_root()->hash() << " "; tout << "\n"; @@ -597,7 +597,7 @@ namespace smt { } m_cg_table.display(tout); ); - CTRACE("add_eq", !parent->is_marked() && parent->is_cgc_enabled() && !parent->is_true_eq() && !parent->is_cgr() && m_cg_table.contains_ptr(parent), tout << "!cgr contains " << parent->get_owner_id() << "\n";); + CTRACE(add_eq, !parent->is_marked() && parent->is_cgc_enabled() && !parent->is_true_eq() && !parent->is_cgr() && m_cg_table.contains_ptr(parent), tout << "!cgr contains " << parent->get_owner_id() << "\n";); SASSERT(parent->is_marked() || !parent->is_cgc_enabled() || parent->is_true_eq() || parent->is_cgr() == m_cg_table.contains_ptr(parent)); SASSERT(parent->is_marked() || !parent->is_cgc_enabled() || !parent->is_true_eq() || !m_cg_table.contains_ptr(parent)); if (!parent->is_marked() && parent->is_cgr() && !parent->is_true_eq()) { @@ -635,7 +635,7 @@ namespace smt { parent->unset_mark(); if (parent->is_eq()) { SASSERT(parent->get_num_args() == 2); - TRACE("add_eq_bug", tout << "visiting: #" << parent->get_owner_id() << "\n";); + TRACE(add_eq_bug, tout << "visiting: #" << parent->get_owner_id() << "\n";); enode * lhs = parent->get_arg(0); enode * rhs = parent->get_arg(1); if (lhs->get_root() == rhs->get_root()) { @@ -666,7 +666,7 @@ namespace smt { SASSERT(!m_cg_table.contains_ptr(parent)); if (parent_prime->m_root != parent->m_root) { bool used_commutativity = pair.second; - TRACE("cg", tout << "found new congruence: #" << parent->get_owner_id() << " = #" << parent_prime->get_owner_id() + TRACE(cg, tout << "found new congruence: #" << parent->get_owner_id() << " = #" << parent_prime->get_owner_id() << " used_commutativity: " << used_commutativity << "\n";); push_new_congruence(parent, parent_prime, used_commutativity); } @@ -772,7 +772,7 @@ namespace smt { enode * r2 = n2->get_root(); enode * r1 = n1->get_root(); if (!r1->has_th_vars() && !r2->has_th_vars()) { - TRACE("merge_theory_vars", tout << "Neither have theory vars #" + TRACE(merge_theory_vars, tout << "Neither have theory vars #" << mk_bounded_pp(n1->get_expr(), m) << " #" << mk_bounded_pp(n2->get_expr(), m) << "\n";); return; } @@ -788,7 +788,7 @@ namespace smt { theory_id t1 = r1->m_th_var_list.get_id(); theory_var v2 = m_fparams.m_new_core2th_eq ? get_closest_var(n2, t2) : r2->m_th_var_list.get_var(); theory_var v1 = m_fparams.m_new_core2th_eq ? get_closest_var(n1, t1) : r1->m_th_var_list.get_var(); - TRACE("merge_theory_vars", + TRACE(merge_theory_vars, tout << "v2: " << v2 << " #" << r2->get_owner_id() << ", v1: " << v1 << " #" << r1->get_owner_id() << ", t2: " << t2 << ", t1: " << t1 << "\n";); if (v2 != null_theory_var && v1 != null_theory_var) { @@ -810,13 +810,13 @@ namespace smt { else if (v1 != null_theory_var && v2 == null_theory_var) { r2->m_th_var_list.set_var(v1); r2->m_th_var_list.set_id(t1); - TRACE("merge_theory_vars", tout << "push_new_th_diseqs v1: " << v1 << ", t1: " << t1 << "\n";); + TRACE(merge_theory_vars, tout << "push_new_th_diseqs v1: " << v1 << ", t1: " << t1 << "\n";); push_new_th_diseqs(r2, v1, get_theory(t1)); } } else { // r1 and/or r2 have more than one theory variable. - TRACE("merge_theory_vars", + TRACE(merge_theory_vars, tout << "#" << r1->get_owner_id() << " == #" << r2->get_owner_id() << "\n";); @@ -828,7 +828,7 @@ namespace smt { SASSERT(t2 != null_theory_id); theory_var v1 = m_fparams.m_new_core2th_eq ? get_closest_var(n1, t2) : r1->get_th_var(t2); - TRACE("merge_theory_vars", tout << get_theory(t2)->get_name() << ": " << v2 << " == " << v1 << "\n"); + TRACE(merge_theory_vars, tout << get_theory(t2)->get_name() << ": " << v2 << " == " << v1 << "\n"); if (v1 != null_theory_var) { // only send the equality to the theory, if the equality was not propagated by it. @@ -848,7 +848,7 @@ namespace smt { SASSERT(v1 != null_theory_var); SASSERT(t1 != null_theory_id); theory_var v2 = r2->get_th_var(t1); - TRACE("merge_theory_vars", tout << get_theory(t1)->get_name() << ": " << v2 << " == " << v1 << "\n"); + TRACE(merge_theory_vars, tout << get_theory(t1)->get_name() << ": " << v2 << " == " << v1 << "\n"); if (v2 == null_theory_var) { r2->add_th_var(v1, t1, m_region); push_new_th_diseqs(r2, v1, get_theory(t1)); @@ -873,7 +873,7 @@ namespace smt { SASSERT(curr != m_false_enode); bool_var v = enode2bool_var(curr); literal l(v, sign); - CTRACE("propagate", (get_assignment(l) != l_true), tout << enode_pp(curr, *this) << " " << l << "\n"); + CTRACE(propagate, (get_assignment(l) != l_true), tout << enode_pp(curr, *this) << " " << l << "\n"); if (get_assignment(l) != l_true) assign(l, mk_justification(eq_root_propagation_justification(curr))); curr = curr->m_next; @@ -923,7 +923,7 @@ namespace smt { void context::undo_add_eq(enode * r1, enode * n1, unsigned r2_num_parents) { enode * r2 = r1->get_root(); - TRACE("add_eq", tout << "undo_add_eq #" << r1->get_owner_id() << " #" << r2->get_owner_id() << "\n";); + TRACE(add_eq, tout << "undo_add_eq #" << r1->get_owner_id() << " #" << r2->get_owner_id() << "\n";); // restore r2 class size r2->m_class_size -= r1->m_class_size; @@ -939,7 +939,7 @@ namespace smt { for (; it != end; ++it) { enode * parent = *it; if (parent->is_cgc_enabled()) { - CTRACE("add_eq", !parent->is_cgr() || !m_cg_table.contains_ptr(parent), + CTRACE(add_eq, !parent->is_cgr() || !m_cg_table.contains_ptr(parent), tout << "old num_parents: " << r2_num_parents << "\nnum_parents: " << r2->m_parents.size() << "\nparent: #" << parent->get_owner_id() @@ -964,7 +964,7 @@ namespace smt { // try to reinsert parents of r1 that are not cgr for (enode * parent : enode::parents(r1)) { - TRACE("add_eq_parents", tout << "visiting: #" << parent->get_owner_id() << "\n";); + TRACE(add_eq_parents, tout << "visiting: #" << parent->get_owner_id() << "\n";); if (parent->is_cgc_enabled()) { enode * cg = parent->m_cg; @@ -1063,7 +1063,7 @@ namespace smt { bool context::add_diseq(enode * n1, enode * n2) { enode * r1 = n1->get_root(); enode * r2 = n2->get_root(); - TRACE("add_diseq", tout << "assigning: #" << n1->get_owner_id() << " != #" << n2->get_owner_id() << "\n"; + TRACE(add_diseq, tout << "assigning: #" << n1->get_owner_id() << " != #" << n2->get_owner_id() << "\n"; tout << mk_ll_pp(n1->get_expr(), m) << " != "; tout << mk_ll_pp(n2->get_expr(), m) << "\n"; tout << mk_ll_pp(r1->get_expr(), m) << " != "; @@ -1075,7 +1075,7 @@ namespace smt { m_diseq_vector.push_back(enode_pair(n1, n2));); if (r1 == r2) { - TRACE("add_diseq_inconsistent", tout << "add_diseq #" << n1->get_owner_id() << " #" << n2->get_owner_id() << " inconsistency, scope_lvl: " << m_scope_lvl << "\n";); + TRACE(add_diseq_inconsistent, tout << "add_diseq #" << n1->get_owner_id() << " #" << n2->get_owner_id() << " inconsistency, scope_lvl: " << m_scope_lvl << "\n";); //return false; theory_id t1 = r1->m_th_var_list.get_id(); @@ -1089,7 +1089,7 @@ namespace smt { theory_id t1 = r1->m_th_var_list.get_id(); theory_var v1 = m_fparams.m_new_core2th_eq ? get_closest_var(n1, t1) : r1->m_th_var_list.get_var(); theory_var v2 = m_fparams.m_new_core2th_eq ? get_closest_var(n2, t1) : r2->m_th_var_list.get_var(); - TRACE("add_diseq", tout << "one theory diseq\n"; + TRACE(add_diseq, tout << "one theory diseq\n"; tout << v1 << " != " << v2 << "\n"; tout << "th1: " << t1 << " th2: " << r2->m_th_var_list.get_id() << "\n"; ); @@ -1105,7 +1105,7 @@ namespace smt { theory_id t1 = l1->get_id(); theory_var v1 = m_fparams.m_new_core2th_eq ? get_closest_var(n1, t1) : l1->get_var(); theory * th = get_theory(t1); - TRACE("add_diseq", tout << m.get_family_name(t1) << "\n";); + TRACE(add_diseq, tout << m.get_family_name(t1) << "\n";); if (th->use_diseqs()) { theory_var v2 = m_fparams.m_new_core2th_eq ? get_closest_var(n2, t1) : r2->get_th_var(t1); if (v2 != null_theory_var) @@ -1143,14 +1143,14 @@ namespace smt { SASSERT(m_is_diseq_tmp->get_num_args() == 2); enode * r = m_cg_table.find(m_is_diseq_tmp); SASSERT((r != 0) == m_cg_table.contains(m_is_diseq_tmp)); - TRACE("is_diseq", tout << "r: " << r << "\n";); + TRACE(is_diseq, tout << "r: " << r << "\n";); if (r) { SASSERT(r->is_eq()); literal l = enode2literal(r->get_root()); // SASSERT(result == is_diseq_slow(n1, n2)); return l != true_literal && (l == false_literal || (is_relevant(l) && get_assignment(l) == l_false)); } - CTRACE("is_diseq_bug", is_diseq_slow(n1, n2), tout << "#" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";); + CTRACE(is_diseq_bug, is_diseq_slow(n1, n2), tout << "#" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";); return false; } @@ -1164,7 +1164,7 @@ namespace smt { if (parent->is_eq() && is_relevant(parent->get_expr()) && get_assignment(enode2bool_var(parent)) == l_false && ((parent->get_arg(0)->get_root() == n1->get_root() && parent->get_arg(1)->get_root() == n2->get_root()) || (parent->get_arg(1)->get_root() == n1->get_root() && parent->get_arg(0)->get_root() == n2->get_root()))) { - TRACE("is_diseq_bug", tout << "parent: #" << parent->get_owner_id() << ", parent->root: #" << + TRACE(is_diseq_bug, tout << "parent: #" << parent->get_owner_id() << ", parent->root: #" << parent->get_root()->get_owner_id() << " assignment(parent): " << get_assignment(enode2bool_var(parent)) << " args: #" << parent->get_arg(0)->get_owner_id() << " #" << parent->get_arg(1)->get_owner_id() << "\n";); return true; @@ -1191,7 +1191,7 @@ namespace smt { if (depth == 0) return false; if (r1->get_num_parents() < SMALL_NUM_PARENTS) { - TRACE("is_ext_diseq", tout << enode_pp(n1, *this) << " " << enode_pp(n2, *this) << " " << depth << "\n";); + TRACE(is_ext_diseq, tout << enode_pp(n1, *this) << " " << enode_pp(n2, *this) << " " << depth << "\n";); for (enode * p1 : enode::parents(r1)) { if (!is_relevant(p1)) continue; @@ -1200,7 +1200,7 @@ namespace smt { if (!p1->is_cgr()) continue; func_decl * f = p1->get_decl(); - TRACE("is_ext_diseq", tout << "p1: " << enode_pp(p1, *this) << "\n";); + TRACE(is_ext_diseq, tout << "p1: " << enode_pp(p1, *this) << "\n";); unsigned num_args = p1->get_num_args(); for (enode * p2 : enode::parents(r2)) { if (!is_relevant(p2)) @@ -1209,7 +1209,7 @@ namespace smt { continue; if (!p2->is_cgr()) continue; - TRACE("is_ext_diseq", tout << "p2: " << enode_pp(p2, *this) << "\n";); + TRACE(is_ext_diseq, tout << "p2: " << enode_pp(p2, *this) << "\n";); if (p1->get_root() != p2->get_root() && p2->get_decl() == f && p2->get_num_args() == num_args) { unsigned j = 0; for (j = 0; j < num_args; j++) { @@ -1223,7 +1223,7 @@ namespace smt { break; } if (j == num_args) { - TRACE("is_ext_diseq", tout << "found parents: " << enode_pp(p1, *this) << " " << enode_pp(p2, *this) << "\n";); + TRACE(is_ext_diseq, tout << "found parents: " << enode_pp(p1, *this) << " " << enode_pp(p2, *this) << "\n";); if (is_ext_diseq(p1, p2, depth - 1)) return true; } @@ -1288,7 +1288,7 @@ namespace smt { expr * arg = r->get_expr()->get_arg(i); SASSERT(e_internalized(arg)); enode * _arg = get_enode(arg); - CTRACE("eq_to_bug", args[i]->get_root() != _arg->get_root(), + CTRACE(eq_to_bug, args[i]->get_root() != _arg->get_root(), tout << "#" << args[i]->get_expr_id() << " #" << args[i]->get_root()->get_expr_id() << " #" << _arg->get_expr_id() << " #" << _arg->get_root()->get_expr_id() << "\n"; tout << "#" << r->get_expr_id() << "\n"; @@ -1325,13 +1325,13 @@ namespace smt { */ bool context::propagate_atoms() { SASSERT(!inconsistent()); - CTRACE("propagate_atoms", !m_atom_propagation_queue.empty(), tout << m_atom_propagation_queue << "\n";); + CTRACE(propagate_atoms, !m_atom_propagation_queue.empty(), tout << m_atom_propagation_queue << "\n";); for (unsigned i = 0; i < m_atom_propagation_queue.size() && !get_cancel_flag(); i++) { SASSERT(!inconsistent()); literal l = m_atom_propagation_queue[i]; bool_var v = l.var(); lbool val = get_assignment(v); - TRACE("propagate_atoms", tout << "propagating atom, #" << bool_var2expr(v)->get_id() + TRACE(propagate_atoms, tout << "propagating atom, #" << bool_var2expr(v)->get_id() << ", is_enode(): " << get_bdata(v).is_enode() << " tag: " << (get_bdata(v).is_eq()?"eq":"") << (get_bdata(v).is_theory_atom()?"th":"") @@ -1354,7 +1354,7 @@ namespace smt { add_eq(get_enode(lhs), get_enode(rhs), eq_justification(l)); } else { - TRACE("add_diseq", display_eq_detail(tout, bool_var2enode(v));); + TRACE(add_diseq, display_eq_detail(tout, bool_var2enode(v));); if (!add_diseq(get_enode(lhs), get_enode(rhs)) && !inconsistent()) { literal n_eq = literal(l.var(), true); set_conflict(b_justification(mk_justification(eq_propagation_justification(get_enode(lhs), get_enode(rhs)))), n_eq); @@ -1370,7 +1370,7 @@ namespace smt { // Remark: when RELEVANCY_LEMMA is true, a quantifier can be asserted to false and marked as relevant. // This happens when a quantifier is part of a lemma (conflict-clause), and this conflict clause // becomes an unit-clause and the remaining literal is the negation of a quantifier. - CTRACE("assign_quantifier_bug", get_assignment(v) != l_true, + CTRACE(assign_quantifier_bug, get_assignment(v) != l_true, tout << "#" << bool_var2expr(v)->get_id() << " val: " << get_assignment(v) << "\n"; tout << mk_pp(bool_var2expr(v), m) << "\n"; display(tout);); @@ -1419,11 +1419,11 @@ namespace smt { SASSERT(get_assignment(v) != l_undef); SASSERT(get_bdata(v).is_enode()); lbool val = get_assignment(v); - TRACE("propagate_bool_var_enode_bug", tout << "var: " << v << " #" << bool_var2expr(v)->get_id() << "\n";); + TRACE(propagate_bool_var_enode_bug, tout << "var: " << v << " #" << bool_var2expr(v)->get_id() << "\n";); SASSERT(v < m_b_internalized_stack.size()); enode * n = bool_var2enode(v); - CTRACE("mk_bool_var", !n, tout << "No enode for " << v << "\n";); + CTRACE(mk_bool_var, !n, tout << "No enode for " << v << "\n";); bool sign = val == l_false; if (n->merge_tf()) add_eq(n, sign ? m_false_enode : m_true_enode, eq_justification(literal(v, sign))); @@ -1455,25 +1455,25 @@ namespace smt { */ void context::push_new_th_diseqs(enode * r, theory_var v, theory * th) { if (!th->use_diseqs()) { - TRACE("push_new_th_diseqs", tout << m.get_family_name(th->get_id()) << " not using diseqs\n";); + TRACE(push_new_th_diseqs, tout << m.get_family_name(th->get_id()) << " not using diseqs\n";); return; } theory_id th_id = th->get_id(); - TRACE("push_new_th_diseqs", tout << "#" << r->get_owner_id() << " " << mk_bounded_pp(r->get_expr(), m) << " v" << v << " th: " << th_id << "\n";); + TRACE(push_new_th_diseqs, tout << "#" << r->get_owner_id() << " " << mk_bounded_pp(r->get_expr(), m) << " v" << v << " th: " << th_id << "\n";); for (enode * parent : r->get_parents()) { - CTRACE("parent_bug", parent == 0, tout << "#" << r->get_owner_id() << ", num_parents: " << r->get_num_parents() << "\n"; display(tout);); + CTRACE(parent_bug, parent == 0, tout << "#" << r->get_owner_id() << ", num_parents: " << r->get_num_parents() << "\n"; display(tout);); if (parent->is_eq()) { bool_var bv = get_bool_var_of_id(parent->get_owner_id()); if (get_assignment(bv) == l_false) { enode * lhs = parent->get_arg(0); enode * rhs = parent->get_arg(1); - TRACE("push_new_th_diseqs", + TRACE(push_new_th_diseqs, tout << "#" << parent->get_owner_id() << " "; tout << "lhs: #" << lhs->get_owner_id() << ", rhs: #" << rhs->get_owner_id() << ", lhs->root: #" << lhs->get_root()->get_owner_id() << ", rhs->root: #" << rhs->get_root()->get_owner_id() << ", r: #" << r->get_owner_id() << ", r->root: #" << r->get_root()->get_owner_id() << "\n"; ); - CTRACE("push_new_th_diseqs", lhs->get_root() != r->get_root() && rhs->get_root() != r->get_root(), + CTRACE(push_new_th_diseqs, lhs->get_root() != r->get_root() && rhs->get_root() != r->get_root(), tout << "lhs: #" << lhs->get_owner_id() << ", rhs: #" << rhs->get_owner_id() << ", lhs->root: #" << lhs->get_root()->get_owner_id() << ", rhs->root: #" << rhs->get_root()->get_owner_id() << ", r: #" << r->get_owner_id() << ", r->root: #" << r->get_root()->get_owner_id() << "\n"; @@ -1502,7 +1502,7 @@ namespace smt { \pre The expression must be attached to a boolean variable. */ inline lbool context::get_assignment_core(expr * n) const { - CTRACE("get_assignment_bug", !b_internalized(n), tout << "n:\n" << mk_pp(n, m) << "\n"; display(tout);); + CTRACE(get_assignment_bug, !b_internalized(n), tout << "n:\n" << mk_pp(n, m) << "\n"; display(tout);); SASSERT(b_internalized(n)); unsigned id = n->get_id(); bool_var var = get_bool_var_of_id(id); @@ -1549,7 +1549,7 @@ namespace smt { if (n == m_false_enode) return l_false; bool_var v = get_bool_var_of_id(owner->get_id()); - CTRACE("missing_propagation", v == null_bool_var, tout << mk_pp(owner, m) << "\n";); + CTRACE(missing_propagation, v == null_bool_var, tout << mk_pp(owner, m) << "\n";); return get_assignment(v); } @@ -1585,7 +1585,7 @@ namespace smt { m_atom_propagation_queue.push_back(literal(v, val == l_false)); } } - TRACE("propagate_relevancy", tout << "marking as relevant:\n" << mk_bounded_pp(n, m) << " " << m_scope_lvl << "\n";); + TRACE(propagate_relevancy, tout << "marking as relevant:\n" << mk_bounded_pp(n, m) << " " << m_scope_lvl << "\n";); m_case_split_queue->relevant_eh(n); if (is_app(n)) { @@ -1701,7 +1701,8 @@ namespace smt { congruences cannot be retracted to a consistent state. */ bool context::propagate() { - TRACE("propagate", tout << "propagating... " << m_qhead << ":" << m_assigned_literals.size() << "\n";); + TRACE(propagate, tout << "propagating... " << m_qhead << ":" << m_assigned_literals.size() << "\n"); + while (true) { if (inconsistent()) return false; @@ -1747,14 +1748,14 @@ namespace smt { void context::set_conflict(const b_justification & js, literal not_l) { if (!inconsistent()) { - TRACE("set_conflict", display_literal_verbose(tout << m_scope_lvl << " ", not_l); display(tout << " ", js); ); + TRACE(set_conflict, display_literal_verbose(tout << m_scope_lvl << " ", not_l); display(tout << " ", js); ); m_conflict = js; m_not_l = not_l; } } void context::assign_quantifier(quantifier * q) { - TRACE("assumption", tout << mk_pp(q, m) << "\n";); + TRACE(assumption, tout << mk_pp(q, m) << "\n";); m_qmanager->assign_eh(q); } @@ -1768,7 +1769,7 @@ namespace smt { } void context::rescale_bool_var_activity() { - TRACE("case_split", tout << "rescale\n";); + TRACE(case_split, tout << "rescale\n";); svector::iterator it = m_activity.begin(); svector::iterator end = m_activity.end(); for (; it != end; ++it) @@ -1818,11 +1819,11 @@ namespace smt { case PS_CACHING_CONSERVATIVE: case PS_CACHING_CONSERVATIVE2: if (m_phase_cache_on && d.m_phase_available) { - TRACE("phase_selection", tout << "using cached value, is_pos: " << m_bdata[var].m_phase << ", var: p" << var << "\n";); + TRACE(phase_selection, tout << "using cached value, is_pos: " << m_bdata[var].m_phase << ", var: p" << var << "\n";); return m_bdata[var].m_phase; } else { - TRACE("phase_selection", tout << "setting to false\n";); + TRACE(phase_selection, tout << "setting to false\n";); return m_phase_default; } case PS_ALWAYS_FALSE: @@ -1873,7 +1874,7 @@ namespace smt { static unsigned counter = 0; counter++; if (counter % 100 == 0) { - TRACE("activity_profile", + TRACE(activity_profile, for (unsigned i=0; ipush(); s.m_assigned_literals_lim = m_assigned_literals.size(); @@ -2029,7 +2030,7 @@ namespace smt { SASSERT(m_flushing || !cls->in_reinit_stack()); if (log) m_clause_proof.del(*cls); - CTRACE("context", !m_flushing, display_clause_smt2(tout << "deleting ", *cls) << "\n";); + CTRACE(context, !m_flushing, display_clause_smt2(tout << "deleting ", *cls) << "\n";); if (!cls->deleted()) remove_cls_occs(cls); cls->deallocate(m); @@ -2088,7 +2089,7 @@ namespace smt { while (i != old_lim) { --i; literal l = m_assigned_literals[i]; - CTRACE("assign_core", l.var() == 13, tout << "unassign " << l << "\n";); + CTRACE(assign_core, l.var() == 13, tout << "unassign " << l << "\n";); m_assignment[l.index()] = l_undef; m_assignment[(~l).index()] = l_undef; bool_var v = l.var(); @@ -2233,7 +2234,7 @@ namespace smt { unsigned ilvl = e->get_iscope_lvl(); if (ilvl <= new_scope_lvl) continue; // node and its children will not be recreated during backtracking - TRACE("cached_generation", tout << "caching: #" << n->get_id() << " " << e->get_generation() << "\n";); + TRACE(cached_generation, tout << "caching: #" << n->get_id() << " " << e->get_generation() << "\n";); m_cached_generation.insert(n, e->get_generation()); } for (expr * arg : *to_app(n)) { @@ -2265,7 +2266,7 @@ namespace smt { contains a literal l where l.var() >= num_bool_vars. */ void context::reinit_clauses(unsigned num_scopes, unsigned num_bool_vars) { - TRACE("reinit_clauses_bug", display_watch_lists(tout);); + TRACE(reinit_clauses_bug, display_watch_lists(tout);); if (m_clauses_to_reinit.empty()) return; unsigned lim = m_scope_lvl + num_scopes; @@ -2342,7 +2343,7 @@ namespace smt { else if (get_assignment(l2) == l_false) assign(l1, b_justification(cls)); - TRACE("reinit_clauses", tout << "reinit clause:\n"; display_clause_detail(tout, cls); tout << "\n"; + TRACE(reinit_clauses, tout << "reinit clause:\n"; display_clause_detail(tout, cls); tout << "\n"; tout << "activity: " << cls->get_activity() << ", num_bool_vars: " << num_bool_vars << ", scope_lvl: " << m_scope_lvl << "\n";); keep = true; @@ -2380,7 +2381,7 @@ namespace smt { v.reset(); } CASSERT("reinit_clauses", check_clauses(m_lemmas)); - TRACE("reinit_clauses_bug", display_watch_lists(tout);); + TRACE(reinit_clauses_bug, display_watch_lists(tout);); } void context::reassert_units(unsigned units_to_reassert_lim) { @@ -2395,7 +2396,7 @@ namespace smt { assign(l, b_justification::mk_axiom()); if (is_relevant) mark_as_relevant(l); - TRACE("reassert_units", tout << "reasserting #" << unit->get_id() << " " << sign << " @ " << m_scope_lvl << "\n";); + TRACE(reassert_units, tout << "reasserting #" << unit->get_id() << " " << sign << " @ " << m_scope_lvl << "\n";); } if (at_base_level()) m_units_to_reassert.reset(); @@ -2416,8 +2417,8 @@ namespace smt { if (m.has_trace_stream() && !m_is_auxiliary) m.trace_stream() << "[pop] " << num_scopes << " " << m_scope_lvl << "\n"; - // TRACE("context", tout << "backtracking: " << num_scopes << " from " << m_scope_lvl << "\n";); - TRACE("pop_scope_detail", display(tout);); + // TRACE(context, tout << "backtracking: " << num_scopes << " from " << m_scope_lvl << "\n";); + TRACE(pop_scope_detail, display(tout);); SASSERT(num_scopes > 0); SASSERT(num_scopes <= m_scope_lvl); SASSERT(m_scopes.size() == m_scope_lvl); @@ -2428,9 +2429,9 @@ namespace smt { m_qmanager->pop(num_scopes); m_case_split_queue->pop_scope(num_scopes); - TRACE("pop_scope", tout << "backtracking: " << num_scopes << ", new_lvl: " << new_lvl << "\n";); + TRACE(pop_scope, tout << "backtracking: " << num_scopes << ", new_lvl: " << new_lvl << "\n";); scope & s = m_scopes[new_lvl]; - TRACE("context", tout << "backtracking new_lvl: " << new_lvl << "\n";); + TRACE(context, tout << "backtracking new_lvl: " << new_lvl << "\n";); units_to_reassert_lim = s.m_units_to_reassert_lim; @@ -2464,7 +2465,7 @@ namespace smt { m_asserted_formulas.pop_scope(num_scopes); - CTRACE("propagate_atoms", !m_atom_propagation_queue.empty(), tout << m_atom_propagation_queue << "\n";); + CTRACE(propagate_atoms, !m_atom_propagation_queue.empty(), tout << m_atom_propagation_queue << "\n";); m_eq_propagation_queue.reset(); m_th_eq_propagation_queue.reset(); @@ -2491,7 +2492,7 @@ namespace smt { // any variable >= num_bool_vars was deleted during backtracking. reinit_clauses(num_scopes, num_bool_vars); reassert_units(units_to_reassert_lim); - TRACE("pop_scope_detail", tout << "end of pop_scope: \n"; display(tout);); + TRACE(pop_scope_detail, tout << "end of pop_scope: \n"; display(tout);); CASSERT("context", check_invariant()); return num_bool_vars; } @@ -2598,12 +2599,12 @@ namespace smt { SASSERT(!cls->in_reinit_stack()); if (cls->deleted()) { - TRACE("simplify_clauses_bug", display_clause(tout << "deleted\n", cls) << "\n";); + TRACE(simplify_clauses_bug, display_clause(tout << "deleted\n", cls) << "\n";); del_clause(true, cls); num_del_clauses++; } else if (simplify_clause(*cls)) { - TRACE("simplify_clauses_bug", display_clause_smt2(tout << "simplified\n", *cls) << "\n";); + TRACE(simplify_clauses_bug, display_clause_smt2(tout << "simplified\n", *cls) << "\n";); for (unsigned idx = 0; idx < 2; idx++) { literal l0 = (*cls)[idx]; b_justification l0_js = get_justification(l0.var()); @@ -2673,16 +2674,16 @@ namespace smt { SASSERT(m_simp_qhead <= sz); if (m_simp_qhead == sz || m_simp_counter > 0) { - TRACE("simplify_clauses", tout << "m_simp_qhead: " << m_simp_qhead << " m_simp_counter: " << m_simp_counter << "\n";); + TRACE(simplify_clauses, tout << "m_simp_qhead: " << m_simp_qhead << " m_simp_counter: " << m_simp_counter << "\n";); return; } if (m_aux_clauses.empty() && m_lemmas.empty()) { - TRACE("simplify_clauses", tout << "no clauses to simplify\n";); + TRACE(simplify_clauses, tout << "no clauses to simplify\n";); return; } - TRACE("simplify_clauses_detail", tout << "before:\n"; display_clauses(tout, m_lemmas);); + TRACE(simplify_clauses_detail, tout << "before:\n"; display_clauses(tout, m_lemmas);); SASSERT(check_clauses(m_lemmas)); SASSERT(check_clauses(m_aux_clauses)); @@ -2717,8 +2718,8 @@ namespace smt { } m_stats.m_num_del_clauses += num_del_clauses; m_stats.m_num_simplifications++; - TRACE("simp_counter", tout << "simp_counter: " << m_simp_counter << " scope_lvl: " << m_scope_lvl << "\n";); - TRACE("simplify_clauses_detail", tout << "after:\n"; display_clauses(tout, m_lemmas);); + TRACE(simp_counter, tout << "simp_counter: " << m_simp_counter << " scope_lvl: " << m_scope_lvl << "\n";); + TRACE(simplify_clauses_detail, tout << "after:\n"; display_clauses(tout, m_lemmas);); SASSERT(check_clauses(m_lemmas) && check_clauses(m_aux_clauses)); } @@ -2760,12 +2761,12 @@ namespace smt { unsigned i = start_del_at; unsigned j = i; unsigned num_del_cls = 0; - TRACE("del_inactive_lemmas", tout << "sz: " << sz << ", start_at: " << start_at << ", end_at: " << end_at + TRACE(del_inactive_lemmas, tout << "sz: " << sz << ", start_at: " << start_at << ", end_at: " << end_at << ", start_del_at: " << start_del_at << "\n";); for (; i < end_at; i++) { clause * cls = m_lemmas[i]; if (can_delete(cls)) { - TRACE("del_inactive_lemmas", tout << "deleting: "; display_clause(tout, cls); tout << ", activity: " << + TRACE(del_inactive_lemmas, tout << "deleting: "; display_clause(tout, cls); tout << ", activity: " << cls->get_activity() << "\n";); del_clause(true, cls); num_del_cls++; @@ -2894,7 +2895,7 @@ namespace smt { dealloc(th); return; // context already has a theory for the given family id. } - TRACE("internalize", tout << this << " " << th->get_family_id() << "\n";); + TRACE(internalize, tout << this << " " << th->get_family_id() << "\n";); SASSERT(std::find(m_theory_set.begin(), m_theory_set.end(), th) == m_theory_set.end()); m_theories.register_plugin(th); th->init(); @@ -3048,7 +3049,7 @@ namespace smt { */ void context::flush() { flet l1(m_flushing, true); - TRACE("flush", tout << "m_scope_lvl: " << m_scope_lvl << "\n";); + TRACE(flush, tout << "m_scope_lvl: " << m_scope_lvl << "\n";); m_relevancy_propagator = nullptr; m_model_generator->reset(); for (theory* t : m_theory_set) { @@ -3072,15 +3073,15 @@ namespace smt { void context::assert_expr_core(expr * e, proof * pr) { if (get_cancel_flag()) return; SASSERT(is_well_sorted(m, e)); - TRACE("begin_assert_expr", tout << mk_pp(e, m) << " " << mk_pp(pr, m) << "\n";); - TRACE("begin_assert_expr_ll", tout << mk_ll_pp(e, m) << "\n";); + TRACE(begin_assert_expr, tout << mk_pp(e, m) << " " << mk_pp(pr, m) << "\n";); + TRACE(begin_assert_expr_ll, tout << mk_ll_pp(e, m) << "\n";); if (!m_searching) pop_to_base_lvl(); if (pr == nullptr) m_asserted_formulas.assert_expr(e); else m_asserted_formulas.assert_expr(e, pr); - TRACE("end_assert_expr_ll", ast_mark m; m_asserted_formulas.display_ll(tout, m);); + TRACE(end_assert_expr_ll, ast_mark m; m_asserted_formulas.display_ll(tout, m);); } void context::add_asserted(expr* e) { @@ -3110,7 +3111,7 @@ namespace smt { }; void context::mk_th_case_split(unsigned num_lits, literal * lits) { - TRACE("theory_case_split", display_literals_verbose(tout << "theory case split: ", num_lits, lits); tout << std::endl;); + TRACE(theory_case_split, display_literals_verbose(tout << "theory case split: ", num_lits, lits); tout << std::endl;); // If we don't use the theory case split heuristic, // for each pair of literals (l1, l2) we add the clause (~l1 OR ~l2) // to enforce the condition that at most one literal can be assigned 'true'. @@ -3143,7 +3144,7 @@ namespace smt { } m_literal2casesplitsets[l.index()].push_back(new_case_split); } - TRACE("theory_case_split", tout << "tracking case split literal set { "; + TRACE(theory_case_split, tout << "tracking case split literal set { "; for (unsigned i = 0; i < num_lits; ++i) { tout << lits[i].index() << " "; } @@ -3177,16 +3178,16 @@ namespace smt { unsigned assigned_literal_end = m_assigned_literals.size(); for (; qhead < assigned_literal_end; ++qhead) { literal l = m_assigned_literals[qhead]; - TRACE("theory_case_split", tout << "check literal " << l.index() << std::endl; display_literal_verbose(tout, l); tout << std::endl;); + TRACE(theory_case_split, tout << "check literal " << l.index() << std::endl; display_literal_verbose(tout, l); tout << std::endl;); // check if this literal participates in any theory case split if (!m_all_th_case_split_literals.contains(l.index())) { continue; } - TRACE("theory_case_split", tout << "assigned literal " << l.index() << " is a theory case split literal" << std::endl;); + TRACE(theory_case_split, tout << "assigned literal " << l.index() << " is a theory case split literal" << std::endl;); // now find the sets of literals which contain l vector const& case_split_sets = m_literal2casesplitsets[l.index()]; for (const auto& case_split_set : case_split_sets) { - TRACE("theory_case_split", tout << "found case split set { "; + TRACE(theory_case_split, tout << "found case split set { "; for (const auto& set_elem : case_split_set) { tout << set_elem.index() << " "; } @@ -3194,11 +3195,11 @@ namespace smt { for (const auto& l2 : case_split_set) { if (l2 != l) { b_justification js(l); - TRACE("theory_case_split", tout << "case split literal "; smt::display(tout, l2, m, m_bool_var2expr.data()); tout << std::endl;); + TRACE(theory_case_split, tout << "case split literal "; smt::display(tout, l2, m, m_bool_var2expr.data()); tout << std::endl;); if (l2 == true_literal || l2 == false_literal || l2 == null_literal) continue; assign(~l2, js); if (inconsistent()) { - TRACE("theory_case_split", tout << "conflict detected!" << std::endl;); + TRACE(theory_case_split, tout << "conflict detected!" << std::endl;); return false; } } @@ -3257,7 +3258,7 @@ namespace smt { if (get_cancel_flag()) return; if (m_internalizing_assertions) return; flet _internalizing(m_internalizing_assertions, true); - TRACE("internalize_assertions", tout << "internalize_assertions()...\n";); + TRACE(internalize_assertions, tout << "internalize_assertions()...\n";); timeit tt(get_verbosity_level() >= 100, "smt.preprocessing"); unsigned qhead = 0; do { @@ -3286,9 +3287,9 @@ namespace smt { } while (qhead < m_asserted_formulas.get_num_formulas()); - TRACE("internalize_assertions", tout << "after internalize_assertions()...\n"; + TRACE(internalize_assertions, tout << "after internalize_assertions()...\n"; tout << "inconsistent: " << inconsistent() << "\n";); - TRACE("after_internalize_assertions", display(tout);); + TRACE(after_internalize_assertions, display(tout);); } void context::asserted_inconsistent() { @@ -3416,17 +3417,17 @@ namespace smt { m_assumptions.push_back(l); get_bdata(l.var()).m_assumption = true; SASSERT(is_relevant(l)); - TRACE("assumptions", tout << l << ":" << curr_assumption << " " << mk_pp(orig_assumption, m) << "\n";); + TRACE(assumptions, tout << l << ":" << curr_assumption << " " << mk_pp(orig_assumption, m) << "\n";); } } m_search_lvl = m_scope_lvl; SASSERT(asms.empty() || m_search_lvl > m_base_lvl); SASSERT(!asms.empty() || m_search_lvl == m_base_lvl); - TRACE("after_internalization", display(tout);); + TRACE(after_internalization, display(tout);); } void context::reset_assumptions() { - TRACE("unsat_core_bug", tout << "reset " << m_assumptions << "\n";); + TRACE(unsat_core_bug, tout << "reset " << m_assumptions << "\n";); for (literal lit : m_assumptions) get_bdata(lit.var()).m_assumption = false; m_assumptions.reset(); @@ -3456,7 +3457,7 @@ namespace smt { literal_vector::const_iterator end = m_conflict_resolution->end_unsat_core(); for (; it != end; ++it) { literal l = *it; - TRACE("unsat_core_bug", tout << "answer literal: " << l << "\n";); + TRACE(unsat_core_bug, tout << "answer literal: " << l << "\n";); SASSERT(get_bdata(l.var()).m_assumption); if (!m_literal2assumption.contains(l.index())) l.neg(); SASSERT(m_literal2assumption.contains(l.index())); @@ -3464,14 +3465,14 @@ namespace smt { already_found_assumptions.insert(l.index()); expr* orig_assumption = m_literal2assumption[l.index()]; m_unsat_core.push_back(orig_assumption); - TRACE("assumptions", tout << l << ": " << mk_pp(orig_assumption, m) << "\n";); + TRACE(assumptions, tout << l << ": " << mk_pp(orig_assumption, m) << "\n";); } } reset_assumptions(); pop_to_base_lvl(); // undo the push_scope() performed by init_assumptions m_search_lvl = m_base_lvl; std::sort(m_unsat_core.data(), m_unsat_core.data() + m_unsat_core.size(), ast_lt_proc()); - TRACE("unsat_core_bug", tout << "unsat core:\n" << m_unsat_core << "\n";); + TRACE(unsat_core_bug, tout << "unsat core:\n" << m_unsat_core << "\n";); validate_unsat_core(); // theory validation of unsat core for (theory* th : m_theory_set) { @@ -3507,7 +3508,7 @@ namespace smt { \brief Execute some finalization code after performing the search. */ lbool context::check_finalize(lbool r) { - TRACE("after_search", display(tout << "result: " << r << "\n"); + TRACE(after_search, display(tout << "result: " << r << "\n"); m_case_split_queue->display(tout << "case splits\n"); ); m_search_finalized = true; @@ -3633,12 +3634,12 @@ namespace smt { expr_ref_vector theory_assumptions(m); add_theory_assumptions(theory_assumptions); if (!theory_assumptions.empty()) { - TRACE("search", tout << "Adding theory assumptions to context" << std::endl;); + TRACE(search, tout << "Adding theory assumptions to context" << std::endl;); return check(0, nullptr, reset_cancel); } else { search_completion sc(*this); - TRACE("before_search", display(tout);); + TRACE(before_search, display(tout);); return check_finalize(search()); } } @@ -3698,12 +3699,12 @@ namespace smt { try { internalize_assertions(); add_theory_assumptions(asms); - TRACE("unsat_core_bug", tout << asms << '\n';); + TRACE(unsat_core_bug, tout << asms << '\n';); init_assumptions(asms); } catch (oom_exception&) { return l_undef; } - TRACE("before_search", display(tout);); + TRACE(before_search, display(tout);); r = search(); r = mk_unsat_core(r); } @@ -3714,7 +3715,7 @@ namespace smt { lbool context::check(expr_ref_vector const& cube, vector const& clauses) { if (!check_preamble(true)) return l_undef; - TRACE("before_search", display(tout);); + TRACE(before_search, display(tout);); setup_context(false); lbool r = l_undef; search_completion sc(*this); @@ -3765,7 +3766,7 @@ namespace smt { m_internal_completed = l_undef; if (m.has_type_vars() && !m_theories.get_plugin(poly_family_id)) register_plugin(alloc(theory_polymorphism, *this)); - TRACE("literal_occ", display_literal_num_occs(tout);); + TRACE(literal_occ, display_literal_num_occs(tout);); } void context::end_search() { @@ -3817,17 +3818,17 @@ namespace smt { timeit tt(get_verbosity_level() >= 100, "smt.stats"); reset_model(); SASSERT(at_search_level()); - TRACE("search", display(tout); display_enodes_lbls(tout);); - TRACE("search_detail", m_asserted_formulas.display(tout);); + TRACE(search, display(tout); display_enodes_lbls(tout);); + TRACE(search_detail, m_asserted_formulas.display(tout);); init_search(); for (auto const& [var, value] : m_values) initialize_value(var, value); flet l(m_searching, true); - TRACE("after_init_search", display(tout);); + TRACE(after_init_search, display(tout);); IF_VERBOSE(2, verbose_stream() << "(smt.searching)\n";); log_stats(); - TRACE("search_lite", tout << "searching...\n";); + TRACE(search_lite, tout << "searching...\n";); lbool status = l_undef; unsigned curr_lvl = m_scope_lvl; @@ -3835,8 +3836,8 @@ namespace smt { SASSERT(!inconsistent()); status = bounded_search(); - TRACE("search_bug", tout << "status: " << status << ", inconsistent: " << inconsistent() << "\n";); - TRACE("assigned_literals_per_lvl", display_num_assigned_literals_per_lvl(tout); + TRACE(search_bug, tout << "status: " << status << ", inconsistent: " << inconsistent() << "\n";); + TRACE(assigned_literals_per_lvl, display_num_assigned_literals_per_lvl(tout); tout << ", num_assigned: " << m_assigned_literals.size() << "\n";); if (!restart(status, curr_lvl)) { @@ -3844,7 +3845,7 @@ namespace smt { } } - TRACE("guessed_literals", + TRACE(guessed_literals, expr_ref_vector guessed_lits(m); get_guessed_literals(guessed_lits); tout << guessed_lits << "\n";); @@ -3903,7 +3904,7 @@ namespace smt { if (!inconsistent()) th->restart_eh(); - TRACE("mbqi_bug_detail", tout << "before instantiating quantifiers...\n";); + TRACE(mbqi_bug_detail, tout << "before instantiating quantifiers...\n";); if (!inconsistent()) m_qmanager->restart_eh(); if (inconsistent()) { @@ -3935,7 +3936,7 @@ namespace smt { if (m_fparams.m_restart_adaptive) verbose_stream() << " :agility " << m_agility; verbose_stream() << ")" << std::endl; verbose_stream().flush();); - TRACE("assigned_literals_per_lvl", display_num_assigned_literals_per_lvl(tout); tout << "\n";); + TRACE(assigned_literals_per_lvl, display_num_assigned_literals_per_lvl(tout); tout << "\n";); counter = 0; } } @@ -3943,7 +3944,7 @@ namespace smt { lbool context::bounded_search() { unsigned counter = 0; - TRACE("bounded_search", tout << "starting bounded search...\n";); + TRACE(bounded_search, tout << "starting bounded search...\n";); while (true) { while (!propagate()) { @@ -3951,7 +3952,7 @@ namespace smt { static bool first_propagate = true; if (first_propagate) { first_propagate = false; - TRACE("after_first_propagate", display(tout);); + TRACE(after_first_propagate, display(tout);); } }); @@ -3970,12 +3971,12 @@ namespace smt { return l_undef; if (m_num_conflicts_since_restart > m_restart_threshold && m_scope_lvl - m_base_lvl > 2) { - TRACE("search_bug", tout << "bounded-search return undef, inconsistent: " << inconsistent() << "\n";); + TRACE(search_bug, tout << "bounded-search return undef, inconsistent: " << inconsistent() << "\n";); return l_undef; // restart } if (m_num_conflicts > m_fparams.m_max_conflicts) { - TRACE("search_bug", tout << "bounded-search return undef, inconsistent: " << inconsistent() << "\n";); + TRACE(search_bug, tout << "bounded-search return undef, inconsistent: " << inconsistent() << "\n";); m_last_search_failure = NUM_CONFLICTS; return l_undef; } @@ -4004,7 +4005,7 @@ namespace smt { if (inconsistent()) return l_false; final_check_status fcs = final_check(); - TRACE("final_check_result", tout << "fcs: " << fcs << " last_search_failure: " << m_last_search_failure << "\n";); + TRACE(final_check_result, tout << "fcs: " << fcs << " last_search_failure: " << m_last_search_failure << "\n";); switch (fcs) { case FC_DONE: log_stats(); @@ -4053,7 +4054,7 @@ namespace smt { } final_check_status context::final_check() { - TRACE("final_check", tout << "final_check inconsistent: " << inconsistent() << "\n"; display(tout); display_normalized_enodes(tout);); + TRACE(final_check, tout << "final_check inconsistent: " << inconsistent() << "\n"; display(tout); display_normalized_enodes(tout);); CASSERT("relevancy", check_relevancy()); if (m_fparams.m_model_on_final_check) { @@ -4063,7 +4064,7 @@ namespace smt { } m_stats.m_num_final_checks++; - TRACE("final_check_stats", tout << "m_stats.m_num_final_checks = " << m_stats.m_num_final_checks << "\n";); + TRACE(final_check_stats, tout << "m_stats.m_num_final_checks = " << m_stats.m_num_final_checks << "\n";); final_check_status ok = m_qmanager->final_check_eh(false); if (ok != FC_DONE) @@ -4078,13 +4079,13 @@ namespace smt { failure f = OK; do { - TRACE("final_check_step", tout << "processing: " << m_final_check_idx << ", result: " << result << "\n";); + TRACE(final_check_step, tout << "processing: " << m_final_check_idx << ", result: " << result << "\n";); final_check_status ok; if (m_final_check_idx < num_th) { theory * th = m_theory_set[m_final_check_idx]; IF_VERBOSE(100, verbose_stream() << "(smt.final-check \"" << th->get_name() << "\")\n";); ok = th->final_check_eh(); - TRACE("final_check_step", tout << "final check '" << th->get_name() << " ok: " << ok << " inconsistent " << inconsistent() << "\n";); + TRACE(final_check_step, tout << "final check '" << th->get_name() << " ok: " << ok << " inconsistent " << inconsistent() << "\n";); if (get_cancel_flag()) { f = CANCELED; ok = FC_GIVEUP; @@ -4096,7 +4097,7 @@ namespace smt { } else { ok = m_qmanager->final_check_eh(true); - TRACE("final_check_step", tout << "quantifier ok: " << ok << " " << "inconsistent " << inconsistent() << "\n";); + TRACE(final_check_step, tout << "quantifier ok: " << ok << " " << "inconsistent " << inconsistent() << "\n";); } m_final_check_idx = (m_final_check_idx + 1) % range; @@ -4115,15 +4116,15 @@ namespace smt { } while (m_final_check_idx != old_idx); - TRACE("final_check_step", tout << "result: " << result << "\n";); + TRACE(final_check_step, tout << "result: " << result << "\n";); if (can_propagate()) { - TRACE("final_check_step", tout << "can propagate: continue...\n";); + TRACE(final_check_step, tout << "can propagate: continue...\n";); return FC_CONTINUE; } SASSERT(result != FC_DONE || check_th_diseq_propagation()); - TRACE("final_check_step", tout << "RESULT final_check: " << result << "\n";); + TRACE(final_check_step, tout << "RESULT final_check: " << result << "\n";); if (result == FC_GIVEUP && f != OK) m_last_search_failure = f; if (result == FC_DONE && has_lambda()) { @@ -4147,7 +4148,7 @@ namespace smt { for (unsigned i = head; i < sz; i++) { literal l = m_assigned_literals[i]; bool_var v = l.var(); - TRACE("forget_phase", tout << "forgetting phase of l: " << l << "\n";); + TRACE(forget_phase, tout << "forgetting phase of l: " << l << "\n";); m_bdata[v].m_phase_available = false; } } @@ -4208,7 +4209,7 @@ namespace smt { cache_generation(num_lits, lits, new_lvl); SASSERT(new_lvl < m_scope_lvl); - TRACE("resolve_conflict_bug", + TRACE(resolve_conflict_bug, tout << "m_scope_lvl: " << m_scope_lvl << ", new_lvl: " << new_lvl << ", lemma_intern_lvl: " << m_conflict_resolution->get_lemma_intern_lvl() << "\n"; tout << "num_lits: " << num_lits << "\n"; for (unsigned i = 0; i < num_lits; i++) { @@ -4242,8 +4243,8 @@ namespace smt { if (m.proofs_enabled()) { pr = m_conflict_resolution->get_lemma_proof(); // check_proof(pr); - TRACE("context_proof", tout << mk_ll_pp(pr, m);); - TRACE("context_proof_hack", + TRACE(context_proof, tout << mk_ll_pp(pr, m);); + TRACE(context_proof_hack, static ast_mark visited; ast_ll_pp(tout, m, pr, visited);); } @@ -4274,7 +4275,7 @@ namespace smt { // For reference, here is the buggy version // BEGIN BUGGY VERSION // bool_var v = get_bool_var(atom); - // CTRACE("resolve_conflict_crash", v == null_bool_var, tout << mk_ismt2_pp(atom, m) << "\n";); + // CTRACE(resolve_conflict_crash, v == null_bool_var, tout << mk_ismt2_pp(atom, m) << "\n";); // SASSERT(v != null_bool_var); // literal new_l = literal(v, l.sign()); // END BUGGY VERSION @@ -4285,7 +4286,7 @@ namespace smt { if (relevancy()) restore_relevancy(num_lits, lits); // Resetting the cache manually because I did not invoke pop_scope, but pop_scope_core reset_cache_generation(); - TRACE("resolve_conflict_bug", + TRACE(resolve_conflict_bug, tout << "AFTER m_scope_lvl: " << m_scope_lvl << ", new_lvl: " << new_lvl << ", lemma_intern_lvl: " << m_conflict_resolution->get_lemma_intern_lvl() << "\n"; tout << "num_lits: " << num_lits << "\n"; @@ -4303,7 +4304,7 @@ namespace smt { expr* real_atom; VERIFY(m.is_not(expr_lits.get(i), real_atom)); // the sign must have flipped when internalizing - CTRACE("resolve_conflict_bug", real_atom != bool_var2expr(l.var()), tout << mk_pp(real_atom, m) << "\n" << mk_pp(bool_var2expr(l.var()), m) << "\n";); + CTRACE(resolve_conflict_bug, real_atom != bool_var2expr(l.var()), tout << mk_pp(real_atom, m) << "\n" << mk_pp(bool_var2expr(l.var()), m) << "\n";); SASSERT(real_atom == bool_var2expr(l.var())); } else { @@ -4342,11 +4343,11 @@ namespace smt { while (m.is_not(unit, unit)) unit_sign = !unit_sign; m_units_to_reassert.push_back({ expr_ref(unit, m), unit_sign, is_relevant(unit) }); - TRACE("reassert_units", tout << "asserting " << mk_pp(unit, m) << " #" << unit->get_id() << " " << unit_sign << " @ " << m_scope_lvl << "\n";); + TRACE(reassert_units, tout << "asserting " << mk_pp(unit, m) << " #" << unit->get_id() << " " << unit_sign << " @ " << m_scope_lvl << "\n";); } m_conflict_resolution->release_lemma_atoms(); - TRACE("context_lemma", tout << "new lemma: "; + TRACE(context_lemma, tout << "new lemma: "; literal_vector v(num_lits, lits); std::sort(v.begin(), v.end()); for (unsigned i = 0; i < num_lits; i++) { @@ -4521,7 +4522,7 @@ namespace smt { expr * _lhs = lhs->get_expr(); expr * _rhs = rhs->get_expr(); expr * eq = mk_eq_atom(_lhs, _rhs); - TRACE("assume_eq", tout << "creating interface eq:\n" << mk_pp(eq, m) << "\n";); + TRACE(assume_eq, tout << "creating interface eq:\n" << mk_pp(eq, m) << "\n";); if (m.is_false(eq)) { return false; } @@ -4550,26 +4551,26 @@ namespace smt { } r = true; m_stats.m_num_interface_eqs++; - TRACE("assume_eq", tout << "new internalization.\n";); + TRACE(assume_eq, tout << "new internalization.\n";); } bool_var v = get_bool_var(eq); bool_var_data & d = m_bdata[v]; if (!d.try_true_first()) { set_true_first_flag(v); r = true; - TRACE("assume_eq", tout << "marked as ieq.\n";); + TRACE(assume_eq, tout << "marked as ieq.\n";); } if (get_assignment(v) == l_undef) { - TRACE("assume_eq", tout << "variable is unassigned.\n";); + TRACE(assume_eq, tout << "variable is unassigned.\n";); r = true; } if (relevancy() && !is_relevant(eq)) { - TRACE("assume_eq", tout << "marking eq as relevant.\n";); + TRACE(assume_eq, tout << "marking eq as relevant.\n";); mark_as_relevant(eq); r = true; } - TRACE("assume_eq", tout << "variable value: " << get_assignment(v) << "\n";); - TRACE("assume_eq", tout << "assume_eq result: " << r << "\n";); + TRACE(assume_eq, tout << "variable value: " << get_assignment(v) << "\n";); + TRACE(assume_eq, tout << "assume_eq result: " << r << "\n";); return r; } @@ -4606,7 +4607,7 @@ namespace smt { if (fid != th_id && fid != m.get_basic_family_id()) { if (is_beta_redex(parent, n)) continue; - TRACE("is_shared", tout << enode_pp(n, *this) + TRACE(is_shared, tout << enode_pp(n, *this) << "\nis shared because of:\n" << enode_pp(parent, *this) << "\n";); n->set_is_shared(l_true); @@ -4676,7 +4677,7 @@ namespace smt { if (has_case_splits()) return false; fcs = final_check(); - TRACE("opt", tout << (refinalize?"refinalize":"no-op") << " " << fcs << "\n";); + TRACE(opt, tout << (refinalize?"refinalize":"no-op") << " " << fcs << "\n";); } if (fcs == FC_DONE) { reset_model(); @@ -4686,7 +4687,7 @@ namespace smt { void context::mk_proto_model() { if (m_model || m_proto_model || has_case_splits()) return; - TRACE("get_model", + TRACE(get_model, display(tout); display_normalized_enodes(tout); display_enodes_lbls(tout); @@ -4694,18 +4695,18 @@ namespace smt { ); failure fl = get_last_search_failure(); if (fl == MEMOUT || fl == CANCELED || fl == NUM_CONFLICTS || fl == RESOURCE_LIMIT) { - TRACE("get_model", tout << "last search failure: " << fl << "\n";); + TRACE(get_model, tout << "last search failure: " << fl << "\n";); } else if (m_fparams.m_model || m_fparams.m_model_on_final_check || (m_qmanager->has_quantifiers() && m_qmanager->model_based())) { m_model_generator->reset(); m_proto_model = m_model_generator->mk_model(); m_qmanager->adjust_model(m_proto_model.get()); - TRACE("mbqi_bug", tout << "before complete_partial_funcs:\n"; model_pp(tout, *m_proto_model);); + TRACE(mbqi_bug, tout << "before complete_partial_funcs:\n"; model_pp(tout, *m_proto_model);); m_proto_model->complete_partial_funcs(false); - TRACE("mbqi_bug", tout << "before cleanup:\n"; model_pp(tout, *m_proto_model);); + TRACE(mbqi_bug, tout << "before cleanup:\n"; model_pp(tout, *m_proto_model);); m_proto_model->cleanup(); - TRACE("mbqi_bug", tout << "after cleanup:\n"; model_pp(tout, *m_proto_model);); + TRACE(mbqi_bug, tout << "after cleanup:\n"; model_pp(tout, *m_proto_model);); IF_VERBOSE(11, model_pp(verbose_stream(), *m_proto_model);); } } @@ -4714,7 +4715,7 @@ namespace smt { if (!m_unsat_proof) { m_unsat_proof = m_clause_proof.get_proof(inconsistent()); } - TRACE("context", tout << m_unsat_proof << "\n";); + TRACE(context, tout << m_unsat_proof << "\n";); return m_unsat_proof; } diff --git a/src/smt/smt_context.h b/src/smt/smt_context.h index 865d140e5..3dbadc1cb 100644 --- a/src/smt/smt_context.h +++ b/src/smt/smt_context.h @@ -1201,7 +1201,7 @@ namespace smt { if (act > ACTIVITY_LIMIT) rescale_bool_var_activity(); m_case_split_queue->activity_increased_eh(v); - TRACE("case_split", tout << "v" << v << " " << m_bvar_inc << " -> " << act << "\n";); + TRACE(case_split, tout << "v" << v << " " << m_bvar_inc << " -> " << act << "\n";); } protected: diff --git a/src/smt/smt_context_inv.cpp b/src/smt/smt_context_inv.cpp index f0e8fb59b..59ed43e1b 100644 --- a/src/smt/smt_context_inv.cpp +++ b/src/smt/smt_context_inv.cpp @@ -55,7 +55,7 @@ namespace smt { watch_list::clause_iterator end = wl.end_clause(); for (; it != end; ++it) { clause * cls = *it; - TRACE("watch_list", tout << "l: "; display_literal(tout, l); tout << "\n"; + TRACE(watch_list, tout << "l: "; display_literal(tout, l); tout << "\n"; display_clause(tout, cls); tout << "\n";); SASSERT(l == cls->get_literal(0) || l == cls->get_literal(1)); } @@ -92,7 +92,7 @@ namespace smt { n->get_num_args() == 0 || (!is_true_eq && (!n->is_cgc_enabled() || n->is_cgr() == (m_cg_table.contains_ptr(n)))) || (is_true_eq && !m_cg_table.contains_ptr(n)); - CTRACE("check_enode", !cg_inv, + CTRACE(check_enode, !cg_inv, tout << "n: #" << n->get_expr_id() << ", m_cg: #" << n->m_cg->get_expr_id() << ", contains: " << m_cg_table.contains(n) << "\n"; display(tout);); SASSERT(cg_inv); return true; @@ -116,7 +116,7 @@ namespace smt { bool context::check_missing_clause_propagation(clause_vector const & v) const { for (clause * cls : v) { - CTRACE("missing_propagation", is_unit_clause(cls), display_clause_detail(tout, cls); tout << "\n";); + CTRACE(missing_propagation, is_unit_clause(cls), display_clause_detail(tout, cls); tout << "\n";); SASSERT(!is_unit_clause(cls)); } return true; @@ -159,7 +159,7 @@ namespace smt { if (n->get_root() != n2->get_root()) { if (n->is_true_eq() && n2->is_true_eq()) continue; - CTRACE("missing_propagation", congruent(n, n2), + CTRACE(missing_propagation, congruent(n, n2), tout << mk_pp(n->get_expr(), m) << "\n" << mk_pp(n2->get_expr(), m) << "\n"; display(tout);); SASSERT(!congruent(n, n2)); @@ -174,7 +174,7 @@ namespace smt { if (m.is_bool(n->get_expr()) && get_assignment(n) == l_undef) { enode * first = n; do { - CTRACE("missing_propagation", get_assignment(n) != l_undef, + CTRACE(missing_propagation, get_assignment(n) != l_undef, tout << mk_pp(first->get_expr(), m) << "\nassignment: " << get_assignment(first) << "\n" << mk_pp(n->get_expr(), m) << "\nassignment: " << get_assignment(n) << "\n";); SASSERT(get_assignment(n) == l_undef); @@ -209,17 +209,17 @@ namespace smt { for (unsigned i = 0; i < sz; i++) { expr * n = m_asserted_formulas.get_formula(i); if (m.is_or(n)) { - CTRACE("relevancy_bug", !is_relevant(n), tout << "n: " << mk_ismt2_pp(n, m) << "\n";); + CTRACE(relevancy_bug, !is_relevant(n), tout << "n: " << mk_ismt2_pp(n, m) << "\n";); SASSERT(is_relevant(n)); - TRACE("check_relevancy", tout << "checking:\n" << mk_ll_pp(n, m) << "\n";); + TRACE(check_relevancy, tout << "checking:\n" << mk_ll_pp(n, m) << "\n";); SASSERT(m_relevancy_propagator->check_relevancy_or(to_app(n), true)); } else if (m.is_not(n)) { - CTRACE("relevancy_bug", !is_relevant(to_app(n)->get_arg(0)), tout << "n: " << mk_ismt2_pp(n, m) << "\n";); + CTRACE(relevancy_bug, !is_relevant(to_app(n)->get_arg(0)), tout << "n: " << mk_ismt2_pp(n, m) << "\n";); SASSERT(is_relevant(to_app(n)->get_arg(0))); } else { - CTRACE("relevancy_bug", !is_relevant(n), tout << "n: " << mk_ismt2_pp(n, m) << "\n";); + CTRACE(relevancy_bug, !is_relevant(n), tout << "n: " << mk_ismt2_pp(n, m) << "\n";); SASSERT(is_relevant(n)); } } @@ -234,7 +234,7 @@ namespace smt { for (enode* e : m_enodes) { if (m.is_bool(e->get_expr())) { enode * r = e->get_root(); - CTRACE("eqc_bool", get_assignment(e) != get_assignment(r), + CTRACE(eqc_bool, get_assignment(e) != get_assignment(r), tout << "#" << e->get_expr_id() << "\n" << mk_pp(e->get_expr(), m) << "\n"; tout << "#" << r->get_expr_id() << "\n" << mk_pp(r->get_expr(), m) << "\n"; tout << "assignments: " << get_assignment(e) << " " << get_assignment(r) << "\n"; @@ -262,7 +262,7 @@ namespace smt { (= get_enode(v1') get_enode(v2')) is congruent to (= lhs rhs). */ bool context::check_th_diseq_propagation() const { - TRACE("check_th_diseq_propagation", tout << "m_propagated_th_diseqs.size() " << m_propagated_th_diseqs.size() << "\n";); + TRACE(check_th_diseq_propagation, tout << "m_propagated_th_diseqs.size() " << m_propagated_th_diseqs.size() << "\n";); unsigned num = get_num_bool_vars(); if (inconsistent() || get_manager().limit().is_canceled()) { return true; @@ -271,20 +271,20 @@ namespace smt { if (has_enode(v)) { enode * n = bool_var2enode(v); if (n->is_eq() && is_relevant(n) && get_assignment(v) == l_false && !m.is_iff(n->get_expr())) { - TRACE("check_th_diseq_propagation", tout << "checking: #" << n->get_expr_id() << " " << mk_bounded_pp(n->get_expr(), m) << "\n";); + TRACE(check_th_diseq_propagation, tout << "checking: #" << n->get_expr_id() << " " << mk_bounded_pp(n->get_expr(), m) << "\n";); enode * lhs = n->get_arg(0)->get_root(); enode * rhs = n->get_arg(1)->get_root(); if (rhs->is_interpreted() && lhs->is_interpreted()) continue; if (lhs == rhs) continue; - TRACE("check_th_diseq_propagation", tout << "num. theory_vars: " << lhs->get_num_th_vars() << " " + TRACE(check_th_diseq_propagation, tout << "num. theory_vars: " << lhs->get_num_th_vars() << " " << mk_pp(lhs->get_expr()->get_sort(), m) << "\n";); theory_var_list * l = lhs->get_th_var_list(); while (l) { theory_id th_id = l->get_id(); theory * th = get_theory(th_id); - TRACE("check_th_diseq_propagation", tout << "checking theory: " << m.get_family_name(th_id) << "\n";); + TRACE(check_th_diseq_propagation, tout << "checking theory: " << m.get_family_name(th_id) << "\n";); // if the theory doesn't use diseqs, then the diseqs are not propagated. if (th->use_diseqs() && rhs->get_th_var(th_id) != null_theory_var) { bool found = false; @@ -296,13 +296,13 @@ namespace smt { if ((lhs == lhs_prime && rhs == rhs_prime) || (rhs == lhs_prime && lhs == rhs_prime)) { - TRACE("check_th_diseq_propagation", tout << "ok v" << v << " " << get_assignment(v) << "\n";); + TRACE(check_th_diseq_propagation, tout << "ok v" << v << " " << get_assignment(v) << "\n";); found = true; break; } } } - CTRACE("check_th_diseq_propagation", !found, + CTRACE(check_th_diseq_propagation, !found, tout << "checking theory: " << m.get_family_name(th_id) << "\n" << "root: #" << n->get_root()->get_expr_id() << " node: #" << n->get_expr_id() << "\n" @@ -324,7 +324,7 @@ namespace smt { enode * n1 = p.first; enode * n2 = p.second; if (n1->get_root() == n2->get_root()) { - TRACE("diseq_bug", + TRACE(diseq_bug, tout << "n1: #" << n1->get_expr_id() << ", n2: #" << n2->get_expr_id() << ", r: #" << n1->get_root()->get_expr_id() << "\n"; tout << "n1 parents:\n"; display_parent_eqs(tout, n1); @@ -371,7 +371,7 @@ namespace smt { case l_true: if (!m_proto_model->eval(n, res, false)) return true; - CTRACE("model", !m.is_true(res), tout << n << " evaluates to " << res << "\n" << *m_proto_model << "\n";); + CTRACE(model, !m.is_true(res), tout << n << " evaluates to " << res << "\n" << *m_proto_model << "\n";); if (m.is_false(res)) { return false; } @@ -379,7 +379,7 @@ namespace smt { case l_false: if (!m_proto_model->eval(n, res, false)) return true; - CTRACE("model", !m.is_false(res), tout << n << " evaluates to " << res << "\n" << *m_proto_model << "\n";); + CTRACE(model, !m.is_false(res), tout << n << " evaluates to " << res << "\n" << *m_proto_model << "\n";); if (m.is_true(res)) { return false; } diff --git a/src/smt/smt_context_pp.cpp b/src/smt/smt_context_pp.cpp index a91a437a2..853dc4de3 100644 --- a/src/smt/smt_context_pp.cpp +++ b/src/smt/smt_context_pp.cpp @@ -468,7 +468,7 @@ namespace smt { unsigned context::display_lemma_as_smt_problem(unsigned num_antecedents, literal const * antecedents, literal consequent, symbol const& logic) const { std::string name = mk_lemma_name(); std::ofstream out(name); - TRACE("lemma", tout << name << "\n";); + TRACE(lemma, tout << name << "\n";); display_lemma_as_smt_problem(out, num_antecedents, antecedents, consequent, logic); out.close(); return m_lemma_id; @@ -524,7 +524,7 @@ namespace smt { literal consequent, symbol const& logic) const { std::string name = mk_lemma_name(); std::ofstream out(name); - TRACE("lemma", tout << name << "\n"; + TRACE(lemma, tout << name << "\n"; display_lemma_as_smt_problem(tout, num_antecedents, antecedents, num_eq_antecedents, eq_antecedents, consequent, logic); ); display_lemma_as_smt_problem(out, num_antecedents, antecedents, num_eq_antecedents, eq_antecedents, consequent, logic); diff --git a/src/smt/smt_enode.cpp b/src/smt/smt_enode.cpp index 86b83af4c..69a0784da 100644 --- a/src/smt/smt_enode.cpp +++ b/src/smt/smt_enode.cpp @@ -59,7 +59,7 @@ namespace smt { if (update_children_parent) arg->get_root()->m_parents.push_back(n); } - TRACE("mk_enode_detail", tout << "new enode suppress_args: " << n->m_suppress_args << "\n";); + TRACE(mk_enode_detail, tout << "new enode suppress_args: " << n->m_suppress_args << "\n";); SASSERT(n->m_suppress_args == suppress_args); return n; } diff --git a/src/smt/smt_farkas_util.cpp b/src/smt/smt_farkas_util.cpp index 163f96bb0..ba37bd623 100644 --- a/src/smt/smt_farkas_util.cpp +++ b/src/smt/smt_farkas_util.cpp @@ -318,7 +318,7 @@ namespace smt { } expr_ref farkas_util::get() { - TRACE("arith", + TRACE(arith, for (unsigned i = 0; i < m_coeffs.size(); ++i) { tout << m_coeffs[i] << " * (" << mk_pp(m_ineqs[i].get(), m) << ") "; } @@ -354,7 +354,7 @@ namespace smt { res = extract_consequence(0, m_coeffs.size()); } - TRACE("arith", + TRACE(arith, for (unsigned i = 0; i < m_coeffs.size(); ++i) { tout << m_coeffs[i] << " * (" << mk_pp(m_ineqs[i].get(), m) << ") "; } diff --git a/src/smt/smt_for_each_relevant_expr.cpp b/src/smt/smt_for_each_relevant_expr.cpp index 30b69a149..28da7c70f 100644 --- a/src/smt/smt_for_each_relevant_expr.cpp +++ b/src/smt/smt_for_each_relevant_expr.cpp @@ -38,7 +38,7 @@ namespace smt { for (; it != end; ++it) { symbol const & s = *it; if (s.contains('@')) { - TRACE("for_each_relevant_expr", tout << "@ label: " << mk_pp(n, m_manager) << "\n";); + TRACE(for_each_relevant_expr, tout << "@ label: " << mk_pp(n, m_manager) << "\n";); count += 1; } } @@ -74,7 +74,7 @@ namespace smt { } if (count > 1 && m_first) { - TRACE("for_each_relevant_expr", tout << mk_pp(n, m_manager) << "\n";); + TRACE(for_each_relevant_expr, tout << mk_pp(n, m_manager) << "\n";); m_first = false; } @@ -108,7 +108,7 @@ namespace smt { } if (count > 1 && m_first) { - TRACE("for_each_relevant_expr", tout << mk_pp(n, m_manager) << "\n";); + TRACE(for_each_relevant_expr, tout << mk_pp(n, m_manager) << "\n";); m_first = false; } @@ -121,7 +121,7 @@ namespace smt { } void for_each_relevant_expr::operator()(expr * n) { - TRACE("for_each_relevant_expr", tout << "#" << n->get_id() << "\n";); + TRACE(for_each_relevant_expr, tout << "#" << n->get_id() << "\n";); } void for_each_relevant_expr::reset() { @@ -140,8 +140,8 @@ namespace smt { } void for_each_relevant_expr::process(expr * n) { - TRACE("for_each_relevant_expr", tout << "processing:\n" << mk_bounded_pp(n, m_manager) << "\n";); - TRACE("for_each_relevant_expr", tout << "processing:\n" << mk_pp(n, m_manager) << "\n";); + TRACE(for_each_relevant_expr, tout << "processing:\n" << mk_bounded_pp(n, m_manager) << "\n";); + TRACE(for_each_relevant_expr, tout << "processing:\n" << mk_pp(n, m_manager) << "\n";); if (m_cache.contains(n)) return; m_todo.reset(); @@ -196,7 +196,7 @@ namespace smt { */ void for_each_relevant_expr::process_relevant_child(app * n, lbool val) { unsigned sz = n->get_num_args(); - TRACE("for_each_relevant_expr", tout << val << " " << mk_bounded_pp(n, m_manager) << "\n";); + TRACE(for_each_relevant_expr, tout << val << " " << mk_bounded_pp(n, m_manager) << "\n";); for (unsigned i = 0; i < sz; i++) { expr * arg = n->get_arg(i); if (!is_relevant(arg)) @@ -204,7 +204,7 @@ namespace smt { if (get_assignment(arg) != val) continue; if (m_cache.contains(arg)) { - TRACE("for_each_relevant_expr", tout << "justified by: " << mk_bounded_pp(arg, m_manager) << "\n";); + TRACE(for_each_relevant_expr, tout << "justified by: " << mk_bounded_pp(arg, m_manager) << "\n";); return; // the current child justifies n. } } @@ -215,7 +215,7 @@ namespace smt { if (get_assignment(arg) != val) continue; - TRACE("for_each_relevant_expr", tout << "to_process: " << mk_bounded_pp(arg, m_manager) << "\n";); + TRACE(for_each_relevant_expr, tout << "to_process: " << mk_bounded_pp(arg, m_manager) << "\n";); m_todo.push_back(arg); return; @@ -271,7 +271,7 @@ namespace smt { void collect_relevant_label_lits::operator()(expr * n) { - TRACE("for_each_relevant_expr", + TRACE(for_each_relevant_expr, tout << "label: " << m_manager.is_label_lit(n) << " " << " " << get_assignment(n) << " " << mk_bounded_pp(n, m_manager) << "\n";); if (!m_manager.is_label_lit(n)) @@ -283,7 +283,7 @@ namespace smt { void collect_relevant_labels::operator()(expr * n) { bool pos; - TRACE("for_each_relevant_expr", + TRACE(for_each_relevant_expr, tout << "label: " << m_manager.is_label(n) << " " << get_assignment(n) << " " << mk_bounded_pp(n, m_manager) << "\n";); if (!m_manager.is_label(n, pos)) diff --git a/src/smt/smt_implied_equalities.cpp b/src/smt/smt_implied_equalities.cpp index a2a9098b4..151cee0ab 100644 --- a/src/smt/smt_implied_equalities.cpp +++ b/src/smt/smt_implied_equalities.cpp @@ -98,7 +98,7 @@ namespace { m_solver.assert_expr(m.mk_not(m.mk_eq(s, t))); bool is_eq = l_false == m_solver.check_sat(0,nullptr); m_solver.pop(1); - TRACE("get_implied_equalities", tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";); + TRACE(get_implied_equalities, tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";); if (is_eq) { m_uf.merge(terms[i].id, terms[j].id); if (!non_values.contains(j)) { @@ -126,7 +126,7 @@ namespace { bool is_eq = l_false == m_solver.check_sat(0,nullptr); m_solver.pop(1); m_stats_timer.stop(); - TRACE("get_implied_equalities", tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";); + TRACE(get_implied_equalities, tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";); if (is_eq) { m_uf.merge(terms[i].id, terms[j].id); break; @@ -200,10 +200,10 @@ namespace { for (unsigned i = 0; i < terms.size(); ++i) { expr* t = terms[i].term; vl = (*model)(t); - TRACE("get_implied_equalities", tout << mk_pp(t, m) << " |-> " << mk_pp(vl, m) << "\n";); + TRACE(get_implied_equalities, tout << mk_pp(t, m) << " |-> " << mk_pp(vl, m) << "\n";); reduce_value(model, vl); if (!m.is_value(vl)) { - TRACE("get_implied_equalities", tout << "Not a value: " << mk_pp(vl, m) << "\n";); + TRACE(get_implied_equalities, tout << "Not a value: " << mk_pp(vl, m) << "\n";); non_values.insert(i); continue; } @@ -217,7 +217,7 @@ namespace { m_solver.assert_expr(m.mk_not(m.mk_eq(t, s))); lbool is_sat = m_solver.check_sat(0,nullptr); m_solver.pop(1); - TRACE("get_implied_equalities", tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << is_sat << "\n";); + TRACE(get_implied_equalities, tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << is_sat << "\n";); if (is_sat == l_false) { found = true; m_uf.merge(terms[i].id, terms[vec[j]].id); @@ -234,7 +234,7 @@ namespace { if (!non_values.empty()) { - TRACE("get_implied_equalities", model_smt2_pp(tout, m, *model, 0);); + TRACE(get_implied_equalities, model_smt2_pp(tout, m, *model, 0);); get_implied_equalities_filter_basic(non_values, terms); //get_implied_equalities_basic(terms); } @@ -351,7 +351,7 @@ namespace { class_ids[term_ids[i].id] = m_uf.find(term_ids[i].id); } } - TRACE("get_implied_equalities", + TRACE(get_implied_equalities, for (unsigned i = 0; i < num_terms; ++i) { tout << mk_pp(terms[i], m) << " |-> " << class_ids[i] << "\n"; }); diff --git a/src/smt/smt_induction.cpp.disabled b/src/smt/smt_induction.cpp.disabled index 51cdb5e33..363d2fc7a 100644 --- a/src/smt/smt_induction.cpp.disabled +++ b/src/smt/smt_induction.cpp.disabled @@ -56,7 +56,7 @@ literal_vector collect_induction_literals::pre_select() { continue; result.push_back(lit); } - TRACE("induction", ctx.display(tout << "literal index: " << m_literal_index << "\n" << result << "\n");); + TRACE(induction, ctx.display(tout << "literal index: " << m_literal_index << "\n" << result << "\n");); ctx.push_trail(value_trail(m_literal_index)); m_literal_index = ctx.assigned_literals().size(); diff --git a/src/smt/smt_internalizer.cpp b/src/smt/smt_internalizer.cpp index ccdfc5ccb..c15505ab0 100644 --- a/src/smt/smt_internalizer.cpp +++ b/src/smt/smt_internalizer.cpp @@ -201,14 +201,14 @@ namespace smt { // stack overflow. // a caveat is that theory internalizers do rely on recursive descent so // internalization over these follows top-down - TRACE("deep_internalize", tout << "expression is deep: #" << n->get_id() << "\n" << mk_ll_pp(n, m);); + TRACE(deep_internalize, tout << "expression is deep: #" << n->get_id() << "\n" << mk_ll_pp(n, m);); ts_todo.push_back(expr_bool_pair(n, true)); } } svector sorted_exprs; top_sort_expr(exprs, num_exprs, sorted_exprs); - TRACE("deep_internalize", for (auto & kv : sorted_exprs) tout << "#" << kv.first->get_id() << " " << kv.second << "\n"; ); + TRACE(deep_internalize, for (auto & kv : sorted_exprs) tout << "#" << kv.first->get_id() << " " << kv.second << "\n"; ); for (auto & kv : sorted_exprs) { expr* e = kv.first; SASSERT(should_internalize_rec(e)); @@ -226,10 +226,10 @@ namespace smt { \remark pr is 0 if proofs are disabled. */ void context::internalize_assertion(expr * n, proof * pr, unsigned generation) { - TRACE("internalize_assertion", tout << mk_pp(n, m) << "\n";); - TRACE("internalize_assertion_ll", tout << mk_ll_pp(n, m) << "\n";); - TRACE("generation", tout << "generation: " << m_generation << "\n";); - TRACE("incompleteness_bug", tout << "[internalize-assertion]: #" << n->get_id() << "\n";); + TRACE(internalize_assertion, tout << mk_pp(n, m) << "\n";); + TRACE(internalize_assertion_ll, tout << mk_ll_pp(n, m) << "\n";); + TRACE(generation, tout << "generation: " << m_generation << "\n";); + TRACE(incompleteness_bug, tout << "[internalize-assertion]: #" << n->get_id() << "\n";); flet l(m_generation, generation); m_stats.m_max_generation = std::max(m_generation, m_stats.m_max_generation); internalize_deep(n); @@ -312,7 +312,7 @@ namespace smt { #define DISTINCT_SZ_THRESHOLD 32 void context::assert_distinct(app * n, proof * pr) { - TRACE("assert_distinct", tout << mk_pp(n, m) << "\n";); + TRACE(assert_distinct, tout << mk_pp(n, m) << "\n";); unsigned num_args = n->get_num_args(); if (num_args == 0 || num_args <= DISTINCT_SZ_THRESHOLD || m.proofs_enabled()) { assert_default(n, pr); @@ -327,7 +327,7 @@ namespace smt { enode * e = mk_enode(val, false, false, true); e->mark_as_interpreted(); app_ref eq(m.mk_eq(fapp, val), m); - TRACE("assert_distinct", tout << "eq: " << mk_pp(eq, m) << "\n";); + TRACE(assert_distinct, tout << "eq: " << mk_pp(eq, m) << "\n";); assert_default(eq, nullptr); mark_as_relevant(eq.get()); // TODO: we may want to hide the auxiliary values val and the function f from the model. @@ -366,8 +366,8 @@ namespace smt { } void context::internalize_rec(expr * n, bool gate_ctx) { - TRACE("internalize", tout << "internalizing:\n" << mk_pp(n, m) << "\n";); - TRACE("internalize_bug", tout << "internalizing:\n" << mk_bounded_pp(n, m) << "\n";); + TRACE(internalize, tout << "internalizing:\n" << mk_pp(n, m) << "\n";); + TRACE(internalize_bug, tout << "internalizing:\n" << mk_bounded_pp(n, m) << "\n";); if (is_var(n)) { throw default_exception("Formulas should not contain unbound variables"); } @@ -388,7 +388,7 @@ namespace smt { \brief Internalize the given formula into the logical context. */ void context::internalize_formula(expr * n, bool gate_ctx) { - TRACE("internalize_bug", tout << "internalize formula: #" << n->get_id() << ", gate_ctx: " << gate_ctx << "\n" << mk_pp(n, m) << "\n";); + TRACE(internalize_bug, tout << "internalize formula: #" << n->get_id() << ", gate_ctx: " << gate_ctx << "\n" << mk_pp(n, m) << "\n";); SASSERT(m.is_bool(n)); if (m.is_true(n) || m.is_false(n)) return; @@ -403,19 +403,19 @@ namespace smt { if (b_internalized(n)) { // n was already internalized as a boolean. bool_var v = get_bool_var(n); - TRACE("internalize_bug", tout << "#" << n->get_id() << " already has bool_var v" << v << "\n";); + TRACE(internalize_bug, tout << "#" << n->get_id() << " already has bool_var v" << v << "\n";); // n was already internalized as boolean, but an enode was // not associated with it. So, an enode is necessary, if // n is not in the context of a gate and is an application. if (!gate_ctx && is_app(n)) { if (e_internalized(n)) { - TRACE("internalize_bug", tout << "forcing enode #" << n->get_id() << " to merge with t/f\n";); + TRACE(internalize_bug, tout << "forcing enode #" << n->get_id() << " to merge with t/f\n";); enode * e = get_enode(to_app(n)); set_merge_tf(e, v, false); } else { - TRACE("internalize_bug", tout << "creating enode for #" << n->get_id() << "\n";); + TRACE(internalize_bug, tout << "creating enode for #" << n->get_id() << "\n";); mk_enode(to_app(n), true, /* suppress arguments, we not not use CC for this kind of enode */ true, /* bool enode must be merged with true/false, since it is not in the context of a gate */ @@ -451,7 +451,7 @@ namespace smt { bool_var v = get_bool_var(n); bool_var_data & d = get_bdata(v); d.set_eq_flag(); - TRACE("internalize", tout << mk_pp(n, m) << " " << literal(v, false) << "\n";); + TRACE(internalize, tout << mk_pp(n, m) << " " << literal(v, false) << "\n";); sort * s = n->get_arg(0)->get_sort(); theory * th = m_theories.get_plugin(s->get_family_id()); @@ -463,7 +463,7 @@ namespace smt { \brief Internalize distinct constructor. */ void context::internalize_distinct(app * n, bool gate_ctx) { - TRACE("distinct", tout << "internalizing distinct: " << mk_pp(n, m) << "\n";); + TRACE(distinct, tout << "internalizing distinct: " << mk_pp(n, m) << "\n";); SASSERT(!b_internalized(n)); SASSERT(m.is_distinct(n)); bool_var v = mk_bool_var(n); @@ -493,12 +493,12 @@ namespace smt { bool context::internalize_theory_atom(app * n, bool gate_ctx) { SASSERT(!b_internalized(n)); theory * th = m_theories.get_plugin(n->get_family_id()); - TRACE("datatype_bug", tout << "internalizing theory atom:\n" << mk_pp(n, m) << "\n";); + TRACE(datatype_bug, tout << "internalizing theory atom:\n" << mk_pp(n, m) << "\n";); if (!th || !th->internalize_atom(n, gate_ctx)) return false; - TRACE("datatype_bug", tout << "internalization succeeded\n" << mk_pp(n, m) << "\n";); + TRACE(datatype_bug, tout << "internalization succeeded\n" << mk_pp(n, m) << "\n";); SASSERT(b_internalized(n)); - TRACE("internalize_theory_atom", tout << "internalizing theory atom: #" << n->get_id() << "\n";); + TRACE(internalize_theory_atom, tout << "internalizing theory atom: #" << n->get_id() << "\n";); bool_var v = get_bool_var(n); if (!gate_ctx) { // if the formula is not in the context of a gate, then it @@ -561,8 +561,8 @@ namespace smt { context. */ void context::internalize_quantifier(quantifier * q, bool gate_ctx) { - TRACE("internalize_quantifier", tout << mk_pp(q, m) << "\n";); - CTRACE("internalize_quantifier_zero", q->get_weight() == 0, tout << mk_pp(q, m) << "\n";); + TRACE(internalize_quantifier, tout << mk_pp(q, m) << "\n";); + CTRACE(internalize_quantifier_zero, q->get_weight() == 0, tout << mk_pp(q, m) << "\n";); SASSERT(gate_ctx); // limitation of the current implementation SASSERT(!b_internalized(q)); if (!is_forall(q)) @@ -583,7 +583,7 @@ namespace smt { void context::internalize_lambda(quantifier * q) { - TRACE("internalize_quantifier", tout << mk_pp(q, m) << "\n";); + TRACE(internalize_quantifier, tout << mk_pp(q, m) << "\n";); SASSERT(is_lambda(q)); if (e_internalized(q)) return; @@ -617,12 +617,12 @@ namespace smt { bool context::has_lambda() { for (auto const & [n, q] : m_lambdas) { if (n->get_class_size() != 1) { - TRACE("context", tout << "class size " << n->get_class_size() << " " << enode_pp(n, *this) << "\n"); + TRACE(context, tout << "class size " << n->get_class_size() << " " << enode_pp(n, *this) << "\n"); return true; } for (enode* p : enode::parents(n)) if (!is_beta_redex(p, n)) { - TRACE("context", tout << "not a beta redex " << enode_pp(p, *this) << "\n"); + TRACE(context, tout << "not a beta redex " << enode_pp(p, *this) << "\n"); return true; } } @@ -636,7 +636,7 @@ namespace smt { SASSERT(!b_internalized(n)); SASSERT(!e_internalized(n)); - CTRACE("resolve_conflict_crash", m.is_not(n), tout << mk_ismt2_pp(n, m) << "\ngate_ctx: " << gate_ctx << "\n";); + CTRACE(resolve_conflict_crash, m.is_not(n), tout << mk_ismt2_pp(n, m) << "\ngate_ctx: " << gate_ctx << "\n";); bool _is_gate = is_gate(m, n) || m.is_not(n); // process args @@ -644,7 +644,7 @@ namespace smt { internalize_rec(arg, _is_gate); } - CTRACE("internalize_bug", b_internalized(n), tout << mk_ll_pp(n, m) << "\n";); + CTRACE(internalize_bug, b_internalized(n), tout << mk_ll_pp(n, m) << "\n";); bool is_new_var = false; bool_var v; @@ -720,7 +720,7 @@ namespace smt { } } - CTRACE("internalize_bug", e_internalized(n), + CTRACE(internalize_bug, e_internalized(n), tout << "#" << n->get_id() << ", merge_tf: " << get_enode(n)->merge_tf() << "\n";); } @@ -864,7 +864,7 @@ namespace smt { literal c_lit = get_literal(c); literal eq1_lit = get_literal(eq1); literal eq2_lit = get_literal(eq2); - TRACE("internalize_ite_term_bug", + TRACE(internalize_ite_term_bug, tout << mk_ismt2_pp(n, m) << "\n"; tout << mk_ismt2_pp(c, m) << "\n"; tout << mk_ismt2_pp(t, m) << "\n"; @@ -876,7 +876,7 @@ namespace smt { mk_gate_clause( c_lit, eq2_lit); if (relevancy()) { relevancy_eh * eh = m_relevancy_propagator->mk_term_ite_relevancy_eh(n, eq1, eq2); - TRACE("ite_term_relevancy", tout << "#" << n->get_id() << " #" << eq1->get_id() << " #" << eq2->get_id() << "\n";); + TRACE(ite_term_relevancy, tout << "#" << n->get_id() << " #" << eq1->get_id() << " #" << eq2->get_id() << "\n";); add_rel_watch(c_lit, eh); add_rel_watch(~c_lit, eh); add_relevancy_eh(n, eh); @@ -923,8 +923,8 @@ namespace smt { //SASSERT(!m.is_not(n)); unsigned id = n->get_id(); bool_var v = m_b_internalized_stack.size(); - TRACE("mk_bool_var", tout << "creating boolean variable: " << v << " for:\n" << mk_pp(n, m) << " " << n->get_id() << "\n";); - TRACE("mk_var_bug", tout << "mk_bool: " << v << "\n";); + TRACE(mk_bool_var, tout << "creating boolean variable: " << v << " for:\n" << mk_pp(n, m) << " " << n->get_id() << "\n";); + TRACE(mk_var_bug, tout << "mk_bool: " << v << "\n";); set_bool_var(id, v); m_bdata.reserve(v+1); m_activity.reserve(v+1); @@ -965,9 +965,9 @@ namespace smt { unsigned n_id = n->get_id(); bool_var v = get_bool_var_of_id(n_id); m_bool_var2expr[v] = nullptr; - TRACE("undo_mk_bool_var", tout << "undo_bool: " << v << "\n" << mk_pp(n, m) << "\n" << "m_bdata.size: " << m_bdata.size() + TRACE(undo_mk_bool_var, tout << "undo_bool: " << v << "\n" << mk_pp(n, m) << "\n" << "m_bdata.size: " << m_bdata.size() << " m_assignment.size: " << m_assignment.size() << "\n";); - TRACE("mk_var_bug", tout << "undo_mk_bool: " << v << "\n";); + TRACE(mk_var_bug, tout << "undo_mk_bool: " << v << "\n";); // bool_var_data & d = m_bdata[v]; m_case_split_queue->del_var_eh(v); if (is_quantifier(n)) @@ -983,7 +983,7 @@ namespace smt { in the egraph. */ enode * context::mk_enode(app * n, bool suppress_args, bool merge_tf, bool cgc_enabled) { - TRACE("mk_enode_detail", tout << mk_pp(n, m) << "\nsuppress_args: " << suppress_args << ", merge_tf: " << + TRACE(mk_enode_detail, tout << mk_pp(n, m) << "\nsuppress_args: " << suppress_args << ", merge_tf: " << merge_tf << ", cgc_enabled: " << cgc_enabled << "\n";); SASSERT(!e_internalized(n)); unsigned id = n->get_id(); @@ -991,15 +991,15 @@ namespace smt { unsigned _generation = 0; if (!m_cached_generation.empty() && m_cached_generation.find(n, _generation)) { generation = _generation; - CTRACE("cached_generation", generation != m_generation, + CTRACE(cached_generation, generation != m_generation, tout << "cached_generation: #" << n->get_id() << " " << generation << " " << m_generation << "\n";); } enode * e = enode::mk(m, m_region, m_app2enode, n, generation, suppress_args, merge_tf, m_scope_lvl, cgc_enabled, true); - TRACE("mk_enode_detail", tout << "e.get_num_args() = " << e->get_num_args() << "\n";); + TRACE(mk_enode_detail, tout << "e.get_num_args() = " << e->get_num_args() << "\n";); if (m.is_unique_value(n)) e->mark_as_interpreted(); - TRACE("mk_var_bug", tout << "mk_enode: " << id << "\n";); - TRACE("generation", tout << "mk_enode: " << id << " " << generation << "\n";); + TRACE(mk_var_bug, tout << "mk_enode: " << id << "\n";); + TRACE(generation, tout << "mk_enode: " << id << " " << generation << "\n";); m_app2enode.setx(id, e, nullptr); m_e_internalized_stack.push_back(n); m_trail_stack.push_back(&m_mk_enode_trail); @@ -1037,12 +1037,12 @@ namespace smt { } SASSERT(e_internalized(n)); m_stats.m_num_mk_enode++; - TRACE("mk_enode", tout << "created enode: #" << e->get_owner_id() << " for:\n" << mk_pp(n, m) << "\n"; + TRACE(mk_enode, tout << "created enode: #" << e->get_owner_id() << " for:\n" << mk_pp(n, m) << "\n"; if (e->get_num_args() > 0) { tout << "is_true_eq: " << e->is_true_eq() << " in cg_table: " << m_cg_table.contains_ptr(e) << " is_cgr: " << e->is_cgr() << "\n"; }); - SCTRACE("causality", m_coming_from_quant, tout << "EN: #" << e->get_owner_id() << "\n";); + SCTRACE(causality, m_coming_from_quant, tout << "EN: #" << e->get_owner_id() << "\n";); if (m.has_trace_stream()) m.trace_stream() << "[attach-enode] #" << n->get_id() << " " << m_generation << "\n"; @@ -1062,8 +1062,8 @@ namespace smt { SASSERT(!m_e_internalized_stack.empty()); m_stats.m_num_del_enode++; expr * n = m_e_internalized_stack.back(); - TRACE("undo_mk_enode", tout << "undo_enode: #" << n->get_id() << "\n" << mk_pp(n, m) << "\n";); - TRACE("mk_var_bug", tout << "undo_mk_enode: " << n->get_id() << "\n";); + TRACE(undo_mk_enode, tout << "undo_enode: #" << n->get_id() << "\n" << mk_pp(n, m) << "\n";); + TRACE(mk_var_bug, tout << "undo_mk_enode: " << n->get_id() << "\n";); unsigned n_id = n->get_id(); SASSERT(is_app(n)); enode * e = m_app2enode[n_id]; @@ -1135,7 +1135,7 @@ namespace smt { clauses because they are deleted during backtracking. */ bool context::simplify_aux_clause_literals(unsigned & num_lits, literal * lits, literal_buffer & simp_lits) { - TRACE("simplify_aux_clause_literals", display_literals(tout, num_lits, lits); tout << "\n";); + TRACE(simplify_aux_clause_literals, display_literals(tout, num_lits, lits); tout << "\n";); std::sort(lits, lits + num_lits); literal prev = null_literal; unsigned j = 0; @@ -1144,7 +1144,7 @@ namespace smt { lbool val = get_assignment(curr); switch (val) { case l_false: - TRACE("simplify_aux_clause_literals", display_literal_verbose(tout << get_assign_level(curr) << " " << get_scope_level() << " " << curr << ":", curr); tout << "\n"; ); + TRACE(simplify_aux_clause_literals, display_literal_verbose(tout << get_assign_level(curr) << " " << get_scope_level() << " " << curr << ":", curr); tout << "\n"; ); if (curr != prev) { prev = curr; simp_lits.push_back(~curr); @@ -1191,9 +1191,9 @@ namespace smt { kind of simplification. */ bool context::simplify_aux_lemma_literals(unsigned & num_lits, literal * lits) { - TRACE("simplify_aux_lemma_literals", display_literals(tout << "1) ", num_lits, lits) << "\n";); + TRACE(simplify_aux_lemma_literals, display_literals(tout << "1) ", num_lits, lits) << "\n";); std::sort(lits, lits + num_lits); - TRACE("simplify_aux_lemma_literals", display_literals(tout << "2) ", num_lits, lits) << "\n";); + TRACE(simplify_aux_lemma_literals, display_literals(tout << "2) ", num_lits, lits) << "\n";); literal prev = null_literal; unsigned i = 0; unsigned j = 0; @@ -1215,7 +1215,7 @@ namespace smt { } } num_lits = j; - TRACE("simplify_aux_lemma_literals", display_literals(tout << "3) ", num_lits, lits) << "\n";); + TRACE(simplify_aux_lemma_literals, display_literals(tout << "3) ", num_lits, lits) << "\n";); return true; } @@ -1379,7 +1379,7 @@ namespace smt { The deletion event handler is ignored if binary clause optimization is applicable. */ clause * context::mk_clause(unsigned num_lits, literal * lits, justification * j, clause_kind k, clause_del_eh * del_eh) { - TRACE("mk_clause", display_literals_verbose(tout << "creating clause: " << literal_vector(num_lits, lits) << "\n", num_lits, lits) << "\n";); + TRACE(mk_clause, display_literals_verbose(tout << "creating clause: " << literal_vector(num_lits, lits) << "\n", num_lits, lits) << "\n";); m_clause_proof.add(num_lits, lits, k, j); literal_buffer simp_lits; switch (k) { @@ -1420,7 +1420,7 @@ namespace smt { default: break; } - TRACE("mk_clause", display_literals_verbose(tout << "after simplification: " << literal_vector(num_lits, lits) << "\n", num_lits, lits) << "\n";); + TRACE(mk_clause, display_literals_verbose(tout << "after simplification: " << literal_vector(num_lits, lits) << "\n", num_lits, lits) << "\n";); unsigned activity = 1; bool lemma = is_lemma(k); @@ -1430,7 +1430,7 @@ namespace smt { case 0: if (j && !j->in_region()) m_justifications.push_back(j); - TRACE("mk_clause", tout << "empty clause... setting conflict\n";); + TRACE(mk_clause, tout << "empty clause... setting conflict\n";); set_conflict(j == nullptr ? b_justification::mk_axiom() : b_justification(j)); SASSERT(inconsistent()); return nullptr; @@ -1482,7 +1482,7 @@ namespace smt { cls->swap_lits(0, w1_idx); int w2_idx = select_watch_lit(cls, 1); cls->swap_lits(1, w2_idx); - TRACE("mk_th_lemma", display_clause(tout, cls); tout << "\n";); + TRACE(mk_th_lemma, display_clause(tout, cls); tout << "\n";); } // display_clause(std::cout, cls); std::cout << "\n"; m_lemmas.push_back(cls); @@ -1517,8 +1517,8 @@ namespace smt { add_lit_occs(*cls); - TRACE("add_watch_literal_bug", display_clause_detail(tout, cls);); - TRACE("mk_clause_result", display_clause_detail(tout, cls);); + TRACE(add_watch_literal_bug, display_clause_detail(tout, cls);); + TRACE(mk_clause_result, display_clause_detail(tout, cls);); CASSERT("mk_clause", check_clause(cls)); return cls; }} @@ -1559,7 +1559,7 @@ namespace smt { void context::mk_th_clause(theory_id tid, unsigned num_lits, literal * lits, unsigned num_params, parameter * params, clause_kind k) { justification * js = nullptr; - TRACE("mk_th_axiom", display_literals_verbose(tout, num_lits, lits) << "\n";); + TRACE(mk_th_axiom, display_literals_verbose(tout, num_lits, lits) << "\n";); if (m.proofs_enabled()) { js = mk_justification(theory_axiom_justification(tid, *this, num_lits, lits, num_params, params)); @@ -1600,7 +1600,7 @@ namespace smt { void context::mk_gate_clause(unsigned num_lits, literal * lits) { if (m.proofs_enabled()) { proof * pr = mk_clause_def_axiom(num_lits, lits, nullptr); - TRACE("gate_clause", tout << mk_ll_pp(pr, m);); + TRACE(gate_clause, tout << mk_ll_pp(pr, m);); mk_clause(num_lits, lits, mk_justification(justification_proof_wrapper(*this, pr))); } else if (clause_proof_active()) { @@ -1641,7 +1641,7 @@ namespace smt { expr * fact = m.get_fact(pr); if (!m.is_or(fact)) { proof * def = mk_clause_def_axiom(num_lits, lits, m.get_fact(pr)); - TRACE("gate_clause", tout << mk_ll_pp(def, m) << "\n"; + TRACE(gate_clause, tout << mk_ll_pp(def, m) << "\n"; tout << mk_ll_pp(pr, m);); proof * prs[2] = { def, pr }; pr = m.mk_unit_resolution(2, prs); @@ -1692,7 +1692,7 @@ namespace smt { relevancy_eh * eh = m_relevancy_propagator->mk_ite_relevancy_eh(n); literal l = get_literal(n->get_arg(0)); // when the condition of an ite is assigned to true or false, the ite-parent must be notified. - TRACE("propagate_relevant_ite", tout << "#" << n->get_id() << ", eh: " << eh << "\n";); + TRACE(propagate_relevant_ite, tout << "#" << n->get_id() << ", eh: " << eh << "\n";); add_rel_watch(l, eh); add_rel_watch(~l, eh); } @@ -1709,12 +1709,12 @@ namespace smt { void context::mk_and_cnstr(app * n) { literal l = get_literal(n); - TRACE("mk_and_cnstr", tout << "l: "; display_literal(tout, l); tout << "\n";); + TRACE(mk_and_cnstr, tout << "l: "; display_literal(tout, l); tout << "\n";); literal_buffer buffer; buffer.push_back(l); for (expr * arg : *n) { literal l_arg = get_literal(arg); - TRACE("mk_and_cnstr", tout << "l_arg: "; display_literal(tout, l_arg); tout << "\n";); + TRACE(mk_and_cnstr, tout << "l_arg: "; display_literal(tout, l_arg); tout << "\n";); mk_gate_clause(~l, l_arg); buffer.push_back(~l_arg); } @@ -1740,7 +1740,7 @@ namespace smt { literal l1 = get_literal(n->get_arg(0)); literal l2 = get_literal(n->get_arg(1)); if (sign) l.neg(); - TRACE("mk_iff_cnstr", tout << "l: " << l << ", l1: " << l1 << ", l2: " << l2 << "\n";); + TRACE(mk_iff_cnstr, tout << "l: " << l << ", l1: " << l1 << ", l2: " << l2 << "\n";); mk_gate_clause(~l, l1, ~l2); mk_gate_clause(~l, ~l1 , l2); mk_gate_clause( l, l1, l2); diff --git a/src/smt/smt_justification.cpp b/src/smt/smt_justification.cpp index d2a8aa2e6..cea8558ed 100644 --- a/src/smt/smt_justification.cpp +++ b/src/smt/smt_justification.cpp @@ -50,7 +50,7 @@ namespace smt { auto& r = ctx.get_region(); m_literals = new (r) literal[num_lits]; memcpy(m_literals, lits, sizeof(literal) * num_lits); - TRACE("unit_resolution_justification_bug", tout << literal_vector(num_lits, lits) << "\n";); + TRACE(unit_resolution_justification_bug, tout << literal_vector(num_lits, lits) << "\n";); SASSERT(m_num_literals > 0); } @@ -63,7 +63,7 @@ namespace smt { SASSERT(!js || !js->in_region()); m_literals = alloc_vect(num_lits); memcpy(m_literals, lits, sizeof(literal) * num_lits); - TRACE("unit_resolution_justification_bug", tout << literal_vector(num_lits, lits) << "\n";); + TRACE(unit_resolution_justification_bug, tout << literal_vector(num_lits, lits) << "\n";); SASSERT(num_lits != 0); } @@ -97,7 +97,7 @@ namespace smt { else prs.push_back(pr); } - TRACE("unit_resolution_justification_bug", + TRACE(unit_resolution_justification_bug, tout << "in mk_proof\n" << literal_vector(m_num_literals, m_literals) << "\n"; for (proof* p : prs) tout << mk_ll_pp(m.get_fact(p), m);); return m.mk_unit_resolution(prs.size(), prs.data()); @@ -231,7 +231,7 @@ namespace smt { } pr = m.mk_modus_ponens(pr2, pr1); - TRACE("mp_iff_justification", tout << mk_pp(fact1, m) << "\n" << mk_pp(fact2, m) << "\n" << + TRACE(mp_iff_justification, tout << mk_pp(fact1, m) << "\n" << mk_pp(fact2, m) << "\n" << mk_pp(m.get_fact(pr), m) << "\n";); return pr; } diff --git a/src/smt/smt_kernel.cpp b/src/smt/smt_kernel.cpp index be4bc66d6..a0df5c52f 100644 --- a/src/smt/smt_kernel.cpp +++ b/src/smt/smt_kernel.cpp @@ -127,7 +127,7 @@ namespace smt { lbool kernel::check(unsigned num_assumptions, expr * const * assumptions) { lbool r = m_imp->m_kernel.check(num_assumptions, assumptions); - TRACE("smt_kernel", tout << "check result: " << r << "\n";); + TRACE(smt_kernel, tout << "check result: " << r << "\n";); return r; } diff --git a/src/smt/smt_model_checker.cpp b/src/smt/smt_model_checker.cpp index c17fd5909..dfe5606a8 100644 --- a/src/smt/smt_model_checker.cpp +++ b/src/smt/smt_model_checker.cpp @@ -165,12 +165,12 @@ namespace smt { bool model_checker::assert_neg_q_m(quantifier * q, expr_ref_vector & sks) { expr_ref tmp(m); - TRACE("model_checker", tout << "curr_model:\n"; model_pp(tout, *m_curr_model);); + TRACE(model_checker, tout << "curr_model:\n"; model_pp(tout, *m_curr_model);); if (!m_curr_model->eval(q->get_expr(), tmp, true)) { return false; } - TRACE("model_checker", tout << "q after applying interpretation:\n" << mk_ismt2_pp(tmp, m) << "\n";); + TRACE(model_checker, tout << "q after applying interpretation:\n" << mk_ismt2_pp(tmp, m) << "\n";); ptr_buffer subst_args; unsigned num_decls = q->get_num_decls(); subst_args.resize(num_decls, nullptr); @@ -189,14 +189,14 @@ namespace smt { expr_ref sk_body = s(tmp, subst_args.size(), subst_args.data()); expr_ref r(m); r = m.mk_not(sk_body); - TRACE("model_checker", tout << "mk_neg_q_m:\n" << mk_ismt2_pp(r, m) << "\n";); + TRACE(model_checker, tout << "mk_neg_q_m:\n" << mk_ismt2_pp(r, m) << "\n";); m_aux_context->assert_expr(r); return true; } bool model_checker::add_instance(quantifier * q, model * cex, expr_ref_vector & sks, bool use_inv) { if (cex == nullptr || sks.empty()) { - TRACE("model_checker", tout << "no model is available\n";); + TRACE(model_checker, tout << "no model is available\n";); return false; } array_util autil(m); @@ -212,22 +212,22 @@ namespace smt { func_decl * sk_d = to_app(sk)->get_decl(); expr_ref sk_value(cex->get_some_const_interp(sk_d), m); if (!sk_value) { - TRACE("model_checker", tout << "Could not get value for " << sk_d->get_name() << "\n";); + TRACE(model_checker, tout << "Could not get value for " << sk_d->get_name() << "\n";); return false; // get_some_value failed... giving up } - TRACE("model_checker", tout << "Got some value " << sk_value << "\n";); + TRACE(model_checker, tout << "Got some value " << sk_value << "\n";); if (use_inv) { unsigned sk_term_gen = 0; expr * sk_term = m_model_finder.get_inv(q, i, sk_value, sk_term_gen); if (sk_term != nullptr) { - TRACE("model_checker", tout << "Found inverse " << mk_pp(sk_term, m) << "\n";); + TRACE(model_checker, tout << "Found inverse " << mk_pp(sk_term, m) << "\n";); SASSERT(!m.is_model_value(sk_term)); max_generation = std::max(sk_term_gen, max_generation); sk_value = sk_term; } else { - TRACE("model_checker", tout << "no inverse value for " << sk_value << "\n";); + TRACE(model_checker, tout << "no inverse value for " << sk_value << "\n";); return false; } } @@ -235,7 +235,7 @@ namespace smt { expr * sk_term = get_term_from_ctx(sk_value); func_decl * f = nullptr; if (sk_term != nullptr) { - TRACE("model_checker", tout << "sk term " << mk_pp(sk_term, m) << "\n"); + TRACE(model_checker, tout << "sk term " << mk_pp(sk_term, m) << "\n"); sk_value = sk_term; } // last ditch: am I an array? @@ -245,7 +245,7 @@ namespace smt { } if (contains_model_value(sk_value)) { - TRACE("model_checker", tout << "type compatible term " << mk_pp(sk_value, m) << "\n"); + TRACE(model_checker, tout << "type compatible term " << mk_pp(sk_value, m) << "\n"); sk_value = get_type_compatible_term(sk_value); } func_decl * f = nullptr; @@ -267,7 +267,7 @@ namespace smt { bindings.set(num_decls - i - 1, sk_value); } - TRACE("model_checker", tout << q->get_qid() << " found (use_inv: " << use_inv << ") new instance: " << bindings << "\ndefs:\n" << defs << "\n";); + TRACE(model_checker, tout << q->get_qid() << " found (use_inv: " << use_inv << ") new instance: " << bindings << "\ndefs:\n" << defs << "\n";); if (!defs.empty()) def = mk_and(defs); max_generation = std::max(m_qm->get_generation(q), max_generation); add_instance(q, bindings, max_generation, def.get()); @@ -313,14 +313,14 @@ namespace smt { func_decl * sk_d = to_app(sk)->get_decl(); expr_ref sk_value(cex->get_some_const_interp(sk_d), m); if (!sk_value) { - TRACE("model_checker", tout << "no constant interpretation for " << mk_pp(sk, m) << "\n";); + TRACE(model_checker, tout << "no constant interpretation for " << mk_pp(sk, m) << "\n";); return false; // get_some_value failed... aborting add_blocking_clause } diseqs.push_back(m.mk_not(m.mk_eq(sk, sk_value))); } expr_ref blocking_clause(m); blocking_clause = m.mk_or(diseqs.size(), diseqs.data()); - TRACE("model_checker", tout << "blocking clause:\n" << mk_ismt2_pp(blocking_clause, m) << "\n";); + TRACE(model_checker, tout << "blocking clause:\n" << mk_ismt2_pp(blocking_clause, m) << "\n";); m_aux_context->assert_expr(blocking_clause); return true; } @@ -347,17 +347,17 @@ namespace smt { scoped_ctx_push _push(m_aux_context.get()); quantifier * flat_q = get_flat_quantifier(q); - TRACE("model_checker", tout << "model checking:\n" << expr_ref(flat_q->get_expr(), m) << "\n";); + TRACE(model_checker, tout << "model checking:\n" << expr_ref(flat_q->get_expr(), m) << "\n";); expr_ref_vector sks(m); if (!assert_neg_q_m(flat_q, sks)) return false; - TRACE("model_checker", tout << "skolems:\n" << sks << "\n";); + TRACE(model_checker, tout << "skolems:\n" << sks << "\n";); flet l(m_aux_context->get_fparams().m_array_fake_support, true); lbool r = m_aux_context->check(); - TRACE("model_checker", tout << "[complete] model-checker result: " << to_sat_str(r) << "\n";); + TRACE(model_checker, tout << "[complete] model-checker result: " << to_sat_str(r) << "\n";); if (r != l_true) { return is_safe_for_mbqi(q) && r == l_false; // quantifier is satisfied by m_curr_model } @@ -373,7 +373,7 @@ namespace smt { while (true) { flet l(m_aux_context->get_fparams().m_array_fake_support, true); lbool r = m_aux_context->check(); - TRACE("model_checker", tout << "[restricted] model-checker (" << (num_new_instances+1) << ") result: " << to_sat_str(r) << "\n";); + TRACE(model_checker, tout << "[restricted] model-checker (" << (num_new_instances+1) << ") result: " << to_sat_str(r) << "\n";); if (r != l_true) break; model_ref cex; @@ -384,7 +384,7 @@ namespace smt { } num_new_instances++; if (num_new_instances >= m_max_cexs || !add_blocking_clause(cex.get(), sks)) { - TRACE("model_checker", tout << "Add blocking clause failed new-instances: " << num_new_instances << " max-cex: " << m_max_cexs << "\n";); + TRACE(model_checker, tout << "Add blocking clause failed new-instances: " << num_new_instances << " max-cex: " << m_max_cexs << "\n";); // add_blocking_clause failed... stop the search for new counter-examples... break; } @@ -392,7 +392,7 @@ namespace smt { if (num_new_instances == 0) { // failed to create instances when restricting to inst sets... then use result of the complete model check - TRACE("model_checker", tout << "using complete_cex result:\n"; model_pp(tout, *complete_cex);); + TRACE(model_checker, tout << "using complete_cex result:\n"; model_pp(tout, *complete_cex);); add_instance(q, complete_cex.get(), sks, false); } @@ -455,7 +455,7 @@ namespace smt { m_curr_model = md; m_value2expr.reset(); - TRACE("model_checker", tout << "MODEL_CHECKER INVOKED\n"; + TRACE(model_checker, tout << "MODEL_CHECKER INVOKED\n"; tout << "model:\n"; model_pp(tout, *m_curr_model);); for (quantifier* q : *m_qm) @@ -466,7 +466,7 @@ namespace smt { md->compress(); - TRACE("model_checker", tout << "MODEL_CHECKER INVOKED\n"; + TRACE(model_checker, tout << "MODEL_CHECKER INVOKED\n"; tout << "model:\n"; model_pp(tout, *m_curr_model);); if (m_params.m_mbqi_trace) { verbose_stream() << "(smt.mbqi \"started\")\n"; @@ -482,8 +482,8 @@ namespace smt { if (found_relevant) m_iteration_idx++; - TRACE("model_checker", tout << "model after check:\n"; model_pp(tout, *md);); - TRACE("model_checker", tout << "model checker result: " << (num_failures == 0) << "\n";); + TRACE(model_checker, tout << "model after check:\n"; model_pp(tout, *md);); + TRACE(model_checker, tout << "model checker result: " << (num_failures == 0) << "\n";); m_max_cexs += m_params.m_mbqi_max_cexs; if (num_failures == 0 && !m_context->validate_model()) { @@ -525,7 +525,7 @@ namespace smt { continue; } - TRACE("model_checker", + TRACE(model_checker, tout << "Check: " << mk_pp(q, m) << "\n"; tout << m_context->get_assignment(q) << "\n";); @@ -537,7 +537,7 @@ namespace smt { if (m_params.m_mbqi_trace || get_verbosity_level() >= 5) { IF_VERBOSE(0, verbose_stream() << "(smt.mbqi :failed " << q->get_qid() << ")\n"); } - TRACE("model_checker", tout << "checking quantifier " << mk_pp(q, m) << " failed\n";); + TRACE(model_checker, tout << "checking quantifier " << mk_pp(q, m) << " failed\n";); num_failures++; } } @@ -555,7 +555,7 @@ namespace smt { } bool model_checker::has_new_instances() { - TRACE("model_checker", tout << "instances: " << m_new_instances.size() << "\n";); + TRACE(model_checker, tout << "instances: " << m_new_instances.size() << "\n";); return !m_new_instances.empty(); } @@ -569,7 +569,7 @@ namespace smt { } void model_checker::assert_new_instances() { - TRACE("model_checker_bug_detail", tout << "assert_new_instances, inconsistent: " << m_context->inconsistent() << "\n";); + TRACE(model_checker_bug_detail, tout << "assert_new_instances, inconsistent: " << m_context->inconsistent() << "\n";); ptr_buffer bindings; vector> dummy; for (instance const& inst : m_new_instances) { @@ -582,7 +582,7 @@ namespace smt { for (unsigned i = 0; i < num_decls; i++) { expr * b = m_pinned_exprs.get(offset + i); if (!m_context->e_internalized(b)) { - TRACE("model_checker", tout << "internalizing b:\n" << mk_pp(b, m) << "\n";); + TRACE(model_checker, tout << "internalizing b:\n" << mk_pp(b, m) << "\n";); m_context->internalize(b, false, gen); } bindings.push_back(m_context->get_enode(b)); @@ -604,12 +604,12 @@ namespace smt { } } - TRACE("model_checker_bug_detail", tout << "instantiating... q:\n" << mk_pp(q, m) << "\n"; + TRACE(model_checker_bug_detail, tout << "instantiating... q:\n" << mk_pp(q, m) << "\n"; tout << "inconsistent: " << m_context->inconsistent() << "\n"; tout << "bindings:\n" << expr_ref_vector(m, num_decls, m_pinned_exprs.data() + offset) << "\n"; tout << "def " << mk_pp(inst.m_def, m) << "\n";); m_context->add_instance(q, nullptr, num_decls, bindings.data(), inst.m_def, gen, gen, gen, dummy); - TRACE("model_checker_bug_detail", tout << "after instantiating, inconsistent: " << m_context->inconsistent() << "\n";); + TRACE(model_checker_bug_detail, tout << "after instantiating, inconsistent: " << m_context->inconsistent() << "\n";); } } } diff --git a/src/smt/smt_model_finder.cpp b/src/smt/smt_model_finder.cpp index 3a984caf2..a39f9e8b7 100644 --- a/src/smt/smt_model_finder.cpp +++ b/src/smt/smt_model_finder.cpp @@ -93,7 +93,7 @@ namespace smt { SASSERT(m_elems.contains(n)); SASSERT(m_inv.empty()); m_elems.erase(n); - TRACE("model_finder", tout << mk_pp(n, m) << "\n";); + TRACE(model_finder, tout << mk_pp(n, m) << "\n";); m.dec_ref(n); } @@ -126,7 +126,7 @@ namespace smt { unsigned gen = kv.m_value; expr* t_val = ev.eval(t, true); if (!t_val) break; - TRACE("model_finder", tout << mk_pp(t, m) << " " << mk_pp(t_val, m) << "\n";); + TRACE(model_finder, tout << mk_pp(t, m) << " " << mk_pp(t_val, m) << "\n";); expr* old_t = nullptr; if (m_inv.find(t_val, old_t)) { @@ -568,7 +568,7 @@ namespace smt { expr* n = kv.m_key; expr* n_val = eval(n, true); if (should_cleanup(n_val)) { - TRACE("model_finder", tout << "cleanup " << s << " " << mk_pp(n, m) << " " << mk_pp(n_val, m) << "\n";); + TRACE(model_finder, tout << "cleanup " << s << " " << mk_pp(n, m) << " " << mk_pp(n_val, m) << "\n";); to_delete.push_back(n); } } @@ -595,11 +595,11 @@ namespace smt { expr_ref tmp(m); if (!m_model->eval(n, tmp, model_completion)) { r = nullptr; - TRACE("model_finder", tout << "eval\n" << mk_pp(n, m) << "\n-----> null\n";); + TRACE(model_finder, tout << "eval\n" << mk_pp(n, m) << "\n-----> null\n";); } else { r = tmp; - TRACE("model_finder", tout << "eval\n" << mk_pp(n, m) << "\n----->\n" << mk_pp(r, m) << "\n";); + TRACE(model_finder, tout << "eval\n" << mk_pp(n, m) << "\n----->\n" << mk_pp(r, m) << "\n";); } m_eval_cache[model_completion].insert(n, r); m_eval_cache_range.push_back(r); @@ -679,7 +679,7 @@ namespace smt { m_model->register_aux_decl(r->get_decl()); m_sort2k.insert(s, r); m_ks.push_back(r); - TRACE("model_finder", tout << sort_ref(s, m) << " := " << "\n";); + TRACE(model_finder, tout << sort_ref(s, m) << " := " << "\n";); return r; } @@ -702,7 +702,7 @@ namespace smt { return nullptr; m_model->register_decl(k_decl, r); SASSERT(m_model->get_const_interp(k_decl) == r); - TRACE("model_finder", tout << mk_pp(r, m) << "\n";); + TRACE(model_finder, tout << mk_pp(r, m) << "\n";); return r; } @@ -712,7 +712,7 @@ namespace smt { It invokes get_k_interp that may fail. */ bool assert_k_diseq_exceptions(app* k, ptr_vector const& exceptions) { - TRACE("assert_k_diseq_exceptions", tout << "assert_k_diseq_exceptions, " << "k: " << mk_pp(k, m) << "\nexceptions:\n"; + TRACE(assert_k_diseq_exceptions, tout << "assert_k_diseq_exceptions, " << "k: " << mk_pp(k, m) << "\nexceptions:\n"; for (expr* e : exceptions) tout << mk_pp(e, m) << "\n";); expr* k_interp = get_k_interp(k); if (k_interp == nullptr) @@ -730,7 +730,7 @@ namespace smt { } void set_projection_else(node* n) { - TRACE("model_finder", n->display(tout, m);); + TRACE(model_finder, n->display(tout, m);); SASSERT(n->is_root()); SASSERT(!n->is_mono_proj()); instantiation_set const* s = n->get_instantiation_set(); @@ -747,7 +747,7 @@ namespace smt { return; } sort* s = n->get_sort(); - TRACE("model_finder", tout << "trying to create k for " << mk_pp(s, m) << ", is_infinite: " << is_infinite(s) << "\n";); + TRACE(model_finder, tout << "trying to create k for " << mk_pp(s, m) << ", is_infinite: " << is_infinite(s) << "\n";); if (is_infinite(s)) { app* k = get_k_for(s); if (assert_k_diseq_exceptions(k, exceptions)) { @@ -780,7 +780,7 @@ namespace smt { for (expr* e : exceptions) { arith_rw.mk_sub(e, one, e_minus_1); arith_rw.mk_add(e, one, e_plus_1); - TRACE("mf_simp_bug", tout << "e:\n" << mk_ismt2_pp(e, m) << "\none:\n" << mk_ismt2_pp(one, m) << "\n";); + TRACE(mf_simp_bug, tout << "e:\n" << mk_ismt2_pp(e, m) << "\none:\n" << mk_ismt2_pp(one, m) << "\n";); // Note: exceptions come from quantifiers bodies. So, they have generation 0. n->insert(e_plus_1, 0); n->insert(e_minus_1, 0); @@ -792,7 +792,7 @@ namespace smt { for (expr* e : exceptions) { bv_rw.mk_add(e, one, e_plus_1); bv_rw.mk_sub(e, one, e_minus_1); - TRACE("mf_simp_bug", tout << "e:\n" << mk_ismt2_pp(e, m) << "\none:\n" << mk_ismt2_pp(one, m) << "\n";); + TRACE(mf_simp_bug, tout << "e:\n" << mk_ismt2_pp(e, m) << "\none:\n" << mk_ismt2_pp(one, m) << "\n";); // Note: exceptions come from quantifiers bodies. So, they have generation 0. n->insert(e_plus_1, 0); n->insert(e_minus_1, 0); @@ -819,7 +819,7 @@ namespace smt { already_found.insert(t_val); } } - TRACE("model_finder_bug", tout << "values for the instantiation_set of @" << n->get_id() << "\n"; + TRACE(model_finder_bug, tout << "values for the instantiation_set of @" << n->get_id() << "\n"; for (expr* v : values) { tout << mk_pp(v, m) << "\n"; }); @@ -900,7 +900,7 @@ namespace smt { func_decl* p = m.mk_fresh_func_decl(1, &s, s); m_model->register_aux_decl(p, rpi); n->set_proj(p); - TRACE("model_finder", n->display(tout << p->get_name() << "\n", m);); + TRACE(model_finder, n->display(tout << p->get_name() << "\n", m);); } void mk_simple_proj(node* n) { @@ -920,7 +920,7 @@ namespace smt { pi->insert_new_entry(&v, v); n->set_proj(p); - TRACE("model_finder", n->display(tout << p->get_name() << "\n", m);); + TRACE(model_finder, n->display(tout << p->get_name() << "\n", m);); } void mk_projections() { @@ -943,7 +943,7 @@ namespace smt { func_interp* fi = m_model->get_func_interp(f); if (fi == nullptr) { fi = alloc(func_interp, m, f->get_arity()); - TRACE("model_finder", tout << "register " << f->get_name() << "\n";); + TRACE(model_finder, tout << "register " << f->get_name() << "\n";); m_model->register_decl(f, fi); SASSERT(fi->is_partial()); } @@ -980,7 +980,7 @@ namespace smt { for (node* n : m_root_nodes) { SASSERT(n->is_root()); instantiation_set const* s = n->get_instantiation_set(); - TRACE("model_finder", s->display(tout);); + TRACE(model_finder, s->display(tout);); obj_map const& elems = s->get_elems(); if (elems.empty()) { // The method get_some_value cannot be used if n->get_sort() is an uninterpreted sort or is a sort built using uninterpreted sorts @@ -1010,7 +1010,7 @@ namespace smt { sort2elems.insert(s, e); } n->insert(e, 0); - TRACE("model_finder", tout << "fresh constant: " << mk_pp(e, m) << "\n";); + TRACE(model_finder, tout << "fresh constant: " << mk_pp(e, m) << "\n";); } } @@ -1085,7 +1085,7 @@ namespace smt { func_decl* f_aux = m.mk_fresh_func_decl(f->get_name(), symbol::null, arity, f->get_domain(), f->get_range()); func_interp* new_fi = alloc(func_interp, m, arity); new_fi->set_else(m.mk_app(f_aux, args.size(), args.data())); - TRACE("model_finder", tout << "Setting new interpretation for " << f->get_name() << "\n" << + TRACE(model_finder, tout << "Setting new interpretation for " << f->get_name() << "\n" << mk_pp(new_fi->get_else(), m) << "\n"; tout << "old interpretation: " << mk_pp(fi->get_interp(), m) << "\n";); m_model->reregister_decl(f, new_fi, f_aux); @@ -1121,7 +1121,7 @@ namespace smt { mk_projections(); mk_inverses(); complete_partial_funcs(partial_funcs); - TRACE("model_finder", tout << "after auf_solver fixing the model\n"; + TRACE(model_finder, tout << "after auf_solver fixing the model\n"; display_nodes(tout); tout << "NEW MODEL:\n"; model_pp(tout, *m_model);); @@ -1197,7 +1197,7 @@ namespace smt { void process_auf(quantifier* q, auf_solver& s, context* ctx) override { node* n1 = s.get_A_f_i(m_f, m_arg_i); node* n2 = s.get_uvar(q, m_var_j); - CTRACE("model_finder", n1->get_sort() != n2->get_sort(), + CTRACE(model_finder, n1->get_sort() != n2->get_sort(), tout << "sort bug:\n" << mk_ismt2_pp(q->get_expr(), m) << "\n" << mk_ismt2_pp(q, m) << "\n"; tout << "decl(0): " << q->get_decl_name(0) << "\n"; tout << "f: " << m_f->get_name() << " i: " << m_arg_i << "\n"; @@ -1414,7 +1414,7 @@ namespace smt { app* get_array() const { return to_app(m_select->get_arg(0)); } func_decl* get_array_func_decl(app* ground_array, auf_solver& s) { - TRACE("model_evaluator", tout << expr_ref(ground_array, m) << "\n";); + TRACE(model_evaluator, tout << expr_ref(ground_array, m) << "\n";); expr* ground_array_interp = s.eval(ground_array, false); if (ground_array_interp && m_array.is_as_array(ground_array_interp)) return m_array.get_as_array_func_decl(ground_array_interp); @@ -1442,7 +1442,7 @@ namespace smt { void process_auf(quantifier* q, auf_solver& s, context* ctx) override { ptr_buffer arrays; get_auf_arrays(get_array(), ctx, arrays); - TRACE("select_var", + TRACE(select_var, tout << "enodes matching: "; display(tout); tout << "\n"; for (enode* n : arrays) { tout << "#" << n->get_expr_id() << "\n" << mk_pp(n->get_expr(), m) << "\n"; @@ -1683,7 +1683,7 @@ namespace smt { } } m_qinfo_vect.push_back(q.detach()); - TRACE("model_finder", tout << "new quantifier qinfo: "; qi->display(tout); tout << "\n";); + TRACE(model_finder, tout << "new quantifier qinfo: "; qi->display(tout); tout << "\n";); } public: @@ -1707,7 +1707,7 @@ namespace smt { m_mf(mf), m_q(q, m), m_uvar_inst_sets(nullptr) { - CTRACE("model_finder_bug", has_quantifiers(m_flat_q->get_expr()), + CTRACE(model_finder_bug, has_quantifiers(m_flat_q->get_expr()), tout << mk_pp(q, m) << "\n" << mk_pp(m_flat_q, m) << "\n";); } @@ -1812,7 +1812,7 @@ namespace smt { bool is_var_plus_ground(expr* n, var*& v, expr_ref& t) { bool inv; - TRACE("is_var_plus_ground", tout << mk_pp(n, m) << "\n"; + TRACE(is_var_plus_ground, tout << mk_pp(n, m) << "\n"; tout << "is_var_plus_ground: " << is_var_plus_ground(n, inv, v, t) << "\n"; tout << "inv: " << inv << "\n";); return is_var_plus_ground(n, inv, v, t) && !inv; @@ -1856,17 +1856,17 @@ namespace smt { bool is_var_and_ground(expr* lhs, expr* rhs, var*& v, expr_ref& t, bool& inv) { inv = false; // true if invert the sign - TRACE("is_var_and_ground", tout << "is_var_and_ground: " << mk_ismt2_pp(lhs, m) << " " << mk_ismt2_pp(rhs, m) << "\n";); + TRACE(is_var_and_ground, tout << "is_var_and_ground: " << mk_ismt2_pp(lhs, m) << " " << mk_ismt2_pp(rhs, m) << "\n";); if (is_var(lhs) && is_ground(rhs)) { v = to_var(lhs); t = rhs; - TRACE("is_var_and_ground", tout << "var and ground\n";); + TRACE(is_var_and_ground, tout << "var and ground\n";); return true; } else if (is_var(rhs) && is_ground(lhs)) { v = to_var(rhs); t = lhs; - TRACE("is_var_and_ground", tout << "ground and var\n";); + TRACE(is_var_and_ground, tout << "ground and var\n";); return true; } else { @@ -1945,7 +1945,7 @@ namespace smt { return false; if (sign) { bool r = is_le_ge(atom) && is_var_and_ground(to_app(atom)->get_arg(0), to_app(atom)->get_arg(1), v, t); - CTRACE("is_x_gle_t", r, tout << "is_x_gle_t: " << mk_ismt2_pp(atom, m) << "\n--->\n" + CTRACE(is_x_gle_t, r, tout << "is_x_gle_t: " << mk_ismt2_pp(atom, m) << "\n--->\n" << mk_ismt2_pp(v, m) << " " << mk_ismt2_pp(t, m) << "\n"; tout << "sign: " << sign << "\n";); return r; @@ -1965,7 +1965,7 @@ namespace smt { mk_add(tmp, one, t); else mk_sub(tmp, one, t); - TRACE("is_x_gle_t", tout << "is_x_gle_t: " << mk_ismt2_pp(atom, m) << "\n--->\n" + TRACE(is_x_gle_t, tout << "is_x_gle_t: " << mk_ismt2_pp(atom, m) << "\n--->\n" << mk_ismt2_pp(v, m) << " " << mk_ismt2_pp(t, m) << "\n"; tout << "sign: " << sign << "\n";); return true; @@ -2114,7 +2114,7 @@ namespace smt { } void process_literal(expr* atom, bool sign) { - CTRACE("model_finder_bug", is_ground(atom), tout << mk_pp(atom, m) << "\n";); + CTRACE(model_finder_bug, is_ground(atom), tout << mk_pp(atom, m) << "\n";); SASSERT(!is_ground(atom)); SASSERT(m.is_bool(atom)); @@ -2348,12 +2348,12 @@ namespace smt { } void model_finder::register_quantifier(quantifier* q) { - TRACE("model_finder", tout << "registering:\n" << q->get_id() << ": " << q << " " << &m_q2info << " " << mk_pp(q, m) << "\n";); + TRACE(model_finder, tout << "registering:\n" << q->get_id() << ": " << q << " " << &m_q2info << " " << mk_pp(q, m) << "\n";); quantifier_info* new_info = alloc(quantifier_info, *this, m, q); m_q2info.insert(q, new_info); m_quantifiers.push_back(q); m_analyzer->operator()(new_info); - TRACE("model_finder", tout << "after analyzer:\n"; new_info->display(tout);); + TRACE(model_finder, tout << "after analyzer:\n"; new_info->display(tout);); } void model_finder::push_scope() { @@ -2420,7 +2420,7 @@ namespace smt { qi->populate_inst_sets(*(m_auf_solver.get()), m_context); } m_auf_solver->fix_model(m_new_constraints); - TRACE("model_finder", + TRACE(model_finder, for (quantifier* q : qs) { quantifier_info* qi = get_quantifier_info(q); quantifier* fq = qi->get_flat_q(); @@ -2436,20 +2436,20 @@ namespace smt { void model_finder::process_simple_macros(ptr_vector& qs, ptr_vector& residue, proto_model* mdl) { simple_macro_solver sms(m, *this); sms(*mdl, qs, residue); - TRACE("model_finder", tout << "model after processing simple macros:\n"; model_pp(tout, *mdl);); + TRACE(model_finder, tout << "model after processing simple macros:\n"; model_pp(tout, *mdl);); } void model_finder::process_hint_macros(ptr_vector& qs, ptr_vector& residue, proto_model* mdl) { hint_macro_solver hms(m, *this); hms(*mdl, qs, residue); - TRACE("model_finder", tout << "model after processing simple macros:\n"; model_pp(tout, *mdl);); + TRACE(model_finder, tout << "model after processing simple macros:\n"; model_pp(tout, *mdl);); } void model_finder::process_non_auf_macros(ptr_vector& qs, ptr_vector& residue, proto_model* mdl) { non_auf_macro_solver nas(m, *this, m_dependencies); nas.set_mbqi_force_template(m_context->get_fparams().m_mbqi_force_template); nas(*mdl, qs, residue); - TRACE("model_finder", tout << "model after processing non auf macros:\n"; model_pp(tout, *mdl);); + TRACE(model_finder, tout << "model after processing non auf macros:\n"; model_pp(tout, *mdl);); } /** @@ -2473,7 +2473,7 @@ namespace smt { collect_relevant_quantifiers(qs); if (qs.empty()) return; - TRACE("model_finder", tout << "trying to satisfy quantifiers, given model:\n"; model_pp(tout, *m);); + TRACE(model_finder, tout << "trying to satisfy quantifiers, given model:\n"; model_pp(tout, *m);); cleanup_quantifier_infos(qs); m_dependencies.reset(); @@ -2498,7 +2498,7 @@ namespace smt { quantifier* flat_q = get_flat_quantifier(q); SASSERT(flat_q->get_num_decls() >= q->get_num_decls()); mf::instantiation_set const* r = m_auf_solver->get_uvar_inst_set(flat_q, flat_q->get_num_decls() - q->get_num_decls() + i); - TRACE("model_finder", tout << "q: #" << q->get_id() << "\n" << mk_pp(q, m) << "\nflat_q: " << mk_pp(flat_q, m) + TRACE(model_finder, tout << "q: #" << q->get_id() << "\n" << mk_pp(q, m) << "\nflat_q: " << mk_pp(flat_q, m) << "\ni: " << i << " " << flat_q->get_num_decls() - q->get_num_decls() + i << "\n";); if (r != nullptr) return r; @@ -2563,7 +2563,7 @@ namespace smt { } expr_ref new_cnstr(m); new_cnstr = m.mk_or(eqs.size(), eqs.data()); - TRACE("model_finder", tout << "assert_restriction:\n" << mk_pp(new_cnstr, m) << "\n";); + TRACE(model_finder, tout << "assert_restriction:\n" << mk_pp(new_cnstr, m) << "\n";); aux_ctx->assert_expr(new_cnstr); asserted_something = true; } @@ -2575,7 +2575,7 @@ namespace smt { if (sz > 0) { for (unsigned i = 0; i < sz; i++) { expr* c = m_new_constraints.get(i); - TRACE("model_finder_bug_detail", tout << "asserting new constraint: " << mk_pp(c, m) << "\n";); + TRACE(model_finder_bug_detail, tout << "asserting new constraint: " << mk_pp(c, m) << "\n";); m_context->internalize(c, true); literal l(m_context->get_literal(c)); m_context->mark_as_relevant(l); diff --git a/src/smt/smt_model_generator.cpp b/src/smt/smt_model_generator.cpp index a36234cb2..c85227f08 100644 --- a/src/smt/smt_model_generator.cpp +++ b/src/smt/smt_model_generator.cpp @@ -63,7 +63,7 @@ namespace smt { // PARAM-TODO smt_params ---> params_ref m_model = alloc(proto_model, m); // , m_context->get_fparams()); for (theory* th : m_context->theories()) { - TRACE("model_generator_bug", tout << "init_model for theory: " << th->get_name() << "\n";); + TRACE(model_generator_bug, tout << "init_model for theory: " << th->get_name() << "\n";); th->init_model(*this); } } @@ -97,7 +97,7 @@ namespace smt { sort * s = r->get_sort(); model_value_proc * proc = nullptr; if (m.is_bool(s)) { - CTRACE("model", m_context->get_assignment(r) == l_undef, + CTRACE(model, m_context->get_assignment(r) == l_undef, tout << mk_pp(r->get_expr(), m) << "\n";); if (m_context->get_assignment(r) == l_true) proc = alloc(expr_wrapper_proc, m.mk_true()); @@ -115,7 +115,7 @@ namespace smt { SASSERT(proc); } else { - TRACE("model", tout << "creating fresh value for #" + TRACE(model, tout << "creating fresh value for #" << r->get_expr_id() << " " << mk_bounded_pp(r->get_expr(), m) << " " << mk_pp(r->get_sort(), m) << "\n";); @@ -140,7 +140,7 @@ namespace smt { if (!m.is_model_value(n)) { sort * s = r->get_sort(); n = m_model->get_fresh_value(s); - CTRACE("model", n == 0, + CTRACE(model, n == 0, tout << mk_pp(r->get_expr(), m) << "\nsort:\n" << mk_pp(s, m) << "\n"; tout << "is_finite: " << m_model->is_finite(s) << "\n";); } @@ -184,7 +184,7 @@ namespace smt { if (already_traversed.contains(s)) return true; bool visited = true; - TRACE("mg_top_sort", tout << "fresh value of sort " << mk_pp(s, m) << "\n"; + TRACE(mg_top_sort, tout << "fresh value of sort " << mk_pp(s, m) << "\n"; for (enode* r : roots) if (r->get_sort() == s) tout << mk_pp(r->get_expr(), m) << "\n"; @@ -195,9 +195,9 @@ namespace smt { SASSERT(r == r->get_root()); if (root2proc[r]->is_fresh()) continue; // r is associated with a fresh value... - TRACE("mg_top_sort", tout << "fresh!" << src.get_value()->get_idx() << " -> #" << r->get_owner_id() << " " << mk_pp(r->get_sort(), m) << "\n";); + TRACE(mg_top_sort, tout << "fresh!" << src.get_value()->get_idx() << " -> #" << r->get_owner_id() << " " << mk_pp(r->get_sort(), m) << "\n";); visit_child(source(r), colors, todo, visited); - TRACE("mg_top_sort", tout << "visited: " << visited << ", todo.size(): " << todo.size() << "\n";); + TRACE(mg_top_sort, tout << "visited: " << visited << ", todo.size(): " << todo.size() << "\n";); } already_traversed.insert(s); return visited; @@ -214,7 +214,7 @@ namespace smt { for (model_value_dependency const& dep : dependencies) { visit_child(dep, colors, todo, visited); } - TRACE("mg_top_sort", + TRACE(mg_top_sort, tout << "src: " << src << " "; tout << mk_pp(n->get_expr(), m) << "\n"; for (model_value_dependency const& dep : dependencies) { @@ -231,7 +231,7 @@ namespace smt { obj_hashtable & already_traversed, svector & todo, svector & sorted_sources) { - TRACE("mg_top_sort", tout << "process source, is_fresh: " << src.is_fresh_value() << " "; + TRACE(mg_top_sort, tout << "process source, is_fresh: " << src.is_fresh_value() << " "; tout << src << ", todo.size(): " << todo.size() << "\n";); int color = get_color(colors, src); SASSERT(color != Grey); @@ -241,7 +241,7 @@ namespace smt { todo.push_back(src); while (!todo.empty()) { source curr = todo.back(); - TRACE("mg_top_sort", tout << "current source, is_fresh: " << curr.is_fresh_value() << " "; + TRACE(mg_top_sort, tout << "current source, is_fresh: " << curr.is_fresh_value() << " "; tout << curr << ", todo.size(): " << todo.size() << "\n";); switch (get_color(colors, curr)) { case White: @@ -251,7 +251,7 @@ namespace smt { case Grey: // SASSERT(visit_children(curr, roots, root2proc, colors, already_traversed, todo)); set_color(colors, curr, Black); - TRACE("mg_top_sort", tout << "append " << curr << "\n";); + TRACE(mg_top_sort, tout << "append " << curr << "\n";); sorted_sources.push_back(curr); break; case Black: @@ -261,7 +261,7 @@ namespace smt { UNREACHABLE(); } } - TRACE("mg_top_sort", tout << "END process_source, todo.size(): " << todo.size() << "\n";); + TRACE(mg_top_sort, tout << "END process_source, todo.size(): " << todo.size() << "\n";); } /** @@ -306,7 +306,7 @@ namespace smt { expr_ref_vector dependency_values(m); mk_value_procs(root2proc, roots, procs); top_sort_sources(roots, root2proc, sources); - TRACE("sorted_sources", + TRACE(sorted_sources, for (source const& curr : sources) { if (curr.is_fresh_value()) { tout << curr << " " << mk_pp(curr.get_value()->get_sort(), m) << "\n"; @@ -334,16 +334,16 @@ namespace smt { for (source const& curr : sources) { if (curr.is_fresh_value()) { sort * s = curr.get_value()->get_sort(); - TRACE("model_fresh_bug", tout << curr << " : " << mk_pp(s, m) << " " << curr.get_value()->get_value() << "\n";); + TRACE(model_fresh_bug, tout << curr << " : " << mk_pp(s, m) << " " << curr.get_value()->get_value() << "\n";); expr * val = m_model->get_fresh_value(s); - TRACE("model_fresh_bug", tout << curr << " := #" << (val == nullptr ? UINT_MAX : val->get_id()) << "\n";); + TRACE(model_fresh_bug, tout << curr << " := #" << (val == nullptr ? UINT_MAX : val->get_id()) << "\n";); m_asts.push_back(val); curr.get_value()->set_value(val); } else { enode * n = curr.get_enode(); SASSERT(n->get_root() == n); - TRACE("mg_top_sort", tout << curr << "\n";); + TRACE(mg_top_sort, tout << curr << "\n";); app* val = nullptr; if (m.is_value(n->get_expr())) val = to_app(n->get_expr()); @@ -356,7 +356,7 @@ namespace smt { for (model_value_dependency const& d : dependencies) { if (d.is_fresh_value()) { expr* val = d.get_value()->get_value(); - CTRACE("mg_top_sort", !val, + CTRACE(mg_top_sort, !val, tout << "#" << n->get_owner_id() << " " << mk_pp(n->get_expr(), m) << " -> " << d << "\n";); // there is a cyclic dependency for default(A), where A @@ -368,7 +368,7 @@ namespace smt { } else { enode * child = d.get_enode(); - TRACE("mg_top_sort", tout << "#" << n->get_owner_id() << " (" << mk_pp(n->get_expr(), m) << "): " + TRACE(mg_top_sort, tout << "#" << n->get_owner_id() << " (" << mk_pp(n->get_expr(), m) << "): " << mk_pp(child->get_expr(), m) << " " << mk_pp(child->get_root()->get_expr(), m) << "\n";); child = child->get_root(); dependency_values.push_back(m_root2value[child]); @@ -385,7 +385,7 @@ namespace smt { for (enode * n : m_context->enodes()) { if (is_uninterp_const(n->get_expr()) && m_context->is_relevant(n)) { func_decl * d = n->get_expr()->get_decl(); - TRACE("mg_top_sort", tout << d->get_name() << " " << (m_hidden_ufs.contains(d)?"hidden":"visible") << "\n";); + TRACE(mg_top_sort, tout << d->get_name() << " " << (m_hidden_ufs.contains(d)?"hidden":"visible") << "\n";); if (m_hidden_ufs.contains(d)) continue; expr * val = get_value(n); m_model->register_decl(d, val); @@ -450,7 +450,7 @@ namespace smt { SASSERT(m_model->has_interpretation(f)); SASSERT(m_model->get_func_interp(f) == fi); // The entry must be new because n->get_cg() == n - TRACE("model", + TRACE(model, tout << "insert new entry for:\n" << mk_ismt2_pp(n->get_expr(), m) << "\nargs: "; for (unsigned i = 0; i < num_args; i++) { tout << "#" << n->get_arg(i)->get_owner_id() << " "; @@ -506,20 +506,20 @@ namespace smt { void model_generator::register_macros() { unsigned num = m_context->get_num_macros(); - TRACE("model", tout << "num. macros: " << num << "\n";); + TRACE(model, tout << "num. macros: " << num << "\n";); expr_ref v(m); for (unsigned i = 0; i < num; i++) { func_decl * f = m_context->get_macro_interpretation(i, v); func_interp * fi = alloc(func_interp, m, f->get_arity()); fi->set_else(v); - TRACE("model", tout << f->get_name() << "\n" << mk_pp(v, m) << "\n";); + TRACE(model, tout << f->get_name() << "\n" << mk_pp(v, m) << "\n";); m_model->register_decl(f, fi); } } proto_model * model_generator::mk_model() { SASSERT(!m_model); - TRACE("model_verbose", m_context->display(tout);); + TRACE(model_verbose, m_context->display(tout);); init_model(); register_existing_model_values(); mk_bool_model(); @@ -527,7 +527,7 @@ namespace smt { mk_func_interps(); finalize_theory_models(); register_macros(); - TRACE("model", model_v2_pp(tout, *m_model, true);); + TRACE(model, model_v2_pp(tout, *m_model, true);); return m_model.get(); } diff --git a/src/smt/smt_quantifier.cpp b/src/smt/smt_quantifier.cpp index f605e3b57..e6f156195 100644 --- a/src/smt/smt_quantifier.cpp +++ b/src/smt/smt_quantifier.cpp @@ -211,23 +211,23 @@ namespace smt { if (pat != nullptr) { if (used_enodes.size() > 0) { - STRACE("causality", tout << "New-Match: "<< static_cast(f);); - STRACE("triggers", tout <<", Pat: "<< expr_ref(pat, m());); - STRACE("causality", tout <<", Father:";); + STRACE(causality, tout << "New-Match: "<< static_cast(f);); + STRACE(triggers, tout <<", Pat: "<< expr_ref(pat, m());); + STRACE(causality, tout <<", Father:";); } for (auto n : used_enodes) { enode *orig = std::get<0>(n); enode *substituted = std::get<1>(n); (void) substituted; if (orig == nullptr) { - STRACE("causality", tout << " #" << substituted->get_owner_id();); + STRACE(causality, tout << " #" << substituted->get_owner_id();); } else { - STRACE("causality", tout << " (#" << orig->get_owner_id() << " #" << substituted->get_owner_id() << ")";); + STRACE(causality, tout << " (#" << orig->get_owner_id() << " #" << substituted->get_owner_id() << ")";); } } if (used_enodes.size() > 0) { - STRACE("causality", tout << "\n";); + STRACE(causality, tout << "\n";); } } } @@ -300,7 +300,7 @@ namespace smt { get_stat(q)->update_max_generation(max_generation); fingerprint * f = m_context.add_fingerprint(q, q->get_id(), num_bindings, bindings, def); if (f) { - if (is_trace_enabled("causality")) { + if (is_trace_enabled(TraceTag::causality)) { log_causality(f,pat,used_enodes); } if (has_trace_stream()) { @@ -310,7 +310,7 @@ namespace smt { m_num_instances++; } - CTRACE("bindings", f != nullptr, + CTRACE(bindings, f != nullptr, tout << expr_ref(q, m()) << "\n"; for (unsigned i = 0; i < num_bindings; ++i) { tout << expr_ref(bindings[i]->get_expr(), m()) << " [r " << bindings[i]->get_root()->get_owner_id() << "] "; @@ -328,7 +328,7 @@ namespace smt { } m_qi_queue.init_search_eh(); m_plugin->init_search_eh(); - TRACE("smt_params", m_params.display(tout); ); + TRACE(smt_params, m_params.display(tout); ); } void assign_eh(quantifier * q) { @@ -636,7 +636,7 @@ namespace smt { mbqi.id to be instantiated with MBQI. The default value is the empty string, so all quantifiers are instantiated. */ void add(quantifier * q) override { - TRACE("model_finder", tout << "add " << q->get_id() << ": " << q << " " << m_fparams->m_mbqi << " " << mbqi_enabled(q) << "\n";); + TRACE(model_finder, tout << "add " << q->get_id() << ": " << q << " " << m_fparams->m_mbqi << " " << mbqi_enabled(q) << "\n";); if (m_fparams->m_mbqi && mbqi_enabled(q)) { m_active = true; m_model_finder->register_quantifier(q); @@ -687,13 +687,13 @@ namespace smt { SASSERT(m.is_pattern(mp)); bool unary = (mp->get_num_args() == 1); if (!unary && j >= num_eager_multi_patterns) { - TRACE("quantifier", tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n" + TRACE(quantifier, tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n" << "j: " << j << " unary: " << unary << " m_params.m_qi_max_eager_multipatterns: " << m_fparams->m_qi_max_eager_multipatterns << " num_eager_multi_patterns: " << num_eager_multi_patterns << "\n";); m_lazy_mam->add_pattern(q, mp); } else { - TRACE("quantifier", tout << "adding:\n" << expr_ref(mp, m) << "\n";); + TRACE(quantifier, tout << "adding:\n" << expr_ref(mp, m) << "\n";); m_mam->add_pattern(q, mp); } if (!unary) @@ -726,7 +726,7 @@ namespace smt { m_model_finder->restart_eh(); m_model_checker->restart_eh(); } - TRACE("mam_stats", m_mam->display(tout);); + TRACE(mam_stats, m_mam->display(tout);); } bool is_shared(enode * n) const override { diff --git a/src/smt/smt_quick_checker.cpp b/src/smt/smt_quick_checker.cpp index d1e276f2b..04acc1a7b 100644 --- a/src/smt/smt_quick_checker.cpp +++ b/src/smt/smt_quick_checker.cpp @@ -129,7 +129,7 @@ namespace smt { v.push_back(curr); } } - TRACE("collector", + TRACE(collector, tout << "candidates:\n"; for (unsigned i = 0; i < m_num_vars; i++) { tout << "var " << i << ":"; @@ -143,7 +143,7 @@ namespace smt { void quick_checker::collector::operator()(quantifier * q, bool conservative, vector & candidates) { flet l(m_conservative, conservative); init(q); - TRACE("collector", tout << "model checking: #" << q->get_id() << "\n" << mk_pp(q, m_manager) << "\n";); + TRACE(collector, tout << "model checking: #" << q->get_id() << "\n" << mk_pp(q, m_manager) << "\n";); collect(q->get_expr(), nullptr, 0); save_result(candidates); } @@ -159,7 +159,7 @@ namespace smt { \brief Instantiate instances unsatisfied by the current model. Return true if new instances were generated. */ bool quick_checker::instantiate_unsat(quantifier * q) { - TRACE("quick_checker", tout << "instantiate instances unsatisfied by current model\n" << mk_pp(q, m_manager) << "\n";); + TRACE(quick_checker, tout << "instantiate instances unsatisfied by current model\n" << mk_pp(q, m_manager) << "\n";); m_candidate_vectors.reset(); m_collector(q, true, m_candidate_vectors); m_num_bindings = q->get_num_decls(); @@ -170,7 +170,7 @@ namespace smt { \brief Instantiate instances not satisfied by the current model. Return true if new instances were generated. */ bool quick_checker::instantiate_not_sat(quantifier * q) { - TRACE("quick_checker", tout << "instantiate instances not satisfied by current model\n" << mk_pp(q, m_manager) << "\n";); + TRACE(quick_checker, tout << "instantiate instances not satisfied by current model\n" << mk_pp(q, m_manager) << "\n";); m_candidate_vectors.reset(); m_collector(q, false, m_candidate_vectors); m_num_bindings = q->get_num_decls(); @@ -208,8 +208,8 @@ namespace smt { szs.push_back(sz); it.push_back(0); } - TRACE("quick_checker_sizes", tout << mk_pp(q, m_manager) << "\n"; for (unsigned i = 0; i < szs.size(); i++) tout << szs[i] << " "; tout << "\n";); - TRACE("quick_checker_candidates", + TRACE(quick_checker_sizes, tout << mk_pp(q, m_manager) << "\n"; for (unsigned i = 0; i < szs.size(); i++) tout << szs[i] << " "; tout << "\n";); + TRACE(quick_checker_candidates, tout << "candidates:\n"; for (unsigned i = 0; i < m_num_bindings; i++) { enode_vector & v = m_candidate_vectors[i]; @@ -224,7 +224,7 @@ namespace smt { m_bindings[m_num_bindings - i - 1] = m_candidate_vectors[i][it[i]]; if (!m_context.contains_instance(q, m_num_bindings, m_bindings.data())) { bool is_candidate = false; - TRACE("quick_checker", tout << "processing bindings:"; + TRACE(quick_checker, tout << "processing bindings:"; for (unsigned i = 0; i < m_num_bindings; i++) tout << " #" << m_bindings[i]->get_owner_id(); tout << "\n";); if (unsat) @@ -232,8 +232,8 @@ namespace smt { else is_candidate = !check_quantifier(q, true); if (is_candidate) { - TRACE("quick_checker", tout << "found new candidate\n";); - TRACE("quick_checker_sizes", tout << "found new candidate\n"; + TRACE(quick_checker, tout << "found new candidate\n";); + TRACE(quick_checker_sizes, tout << "found new candidate\n"; for (unsigned i = 0; i < m_num_bindings; i++) tout << "#" << m_bindings[i]->get_owner_id() << " "; tout << "\n";); unsigned max_generation = get_max_generation(m_num_bindings, m_bindings.data()); if (m_context.add_instance(q, nullptr /* no pattern was used */, m_num_bindings, m_bindings.data(), nullptr, @@ -329,7 +329,7 @@ namespace smt { } } expr * new_a = canonize(a); - TRACE("quick_checker_canonizer", tout << "before:\n" << mk_pp(a, m_manager) << "\nafter:\n" << mk_pp(new_a, m_manager) << "\n";); + TRACE(quick_checker_canonizer, tout << "before:\n" << mk_pp(a, m_manager) << "\nafter:\n" << mk_pp(new_a, m_manager) << "\n";); if (m_context.lit_internalized(new_a) && m_context.is_relevant(new_a)) { lbool val = m_context.get_assignment(new_a); if (val != l_undef) diff --git a/src/smt/smt_relevancy.cpp b/src/smt/smt_relevancy.cpp index ce6de3ec3..f7ba3dcce 100644 --- a/src/smt/smt_relevancy.cpp +++ b/src/smt/smt_relevancy.cpp @@ -276,7 +276,7 @@ namespace smt { --i; expr * n = m_relevant_exprs.get(i); m_is_relevant.remove(n->get_id()); - TRACE("propagate_relevancy", tout << "unmarking:\n" << mk_ismt2_pp(n, get_manager()) << "\n";); + TRACE(propagate_relevancy, tout << "unmarking:\n" << mk_ismt2_pp(n, get_manager()) << "\n";); } m_relevant_exprs.shrink(old_lim); m_qhead = m_relevant_exprs.size(); @@ -424,18 +424,18 @@ namespace smt { \brief Propagate relevancy for an ite-expression. */ void propagate_relevant_ite(app * n) { - TRACE("propagate_relevant_ite", tout << "propagating relevancy for #" << n->get_id() << "\n" << mk_pp(n, get_manager()) << "\n";); + TRACE(propagate_relevant_ite, tout << "propagating relevancy for #" << n->get_id() << "\n" << mk_pp(n, get_manager()) << "\n";); mark_as_relevant(n->get_arg(0)); switch (m_context.find_assignment(n->get_arg(0))) { case l_false: - TRACE("propagate_relevant_ite", tout << "marking as relevant: " << mk_pp(n->get_arg(2), get_manager()) << "\n";); + TRACE(propagate_relevant_ite, tout << "marking as relevant: " << mk_pp(n->get_arg(2), get_manager()) << "\n";); mark_as_relevant(n->get_arg(2)); break; case l_undef: - TRACE("propagate_relevant_ite", tout << "ite c is unassigned\n";); + TRACE(propagate_relevant_ite, tout << "ite c is unassigned\n";); break; case l_true: - TRACE("propagate_relevant_ite", tout << "marking as relevant: " << mk_pp(n->get_arg(1), get_manager()) << "\n";); + TRACE(propagate_relevant_ite, tout << "marking as relevant: " << mk_pp(n->get_arg(1), get_manager()) << "\n";); mark_as_relevant(n->get_arg(1)); break; } @@ -456,8 +456,8 @@ namespace smt { ast_manager & m = get_manager(); while (m_qhead < m_relevant_exprs.size()) { expr * n = m_relevant_exprs.get(m_qhead); - TRACE("propagate_relevancy_to_args", tout << "propagating relevancy to args of #" << n->get_id() << "\n";); - TRACE("propagate_relevancy", tout << "marking as relevant:\n" << mk_bounded_pp(n, m) << "\n";); + TRACE(propagate_relevancy_to_args, tout << "propagating relevancy to args of #" << n->get_id() << "\n";); + TRACE(propagate_relevancy, tout << "marking as relevant:\n" << mk_bounded_pp(n, m) << "\n";); SASSERT(is_relevant_core(n)); m_qhead++; if (is_app(n)) { @@ -528,7 +528,7 @@ namespace smt { SASSERT(is_relevant(n)); unsigned num_args = n->get_num_args(); for (unsigned i = 0; i < num_args; i++) { - CTRACE("relevancy_bug", !is_relevant(n->get_arg(i)), tout << "n: " << mk_ismt2_pp(n, get_manager()) << "\ni: " << i << "\n";); + CTRACE(relevancy_bug, !is_relevant(n->get_arg(i)), tout << "n: " << mk_ismt2_pp(n, get_manager()) << "\ni: " << i << "\n";); SASSERT(is_relevant(n->get_arg(i))); } return true; @@ -545,7 +545,7 @@ namespace smt { if (m_context.find_assignment(arg) == l_true && is_relevant(arg)) return true; } - TRACE("check_relevancy", tout << "failed:\n" << mk_ll_pp(n, get_manager()); display(tout);); + TRACE(check_relevancy, tout << "failed:\n" << mk_ll_pp(n, get_manager()); display(tout);); UNREACHABLE(); } return true; @@ -572,7 +572,7 @@ namespace smt { switch (m_context.find_assignment(n->get_arg(0))) { case l_false: if (get_manager().is_bool(n)) { - TRACE("ite_bug", tout << mk_bounded_pp(n, get_manager()) << "\n";); + TRACE(ite_bug, tout << mk_bounded_pp(n, get_manager()) << "\n";); SASSERT(is_relevant(n->get_arg(2))); } else { @@ -604,7 +604,7 @@ namespace smt { for (unsigned i = 0; i < sz; i++) { expr * n = v.get(i); if (is_relevant(n)) { - TRACE("check_relevancy", tout << "checking:\n" << mk_ll_pp(n, get_manager()) << "internalized: " << m_context.find_enode(n) << "\n";); + TRACE(check_relevancy, tout << "checking:\n" << mk_ll_pp(n, get_manager()) << "internalized: " << m_context.find_enode(n) << "\n";); if (m.is_or(n)) { SASSERT(check_relevancy_or(to_app(n), false)); } @@ -656,13 +656,13 @@ namespace smt { rp.mark_as_relevant(m_parent->get_arg(0)); switch (rp.get_context().get_assignment(m_parent->get_arg(0))) { case l_false: - TRACE("ite_term_relevancy", tout << "marking else: #" << m_else_eq->get_id() << "\n";); + TRACE(ite_term_relevancy, tout << "marking else: #" << m_else_eq->get_id() << "\n";); rp.mark_as_relevant(m_else_eq); break; case l_undef: break; case l_true: - TRACE("ite_term_relevancy", tout << "marking then: #" << m_then_eq->get_id() << "\n";); + TRACE(ite_term_relevancy, tout << "marking then: #" << m_then_eq->get_id() << "\n";); rp.mark_as_relevant(m_then_eq); break; } diff --git a/src/smt/smt_setup.cpp b/src/smt/smt_setup.cpp index 4aad75833..7a053ded0 100644 --- a/src/smt/smt_setup.cpp +++ b/src/smt/smt_setup.cpp @@ -52,14 +52,14 @@ namespace smt { } void setup::operator()(config_mode cm) { - TRACE("internalize", tout << "setup " << &m_context << "\n";); + TRACE(internalize, tout << "setup " << &m_context << "\n";); SASSERT(m_context.get_scope_level() == 0); SASSERT(!m_already_configured); // if (m_params.m_mbqi && m_params.m_model_compact) { // warning_msg("ignoring MODEL_COMPACT=true because it cannot be used with MBQI=true"); // m_params.m_model_compact = false; // } - TRACE("setup", tout << "configuring logical context, logic: " << m_logic << " " << cm << "\n";); + TRACE(setup, tout << "configuring logical context, logic: " << m_logic << " " << cm << "\n";); m_already_configured = true; @@ -142,7 +142,7 @@ namespace smt { void setup::setup_auto_config() { static_features st(m_manager); IF_VERBOSE(100, verbose_stream() << "(smt.configuring)\n";); - TRACE("setup", tout << "setup, logic: " << m_logic << "\n";); + TRACE(setup, tout << "setup, logic: " << m_logic << "\n";); // HACK: do not collect features for QF_BV and QF_AUFBV... since they do not use them... if (m_logic == "QF_BV") { setup_QF_BV(); @@ -155,7 +155,7 @@ namespace smt { ptr_vector fmls; m_context.get_asserted_formulas(fmls); st.collect(fmls.size(), fmls.data()); - TRACE("setup", st.display_primitive(tout);); + TRACE(setup, st.display_primitive(tout);); IF_VERBOSE(1000, st.display_primitive(verbose_stream());); if (m_logic == "QF_UF") setup_QF_UF(st); @@ -234,7 +234,7 @@ namespace smt { void setup::setup_QF_UF(static_features const & st) { check_no_arithmetic(st, "QF_UF"); setup_QF_UF(); - TRACE("setup", + TRACE(setup, tout << "st.m_num_theories: " << st.m_num_theories << "\n"; tout << "st.m_num_uninterpreted_functions: " << st.m_num_uninterpreted_functions << "\n";); } @@ -268,7 +268,7 @@ namespace smt { throw default_exception("Benchmark is not in QF_RDL (real difference logic)."); if (st.m_has_int) throw default_exception("Benchmark has integer variables but it is marked as QF_RDL (real difference logic)."); - TRACE("setup", tout << "setup_QF_RDL(st)\n";); + TRACE(setup, tout << "setup_QF_RDL(st)\n";); check_no_uninterpreted_functions(st, "QF_RDL"); m_params.m_relevancy_lvl = 0; m_params.m_arith_eq2ineq = true; @@ -294,11 +294,11 @@ namespace smt { if (m_params.m_arith_auto_config_simplex || st.m_num_uninterpreted_constants > 4 * st.m_num_bool_constants || st.m_num_ite_terms > 0 /* theory_rdl and theory_frdl do not support ite-terms */) { // if (!st.m_has_rational && !m_params.m_model && st.arith_k_sum_is_small()) { - // TRACE("rdl_bug", tout << "using theory_smi_arith\n";); + // TRACE(rdl_bug, tout << "using theory_smi_arith\n";); // m_context.register_plugin(alloc(smt::theory_smi_arith, m_context)); // } // else { - TRACE("rdl_bug", tout << "using theory_mi_arith\n";); + TRACE(rdl_bug, tout << "using theory_mi_arith\n";); //setup_lra_arith(); m_context.register_plugin(alloc(smt::theory_mi_arith, m_context)); // } @@ -316,7 +316,7 @@ namespace smt { } void setup::setup_QF_IDL() { - TRACE("setup", tout << "setup_QF_IDL()\n";); + TRACE(setup, tout << "setup_QF_IDL()\n";); m_params.setup_QF_IDL(); setup_lra_arith(); } @@ -326,9 +326,9 @@ namespace smt { throw default_exception("Benchmark is not in QF_IDL (integer difference logic)."); if (st.m_has_real) throw default_exception("Benchmark has real variables but it is marked as QF_IDL (integer difference logic)."); - TRACE("setup", tout << "setup QF_IDL, m_arith_k_sum: " << st.m_arith_k_sum << " m_num_diff_terms: " << st.m_num_arith_terms << "\n"; + TRACE(setup, tout << "setup QF_IDL, m_arith_k_sum: " << st.m_arith_k_sum << " m_num_diff_terms: " << st.m_num_arith_terms << "\n"; st.display_primitive(tout);); - TRACE("setup", tout << "setup_QF_IDL(st)\n";); + TRACE(setup, tout << "setup_QF_IDL(st)\n";); check_no_uninterpreted_functions(st, "QF_IDL"); m_params.m_relevancy_lvl = 0; m_params.m_arith_eq2ineq = true; @@ -351,7 +351,7 @@ namespace smt { m_params.m_random_initial_activity = IA_RANDOM; } - TRACE("setup", + TRACE(setup, tout << "RELEVANCY: " << m_params.m_relevancy_lvl << "\n"; tout << "ARITH_EQ_BOUNDS: " << m_params.m_arith_eq_bounds << "\n";); @@ -359,7 +359,7 @@ namespace smt { m_context.register_plugin(alloc(smt::theory_mi_arith, m_context)); } else if (!m_params.m_arith_auto_config_simplex && st.is_dense()) { - TRACE("setup", tout << "using dense diff logic...\n";); + TRACE(setup, tout << "using dense diff logic...\n";); m_params.m_phase_selection = PS_CACHING_CONSERVATIVE; if (st.arith_k_sum_is_small()) m_context.register_plugin(alloc(smt::theory_dense_si, m_context)); @@ -369,24 +369,24 @@ namespace smt { } else { // if (st.arith_k_sum_is_small()) { - // TRACE("setup", tout << "using small integer simplex...\n"; + // TRACE(setup, tout << "using small integer simplex...\n"; // m_context.register_plugin(alloc(smt::theory_si_arith, m_context)); // } // else { - TRACE("setup", tout << "using big integer simplex...\n";); + TRACE(setup, tout << "using big integer simplex...\n";); m_context.register_plugin(alloc(smt::theory_i_arith, m_context)); // } } } void setup::setup_QF_UFIDL() { - TRACE("setup", tout << "setup_QF_UFIDL()\n";); + TRACE(setup, tout << "setup_QF_UFIDL()\n";); m_params.setup_QF_UFIDL(); setup_lra_arith(); } void setup::setup_QF_UFIDL(static_features & st) { - TRACE("setup", tout << "setup_QF_UFIDL(st)\n";); + TRACE(setup, tout << "setup_QF_UFIDL(st)\n";); if (st.m_has_real) throw default_exception("Benchmark has real variables but it is marked as QF_UFIDL (uninterpreted functions and difference logic)."); m_params.m_relevancy_lvl = 0; @@ -425,7 +425,7 @@ namespace smt { } void setup::setup_QF_LRA() { - TRACE("setup", tout << "setup_QF_LRA()\n";); + TRACE(setup, tout << "setup_QF_LRA()\n";); m_params.setup_QF_LRA(); setup_lra_arith(); } @@ -441,14 +441,14 @@ namespace smt { } void setup::setup_QF_LIA() { - TRACE("setup", tout << "setup_QF_LIA(st)\n";); + TRACE(setup, tout << "setup_QF_LIA(st)\n";); m_params.setup_QF_LIA(); setup_lra_arith(); } void setup::setup_QF_LIA(static_features const & st) { check_no_uninterpreted_functions(st, "QF_LIA"); - TRACE("setup", tout << "QF_LIA setup\n";); + TRACE(setup, tout << "QF_LIA setup\n";); m_params.setup_QF_LIA(st); setup_lra_arith(); } @@ -472,7 +472,7 @@ namespace smt { } void setup::setup_QF_BV() { - TRACE("setup", tout << "qf-bv\n";); + TRACE(setup, tout << "qf-bv\n";); m_params.setup_QF_BV(); setup_bv(); } @@ -484,7 +484,7 @@ namespace smt { } void setup::setup_QF_AX() { - TRACE("setup", tout << "QF_AX\n";); + TRACE(setup, tout << "QF_AX\n";); m_params.setup_QF_AX(); setup_arrays(); } @@ -495,7 +495,7 @@ namespace smt { } void setup::setup_QF_AUFLIA() { - TRACE("QF_AUFLIA", tout << "no static features\n";); + TRACE(QF_AUFLIA, tout << "no static features\n";); m_params.setup_QF_AUFLIA(); setup_i_arith(); setup_arrays(); @@ -508,9 +508,9 @@ namespace smt { } void setup::setup_AUFLIA(bool simple_array) { - TRACE("setup", tout << "AUFLIA\n";); + TRACE(setup, tout << "AUFLIA\n";); m_params.setup_AUFLIA(simple_array); - TRACE("setup", tout << "max_eager_multipatterns: " << m_params.m_qi_max_eager_multipatterns << "\n";); + TRACE(setup, tout << "max_eager_multipatterns: " << m_params.m_qi_max_eager_multipatterns << "\n";); m_context.register_plugin(alloc(smt::theory_i_arith, m_context)); setup_arrays(); } @@ -523,7 +523,7 @@ namespace smt { } void setup::setup_AUFLIRA(bool simple_array) { - TRACE("setup", tout << "AUFLIRA\n";); + TRACE(setup, tout << "AUFLIRA\n";); m_params.setup_AUFLIRA(simple_array); setup_mi_arith(); setup_arrays(); @@ -732,12 +732,12 @@ namespace smt { } void setup::setup_datatypes() { - TRACE("datatype", tout << "registering theory datatype...\n";); + TRACE(datatype, tout << "registering theory datatype...\n";); m_context.register_plugin(alloc(theory_datatype, m_context)); } void setup::setup_recfuns() { - TRACE("recfun", tout << "registering theory recfun...\n";); + TRACE(recfun, tout << "registering theory recfun...\n";); theory_recfun * th = alloc(theory_recfun, m_context); m_context.register_plugin(th); } @@ -815,7 +815,7 @@ namespace smt { ptr_vector fmls; m_context.get_asserted_formulas(fmls); st.collect(fmls.size(), fmls.data()); - TRACE("setup", tout << "setup_unknown\n";); + TRACE(setup, tout << "setup_unknown\n";); setup_arith(); setup_arrays(); setup_bv(); @@ -846,7 +846,7 @@ namespace smt { } void setup::setup_unknown(static_features & st) { - TRACE("setup", tout << "setup_unknown\n";); + TRACE(setup, tout << "setup_unknown\n";); if (st.m_num_quantifiers > 0) { if (st.m_has_real) setup_AUFLIRA(false); @@ -863,7 +863,7 @@ namespace smt { return; } - TRACE("setup", + TRACE(setup, tout << "num non UF theories: " << st.num_non_uf_theories() << "\n"; tout << "num theories: " << st.num_theories() << "\n"; tout << "is_diff_logic: " << is_diff_logic(st) << "\n"; diff --git a/src/smt/smt_solver.cpp b/src/smt/smt_solver.cpp index 847eb5077..6eff267e4 100644 --- a/src/smt/smt_solver.cpp +++ b/src/smt/smt_solver.cpp @@ -196,7 +196,7 @@ namespace { } lbool check_sat_core2(unsigned num_assumptions, expr * const * assumptions) override { - TRACE("solver_na2as", tout << "smt_solver::check_sat_core: " << num_assumptions << "\n";); + TRACE(solver_na2as, tout << "smt_solver::check_sat_core: " << num_assumptions << "\n";); return m_context.check(num_assumptions, assumptions); } diff --git a/src/smt/smt_theory.cpp b/src/smt/smt_theory.cpp index a182887f4..734163cb6 100644 --- a/src/smt/smt_theory.cpp +++ b/src/smt/smt_theory.cpp @@ -135,7 +135,7 @@ namespace smt { if (m.are_distinct(a, b)) return false_literal; app_ref eq(ctx.mk_eq_atom(a, b), get_manager()); - TRACE("mk_var_bug", tout << "mk_eq: " << eq->get_id() << " " << a->get_id() << " " << b->get_id() << "\n"; + TRACE(mk_var_bug, tout << "mk_eq: " << eq->get_id() << " " << a->get_id() << " " << b->get_id() << "\n"; tout << mk_ll_pp(a, get_manager()) << "\n" << mk_ll_pp(b, get_manager());); ctx.internalize(eq, gate_ctx); return ctx.get_literal(eq); diff --git a/src/smt/smt_theory.h b/src/smt/smt_theory.h index 50f29606e..25104affd 100644 --- a/src/smt/smt_theory.h +++ b/src/smt/smt_theory.h @@ -512,22 +512,22 @@ namespace smt { */ template bool assume_eqs(VarValueTable & table) { - TRACE("assume_eqs", tout << "starting...\n";); + TRACE(assume_eqs, tout << "starting...\n";); table.reset(); bool result = false; int num = get_num_vars(); for (theory_var v = 0; v < num; v++) { enode * n = get_enode(v); theory_var other = null_theory_var; - TRACE("assume_eqs", + TRACE(assume_eqs, tout << "#" << n->get_owner_id() << " is_relevant_and_shared: " << is_relevant_and_shared(n) << "\n";); if (n != nullptr && is_relevant_and_shared(n)) { other = table.insert_if_not_there(v); if (other != v) { enode * n2 = get_enode(other); - TRACE("assume_eqs", tout << "value(#" << n->get_owner_id() << ") = value(#" << n2->get_owner_id() << ")\n";); + TRACE(assume_eqs, tout << "value(#" << n->get_owner_id() << ") = value(#" << n2->get_owner_id() << ")\n";); if (assume_eq(n, n2)) { - TRACE("assume_eqs", tout << "new assumed eq\n";); + TRACE(assume_eqs, tout << "new assumed eq\n";); result = true; } } diff --git a/src/smt/spanning_tree_def.h b/src/smt/spanning_tree_def.h index 478889c90..0100a2551 100644 --- a/src/smt/spanning_tree_def.h +++ b/src/smt/spanning_tree_def.h @@ -48,7 +48,7 @@ namespace smt { m_thread[i] = i + 1; } - TRACE("network_flow", { + TRACE(network_flow, { tout << pp_vector("Predecessors", m_pred) << pp_vector("Threads", m_thread); tout << pp_vector("Depths", m_depth) << pp_vector("Tree", m_tree); }); @@ -156,7 +156,7 @@ namespace smt { SASSERT(is_ancestor_of(v, q)); - TRACE("network_flow", { + TRACE(network_flow, { tout << "update_spanning_tree: (" << p << ", " << q << ") enters, ("; tout << u << ", " << v << ") leaves\n"; }); @@ -202,7 +202,7 @@ namespace smt { SASSERT(!in_subtree_t2(u)); SASSERT(in_subtree_t2(v)); - TRACE("network_flow", { + TRACE(network_flow, { tout << pp_vector("Predecessors", m_pred) << pp_vector("Threads", m_thread); tout << pp_vector("Depths", m_depth) << pp_vector("Tree", m_tree); }); diff --git a/src/smt/tactic/ctx_solver_simplify_tactic.cpp b/src/smt/tactic/ctx_solver_simplify_tactic.cpp index 6b1d1b7f4..f34f0c98b 100644 --- a/src/smt/tactic/ctx_solver_simplify_tactic.cpp +++ b/src/smt/tactic/ctx_solver_simplify_tactic.cpp @@ -97,7 +97,7 @@ protected: void reduce(goal& g) { if (m.proofs_enabled()) return; - TRACE("ctx_solver_simplify_tactic", g.display(tout);); + TRACE(ctx_solver_simplify_tactic, g.display(tout);); expr_ref fml(m); tactic_report report("ctx-solver-simplify", g); if (g.inconsistent()) @@ -111,7 +111,7 @@ protected: if (!m.inc()) return; SASSERT(m_solver.get_scope_level() == 0); - TRACE("ctx_solver_simplify_tactic", + TRACE(ctx_solver_simplify_tactic, for (expr* f : fmls) { tout << mk_pp(f, m) << "\n"; } @@ -127,11 +127,11 @@ protected: fml1 = m.mk_not(fml1); m_solver.assert_expr(fml1); lbool is_sat = m_solver.check(); - TRACE("ctx_solver_simplify_tactic", tout << "is non-equivalence sat?: " << is_sat << "\n";); + TRACE(ctx_solver_simplify_tactic, tout << "is non-equivalence sat?: " << is_sat << "\n";); if (is_sat == l_true) { model_ref mdl; m_solver.get_model(mdl); - TRACE("ctx_solver_simplify_tactic", + TRACE(ctx_solver_simplify_tactic, tout << "result is not equivalent to input\n"; tout << mk_pp(fml1, m) << "\n"; tout << "evaluates to: " << (*mdl)(fml1) << "\n"; @@ -203,7 +203,7 @@ protected: goto done; } if (m.is_bool(e) && simplify_bool(n, res)) { - TRACE("ctx_solver_simplify_tactic", + TRACE(ctx_solver_simplify_tactic, m_solver.display(tout) << "\n"; tout << "simplified: " << mk_pp(n, m) << "\n" << mk_pp(e, m) << " |-> " << mk_pp(res, m) << "\n";); goto done; diff --git a/src/smt/tactic/smt_tactic_core.cpp b/src/smt/tactic/smt_tactic_core.cpp index 0914df13f..587ed9b56 100644 --- a/src/smt/tactic/smt_tactic_core.cpp +++ b/src/smt/tactic/smt_tactic_core.cpp @@ -55,7 +55,7 @@ public: m_params_ref(p), m_vars(m) { updt_params_core(p); - TRACE("smt_tactic", tout << "p: " << p << "\n";); + TRACE(smt_tactic, tout << "p: " << p << "\n";); } tactic * translate(ast_manager & m) override { @@ -83,7 +83,7 @@ public: } void updt_params(params_ref const & p) override { - TRACE("smt_tactic", tout << "updt_params: " << p << "\n";); + TRACE(smt_tactic, tout << "updt_params: " << p << "\n";); updt_params_core(p); fparams().updt_params(p); m_params_ref.copy(p); @@ -132,7 +132,7 @@ public: m_params_ref.reset(); m_params_ref.append(o.params()); smt::kernel * new_ctx = alloc(smt::kernel, m, m_params, m_params_ref); - TRACE("smt_tactic", tout << "logic: " << o.m_logic << "\n";); + TRACE(smt_tactic, tout << "logic: " << o.m_logic << "\n";); new_ctx->set_logic(o.m_logic); if (o.m_callback) { new_ctx->set_progress_callback(o.m_callback); @@ -159,15 +159,15 @@ public: try { IF_VERBOSE(10, verbose_stream() << "(smt.tactic start)\n";); tactic_report report("smt", *in); - TRACE("smt_tactic", tout << this << "\nAUTO_CONFIG: " << fparams().m_auto_config << " HIDIV0: " << fparams().m_hi_div0 << " " + TRACE(smt_tactic, tout << this << "\nAUTO_CONFIG: " << fparams().m_auto_config << " HIDIV0: " << fparams().m_hi_div0 << " " << " PREPROCESS: " << fparams().m_preprocess << "\n"; tout << "RELEVANCY: " << fparams().m_relevancy_lvl << "\n"; tout << "fail-if-inconclusive: " << m_fail_if_inconclusive << "\n"; tout << "params_ref: " << m_params_ref << "\n"; tout << "nnf: " << fparams().m_nnf_cnf << "\n";); - TRACE("smt_tactic_params", m_params.display(tout);); - TRACE("smt_tactic_detail", in->display(tout);); - TRACE("smt_tactic_memory", tout << "wasted_size: " << m.get_allocator().get_wasted_size() << "\n";); + TRACE(smt_tactic_params, m_params.display(tout);); + TRACE(smt_tactic_detail, in->display(tout);); + TRACE(smt_tactic_memory, tout << "wasted_size: " << m.get_allocator().get_wasted_size() << "\n";); scoped_init_ctx init(*this, m); SASSERT(m_ctx); @@ -177,7 +177,7 @@ public: ref fmc; if (in->unsat_core_enabled()) { extract_clauses_and_dependencies(in, clauses, assumptions, bool2dep, fmc); - TRACE("mus", in->display_with_dependencies(tout); + TRACE(mus, in->display_with_dependencies(tout); tout << clauses << "\n";); if (in->proofs_enabled() && !assumptions.empty()) throw tactic_exception("smt tactic does not support simultaneous generation of proofs and unsat cores"); @@ -210,14 +210,14 @@ public: r = m_ctx->check(assumptions.size(), assumptions.data()); } catch(...) { - TRACE("smt_tactic", tout << "exception\n";); + TRACE(smt_tactic, tout << "exception\n";); m_ctx->collect_statistics(m_stats); throw; } SASSERT(m_ctx); m_ctx->collect_statistics(m_stats); proof_ref pr(m_ctx->get_proof(), m); - TRACE("smt_tactic", tout << r << " " << pr << "\n";); + TRACE(smt_tactic, tout << r << " " << pr << "\n";); switch (r) { case l_true: { if (m_fail_if_inconclusive && !in->sat_preserved()) @@ -244,7 +244,7 @@ public: } case l_false: { if (m_fail_if_inconclusive && !in->unsat_preserved()) { - TRACE("smt_tactic", tout << "failed to show to be unsat...\n";); + TRACE(smt_tactic, tout << "failed to show to be unsat...\n";); throw tactic_exception("under-approximated goal found to be unsat"); } // formula is unsat, reset the goal, and store false there. diff --git a/src/smt/tactic/unit_subsumption_tactic.cpp b/src/smt/tactic/unit_subsumption_tactic.cpp index e0197d15d..c4773482e 100644 --- a/src/smt/tactic/unit_subsumption_tactic.cpp +++ b/src/smt/tactic/unit_subsumption_tactic.cpp @@ -73,7 +73,7 @@ struct unit_subsumption_tactic : public tactic { r->elim_true(); result.push_back(r.get()); m_context.pop(2); - TRACE("unit_subsumption_tactic", g->display(tout); r->display(tout);); + TRACE(unit_subsumption_tactic, g->display(tout); r->display(tout);); } void assert_clauses(goal_ref const& g) { @@ -104,7 +104,7 @@ struct unit_subsumption_tactic : public tactic { bool is_unsat = m_context.inconsistent(); m_context.pop(2); if (is_unsat) { - TRACE("unit_subsumption_tactic", tout << "Removing clause " << i << "\n";); + TRACE(unit_subsumption_tactic, tout << "Removing clause " << i << "\n";); m_is_deleted.set(i, true); m_deleted.push_back(i); } diff --git a/src/smt/theory_arith_aux.h b/src/smt/theory_arith_aux.h index e624f84b5..80f6c58fe 100644 --- a/src/smt/theory_arith_aux.h +++ b/src/smt/theory_arith_aux.h @@ -182,13 +182,13 @@ namespace smt { template typename theory_arith::numeral theory_arith::row::get_denominators_lcm() const { numeral r(1); - TRACE("lcm_bug", tout << "starting get_denominators_lcm...\n";); + TRACE(lcm_bug, tout << "starting get_denominators_lcm...\n";); typename vector::const_iterator it = m_entries.begin(); typename vector::const_iterator end = m_entries.end(); for (; it != end; ++it) { if (!it->is_dead()) { r = lcm(r, denominator(it->m_coeff)); - TRACE("lcm_bug", tout << "it->m_coeff: " << it->m_coeff << ", denominator(it->m_coeff): " << denominator(it->m_coeff) << ", r: " << r << "\n";); + TRACE(lcm_bug, tout << "it->m_coeff: " << it->m_coeff << ", denominator(it->m_coeff): " << denominator(it->m_coeff) << ", r: " << r << "\n";); } } return r; @@ -521,7 +521,7 @@ namespace smt { typename vector::const_iterator end = r.end_entries(); for (; it != end; ++it) { if (!it->is_dead() && !it->m_coeff.is_int()) { - TRACE("gomory_cut", display_row(tout, r, true);); + TRACE(gomory_cut, display_row(tout, r, true);); return false; } } @@ -569,7 +569,7 @@ namespace smt { void theory_arith::move_unconstrained_to_base() { if (lazy_pivoting_lvl() == 0) return; - TRACE("move_unconstrained_to_base", tout << "before...\n"; display(tout);); + TRACE(move_unconstrained_to_base, tout << "before...\n"; display(tout);); int num = get_num_vars(); for (theory_var v = 0; v < num; v++) { if (m_var_occs[v].empty() && is_free(v)) { @@ -587,7 +587,7 @@ namespace smt { case NON_BASE: { col_entry const * entry = get_row_for_eliminating(v); if (entry) { - TRACE("move_unconstrained_to_base", tout << "moving v" << v << " to the base\n";); + TRACE(move_unconstrained_to_base, tout << "moving v" << v << " to the base\n";); row & r = m_rows[entry->m_row_id]; SASSERT(r[entry->m_row_idx].m_var == v); pivot(r.get_base_var(), v, r[entry->m_row_idx].m_coeff, m_eager_gcd); @@ -599,7 +599,7 @@ namespace smt { } } } } - TRACE("move_unconstrained_to_base", tout << "after...\n"; display(tout);); + TRACE(move_unconstrained_to_base, tout << "after...\n"; display(tout);); CASSERT("arith", wf_rows()); CASSERT("arith", wf_columns()); CASSERT("arith", valid_row_assignment()); @@ -737,7 +737,7 @@ namespace smt { template void theory_arith::derived_bound::push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) { - TRACE("arith", tout << m_lits << " " << m_eqs.size() << "\n";); + TRACE(arith, tout << m_lits << " " << m_eqs.size() << "\n";); if (proofs_enabled) { for (literal l : m_lits) a.push_lit(l, coeff, proofs_enabled); @@ -875,7 +875,7 @@ namespace smt { bool use_upper = (kind == B_UPPER); if (!it->m_coeff.is_pos()) use_upper = !use_upper; - TRACE("derived_bound", tout << "using " << (use_upper ? "upper" : "lower") << " bound of v" << v << "\n";); + TRACE(derived_bound, tout << "using " << (use_upper ? "upper" : "lower") << " bound of v" << v << "\n";); bound * b = get_bound(v, use_upper); SASSERT(b); DEBUG_CODE({ @@ -886,14 +886,14 @@ namespace smt { accumulate_justification(*b, *new_bound, it->m_coeff, m_tmp_lit_set, m_tmp_eq_set); } } - TRACE("derived_bound", + TRACE(derived_bound, tout << "explanation:\n"; for (literal l : new_bound->m_lits) tout << l << " "; tout << " "; for (auto const& e : new_bound->m_eqs) tout << "#" << e.first->get_owner_id() << "=#" << e.second->get_owner_id() << " "; tout << "\n";); - DEBUG_CODE(CTRACE("derived_bound", k != val, tout << "k: " << k << ", k_norm: " << k_norm << ", val: " << val << "\n";);); + DEBUG_CODE(CTRACE(derived_bound, k != val, tout << "k: " << k << ", k_norm: " << k_norm << ", val: " << val << "\n";);); SASSERT(k == val); } @@ -981,7 +981,7 @@ namespace smt { was_unsafe |= is_unsafe; bool inc_s = coeff.is_neg() ? inc : !inc; unbounded &= !get_bound(s, inc_s); - TRACE("opt", tout << "is v" << x << " safe to leave for v" << s + TRACE(opt, tout << "is v" << x << " safe to leave for v" << s << "? " << (is_unsafe?"no":"yes") << " " << (has_int?"int":"real") << " " << (unbounded?"unbounded":"bounded") << "\n"; display_row(tout, r, true);); if (was_unsafe && !unbounded) return false; @@ -1040,7 +1040,7 @@ namespace smt { template theory_var theory_arith::add_objective(app* term) { theory_var v = internalize_term_core(term); - TRACE("opt", tout << mk_pp(term, get_manager()) << " |-> v" << v << "\n";); + TRACE(opt, tout << mk_pp(term, get_manager()) << " |-> v" << v << "\n";); SASSERT(!is_quasi_base(v)); if (!is_linear(get_manager(), term)) { v = null_theory_var; @@ -1055,7 +1055,7 @@ namespace smt { template inf_eps_rational theory_arith::maximize(theory_var v, expr_ref& blocker, bool& has_shared) { - TRACE("bound_bug", display_var(tout, v); display(tout);); + TRACE(bound_bug, display_var(tout, v); display(tout);); if (ctx.get_fparams().m_threads > 1) throw default_exception("multi-threaded optimization is not supported"); has_shared = false; @@ -1110,7 +1110,7 @@ namespace smt { e = m_util.mk_gt(obj, e); } } - TRACE("opt", tout << e << "\n";); + TRACE(opt, tout << e << "\n";); return e; } @@ -1127,7 +1127,7 @@ namespace smt { strm << val << " <= " << mk_pp(get_enode(v)->get_expr(), get_manager()); app* b = m.mk_const(symbol(strm.str()), m.mk_bool_sort()); expr_ref result(b, m); - TRACE("opt", tout << result << "\n";); + TRACE(opt, tout << result << "\n";); if (!ctx.b_internalized(b)) { fm.hide(b->get_decl()); bool_var bv = ctx.mk_bool_var(b); @@ -1139,7 +1139,7 @@ namespace smt { m_var_occs[v].push_back(a); m_atoms.push_back(a); insert_bv2a(bv, a); - TRACE("arith", tout << mk_pp(b, m) << "\n"; + TRACE(arith, tout << mk_pp(b, m) << "\n"; display_atom(tout, a, false);); } return result; @@ -1349,7 +1349,7 @@ namespace smt { } has_shared |= ctx.is_shared(get_enode(s)); } - TRACE("opt", + TRACE(opt, tout << (safe_gain(min_gain, max_gain)?"safe":"unsafe") << "\n"; tout << "min gain: " << min_gain; tout << " max gain: " << max_gain << "\n"; @@ -1414,7 +1414,7 @@ namespace smt { if (is_int(x)) { min_gain = inf_numeral::one(); } - TRACE("opt", + TRACE(opt, tout << "v" << x << " := " << get_value(x) << " " << "min gain: " << min_gain << " " << "max gain: " << max_gain << "\n";); @@ -1473,7 +1473,7 @@ namespace smt { if (!max_inc.is_minus_one()) { if (is_int(x_i)) { - TRACE("opt", + TRACE(opt, tout << "v" << x_i << " a_ij " << a_ij << " " << "min gain: " << min_gain << " " << "max gain: " << max_gain << "\n";); @@ -1490,7 +1490,7 @@ namespace smt { is_tighter = true; } } - TRACE("opt", + TRACE(opt, tout << "v" << x_i << (is_int(x_i)?" int":" real") << " a_ij " << a_ij << " " << "min gain: " << min_gain << " " << "max gain: " << max_gain << " tighter: " @@ -1555,7 +1555,7 @@ namespace smt { ++round; (void)round; - TRACE("opt", tout << "round: " << round << ", max: " << max << "\n"; display_row(tout, r, true); tout << "state:\n"; display(tout);); + TRACE(opt, tout << "round: " << round << ", max: " << max << "\n"; display_row(tout, r, true); tout << "state:\n"; display(tout);); typename vector::const_iterator it = r.begin_entries(); typename vector::const_iterator end = r.end_entries(); for (; it != end; ++it) { @@ -1578,12 +1578,12 @@ namespace smt { if (!safe_to_leave) { - TRACE("opt", tout << "no variable picked\n";); + TRACE(opt, tout << "no variable picked\n";); has_bound = true; best_efforts++; } else if (curr_x_i == null_theory_var) { - TRACE("opt", tout << "v" << curr_x_j << " is unrestricted by other variables\n";); + TRACE(opt, tout << "v" << curr_x_j << " is unrestricted by other variables\n";); // we can increase/decrease curr_x_j as much as we want. x_i = null_theory_var; // unbounded x_j = curr_x_j; @@ -1613,7 +1613,7 @@ namespace smt { } } - TRACE("opt", tout << "after traversing row:\nx_i: v" << x_i << ", x_j: v" << x_j << ", gain: " << max_gain << "\n"; + TRACE(opt, tout << "after traversing row:\nx_i: v" << x_i << ", x_j: v" << x_j << ", gain: " << max_gain << "\n"; tout << "best efforts: " << best_efforts << " has shared: " << has_shared << "\n";); @@ -1625,7 +1625,7 @@ namespace smt { } if (x_j == null_theory_var) { - TRACE("opt", tout << "row is " << (max ? "maximized" : "minimized") << "\n"; + TRACE(opt, tout << "row is " << (max ? "maximized" : "minimized") << "\n"; display_row(tout, r, true);); SASSERT(!maintain_integrality || valid_assignment()); SASSERT(satisfy_bounds()); @@ -1643,7 +1643,7 @@ namespace smt { if (max_gain.is_zero()) return BEST_EFFORT; SASSERT(!unbounded_gain(max_gain)); update_value(x_j, max_gain); - TRACE("opt", tout << "moved v" << x_j << " to upper bound\n";); + TRACE(opt, tout << "moved v" << x_j << " to upper bound\n";); SASSERT(!maintain_integrality || valid_assignment()); SASSERT(satisfy_bounds()); continue; @@ -1654,7 +1654,7 @@ namespace smt { SASSERT(max_gain.is_pos()); max_gain.neg(); update_value(x_j, max_gain); - TRACE("opt", tout << "moved v" << x_j << " to lower bound\n";); + TRACE(opt, tout << "moved v" << x_j << " to lower bound\n";); SASSERT(!maintain_integrality || valid_assignment()); SASSERT(satisfy_bounds()); continue; @@ -1684,11 +1684,11 @@ namespace smt { (upper_bound(x_j) - lower_bound(x_j) == max_gain)) { // can increase/decrease x_j up to upper/lower bound. if (inc) { - TRACE("opt", tout << "moved v" << x_j << " to upper bound\n";); + TRACE(opt, tout << "moved v" << x_j << " to upper bound\n";); } else { max_gain.neg(); - TRACE("opt", tout << "moved v" << x_j << " to lower bound\n";); + TRACE(opt, tout << "moved v" << x_j << " to lower bound\n";); } update_value(x_j, max_gain); SASSERT(!maintain_integrality || valid_assignment()); @@ -1696,7 +1696,7 @@ namespace smt { continue; } - TRACE("opt", tout << "max: " << max << ", x_i: v" << x_i << ", x_j: v" << x_j << ", a_ij: " << a_ij << ", coeff: " << coeff << "\n"; + TRACE(opt, tout << "max: " << max << ", x_i: v" << x_i << ", x_j: v" << x_j << ", a_ij: " << a_ij << ", coeff: " << coeff << "\n"; if (upper(x_i)) tout << "upper x_i: " << upper_bound(x_i) << " "; if (lower(x_i)) tout << "lower x_i: " << lower_bound(x_i) << " "; tout << "value x_i: " << get_value(x_i) << "\n"; @@ -1712,7 +1712,7 @@ namespace smt { bool inc_xi = inc?a_ij.is_neg():a_ij.is_pos(); if (!move_to_bound(x_i, inc_xi, best_efforts, has_shared)) { - TRACE("opt", tout << "can't move bound fully\n";); + TRACE(opt, tout << "can't move bound fully\n";); // break; // break; } @@ -1724,7 +1724,7 @@ namespace smt { SASSERT(!maintain_integrality || valid_assignment()); SASSERT(satisfy_bounds()); } - TRACE("opt_verbose", display(tout);); + TRACE(opt_verbose, display(tout);); return (best_efforts>0 || ctx.get_cancel_flag())?BEST_EFFORT:result; } @@ -1760,7 +1760,7 @@ namespace smt { } bool result = false; if (safe_gain(min_gain, max_gain)) { - TRACE("opt", tout << "Safe delta: " << max_gain << "\n";); + TRACE(opt, tout << "Safe delta: " << max_gain << "\n";); SASSERT(!unbounded_gain(max_gain)); if (!inc) { max_gain.neg(); @@ -1805,7 +1805,7 @@ namespace smt { SASSERT(satisfy_bounds()); SASSERT(!is_quasi_base(v)); if ((max && at_upper(v)) || (!max && at_lower(v))) { - TRACE("opt", display_var(tout << "At " << (max?"max: ":"min: ") << mk_pp(e, get_manager()) << " \n", v);); + TRACE(opt, display_var(tout << "At " << (max?"max: ":"min: ") << mk_pp(e, get_manager()) << " \n", v);); return AT_BOUND; // nothing to be done... } m_tmp_row.reset(); @@ -1823,16 +1823,16 @@ namespace smt { } max_min_t r = max_min(m_tmp_row, max, maintain_integrality, has_shared); if (r == OPTIMIZED) { - TRACE("opt", tout << mk_pp(e, get_manager()) << " " << (max ? "max" : "min") << " value is: " << get_value(v) << "\n"; + TRACE(opt, tout << mk_pp(e, get_manager()) << " " << (max ? "max" : "min") << " value is: " << get_value(v) << "\n"; display_row(tout, m_tmp_row, true); display_row_info(tout, m_tmp_row);); mk_bound_from_row(v, get_value(v), max ? B_UPPER : B_LOWER, m_tmp_row); } else if (r == UNBOUNDED) { - TRACE("opt", display_var(tout << "unbounded: " << mk_pp(e, get_manager()) << "\n", v);); + TRACE(opt, display_var(tout << "unbounded: " << mk_pp(e, get_manager()) << "\n", v);); } else { - TRACE("opt", display_var(tout << "not optimized: " << mk_pp(e, get_manager()) << "\n", v);); + TRACE(opt, display_var(tout << "not optimized: " << mk_pp(e, get_manager()) << "\n", v);); } return r; } @@ -1856,7 +1856,7 @@ namespace smt { if (succ) { // process new bounds bool r = propagate_core(); - TRACE("opt", tout << "after max/min round:\n"; display(tout);); + TRACE(opt, tout << "after max/min round:\n"; display(tout);); return r; } return true; @@ -1936,7 +1936,7 @@ namespace smt { } } fi_succeeded: - TRACE("freedom_interval", + TRACE(freedom_interval, tout << "freedom variable for:\n"; display_var(tout, x_j); tout << "["; @@ -2017,7 +2017,7 @@ namespace smt { SASSERT(m_tmp_row.size() > 0); #if 0 - TRACE("imply_eq", display_row_info(tout, m_tmp_row);); + TRACE(imply_eq, display_row_info(tout, m_tmp_row);); m_tmp_acc_lits.reset(); m_tmp_acc_eqs.reset(); m_tmp_lit_set.reset(); @@ -2028,7 +2028,7 @@ namespace smt { (OPTIMIZED == max_min(m_tmp_row, false)) && is_zero_row(m_tmp_row, false, m_tmp_acc_lits, m_tmp_acc_eqs, m_tmp_lit_set, m_tmp_eq_set)) { // v1 == v2 - TRACE("imply_eq", tout << "found new implied equality:\n"; + TRACE(imply_eq, tout << "found new implied equality:\n"; display_var(tout, v1); display_var(tout, v2);); // TODO: assert implied equality // return true; @@ -2138,7 +2138,7 @@ namespace smt { candidates.push_back(other); } } - TRACE("arith_rand", tout << "candidates.size() == " << candidates.size() << "\n";); + TRACE(arith_rand, tout << "candidates.size() == " << candidates.size() << "\n";); if (candidates.empty()) return; @@ -2176,7 +2176,7 @@ namespace smt { enode * r = n->get_root(); enode_vector::const_iterator it = r->begin_parents(); enode_vector::const_iterator end = r->end_parents(); - TRACE("shared", tout << ctx.get_scope_level() << " " << v << " " << r->get_num_parents() << "\n";); + TRACE(shared, tout << ctx.get_scope_level() << " " << v << " " << r->get_num_parents() << "\n";); for (; it != end; ++it) { enode * parent = *it; app * o = parent->get_expr(); @@ -2200,7 +2200,7 @@ namespace smt { // See comment in m_liberal_final_check declaration if (m_liberal_final_check) mutate_assignment(); - TRACE("assume_eq_int", display(tout);); + TRACE(assume_eq_int, display(tout);); unsigned old_sz = m_assume_eq_candidates.size(); m_var_value_table.reset(); @@ -2237,7 +2237,7 @@ namespace smt { enode* n1 = get_enode(v1); enode* n2 = get_enode(v2); m_assume_eq_head++; - CTRACE("arith", + CTRACE(arith, get_value(v1) == get_value(v2) && n1->get_root() != n2->get_root(), tout << "assuming eq: " << ctx.pp(n1) << " = #" << ctx.pp(n2) << "\n";); if (get_value(v1) == get_value(v2) && diff --git a/src/smt/theory_arith_core.h b/src/smt/theory_arith_core.h index e4f788f60..6f40cab0f 100644 --- a/src/smt/theory_arith_core.h +++ b/src/smt/theory_arith_core.h @@ -29,14 +29,14 @@ namespace smt { template void theory_arith::found_unsupported_op(app * n) { - CTRACE("arith", m_unsupported_ops.empty(), tout << "found non supported expression:\n" << mk_pp(n, m) << "\n";); + CTRACE(arith, m_unsupported_ops.empty(), tout << "found non supported expression:\n" << mk_pp(n, m) << "\n";); m_unsupported_ops.push_back(n); ctx.push_trail(push_back_vector>(m_unsupported_ops)); } template void theory_arith::found_underspecified_op(app * n) { - CTRACE("arith", m_underspecified_ops.empty(), tout << "found underspecified expression:\n" << mk_pp(n, m) << "\n";); + CTRACE(arith, m_underspecified_ops.empty(), tout << "found underspecified expression:\n" << mk_pp(n, m) << "\n";); m_underspecified_ops.push_back(n); ctx.push_trail(push_back_vector>(m_underspecified_ops)); @@ -80,7 +80,7 @@ namespace smt { static unsigned counter = 0; counter++; if (counter % 1000 == 0) { - TRACE("arith_adaptive", tout << "arith_conflicts: " << get_num_conflicts() << " total_conflicts: " << total_conflicts << " factor: " << f << "\n";); + TRACE(arith_adaptive, tout << "arith_conflicts: " << get_num_conflicts() << " total_conflicts: " << total_conflicts << " factor: " << f << "\n";); } }); return f >= adaptive_assertion_threshold(); @@ -102,7 +102,7 @@ namespace smt { SASSERT(r == static_cast(m_columns.size())); SASSERT(check_vector_sizes()); bool is_int = is_int_expr(n->get_expr()); - TRACE("mk_arith_var", tout << mk_pp(n->get_expr(), m) << " is_int: " << is_int << "\n";); + TRACE(mk_arith_var, tout << mk_pp(n->get_expr(), m) << " is_int: " << is_int << "\n";); m_columns .push_back(column()); m_data .push_back(var_data(is_int)); if (random_initial_value()) { @@ -129,7 +129,7 @@ namespace smt { m_nl_monomials.push_back(r); SASSERT(check_vector_sizes()); SASSERT(m_var_occs[r].empty()); - TRACE("mk_arith_var", + TRACE(mk_arith_var, tout << "#" << n->get_owner_id() << " :=\n" << mk_ll_pp(n->get_expr(), m) << "\n"; tout << "is_attached_to_var: " << is_attached_to_var(n) << ", var: " << n->get_th_var(get_id()) << "\n";); ctx.attach_th_var(n, this, r); @@ -343,8 +343,8 @@ namespace smt { */ template theory_var theory_arith::internalize_add(app * n) { - TRACE("add_bug", tout << "n: " << mk_pp(n, m) << "\n";); - CTRACE("internalize_add_bug", n->get_num_args() == 2 && n->get_arg(0) == n->get_arg(1), tout << "n: " << mk_pp(n, m) << "\n";); + TRACE(add_bug, tout << "n: " << mk_pp(n, m) << "\n";); + CTRACE(internalize_add_bug, n->get_num_args() == 2 && n->get_arg(0) == n->get_arg(1), tout << "n: " << mk_pp(n, m) << "\n";); SASSERT(m_util.is_add(n)); unsigned r_id = mk_row(); scoped_row_vars _sc(m_row_vars, m_row_vars_top); @@ -376,7 +376,7 @@ namespace smt { */ template theory_var theory_arith::internalize_mul_core(app * t) { - TRACE("internalize_mul_core", tout << "internalizing...\n" << mk_pp(t, m) << "\n";); + TRACE(internalize_mul_core, tout << "internalizing...\n" << mk_pp(t, m) << "\n";); if (!m_util.is_mul(t)) return internalize_term_core(t); for (expr* arg : *t) { @@ -400,7 +400,7 @@ namespace smt { template theory_var theory_arith::internalize_mul(app * m) { rational _val; - TRACE("arith", tout << m->get_num_args() << " " << mk_pp(m, get_manager()) << "\n";); + TRACE(arith, tout << m->get_num_args() << " " << mk_pp(m, get_manager()) << "\n";); SASSERT(m_util.is_mul(m)); expr* arg0 = m->get_arg(0); expr* arg1 = m->get_arg(1); @@ -465,7 +465,7 @@ namespace smt { template theory_var theory_arith::internalize_mod(app * n) { - TRACE("arith_mod", tout << "internalizing...\n" << mk_pp(n, m) << "\n";); + TRACE(arith_mod, tout << "internalizing...\n" << mk_pp(n, m) << "\n";); rational r(1); theory_var s = mk_binary_op(n); if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n); @@ -511,7 +511,7 @@ namespace smt { literal l_conseq = ctx.get_literal(s_conseq); if (negated) l_conseq.neg(); - TRACE("arith", tout << mk_pp(ante, m) << "\n" << mk_pp(conseq, m) << "\n"; + TRACE(arith, tout << mk_pp(ante, m) << "\n" << mk_pp(conseq, m) << "\n"; tout << s_ante << "\n" << s_conseq << "\n"; tout << l_ante << "\n" << l_conseq << "\n";); @@ -544,12 +544,12 @@ namespace smt { void theory_arith::mk_div_axiom(expr * p, expr * q) { if (!m_util.is_zero(q)) { expr_ref div(m), zero(m), eqz(m), eq(m); - TRACE("div_axiom_bug", tout << "expanding div_axiom for: " << mk_pp(p, m) << " / " << mk_pp(q, m) << "\n";); + TRACE(div_axiom_bug, tout << "expanding div_axiom for: " << mk_pp(p, m) << " / " << mk_pp(q, m) << "\n";); div = m_util.mk_div(p, q); zero = m_util.mk_numeral(rational(0), false); eqz = m.mk_eq(q, zero); eq = m.mk_eq(m_util.mk_mul(q, div), p); - TRACE("div_axiom_bug", tout << "eqz: " << mk_pp(eqz, m) << "\neq: " << mk_pp(eq, m) << "\n";); + TRACE(div_axiom_bug, tout << "eqz: " << mk_pp(eqz, m) << "\neq: " << mk_pp(eq, m) << "\n";); mk_axiom(eqz, eq); } } @@ -572,7 +572,7 @@ namespace smt { eq = m.mk_eq(qr, dividend); lower = m_util.mk_ge(mod, zero); upper = m_util.mk_le(mod, abs_divisor); - TRACE("div_axiom_bug", + TRACE(div_axiom_bug, tout << "eqz: " << eqz << "\n"; tout << "neq: " << eq << "\n"; tout << "lower: " << lower << "\n"; @@ -611,7 +611,7 @@ namespace smt { div_ge = m_util.mk_ge(m_util.mk_sub(dividend, m_util.mk_mul(divisor, div)), zero); s(div_ge); mk_axiom(eqz, div_ge, false); - TRACE("arith", tout << eqz << " " << div_ge << "\n"); + TRACE(arith, tout << eqz << " " << div_ge << "\n"); } if (m_params.m_arith_enum_const_mod && m_util.is_numeral(divisor, k) && @@ -721,7 +721,7 @@ namespace smt { SASSERT(n->get_num_args() == 1); if (ctx.e_internalized(n)) return expr2var(n); - TRACE("to_real_bug", tout << "to-real\n" << mk_ismt2_pp(n, m) << "\n";); + TRACE(to_real_bug, tout << "to-real\n" << mk_ismt2_pp(n, m) << "\n";); theory_var arg = internalize_term_core(to_app(n->get_arg(0))); // n may be internalized by the call above if n is of the form (to_real (to_int t)) // The internalizer for (to_int t) will create (to_real (to_int t)) and internalize it. @@ -793,7 +793,7 @@ namespace smt { */ template theory_var theory_arith::internalize_term_core(app * n) { - TRACE("arith_internalize_detail", tout << "internalize_term_core:\n" << mk_pp(n, m) << "\n";); + TRACE(arith_internalize_detail, tout << "internalize_term_core:\n" << mk_pp(n, m) << "\n";); if (ctx.e_internalized(n)) { enode * e = ctx.get_enode(n); if (is_attached_to_var(e)) @@ -845,10 +845,10 @@ namespace smt { return mk_var(mk_enode(n)); } - TRACE("arith_internalize_detail", tout << "before:\n" << mk_pp(n, m) << "\n";); + TRACE(arith_internalize_detail, tout << "before:\n" << mk_pp(n, m) << "\n";); if (!ctx.e_internalized(n)) ctx.internalize(n, false); - TRACE("arith_internalize_detail", tout << "after:\n" << mk_pp(n, m) << "\n";); + TRACE(arith_internalize_detail, tout << "after:\n" << mk_pp(n, m) << "\n";); enode * e = ctx.get_enode(n); if (!is_attached_to_var(e)) return mk_var(e); @@ -892,7 +892,7 @@ namespace smt { theory_var s = r[r.size() - 1].m_var; r.m_base_var = s; set_var_row(s, r_id); - TRACE("init_row_bug", tout << "before:\n"; display_row_info(tout, r);); + TRACE(init_row_bug, tout << "before:\n"; display_row_info(tout, r);); if (lazy_pivoting_lvl() > 2) { set_var_kind(s, QUASI_BASE); normalize_quasi_base_row(r_id); @@ -903,7 +903,7 @@ namespace smt { SASSERT(get_var_kind(s) == BASE); SASSERT(!has_var_kind(get_var_row(s), BASE)); } - TRACE("init_row_bug", tout << "after:\n"; display_row_info(tout, r);); + TRACE(init_row_bug, tout << "after:\n"; display_row_info(tout, r);); if (propagation_mode() != bound_prop_mode::BP_NONE) mark_row_for_bound_prop(r_id); SASSERT(r.is_coeff_of(s, numeral::one())); @@ -949,10 +949,10 @@ namespace smt { */ template void theory_arith::quasi_base_row2base_row(unsigned r_id) { - TRACE("quasi_base_row2base_row", tout << "quasi_base_row2base_row...\n";); + TRACE(quasi_base_row2base_row, tout << "quasi_base_row2base_row...\n";); buffer to_add; collect_vars(r_id, BASE, to_add); - TRACE("quasi_base_bug_detail", + TRACE(quasi_base_bug_detail, display_row_info(tout, r_id); for (unsigned i = 0; i < to_add.size(); i++) { theory_var v = to_add[i].m_var; @@ -995,7 +995,7 @@ namespace smt { save_value(s); } m_value[s] = get_implied_value(s); - TRACE("valid_row_assignment_bug", display_row_info(tout, r_id);); + TRACE(valid_row_assignment_bug, display_row_info(tout, r_id);); SASSERT(!has_var_kind(r_id, BASE)); SASSERT(!has_var_kind(r_id, QUASI_BASE)); SASSERT(valid_row_assignment(m_rows[r_id])); @@ -1014,13 +1014,13 @@ namespace smt { template void theory_arith::mk_clause(literal l1, literal l2, unsigned num_params, parameter * params) { - TRACE("arith", literal lits[2]; lits[0] = l1; lits[1] = l2; ctx.display_literals_verbose(tout, 2, lits); tout << "\n";); + TRACE(arith, literal lits[2]; lits[0] = l1; lits[1] = l2; ctx.display_literals_verbose(tout, 2, lits); tout << "\n";); ctx.mk_th_axiom(get_id(), l1, l2, num_params, params); } template void theory_arith::mk_clause(literal l1, literal l2, literal l3, unsigned num_params, parameter * params) { - TRACE("arith", literal lits[3]; lits[0] = l1; lits[1] = l2; lits[2] = l3; ctx.display_literals_verbose(tout, 3, lits); tout << "\n";); + TRACE(arith, literal lits[3]; lits[0] = l1; lits[1] = l2; lits[2] = l3; ctx.display_literals_verbose(tout, 3, lits); tout << "\n";); ctx.mk_th_axiom(get_id(), l1, l2, l3, num_params, params); } @@ -1028,7 +1028,7 @@ namespace smt { void theory_arith::mk_bound_axioms(atom * a1) { theory_var v = a1->get_var(); atoms & occs = m_var_occs[v]; - TRACE("mk_bound_axioms", tout << "add bound axioms for v" << v << " " << a1 << "\n";); + TRACE(mk_bound_axioms, tout << "add bound axioms for v" << v << " " << a1 << "\n";); if (!ctx.is_searching()) { // // NB. We make an assumption that user push calls propagation @@ -1040,7 +1040,7 @@ namespace smt { } inf_numeral const & k1(a1->get_k()); atom_kind kind1 = a1->get_atom_kind(); - TRACE("mk_bound_axioms", display_atom(tout << "making bound axioms for " << a1 << " ", a1, true); tout << "\n";); + TRACE(mk_bound_axioms, display_atom(tout << "making bound axioms for " << a1 << " ", a1, true); tout << "\n";); typename atoms::iterator it = occs.begin(); typename atoms::iterator end = occs.end(); @@ -1051,7 +1051,7 @@ namespace smt { atom* a2 = *it; inf_numeral const & k2(a2->get_k()); atom_kind kind2 = a2->get_atom_kind(); - TRACE("mk_bound_axioms", display_atom(tout << "compare " << a2 << " ", a2, true); tout << "\n";); + TRACE(mk_bound_axioms, display_atom(tout << "compare " << a2 << " ", a2, true); tout << "\n";); if (k1 == k2 && kind1 == kind2) { continue; @@ -1085,7 +1085,7 @@ namespace smt { template void theory_arith::mk_bound_axiom(atom* a1, atom* a2) { - TRACE("mk_bound_axioms", tout << a1 << " " << a2 << "\n";); + TRACE(mk_bound_axioms, tout << a1 << " " << a2 << "\n";); theory_var v = a1->get_var(); literal l1(a1->get_bool_var()); literal l2(a2->get_bool_var()); @@ -1152,7 +1152,7 @@ namespace smt { template void theory_arith::flush_bound_axioms() { - CTRACE("arith_verbose", !m_new_atoms.empty(), tout << "flush bound axioms\n";); + CTRACE(arith_verbose, !m_new_atoms.empty(), tout << "flush bound axioms\n";); while (!m_new_atoms.empty()) { ptr_vector atoms; @@ -1167,7 +1167,7 @@ namespace smt { --i; } } - CTRACE("arith", atoms.size() > 1, for (auto* a : atoms) a->display(*this, tout) << "\n";); + CTRACE(arith, atoms.size() > 1, for (auto* a : atoms) a->display(*this, tout) << "\n";); ptr_vector occs(m_var_occs[v]); std::sort(atoms.begin(), atoms.end(), compare_atoms()); @@ -1274,7 +1274,7 @@ namespace smt { template bool theory_arith::internalize_atom(app * n, bool gate_ctx) { - TRACE("arith_internalize", tout << "internalizing atom:\n" << mk_bounded_pp(n, m) << "\n";); + TRACE(arith_internalize, tout << "internalizing atom:\n" << mk_bounded_pp(n, m) << "\n";); SASSERT(m_util.is_le(n) || m_util.is_ge(n) || m_util.is_is_int(n)); SASSERT(!ctx.b_internalized(n)); atom_kind kind; @@ -1282,7 +1282,7 @@ namespace smt { if (m_util.is_is_int(n)) { internalize_is_int(n); if (ctx.b_internalized(n)) { - TRACE("arith_internalize", tout << "term was re-internalized: #" << n->get_id() << "\n";); + TRACE(arith_internalize, tout << "term was re-internalized: #" << n->get_id() << "\n";); return true; } bool_var bv = ctx.mk_bool_var(n); @@ -1306,11 +1306,11 @@ namespace smt { } theory_var v = internalize_term_core(lhs); if (v == null_theory_var) { - TRACE("arith_internalize", tout << "failed to internalize: #" << n->get_id() << "\n";); + TRACE(arith_internalize, tout << "failed to internalize: #" << n->get_id() << "\n";); return false; } if (ctx.b_internalized(n)) { - TRACE("arith_internalize", tout << "term was re-internalized: #" << n->get_id() << "\n";); + TRACE(arith_internalize, tout << "term was re-internalized: #" << n->get_id() << "\n";); return true; } bool_var bv = ctx.mk_bool_var(n); @@ -1333,14 +1333,14 @@ namespace smt { occs.push_back(a); m_atoms.push_back(a); insert_bv2a(bv, a); - TRACE("arith_internalize", tout << "succeeded... v" << v << " " << kind << " " << k << "\n"); + TRACE(arith_internalize, tout << "succeeded... v" << v << " " << kind << " " << k << "\n"); return true; } template bool theory_arith::internalize_term(app * term) { theory_var v = internalize_term_core(term); - TRACE("arith_internalize", tout << "internalising term: v" << v << " " << mk_bounded_pp(term, m) << "\n";); + TRACE(arith_internalize, tout << "internalising term: v" << v << " " << mk_bounded_pp(term, m) << "\n";); return v != null_theory_var; } @@ -1358,7 +1358,7 @@ namespace smt { if (n1->get_th_var(get_id()) != null_theory_var && n2->get_th_var(get_id()) != null_theory_var && n1 != n2) { - TRACE("mk_axioms_bug", tout << mk_bounded_pp(atom, m, 5) << "\n";); + TRACE(mk_axioms_bug, tout << mk_bounded_pp(atom, m, 5) << "\n";); m_arith_eq_adapter.mk_axioms(n1, n2); } } @@ -1373,7 +1373,7 @@ namespace smt { void theory_arith::assign_eh(bool_var v, bool is_true) { atom * a = get_bv2a(v); if (!a) return; - TRACE("arith", tout << "assign p" << literal(v,!is_true) << " : " << mk_bounded_pp(ctx.bool_var2expr(v), m) << "\n";); + TRACE(arith, tout << "assign p" << literal(v,!is_true) << " : " << mk_bounded_pp(ctx.bool_var2expr(v), m) << "\n";); SASSERT(ctx.get_assignment(a->get_bool_var()) != l_undef); SASSERT((ctx.get_assignment(a->get_bool_var()) == l_true) == is_true); a->assign_eh(is_true, get_epsilon(a->get_var())); @@ -1382,7 +1382,7 @@ namespace smt { template void theory_arith::relevant_eh(app * n) { - TRACE("arith_relevant_eh", tout << "relevant_eh: " << mk_pp(n, m) << "\n";); + TRACE(arith_relevant_eh, tout << "relevant_eh: " << mk_pp(n, m) << "\n";); if (m_util.is_mod(n)) mk_idiv_mod_axioms(n->get_arg(0), n->get_arg(1)); else if (m_util.is_rem(n)) @@ -1397,7 +1397,7 @@ namespace smt { template void theory_arith::new_eq_eh(theory_var v1, theory_var v2) { - TRACE("arith_new_eq_eh", tout << ctx.pp(get_enode(v1)) << "\n" << ctx.pp(get_enode(v2)) << "\n";); + TRACE(arith_new_eq_eh, tout << ctx.pp(get_enode(v1)) << "\n" << ctx.pp(get_enode(v2)) << "\n";); enode * n1 = get_enode(v1); @@ -1451,7 +1451,7 @@ namespace smt { template void theory_arith::new_diseq_eh(theory_var v1, theory_var v2) { - TRACE("arith_new_diseq_eh", tout << mk_bounded_pp(get_enode(v1)->get_expr(), m) << "\n" << + TRACE(arith_new_diseq_eh, tout << mk_bounded_pp(get_enode(v1)->get_expr(), m) << "\n" << mk_bounded_pp(get_enode(v2)->get_expr(), m) << "\n";); m_stats.m_assert_diseq++; m_arith_eq_adapter.new_diseq_eh(v1, v2); @@ -1464,7 +1464,7 @@ namespace smt { template void theory_arith::init_search_eh() { - TRACE("arith_init_search", display(tout);); + TRACE(arith_init_search, display(tout);); m_num_conflicts = 0; m_branch_cut_counter = 0; m_eager_gcd = m_params.m_arith_eager_gcd; @@ -1490,22 +1490,22 @@ namespace smt { SASSERT(m_to_patch.empty()); - TRACE("arith", tout << "m_final_check_idx: " << m_final_check_idx << ", result: " << result << "\n";); + TRACE(arith, tout << "m_final_check_idx: " << m_final_check_idx << ", result: " << result << "\n";); switch (m_final_check_idx) { case 0: ok = check_int_feasibility(); - TRACE("arith", tout << "check_int_feasibility(), ok: " << ok << "\n";); + TRACE(arith, tout << "check_int_feasibility(), ok: " << ok << "\n";); break; case 1: if (assume_eqs()) ok = FC_CONTINUE; else ok = FC_DONE; - TRACE("arith", tout << "assume_eqs(), ok: " << ok << "\n";); + TRACE(arith, tout << "assume_eqs(), ok: " << ok << "\n";); break; default: ok = process_non_linear(); - TRACE("arith", tout << "non_linear(), ok: " << ok << "\n";); + TRACE(arith, tout << "non_linear(), ok: " << ok << "\n";); break; } m_final_check_idx = (m_final_check_idx + 1) % 3; @@ -1516,7 +1516,7 @@ namespace smt { result = FC_GIVEUP; break; case FC_CONTINUE: - TRACE("arith", + TRACE(arith, tout << "continue arith..." << (ctx.inconsistent()?"inconsistent\n":"\n");); return FC_CONTINUE; @@ -1527,7 +1527,7 @@ namespace smt { for (app* n : m_unsupported_ops) { if (!ctx.is_relevant(n)) continue; - TRACE("arith", tout << "Found unsupported operation " << mk_pp(n, m) << "\n"); + TRACE(arith, tout << "Found unsupported operation " << mk_pp(n, m) << "\n"); result = FC_GIVEUP; } } @@ -1536,8 +1536,8 @@ namespace smt { template final_check_status theory_arith::final_check_eh() { - TRACE("arith_eq_adapter_info", m_arith_eq_adapter.display_already_processed(tout);); - TRACE("arith", display(tout);); + TRACE(arith_eq_adapter_info, m_arith_eq_adapter.display_already_processed(tout);); + TRACE(arith, display(tout);); if (!propagate_core()) return FC_CONTINUE; @@ -1554,7 +1554,7 @@ namespace smt { m_liberal_final_check = false; m_changed_assignment = false; result = final_check_core(); - TRACE("arith", tout << "result: " << result << "\n";); + TRACE(arith, tout << "result: " << result << "\n";); return result; } @@ -1869,7 +1869,7 @@ namespace smt { SASSERT(m_value[v] == get_value(v)); m_old_value[v] = m_value[v]; m_update_trail_stack.push_back(v); - TRACE("save_value", tout << "v" << v << " = " << get_value(v) << "\n";); + TRACE(save_value, tout << "v" << v << " = " << get_value(v) << "\n";); } m_changed_assignment = true; } @@ -1883,9 +1883,9 @@ namespace smt { template void theory_arith::restore_assignment() { CASSERT("arith", valid_row_assignment()); - TRACE("restore_assignment_bug", tout << "START restore_assignment...\n";); + TRACE(restore_assignment_bug, tout << "START restore_assignment...\n";); for (theory_var v : m_update_trail_stack) { - TRACE("restore_assignment_bug", tout << "restoring v" << v << " <- " << m_old_value[v] << "\n";); + TRACE(restore_assignment_bug, tout << "restoring v" << v << " <- " << m_old_value[v] << "\n";); SASSERT(!is_quasi_base(v)); SASSERT(m_in_update_trail_stack.contains(v)); m_value[v] = m_old_value[v]; @@ -1953,7 +1953,7 @@ namespace smt { template template void theory_arith::pivot(theory_var x_i, theory_var x_j, numeral const & a_ij, bool apply_gcd_test) { - TRACE("arith_pivoting", tout << "pivoting: v" << x_i << ", v" << x_j << "\n";); + TRACE(arith_pivoting, tout << "pivoting: v" << x_i << ", v" << x_j << "\n";); m_stats.m_pivots++; SASSERT(is_base(x_i) || is_quasi_base(x_i)); SASSERT(x_i != x_j); @@ -1996,15 +1996,15 @@ namespace smt { CASSERT("arith", wf_rows()); CASSERT("arith", wf_columns()); CASSERT("arith", valid_row_assignment()); - TRACE("arith_pivot", tout << "after pivoting:\n"; + TRACE(arith_pivot, tout << "after pivoting:\n"; display(tout);); - TRACE("pivot_shape", display_rows_shape(tout);); - TRACE("pivot_stats", display_rows_stats(tout);); + TRACE(pivot_shape, display_rows_shape(tout);); + TRACE(pivot_stats, display_rows_stats(tout);); TRACE_CODE({ static unsigned val = 0; val ++; if (val % 100 == 0) { - TRACE("pivot_bignums", display_rows_bignums(tout);); + TRACE(pivot_bignums, display_rows_bignums(tout);); }}); } @@ -2042,7 +2042,7 @@ namespace smt { } } } - CTRACE("eliminate", !Lazy && c.size() != 1, + CTRACE(eliminate, !Lazy && c.size() != 1, tout << "eliminating v" << x_i << ", Lazy: " << Lazy << ", c.size: " << c.size() << "\n"; display(tout);); SASSERT(Lazy || c.size() == 1); @@ -2063,16 +2063,16 @@ namespace smt { template void theory_arith::update_and_pivot(theory_var x_i, theory_var x_j, numeral const & a_ij, inf_numeral const & x_i_new_val) { CASSERT("arith", valid_row_assignment()); - TRACE("update_and_pivot_bug_detail", display(tout);); + TRACE(update_and_pivot_bug_detail, display(tout);); SASSERT(is_base(x_i)); inf_numeral theta = m_value[x_i]; - TRACE("update_and_pivot_bug", tout << "theta 1) " << theta << " " << x_i_new_val << "\n";); + TRACE(update_and_pivot_bug, tout << "theta 1) " << theta << " " << x_i_new_val << "\n";); theta -= x_i_new_val; - TRACE("update_and_pivot_bug", tout << "theta 2) " << theta << " " << a_ij << "\n";); + TRACE(update_and_pivot_bug, tout << "theta 2) " << theta << " " << a_ij << "\n";); theta /= a_ij; - TRACE("update_and_pivot_bug", tout << "theta 3) " << theta << "\n";); + TRACE(update_and_pivot_bug, tout << "theta 3) " << theta << "\n";); update_value(x_j, theta); - CTRACE("arith", get_value(x_i) != x_i_new_val, + CTRACE(arith, get_value(x_i) != x_i_new_val, tout << "x_i: " << x_i << ", x_j: " << x_j << ", a_ij: " << a_ij << ", x_i_new_val: " << x_i_new_val << "\n"; tout << "new val: " << get_value(x_i) << ", theta: " << theta << "\n"; display(tout);); @@ -2215,8 +2215,8 @@ namespace smt { */ template theory_var theory_arith::select_pivot(theory_var x_i, bool is_below, numeral & out_a_ij) { - TRACE("select_pivot", tout << "m_blands_rule: " << m_blands_rule << " v" << x_i << "\n";); - CTRACE("select_pivot_info", x_i > 500, ctx.display(tout);); + TRACE(select_pivot, tout << "m_blands_rule: " << m_blands_rule << " v" << x_i << "\n";); + CTRACE(select_pivot_info, x_i > 500, ctx.display(tout);); if (m_blands_rule) return select_blands_pivot_core(x_i, is_below, out_a_ij); else if (is_below) @@ -2238,7 +2238,7 @@ namespace smt { */ template bool theory_arith::make_var_feasible(theory_var x_i) { - CTRACE("arith_bug", !is_base(x_i), + CTRACE(arith_bug, !is_base(x_i), tout << "x_i: " << x_i << ", below_lower(x_i): " << below_lower(x_i) << ", above_upper(x_i): " << above_upper(x_i) << "\n"; display(tout);); SASSERT(is_base(x_i)); @@ -2255,13 +2255,13 @@ namespace smt { return true; } - TRACE("make_var_feasible", display_row(tout, get_var_row(x_i), false);); + TRACE(make_var_feasible, display_row(tout, get_var_row(x_i), false);); numeral a_ij; theory_var x_j = select_pivot(x_i, is_below, a_ij); if (x_j != null_theory_var) { SASSERT(is_base(x_i)); - TRACE("pivot_bug", display_row_info(tout, get_var_row(x_i));); + TRACE(pivot_bug, display_row_info(tout, get_var_row(x_i));); update_and_pivot(x_i, x_j, a_ij, get_bound(x_i, !is_below)->get_value()); return true; } @@ -2274,7 +2274,7 @@ namespace smt { template theory_var theory_arith::select_lg_error_var(bool least) { - TRACE("select_pivot", tout << "starting...\n";); + TRACE(select_pivot, tout << "starting...\n";); theory_var best = null_theory_var; inf_numeral best_error; inf_numeral curr_error; @@ -2287,7 +2287,7 @@ namespace smt { continue; SASSERT(curr_error > inf_numeral(0)); if (best == null_theory_var || (!least && curr_error > best_error) || (least && curr_error < best_error)) { - TRACE("select_pivot", tout << "best: " << best << " v" << v + TRACE(select_pivot, tout << "best: " << best << " v" << v << ", best_error: " << best_error << ", curr_error: " << curr_error << "\n";); best = v; best_error = curr_error; @@ -2325,7 +2325,7 @@ namespace smt { */ template bool theory_arith::make_feasible() { - TRACE("arith_make_feasible", tout << "make_feasible\n"; display(tout);); + TRACE(arith_make_feasible, tout << "make_feasible\n"; display(tout);); CASSERT("arith", wf_rows()); CASSERT("arith", wf_columns()); CASSERT("arith", valid_row_assignment()); @@ -2344,7 +2344,7 @@ namespace smt { if (m_left_basis.contains(v)) { num_repeated++; if (num_repeated > blands_rule_threshold()) { - TRACE("blands_rule", tout << "using blands rule, " << num_repeated << "\n";); + TRACE(blands_rule, tout << "using blands rule, " << num_repeated << "\n";); // std::cerr << "BLANDS RULE...\n"; m_blands_rule = true; } @@ -2354,15 +2354,15 @@ namespace smt { } } if (!make_var_feasible(v)) { - TRACE("arith_make_feasible", tout << "make_feasible: unsat\n"; display(tout);); + TRACE(arith_make_feasible, tout << "make_feasible: unsat\n"; display(tout);); return false; } - TRACE("arith_make_feasible_detail", display(tout);); + TRACE(arith_make_feasible_detail, display(tout);); if (ctx.get_cancel_flag()) { return true; } } - TRACE("arith_make_feasible", tout << "make_feasible: sat\n"; display(tout);); + TRACE(arith_make_feasible, tout << "make_feasible: sat\n"; display(tout);); CASSERT("arith", wf_rows()); CASSERT("arith", wf_columns()); CASSERT("arith", valid_row_assignment()); @@ -2418,7 +2418,7 @@ namespace smt { explain_bound(r, idx, !is_below, delta, ante); b->push_justification(ante, numeral(1), coeffs_enabled()); - TRACE("sign_row_conflict", tout << "v" << x_i << " is_below: " << is_below << " delta: " << delta << "\n"; display_var(tout, x_i); + TRACE(sign_row_conflict, tout << "v" << x_i << " is_below: " << is_below << " delta: " << delta << "\n"; display_var(tout, x_i); tout << "is_below_lower: " << below_lower(x_i) << ", is_above_upper: " << above_upper(x_i) << "\n"; display_row(tout, r, true); display_row(tout, r, false); @@ -2461,7 +2461,7 @@ namespace smt { SASSERT(get_var_kind(v) == BASE); case BASE: if (!m_to_patch.contains(v) && get_value(v) < k) { - TRACE("to_patch_bug", tout << "need to be patched (assert_lower): "; display_var(tout, v);); + TRACE(to_patch_bug, tout << "need to be patched (assert_lower): "; display_var(tout, v);); m_to_patch.insert(v); } break; @@ -2489,7 +2489,7 @@ namespace smt { theory_var v = b->get_var(); inf_numeral const & k = b->get_value(); - TRACE("arith", display_bound(tout, b); tout << "v" << v << " <= " << k << "\n";); + TRACE(arith, display_bound(tout, b); tout << "v" << v << " <= " << k << "\n";); bound * u = upper(v); bound * l = lower(v); @@ -2509,7 +2509,7 @@ namespace smt { SASSERT(get_var_kind(v) == BASE); case BASE: if (!m_to_patch.contains(v) && get_value(v) > k) { - TRACE("to_patch_bug", tout << "need to be patched (assert upper): "; display_var(tout, v);); + TRACE(to_patch_bug, tout << "need to be patched (assert upper): "; display_var(tout, v);); m_to_patch.insert(v); } break; @@ -2530,11 +2530,11 @@ namespace smt { template bool theory_arith::assert_bound(bound * b) { - TRACE("assert_bound", display_bound(tout, b); display(tout);); + TRACE(assert_bound, display_bound(tout, b); display(tout);); theory_var v = b->get_var(); if (b->is_atom()) { - CTRACE("unassigned_atoms", m_unassigned_atoms[v] <= 0, display_var(tout, v);); + CTRACE(unassigned_atoms, m_unassigned_atoms[v] <= 0, display_var(tout, v);); SASSERT(m_unassigned_atoms[v] > 0); push_dec_unassigned_atoms_trail(v); m_unassigned_atoms[v]--; @@ -2552,7 +2552,7 @@ namespace smt { break; } - TRACE("arith_bound", tout << "result: " << result << "\n"; display(tout);); + TRACE(arith_bound, tout << "result: " << result << "\n"; display(tout);); return result; } @@ -2565,7 +2565,7 @@ namespace smt { antecedents ante(*this); b1->push_justification(ante, numeral(1), coeffs_enabled()); b2->push_justification(ante, numeral(1), coeffs_enabled()); - TRACE("arith_conflict", tout << "bound conflict v" << b1->get_var() << "\n"; + TRACE(arith_conflict, tout << "bound conflict v" << b1->get_var() << "\n"; display_bound(tout, b1, 0); display_bound(tout, b2, 0);); set_conflict(ante, ante, "farkas"); @@ -2647,7 +2647,7 @@ namespace smt { if (!it->is_dead()) { #define UPDATE_IDX(IDX) IDX = IDX == -1 ? i : -2 if (skip_big_coeffs() && it->m_coeff.is_big()) { - TRACE("is_row_useful", tout << "skipping row that contains big number...\n"; display_row_info(tout, r);); + TRACE(is_row_useful, tout << "skipping row that contains big number...\n"; display_row_info(tout, r);); lower_idx = -2; upper_idx = -2; return; @@ -2700,7 +2700,7 @@ namespace smt { // implied_k is a lower bound for entry.m_var bound * curr = lower(entry.m_var); if (curr == nullptr || implied_k > curr->get_value()) { - TRACE("arith_imply_bound", + TRACE(arith_imply_bound, tout << "implying lower bound for v" << entry.m_var << " " << implied_k << " using row:\n"; display_row_info(tout, r); display_var(tout, entry.m_var);); @@ -2711,7 +2711,7 @@ namespace smt { // implied_k is an upper bound for it->m_var bound * curr = upper(entry.m_var); if (curr == nullptr || implied_k < curr->get_value()) { - TRACE("arith_imply_bound", + TRACE(arith_imply_bound, tout << "implying upper bound for v" << entry.m_var << " " << implied_k << " using row:\n"; display_row_info(tout, r); display_var(tout, entry.m_var);); @@ -2755,7 +2755,7 @@ namespace smt { implied_k.addmul(it->m_coeff, b); // implied_k is a bound for the monomial in position it implied_k /= it->m_coeff; - TRACE("arith_imply_bound", + TRACE(arith_imply_bound, display_var(tout, it->m_var); tout << "implied bound: " << (it->m_coeff.is_pos() ? ">=" : "<=") << implied_k << "\n";); if (it->m_coeff.is_pos() == is_lower) { @@ -2763,7 +2763,7 @@ namespace smt { bound * curr = lower(it->m_var); if (curr == nullptr || implied_k > curr->get_value()) { // improved lower bound - TRACE("arith_imply_bound", + TRACE(arith_imply_bound, tout << "implying lower bound for v" << it->m_var << " " << implied_k << " using row:\n"; display_row_info(tout, r); display_var(tout, it->m_var);); @@ -2775,7 +2775,7 @@ namespace smt { bound * curr = upper(it->m_var); if (curr == nullptr || implied_k < curr->get_value()) { // improved upper bound - TRACE("arith_imply_bound", + TRACE(arith_imply_bound, tout << "implying upper bound for v" << it->m_var << " " << implied_k << " using row:\n"; display_row_info(tout, r); display_var(tout, it->m_var);); @@ -2801,7 +2801,7 @@ namespace smt { template void theory_arith::explain_bound(row const & r, int idx, bool is_lower, inf_numeral & delta, antecedents& ante) { SASSERT(delta >= inf_numeral::zero()); - TRACE("arith_conflict", tout << "delta: " << delta << " relax: " << relax_bounds() << " lits: " << ante.lits().size() << " eqs: " << ante.eqs().size() << " idx: " << idx << "\n";); + TRACE(arith_conflict, tout << "delta: " << delta << " relax: " << relax_bounds() << " lits: " << ante.lits().size() << " eqs: " << ante.eqs().size() << " idx: " << idx << "\n";); if (!relax_bounds() && (!ante.lits().empty() || !ante.eqs().empty())) { return; @@ -2817,7 +2817,7 @@ namespace smt { } typename vector::const_iterator it = r.begin_entries(); typename vector::const_iterator end = r.end_entries(); - TRACE("arith_proof", display_row(tout, r, false); ); + TRACE(arith_proof, display_row(tout, r, false); ); for (int idx2 = 0; it != end; ++it, ++idx2) { if (!it->is_dead() && idx != idx2) { bound * b = get_bound(it->m_var, is_lower ? it->m_coeff.is_pos() : it->m_coeff.is_neg()); @@ -2826,7 +2826,7 @@ namespace smt { continue; } if (!relax_bounds() || delta.is_zero()) { - TRACE("propagate_bounds", tout << "push justification: v" << it->m_var << "\n";); + TRACE(propagate_bounds, tout << "push justification: v" << it->m_var << "\n";); b->push_justification(ante, it->m_coeff, coeffs_enabled()); continue; } @@ -2850,7 +2850,7 @@ namespace smt { // limit_k1 += delta * coeff; limit_k1.addmul(inv_coeff, delta); } - TRACE("propagate_bounds_bug", tout << "is_b_lower: " << is_b_lower << " k1: " << k_1 << " limit_k1: " + TRACE(propagate_bounds_bug, tout << "is_b_lower: " << is_b_lower << " k1: " << k_1 << " limit_k1: " << limit_k1 << " delta: " << delta << " coeff: " << coeff << "\n";); inf_numeral k_2 = k_1; atom * new_atom = nullptr; @@ -2863,7 +2863,7 @@ namespace smt { if (val == l_undef) continue; // TODO: check if the following line is a bottleneck - TRACE("arith", tout << "v" << a->get_bool_var() << " " << (val == l_true) << "\n";); + TRACE(arith, tout << "v" << a->get_bool_var() << " " << (val == l_true) << "\n";); a->assign_eh(val == l_true, get_epsilon(a->get_var())); if (val != l_undef && a->get_bound_kind() == b->get_bound_kind()) { @@ -2892,14 +2892,14 @@ namespace smt { SASSERT(!is_b_lower || k_2 < k_1); SASSERT(is_b_lower || k_2 > k_1); if (is_b_lower) { - TRACE("propagate_bounds", tout << "coeff: " << coeff << ", k_1 - k_2: " << k_1 - k_2 << ", delta: " << delta << "\n";); + TRACE(propagate_bounds, tout << "coeff: " << coeff << ", k_1 - k_2: " << k_1 - k_2 << ", delta: " << delta << "\n";); delta -= coeff*(k_1 - k_2); } else { - TRACE("propagate_bounds", tout << "coeff: " << coeff << ", k_2 - k_1: " << k_2 - k_1 << ", delta: " << delta << "\n";); + TRACE(propagate_bounds, tout << "coeff: " << coeff << ", k_2 - k_1: " << k_2 - k_1 << ", delta: " << delta << "\n";); delta -= coeff*(k_2 - k_1); } - TRACE("propagate_bounds", tout << "delta (after replace): " << delta << "\n";); + TRACE(propagate_bounds, tout << "delta (after replace): " << delta << "\n";); new_atom->push_justification(ante, coeff, coeffs_enabled()); SASSERT(delta >= inf_numeral::zero()); } @@ -2925,7 +2925,7 @@ namespace smt { delta = k; delta -= k2; } - TRACE("propagate_bounds", tout << "v" << v << " >= " << k << ", v" << v << " >= " << k2 << ", delta: " << delta << "\n"; + TRACE(propagate_bounds, tout << "v" << v << " >= " << k << ", v" << v << " >= " << k2 << ", delta: " << delta << "\n"; display_row(tout, r);); assign_bound_literal(l, r, idx, is_lower, delta); ++count; @@ -2942,7 +2942,7 @@ namespace smt { delta -= k; delta -= epsilon; if (delta.is_nonneg()) { - TRACE("propagate_bounds", tout << "v" << v << " <= " << k << ", not v" << v << " >= " << k2 << ", delta: " << delta << "\n"; + TRACE(propagate_bounds, tout << "v" << v << " <= " << k << ", not v" << v << " >= " << k2 << ", delta: " << delta << "\n"; display_row(tout, r);); assign_bound_literal(~l, r, idx, is_lower, delta); ++count; @@ -2958,7 +2958,7 @@ namespace smt { delta -= k2; delta -= epsilon; if (delta.is_nonneg()) { - TRACE("propagate_bounds", tout << "v" << v << " >= " << k << ", not v" << v << " <= " << k2 << ", delta: " << delta << "\n"; + TRACE(propagate_bounds, tout << "v" << v << " >= " << k << ", not v" << v << " <= " << k2 << ", delta: " << delta << "\n"; display_row(tout, r);); assign_bound_literal(~l, r, idx, is_lower, delta); ++count; @@ -2970,7 +2970,7 @@ namespace smt { delta = k2; delta -= k; } - TRACE("propagate_bounds", tout << "v" << v << " <= " << k << ", v" << v << " <= " << k2 << ", delta: " << delta << "\n"; + TRACE(propagate_bounds, tout << "v" << v << " <= " << k << ", v" << v << " <= " << k2 << ", delta: " << delta << "\n"; display_row(tout, r);); assign_bound_literal(l, r, idx, is_lower, delta); ++count; @@ -2990,11 +2990,11 @@ namespace smt { explain_bound(r, idx, is_lower, delta, ante); - TRACE("propagate_bounds", + TRACE(propagate_bounds, ante.display(tout) << " --> "; ctx.display_detailed_literal(tout, l) << "\n"); - TRACE("arith", tout << "@" << ctx.get_scope_level() << ": "; + TRACE(arith, tout << "@" << ctx.get_scope_level() << ": "; ante.display(tout) << " --> "; ctx.display_detailed_literal(tout, l) << "\n"); @@ -3025,7 +3025,7 @@ namespace smt { */ template void theory_arith::propagate_bounds() { - TRACE("propagate_bounds_detail", display(tout);); + TRACE(propagate_bounds_detail, display(tout);); unsigned count = 0; for (unsigned r_idx : m_to_check) { row & r = m_rows[r_idx]; @@ -3077,7 +3077,7 @@ namespace smt { SASSERT(num_literals != 0 || num_eqs != 0); m_stats.m_conflicts++; m_num_conflicts++; - TRACE("arith_conflict", + TRACE(arith_conflict, if (proof_rule) tout << proof_rule << "\n"; tout << "@" << ctx.get_scope_level() << "\n"; @@ -3184,7 +3184,7 @@ namespace smt { if (u != nullptr) update_epsilon(get_value(v), u->get_value()); } - TRACE("epsilon_bug", tout << "epsilon: " << m_epsilon << "\n";); + TRACE(epsilon_bug, tout << "epsilon: " << m_epsilon << "\n";); } /** @@ -3228,7 +3228,7 @@ namespace smt { if (get_value(v) != get_value(v2)) { // v and v2 are not known to be equal. // The choice of m_epsilon is making them equal. - TRACE("refine_epsilon", + TRACE(refine_epsilon, tout << "v" << v << " v" << v2 << " " << get_value(v) << " " << get_value(v2) << " " << value << std::endl; ); refine = true; @@ -3243,13 +3243,13 @@ namespace smt { return; numeral two(2); m_epsilon = m_epsilon / two; - TRACE("refine_epsilon", tout << "new epsilon..." << m_epsilon << std::endl;); + TRACE(refine_epsilon, tout << "new epsilon..." << m_epsilon << std::endl;); } } template void theory_arith::init_model(model_generator & mg) { - TRACE("theory_arith", tout << "init model invoked...\n"; + TRACE(theory_arith, tout << "init model invoked...\n"; for (app* n : m_underspecified_ops) { tout << mk_pp(n, m) << "\n"; }); @@ -3279,7 +3279,7 @@ namespace smt { inf_numeral const & val = get_value(v); rational num = val.get_rational().to_rational() + m_epsilon.to_rational() * val.get_infinitesimal().to_rational(); if (is_int(v) && !num.is_int()) { - TRACE("arith", tout << "Truncating non-integer value. This is possible for non-linear constraints v" << v << " " << num << "\n";); + TRACE(arith, tout << "Truncating non-integer value. This is possible for non-linear constraints v" << v << " " << num << "\n";); num = floor(num); } return alloc(expr_wrapper_proc, m_factory->mk_num_value(num, m_util.is_int(var2expr(v)))); @@ -3368,7 +3368,7 @@ namespace smt { CASSERT("arith", wf_rows()); CASSERT("arith", wf_columns()); CASSERT("arith", valid_row_assignment()); - TRACE("arith_pop_scope_bug", display(tout);); + TRACE(arith_pop_scope_bug, display(tout);); // The m_update_trail_stack may not be empty. // In an old version, only propagate_core and methods invoked by propagate_core were // inserting elements in the m_update_trail_stack stack. @@ -3492,13 +3492,13 @@ namespace smt { case QUASI_BASE: SASSERT(m_columns[v].size() == 1); del_row(get_var_row(v)); - TRACE("arith_make_feasible", tout << "del row v" << v << "\n";); + TRACE(arith_make_feasible, tout << "del row v" << v << "\n";); break; case BASE: SASSERT(lazy_pivoting_lvl() != 0 || m_columns[v].size() == 1); if (lazy_pivoting_lvl() > 0) eliminate(v, false); - TRACE("arith_make_feasible", tout << "del row v" << v << "\n";); + TRACE(arith_make_feasible, tout << "del row v" << v << "\n";); del_row(get_var_row(v)); break; case NON_BASE: { @@ -3510,10 +3510,10 @@ namespace smt { pivot(r.get_base_var(), v, r[entry->m_row_idx].m_coeff, false); SASSERT(is_base(v)); del_row(get_var_row(v)); - TRACE("arith_make_feasible", tout << "del row v" << v << "\n";); + TRACE(arith_make_feasible, tout << "del row v" << v << "\n";); } else { - TRACE("arith_make_feasible", tout << "no row v" << v << "\n";); + TRACE(arith_make_feasible, tout << "no row v" << v << "\n";); } break; } } diff --git a/src/smt/theory_arith_eq.h b/src/smt/theory_arith_eq.h index ebdd6e73e..b98347577 100644 --- a/src/smt/theory_arith_eq.h +++ b/src/smt/theory_arith_eq.h @@ -63,7 +63,7 @@ namespace smt { lower(v2)->push_justification(ante, numeral::zero(), proofs_enabled()); upper(v)->push_justification(ante, numeral::zero(), proofs_enabled()); - TRACE("arith_eq", tout << "propagate eq: v" << v << " = v" << v2 << "\n"; + TRACE(arith_eq, tout << "propagate eq: v" << v << " = v" << v2 << "\n"; display_var(tout, v); display_var(tout, v2);); m_stats.m_fixed_eqs++; @@ -174,7 +174,7 @@ namespace smt { timer.stop(); ok++; if (ok % 100000 == 0) { - TRACE("arith_eq", + TRACE(arith_eq, tout << total << " " << ok << " " << static_cast(ok)/static_cast(total) << " " << timer.get_seconds() << "\n"; @@ -215,7 +215,7 @@ namespace smt { void theory_arith::propagate_cheap_eq(unsigned rid) { if (!propagate_eqs()) return; - TRACE("arith_eq_verbose", tout << "checking if row " << rid << " can propagate equality.\n"; + TRACE(arith_eq_verbose, tout << "checking if row " << rid << " can propagate equality.\n"; display_row_info(tout, rid);); row const & r = m_rows[rid]; theory_var x; @@ -245,7 +245,7 @@ namespace smt { // // x1 <= k1 x1 >= k1, x2 <= x1 + k2 x2 >= x1 + k2 // - TRACE("arith_eq", tout << "fixed\n";); + TRACE(arith_eq, tout << "fixed\n";); lower(x2)->push_justification(ante, numeral::zero(), proofs_enabled()); upper(x2)->push_justification(ante, numeral::zero(), proofs_enabled()); m_stats.m_fixed_eqs++; @@ -258,7 +258,7 @@ namespace smt { // found equality x = y antecedents ante(*this); collect_fixed_var_justifications(r, ante); - TRACE("arith_eq", tout << "propagate eq using x-y=0 row:\n"; display_row_info(tout, r);); + TRACE(arith_eq, tout << "propagate eq using x-y=0 row:\n"; display_row_info(tout, r);); m_stats.m_offset_eqs++; propagate_eq_to_core(x, y, ante); } @@ -293,7 +293,7 @@ namespace smt { antecedents ante(*this); collect_fixed_var_justifications(r, ante); collect_fixed_var_justifications(r2, ante); - TRACE("arith_eq", tout << "propagate eq two rows:\n"; + TRACE(arith_eq, tout << "propagate eq two rows:\n"; tout << "x : v" << x << "\n"; tout << "x2 : v" << x2 << "\n"; display_row_info(tout, r); @@ -321,7 +321,7 @@ namespace smt { enode * _x = get_enode(x); enode * _y = get_enode(y); // I doesn't make sense to propagate an equality (to the core) of variables of different sort. - CTRACE("arith", _x->get_sort() != _y->get_sort(), tout << enode_pp(_x, ctx) << " = " << enode_pp(_y, ctx) << "\n"); + CTRACE(arith, _x->get_sort() != _y->get_sort(), tout << enode_pp(_x, ctx) << " = " << enode_pp(_y, ctx) << "\n"); if (_x->get_sort() != _y->get_sort()) return; @@ -335,7 +335,7 @@ namespace smt { eqs.size(), eqs.data(), _x, _y, antecedents.num_params(), antecedents.params("eq-propagate"))); - TRACE("arith_eq", tout << "detected equality: #" << _x->get_owner_id() << " = #" << _y->get_owner_id() << "\n"; + TRACE(arith_eq, tout << "detected equality: #" << _x->get_owner_id() << " = #" << _y->get_owner_id() << "\n"; display_var(tout, x); display_var(tout, y); for (literal lit : lits) diff --git a/src/smt/theory_arith_int.h b/src/smt/theory_arith_int.h index 905f67704..19658b0f4 100644 --- a/src/smt/theory_arith_int.h +++ b/src/smt/theory_arith_int.h @@ -147,7 +147,7 @@ namespace smt { template theory_var theory_arith::find_infeasible_int_base_var() { theory_var r = find_bounded_infeasible_int_base_var(); - CTRACE("find_infeasible_int_base_var", r != null_theory_var, display_var(tout << "bounded infeasible", r);); + CTRACE(find_infeasible_int_base_var, r != null_theory_var, display_var(tout << "bounded infeasible", r);); unsigned n = 0; @@ -169,7 +169,7 @@ namespace smt { } } } - CTRACE("find_infeasible_int_base_var", r != null_theory_var, tout << "found small value v" << r << "\n"); + CTRACE(find_infeasible_int_base_var, r != null_theory_var, tout << "found small value v" << r << "\n"); } if (r == null_theory_var) { @@ -179,7 +179,7 @@ namespace smt { SELECT_VAR(v); } } - CTRACE("find_infeasible_int_base_var", r != null_theory_var, tout << "found base v" << r << "\n"); + CTRACE(find_infeasible_int_base_var, r != null_theory_var, tout << "found base v" << r << "\n"); } @@ -191,7 +191,7 @@ namespace smt { SELECT_VAR(v); } } - CTRACE("find_infeasible_int_base_var", r != null_theory_var, tout << "found quasi base v" << r << "\n"); + CTRACE(find_infeasible_int_base_var, r != null_theory_var, tout << "found quasi base v" << r << "\n"); } CASSERT("arith", wf_rows()); CASSERT("arith", wf_columns()); @@ -210,7 +210,7 @@ namespace smt { m_stats.m_branches++; numeral k = ceil(get_value(v)); rational _k = k.to_rational(); - TRACE("arith_int", tout << "branching v" << v << " = " << get_value(v) << "\n"; + TRACE(arith_int, tout << "branching v" << v << " = " << get_value(v) << "\n"; display_var(tout, v); tout << "k = " << k << ", _k = "<< _k << std::endl; ); @@ -222,7 +222,7 @@ namespace smt { std::function fn = [&]() { return m.mk_or(bound, m.mk_not(bound)); }; scoped_trace_stream _sts(*this, fn); IF_VERBOSE(10, verbose_stream() << "branch " << bound << "\n"); - TRACE("arith_int", tout << mk_bounded_pp(bound, m) << "\n";); + TRACE(arith_int, tout << mk_bounded_pp(bound, m) << "\n";); ctx.internalize(bound, true); ctx.mark_as_relevant(bound.get()); } @@ -255,7 +255,7 @@ namespace smt { for (auto const& r : m_rows) { theory_var b = r.get_base_var(); if (b == null_theory_var) { - TRACE("arith_int", display_row(tout << "null: ", r, true); ); + TRACE(arith_int, display_row(tout << "null: ", r, true); ); continue; } bool is_tight = false; @@ -273,7 +273,7 @@ namespace smt { const_coeff = u->get_value().get_rational(); } if (!is_tight) { - TRACE("arith_int", + TRACE(arith_int, display_row(tout << "!tight: ", r, true); display_var(tout, b); ); @@ -299,7 +299,7 @@ namespace smt { continue; } if (!is_int(x)) { - TRACE("arith_int", display_row(tout << "!int: ", r, true); ); + TRACE(arith_int, display_row(tout << "!int: ", r, true); ); is_tight = false; continue; } @@ -327,7 +327,7 @@ namespace smt { row[i] *= denom.to_rational(); } } - TRACE("arith_int", + TRACE(arith_int, tout << "extracted row:\n"; for (unsigned i = 0; i < max_row; ++i) { tout << row[i] << " "; @@ -368,7 +368,7 @@ namespace smt { } } if (pol.empty()) { - TRACE("arith_int", tout << "The witness is trivial\n";); + TRACE(arith_int, tout << "The witness is trivial\n";); return false; } expr_ref p1(get_manager()), p2(get_manager()); @@ -390,7 +390,7 @@ namespace smt { ctx.mk_th_axiom(get_id(), l1, l2); } - TRACE("arith_int", + TRACE(arith_int, tout << "cut: (or " << mk_pp(p1, get_manager()) << " " << mk_pp(p2, get_manager()) << ")\n"; ); @@ -471,10 +471,10 @@ namespace smt { expr_ref pol(m); pol = m_util.mk_add(_args.size(), _args.data()); result = m_util.mk_ge(pol, m_util.mk_numeral(k, all_int)); - TRACE("arith_mk_polynomial", tout << "before simplification:\n" << result << "\n";); + TRACE(arith_mk_polynomial, tout << "before simplification:\n" << result << "\n";); proof_ref pr(m); get_context().get_rewriter()(result, result, pr); - TRACE("arith_mk_polynomial", tout << "after simplification:\n" << result << "\n";); + TRACE(arith_mk_polynomial, tout << "after simplification:\n" << result << "\n";); SASSERT(is_well_sorted(get_manager(), result)); } @@ -511,12 +511,12 @@ namespace smt { bool cfv = constrain_free_vars(r); if (cfv || !is_gomory_cut_target(r)) { - TRACE("gomory_cut", tout << "failed to apply gomory cut:\n"; + TRACE(gomory_cut, tout << "failed to apply gomory cut:\n"; tout << "constrain_free_vars(r): " << cfv << "\n";); return false; } - TRACE("gomory_cut", tout << "applying cut at:\n"; display_row_info(tout, r);); + TRACE(gomory_cut, tout << "applying cut at:\n"; display_row_info(tout, r);); antecedents ante(*this); @@ -564,14 +564,14 @@ namespace smt { k.addmul(new_a_ij, upper_bound(x_j).get_rational()); upper(x_j)->push_justification(ante, new_a_ij, coeffs_enabled()); } - TRACE("gomory_cut_detail", tout << a_ij << "*v" << x_j << " k: " << k << "\n";); + TRACE(gomory_cut_detail, tout << a_ij << "*v" << x_j << " k: " << k << "\n";); pol.push_back(row_entry(new_a_ij, x_j)); } else { ++num_ints; SASSERT(is_int(x_j)); numeral f_j = Ext::fractional_part(a_ij); - TRACE("gomory_cut_detail", + TRACE(gomory_cut_detail, tout << a_ij << "*v" << x_j << "\n"; tout << "fractional_part: " << Ext::fractional_part(a_ij) << "\n"; tout << "f_j: " << f_j << "\n"; @@ -601,7 +601,7 @@ namespace smt { k.addmul(new_a_ij, upper_bound(x_j).get_rational()); upper(x_j)->push_justification(ante, new_a_ij, coeffs_enabled()); } - TRACE("gomory_cut_detail", tout << "new_a_ij: " << new_a_ij << " k: " << k << "\n";); + TRACE(gomory_cut_detail, tout << "new_a_ij: " << new_a_ij << " k: " << k << "\n";); pol.push_back(row_entry(new_a_ij, x_j)); lcm_den = lcm(lcm_den, denominator(new_a_ij)); } @@ -609,7 +609,7 @@ namespace smt { } } - CTRACE("empty_pol", pol.empty(), display_row_info(tout, r);); + CTRACE(empty_pol, pol.empty(), display_row_info(tout, r);); expr_ref bound(get_manager()); if (pol.empty()) { @@ -636,7 +636,7 @@ namespace smt { else { if (num_ints > 0) { lcm_den = lcm(lcm_den, denominator(k)); - TRACE("gomory_cut_detail", tout << "k: " << k << " lcm_den: " << lcm_den << "\n"; + TRACE(gomory_cut_detail, tout << "k: " << k << " lcm_den: " << lcm_den << "\n"; for (unsigned i = 0; i < pol.size(); i++) { tout << pol[i].m_coeff << " " << pol[i].m_var << "\n"; } @@ -651,7 +651,7 @@ namespace smt { } k *= lcm_den; } - TRACE("gomory_cut_detail", tout << "after *lcm\n"; + TRACE(gomory_cut_detail, tout << "after *lcm\n"; for (unsigned i = 0; i < pol.size(); i++) { tout << pol[i].m_coeff << " * v" << pol[i].m_var << "\n"; } @@ -659,7 +659,7 @@ namespace smt { } mk_polynomial_ge(pol.size(), pol.data(), k.to_rational(), bound); } - TRACE("gomory_cut", tout << "new cut:\n" << bound << "\n"; ante.display(tout);); + TRACE(gomory_cut, tout << "new cut:\n" << bound << "\n"; ante.display(tout);); literal l = null_literal; context & ctx = get_context(); { @@ -695,7 +695,7 @@ namespace smt { return true; m_stats.m_gcd_tests++; numeral lcm_den = r.get_denominators_lcm(); - TRACE("gcd_test_bug", r.display(tout); tout << "lcm: " << lcm_den << "\n";); + TRACE(gcd_test_bug, r.display(tout); tout << "lcm: " << lcm_den << "\n";); numeral consts(0); numeral gcds(0); numeral least_coeff(0); @@ -729,7 +729,7 @@ namespace smt { } SASSERT(gcds.is_int()); SASSERT(least_coeff.is_int()); - TRACE("gcd_test_bug", tout << "coeff: " << e.m_coeff << ", gcds: " << gcds + TRACE(gcd_test_bug, tout << "coeff: " << e.m_coeff << ", gcds: " << gcds << " least_coeff: " << least_coeff << " consts: " << consts << "\n";); } } @@ -742,7 +742,7 @@ namespace smt { } if (!(consts / gcds).is_int()) { - TRACE("gcd_test", tout << "row failed the GCD test:\n"; display_row_info(tout, r);); + TRACE(gcd_test, tout << "row failed the GCD test:\n"; display_row_info(tout, r);); antecedents ante(*this); m_stats.m_gcd_conflicts++; collect_fixed_var_justifications(r, ante); @@ -822,7 +822,7 @@ namespace smt { if (u1 < l1) { m_stats.m_gcd_conflicts++; - TRACE("gcd_test", tout << "row failed the extended GCD test:\n"; display_row_info(tout, r);); + TRACE(gcd_test, tout << "row failed the extended GCD test:\n"; display_row_info(tout, r);); collect_fixed_var_justifications(r, ante); context & ctx = get_context(); ctx.set_conflict( @@ -902,7 +902,7 @@ namespace smt { // check whether value of v is already a multiple of m. if ((get_value(v).get_rational() / m).is_int()) continue; - TRACE("patch_int", + TRACE(patch_int, tout << "TARGET v" << v << " -> ["; if (inf_l) tout << "-oo"; else tout << ceil(l); tout << ", "; @@ -957,13 +957,13 @@ namespace smt { */ template final_check_status theory_arith::check_int_feasibility() { - TRACE("arith_int_detail", get_context().display(tout);); + TRACE(arith_int_detail, get_context().display(tout);); if (!has_infeasible_int_var()) { - TRACE("arith", tout << "FC_DONE 1...\n"; display(tout);); + TRACE(arith, tout << "FC_DONE 1...\n"; display(tout);); return FC_DONE; } - TRACE("arith", + TRACE(arith, int num = get_num_vars(); for (theory_var v = 0; v < num; v++) { if (is_int(v) && !get_value(v).is_int()) { @@ -976,7 +976,7 @@ namespace smt { } }); - TRACE("arith_int_fracs_min_max", + TRACE(arith_int_fracs_min_max, numeral max(0); numeral min(1); int num = get_num_vars(); @@ -993,7 +993,7 @@ namespace smt { tout << "max: " << max << ", min: " << min << "\n";); if (m_params.m_arith_ignore_int) { - TRACE("arith", tout << "Ignore int: give up\n";); + TRACE(arith, tout << "Ignore int: give up\n";); return FC_GIVEUP; } @@ -1005,7 +1005,7 @@ namespace smt { remove_fixed_vars_from_base(); - TRACE("arith_int_freedom", + TRACE(arith_int_freedom, int num = get_num_vars(); bool inf_l; bool inf_u; inf_numeral l; inf_numeral u; @@ -1030,7 +1030,7 @@ namespace smt { if (get_context().inconsistent()) return FC_CONTINUE; - TRACE("arith_int_inf", + TRACE(arith_int_inf, int num = get_num_vars(); for (theory_var v = 0; v < num; v++) { if (is_int(v) && !get_value(v).is_int()) { @@ -1038,7 +1038,7 @@ namespace smt { } }); - TRACE("arith_int_rows", + TRACE(arith_int_rows, unsigned num = 0; for (auto const& e : m_rows) { theory_var v = e.get_base_var(); @@ -1055,7 +1055,7 @@ namespace smt { theory_var int_var = find_infeasible_int_base_var(); if (int_var == null_theory_var) { m_stats.m_patches_succ++; - TRACE("arith_int_incomp", tout << "FC_DONE 2...\n"; display(tout);); + TRACE(arith_int_incomp, tout << "FC_DONE 2...\n"; display(tout);); return m_liberal_final_check || !m_changed_assignment ? FC_DONE : FC_CONTINUE; } @@ -1072,22 +1072,22 @@ namespace smt { m_branch_cut_counter++; // TODO: add giveup code - TRACE("gomory_cut", tout << m_branch_cut_counter << ", " << m_params.m_arith_branch_cut_ratio << std::endl;); + TRACE(gomory_cut, tout << m_branch_cut_counter << ", " << m_params.m_arith_branch_cut_ratio << std::endl;); if (m_branch_cut_counter % m_params.m_arith_branch_cut_ratio == 0) { - TRACE("opt_verbose", display(tout);); + TRACE(opt_verbose, display(tout);); move_non_base_vars_to_bounds(); if (!make_feasible()) { - TRACE("arith_int", tout << "failed to move variables to bounds.\n";); + TRACE(arith_int, tout << "failed to move variables to bounds.\n";); failed(); return FC_CONTINUE; } theory_var int_var = find_infeasible_int_base_var(); if (int_var != null_theory_var) { - TRACE("arith_int", tout << "v" << int_var << " does not have an integer assignment: " << get_value(int_var) << "\n";); + TRACE(arith_int, tout << "v" << int_var << " does not have an integer assignment: " << get_value(int_var) << "\n";); SASSERT(is_base(int_var)); row const & r = m_rows[get_var_row(int_var)]; if (!mk_gomory_cut(r)) { - TRACE("gomory_cut", tout << "silent failure\n";); + TRACE(gomory_cut, tout << "silent failure\n";); } return FC_CONTINUE; } @@ -1100,7 +1100,7 @@ namespace smt { theory_var int_var = find_infeasible_int_base_var(); if (int_var != null_theory_var) { - TRACE("arith_int", tout << "v" << int_var << " does not have an integer assignment: " << get_value(int_var) << "\n";); + TRACE(arith_int, tout << "v" << int_var << " does not have an integer assignment: " << get_value(int_var) << "\n";); // apply branching branch_infeasible_int_var(int_var); ++m_stats.m_branch_infeasible_var; diff --git a/src/smt/theory_arith_inv.h b/src/smt/theory_arith_inv.h index 30a4b5330..0fbc41b5e 100644 --- a/src/smt/theory_arith_inv.h +++ b/src/smt/theory_arith_inv.h @@ -78,21 +78,21 @@ namespace smt { int i = 0; theory_var s = r.m_base_var; SASSERT(is_base(s) || is_quasi_base(s)); - CTRACE("arith_bug", !(!is_base(s) || (!has_var_kind(r_id, BASE) && !has_var_kind(r_id, QUASI_BASE))), + CTRACE(arith_bug, !(!is_base(s) || (!has_var_kind(r_id, BASE) && !has_var_kind(r_id, QUASI_BASE))), display_row_info(tout, r_id);); SASSERT(!is_base(s) || (!has_var_kind(r_id, BASE) && !has_var_kind(r_id, QUASI_BASE))); - CTRACE("arith_bug", is_quasi_base(s) && has_var_kind(r_id, QUASI_BASE), display_row_info(tout, r_id);); + CTRACE(arith_bug, is_quasi_base(s) && has_var_kind(r_id, QUASI_BASE), display_row_info(tout, r_id);); SASSERT(!is_quasi_base(s) || !has_var_kind(r_id, QUASI_BASE)); SASSERT(r.is_coeff_of(s, numeral::one())); typename vector::const_iterator it = r.begin_entries(); typename vector::const_iterator end = r.end_entries(); for (; it != end; ++it, ++i) { if (!it->is_dead()) { - CTRACE("row_bug", already_found[it->m_var], display_row_info(tout, r_id);); + CTRACE(row_bug, already_found[it->m_var], display_row_info(tout, r_id);); SASSERT(!already_found[it->m_var]); already_found[it->m_var] = true; column const & c = m_columns[it->m_var]; - CTRACE("row_bug", it->m_coeff.is_zero(), display_row_info(tout, r_id);); + CTRACE(row_bug, it->m_coeff.is_zero(), display_row_info(tout, r_id);); SASSERT(!it->m_coeff.is_zero()); SASSERT(c[it->m_col_idx].m_row_id == static_cast(r_id)); SASSERT(c[it->m_col_idx].m_row_idx == i); @@ -129,7 +129,7 @@ namespace smt { for (; it != end; ++it, ++i) { if (!it->is_dead()) { row const & r = m_rows[it->m_row_id]; - CTRACE("wf_column", r.size() == 0, tout << "v" << v << ", it->m_row_id: " << it->m_row_id << "\n"; display_row_info(tout, r); display(tout);); + CTRACE(wf_column, r.size() == 0, tout << "v" << v << ", it->m_row_id: " << it->m_row_id << "\n"; display_row_info(tout, r); display(tout);); SASSERT(r.size() != 0); SASSERT(r[it->m_row_idx].m_var == v); SASSERT(r[it->m_row_idx].m_col_idx == i); @@ -158,7 +158,7 @@ namespace smt { */ template bool theory_arith::valid_row_assignment() const { - TRACE("valid_row_assignment", display(tout);); + TRACE(valid_row_assignment, display(tout);); typename vector::const_iterator it = m_rows.begin(); typename vector::const_iterator end = m_rows.end(); for (; it != end; ++it) { @@ -182,7 +182,7 @@ namespace smt { sum += it->m_coeff * m_value[it->m_var]; } } - CTRACE("valid_row_assignment_bug", !sum.is_zero(), tout << "checking: "; display_row_info(tout, r);); + CTRACE(valid_row_assignment_bug, !sum.is_zero(), tout << "checking: "; display_row_info(tout, r);); SASSERT(sum.is_zero()); } return true; @@ -194,7 +194,7 @@ namespace smt { return true; int num = get_num_vars(); for (theory_var v = 0; v < num; v++) { - CTRACE("bound_bug", below_lower(v) || above_upper(v), display_var(tout, v); display(tout);); + CTRACE(bound_bug, below_lower(v) || above_upper(v), display_var(tout, v); display(tout);); SASSERT(!below_lower(v)); SASSERT(!above_upper(v)); if (below_lower(v) || above_upper(v)) return false; @@ -207,7 +207,7 @@ namespace smt { int num = get_num_vars(); for (theory_var v = 0; v < num; v++) { if (is_int(v) && !get_value(v).is_int()) { - TRACE("bound_bug", display_var(tout, v); display(tout);); + TRACE(bound_bug, display_var(tout, v); display(tout);); return false; } } @@ -223,7 +223,7 @@ namespace smt { satisfy_integrality()) { return true; } - TRACE("arith", display(tout);); + TRACE(arith, display(tout);); return false; } diff --git a/src/smt/theory_arith_nl.h b/src/smt/theory_arith_nl.h index 0a2b6e938..51c7f4499 100644 --- a/src/smt/theory_arith_nl.h +++ b/src/smt/theory_arith_nl.h @@ -83,7 +83,7 @@ void theory_arith::mark_dependents(theory_var v, svector & vars for (auto& ce : c) { if (ce.is_dead() || already_visited_rows.contains(ce.m_row_id)) continue; - TRACE("non_linear_bug", tout << "visiting row: " << ce.m_row_id << "\n";); + TRACE(non_linear_bug, tout << "visiting row: " << ce.m_row_id << "\n";); already_visited_rows.insert(ce.m_row_id); row & r = m_rows[ce.m_row_id]; theory_var s = r.get_base_var(); @@ -98,7 +98,7 @@ void theory_arith::mark_dependents(theory_var v, svector & vars for (auto& re : r) { if (!re.is_dead() && !is_fixed(re.m_var)) mark_var(re.m_var, vars, already_found); - CTRACE("non_linear", !re.is_dead() && is_fixed(re.m_var), tout << "skipped fixed\n"); + CTRACE(non_linear, !re.is_dead() && is_fixed(re.m_var), tout << "skipped fixed\n"); } } } @@ -122,10 +122,10 @@ void theory_arith::get_non_linear_cluster(svector & vars) { // NB: vars changes inside of loop for (unsigned idx = 0; idx < vars.size(); ++idx) { theory_var v = vars[idx]; - TRACE("non_linear", tout << "marking dependents of: v" << v << "\n";); + TRACE(non_linear, tout << "marking dependents of: v" << v << "\n";); mark_dependents(v, vars, already_found, already_visited_rows); } - TRACE("non_linear", tout << "variables in non linear cluster: "; + TRACE(non_linear, tout << "variables in non linear cluster: "; for (theory_var v : vars) tout << "v" << v << " "; tout << "\n"; for (theory_var v : m_nl_monomials) tout << "non-linear v" << v << " " << mk_pp(var2expr(v), m) << "\n";); } @@ -262,7 +262,7 @@ void theory_arith::mul_bound_of(expr * var, unsigned power, interval & targ theory_var v = expr2var(var); interval i = mk_interval_for(v); - TRACE("non_linear", + TRACE(non_linear, display_interval(tout << "bound: ",i); tout << i << "\n"; tout << mk_pp(var, get_manager()) << "\n"; tout << "power " << power << ": " << expt(i, power) << "\n"; @@ -274,7 +274,7 @@ void theory_arith::mul_bound_of(expr * var, unsigned power, interval & targ get_manager().limit().inc((target.is_lower_open() || target.minus_infinity()) ? 1 : target.get_lower_value().bitsize()); get_manager().limit().inc((target.is_upper_open() || target.plus_infinity()) ? 1 : target.get_upper_value().bitsize()); - TRACE("non_linear", display_interval(tout << "target after: ", target); tout << "\n";); + TRACE(non_linear, display_interval(tout << "target after: ", target); tout << "\n";); } /** @@ -289,7 +289,7 @@ template interval theory_arith::evaluate_as_interval(expr * n) { expr* arg; rational val; -#define TR() TRACE("nl_evaluate", tout << "eval: " << mk_bounded_pp(n, get_manager(), 10) << "\n";\ +#define TR() TRACE(nl_evaluate, tout << "eval: " << mk_bounded_pp(n, get_manager(), 10) << "\n";\ display_nested_form(tout, n); tout << "\ninterval: " << r << "\n";); if (has_var(n)) { @@ -328,7 +328,7 @@ interval theory_arith::evaluate_as_interval(expr * n) { return r; } else { - TRACE("nl_evaluate", tout << "is unknown\n";); + TRACE(nl_evaluate, tout << "is unknown\n";); return interval(m_dep_manager); } } @@ -372,7 +372,7 @@ void theory_arith::mk_derived_nl_bound(theory_var v, inf_numeral const & co m_asserted_bounds.push_back(new_bound); // copy justification to new bound dependency2new_bound(dep, *new_bound); - TRACE("non_linear", new_bound->display(*this, tout); tout << "\n";); + TRACE(non_linear, new_bound->display(*this, tout); tout << "\n";); } /** @@ -400,7 +400,7 @@ bool theory_arith::update_bounds_using_interval(theory_var v, interval cons } bound * old_lower = lower(v); if (old_lower == nullptr || new_lower > old_lower->get_value()) { - TRACE("non_linear", tout << "NEW lower bound for v" << v << " " << mk_pp(var2expr(v), get_manager()) + TRACE(non_linear, tout << "NEW lower bound for v" << v << " " << mk_pp(var2expr(v), get_manager()) << " " << new_lower << "\n"; display_interval(tout, i); tout << "\n";); mk_derived_nl_bound(v, new_lower, B_LOWER, i.get_lower_dependencies()); @@ -424,7 +424,7 @@ bool theory_arith::update_bounds_using_interval(theory_var v, interval cons } bound * old_upper = upper(v); if (old_upper == nullptr || new_upper < old_upper->get_value()) { - TRACE("non_linear", tout << "NEW upper bound for v" << v << " " << new_upper << "\n"; + TRACE(non_linear, tout << "NEW upper bound for v" << v << " " << new_upper << "\n"; display_interval(tout, i); tout << "\n";); mk_derived_nl_bound(v, new_upper, B_UPPER, i.get_upper_dependencies()); r = true; @@ -436,7 +436,7 @@ bool theory_arith::update_bounds_using_interval(theory_var v, interval cons template bool theory_arith::update_bounds_using_interval(expr * n, interval const & i) { SASSERT(expr2var(n) != null_theory_var); - TRACE("non_linear", tout << "NL bounds for m: " << i << "\n" << mk_pp(n, get_manager()) << "\n";); + TRACE(non_linear, tout << "NL bounds for m: " << i << "\n" << mk_pp(n, get_manager()) << "\n";); return update_bounds_using_interval(expr2var(n), i); } @@ -446,20 +446,20 @@ bool theory_arith::update_bounds_using_interval(expr * n, interval const & template bool theory_arith::propagate_nl_upward(expr * m) { SASSERT(is_pure_monomial(m)); - TRACE("nl_arith_bug", tout << "processing upward:\n" << mk_pp(m, get_manager()) << "\n";); + TRACE(nl_arith_bug, tout << "processing upward:\n" << mk_pp(m, get_manager()) << "\n";); buffer vp; rational coeff = decompose_monomial(m, vp); interval new_bounds(m_dep_manager, coeff); for (var_power_pair const& p : vp) { expr * var = p.first; unsigned power = p.second; - TRACE("nl_arith_bug", tout << "interval before: " << new_bounds << "\n"; + TRACE(nl_arith_bug, tout << "interval before: " << new_bounds << "\n"; theory_var v = expr2var(var); interval i = mk_interval_for(v); display_var(tout, v); tout << "interval for v" << i << " " << mk_pp(var, get_manager()) << "\npower: " << power << " " << expt(i, power) << "\n";); mul_bound_of(var, power, new_bounds); - TRACE("nl_arith_bug", tout << "interval after: " << new_bounds << "\n";); + TRACE(nl_arith_bug, tout << "interval after: " << new_bounds << "\n";); } return update_bounds_using_interval(m, new_bounds); } @@ -494,7 +494,7 @@ bool theory_arith::propagate_nl_downward(expr * n, var_power_pair const& p) if (other_bounds.contains_zero()) return false; // interval division requires that divisor doesn't contain 0. interval r = mk_interval_for(n); - TRACE("nl_arith_bug", tout << "m: " << mk_ismt2_pp(n, get_manager()) << "\nv: " << mk_ismt2_pp(v, get_manager()) << + TRACE(nl_arith_bug, tout << "m: " << mk_ismt2_pp(n, get_manager()) << "\nv: " << mk_ismt2_pp(v, get_manager()) << "\npower: " << power << "\n"; display_interval(tout << "monomial bounds\n", r); display_interval(tout << "other bounds\n", other_bounds); @@ -511,7 +511,7 @@ bool theory_arith::propagate_nl_downward(expr * n, var_power_pair const& p) */ template bool theory_arith::propagate_nl_bounds(expr * m) { - TRACE("non_linear", tout << "propagate several bounds using:\n"; display_monomial(tout, m); tout << "\n";); + TRACE(non_linear, tout << "propagate several bounds using:\n"; display_monomial(tout, m); tout << "\n";); bool result = propagate_nl_upward(m); buffer vp; rational coeff = decompose_monomial(m, vp); @@ -538,14 +538,14 @@ bool theory_arith::propagate_nl_bounds() { if (!ctx.is_relevant(m)) continue; auto p = analyze_monomial(m); - TRACE("propagate_nl_bound", tout << "m: " << mk_ismt2_pp(m, get_manager()) << "\n" << "p: " << p.first << "\n";); + TRACE(propagate_nl_bound, tout << "m: " << mk_ismt2_pp(m, get_manager()) << "\n" << "p: " << p.first << "\n";); unsigned num_bad_vars = p.first; var_power_pair q = p.second; SASSERT(num_bad_vars != 1 || q.first != nullptr); if (num_bad_vars >= 2) continue; bool is_free_m = is_free(m); - TRACE("propagate_nl_bound", tout << "is_free_m: " << is_free_m << "\n";); + TRACE(propagate_nl_bound, tout << "is_free_m: " << is_free_m << "\n";); if (num_bad_vars == 1 && is_free_m) continue; if (num_bad_vars == 0) { @@ -602,11 +602,11 @@ bool theory_arith::check_monomial_assignment(theory_var v, bool & computed_ theory_var curr = expr2var(arg); SASSERT(curr != null_theory_var); v_val = get_value(curr, computed_epsilon); - TRACE("non_linear", tout << mk_pp(arg, get_manager()) << " = " << v_val << "\n";); + TRACE(non_linear, tout << mk_pp(arg, get_manager()) << " = " << v_val << "\n";); val *= v_val; } v_val = get_value(v, computed_epsilon); - TRACE("non_linear", tout << "v" << v << " := " << v_val << " == " << val << "\n";); + TRACE(non_linear, tout << "v" << v << " := " << v_val << " == " << val << "\n";); return v_val == val; } @@ -619,9 +619,9 @@ template bool theory_arith::check_monomial_assignments() { bool computed_epsilon = false; for (theory_var v : m_nl_monomials) { - TRACE("non_linear", tout << "v" << v << " is relevant: " << ctx.is_relevant(get_enode(v)) << "\n"); + TRACE(non_linear, tout << "v" << v << " is relevant: " << ctx.is_relevant(get_enode(v)) << "\n"); if (ctx.is_relevant(get_enode(v)) && !check_monomial_assignment(v, computed_epsilon)) { - TRACE("non_linear", tout << "check_monomial_assignment failed for:\n" << mk_ismt2_pp(var2expr(v), get_manager()) << "\n"; + TRACE(non_linear, tout << "check_monomial_assignment failed for:\n" << mk_ismt2_pp(var2expr(v), get_manager()) << "\n"; display_var(tout, v);); return false; } @@ -641,7 +641,7 @@ bool theory_arith::check_monomial_assignments() { */ template theory_var theory_arith::find_nl_var_for_branching() { - TRACE("nl_branching", tout << "looking for variable to branch...\n"; display(tout);); + TRACE(nl_branching, tout << "looking for variable to branch...\n"; display(tout);); theory_var target = null_theory_var; bool bounded = false; unsigned n = 0; @@ -657,7 +657,7 @@ theory_var theory_arith::find_nl_var_for_branching() { SASSERT(is_pure_monomial(m)); for (expr * arg : *to_app(m)) { theory_var curr = ctx.get_enode(arg)->get_th_var(get_id()); - TRACE("nl_branching", tout << "target: v" << target << ", curr: v" << curr << "\n";); + TRACE(nl_branching, tout << "target: v" << target << ", curr: v" << curr << "\n";); if (!is_fixed(curr) && is_int(curr)) { if (is_bounded(curr)) { numeral new_range; @@ -671,14 +671,14 @@ theory_var theory_arith::find_nl_var_for_branching() { } else if (!bounded) { n++; - TRACE("nl_branching", tout << "n: " << n << "\n";); + TRACE(nl_branching, tout << "n: " << n << "\n";); if (m_random()%n == 0) target = curr; SASSERT(target != null_theory_var); } SASSERT(target != null_theory_var); } - TRACE("nl_branching", tout << "after target: v" << target << "\n";); + TRACE(nl_branching, tout << "after target: v" << target << "\n";); } } } @@ -694,7 +694,7 @@ theory_var theory_arith::find_nl_var_for_branching() { */ template bool theory_arith::branch_nl_int_var(theory_var v) { - TRACE("non_linear", tout << "BRANCHING on v" << v << "\n";); + TRACE(non_linear, tout << "BRANCHING on v" << v << "\n";); m_stats.m_nl_branching++; SASSERT(is_int(v)); expr_ref bound(get_manager()); @@ -704,7 +704,7 @@ bool theory_arith::branch_nl_int_var(theory_var v) { bound = m_util.mk_ge(var2expr(v), m_util.mk_numeral(upper_bound(v).get_rational().to_rational(), true)); else bound = m_util.mk_eq(var2expr(v), m_util.mk_numeral(rational(0), true)); - TRACE("non_linear", tout << "new bound:\n" << mk_pp(bound, get_manager()) << "\n";); + TRACE(non_linear, tout << "new bound:\n" << mk_pp(bound, get_manager()) << "\n";); ast_manager & m = get_manager(); { std::function fn = [&]() { return m.mk_or(bound, m.mk_not(bound)); }; @@ -729,7 +729,7 @@ bool theory_arith::is_monomial_linear(expr * m) const { if (!ctx.e_internalized(arg)) return false; theory_var _var = expr2var(arg); - CTRACE("non_linear", is_fixed(_var), + CTRACE(non_linear, is_fixed(_var), tout << mk_pp(arg, get_manager()) << " is fixed: " << lower_bound(_var) << "\n";); if (!is_fixed(_var)) { num_nl_vars++; @@ -754,7 +754,7 @@ typename theory_arith::numeral theory_arith::get_monomial_fixed_var_pr if (is_fixed(_var)) r *= lower_bound(_var).get_rational(); } - TRACE("arith", tout << mk_pp(m, get_manager()) << " " << r << "\n";); + TRACE(arith, tout << mk_pp(m, get_manager()) << " " << r << "\n";); return r; } @@ -778,7 +778,7 @@ expr * theory_arith::get_monomial_non_fixed_var(expr * m) const { */ template bool theory_arith::propagate_linear_monomial(theory_var v) { - TRACE("non_linear_verbose", tout << "checking whether v" << v << " became linear...\n";); + TRACE(non_linear_verbose, tout << "checking whether v" << v << " became linear...\n";); if (m_data[v].m_nl_propagated) return false; // already propagated this monomial. expr * m = var2expr(v); @@ -789,13 +789,13 @@ bool theory_arith::propagate_linear_monomial(theory_var v) { m_data[v].m_nl_propagated = true; m_nl_propagated.push_back(v); - TRACE("non_linear", tout << "v" << v << " is linear " << mk_pp(m, get_manager()) << "\n";); + TRACE(non_linear, tout << "v" << v << " is linear " << mk_pp(m, get_manager()) << "\n";); numeral k = get_monomial_fixed_var_product(m); - TRACE("non_linear", tout << "new linear monomial... k: " << k << "\n";); + TRACE(non_linear, tout << "new linear monomial... k: " << k << "\n";); expr * x_n = k.is_zero() ? nullptr : get_monomial_non_fixed_var(m); - TRACE("non_linear_bug", if (x_n != 0) { tout << "x_n: " << mk_bounded_pp(x_n, get_manager()) << "\nx_n: #" << x_n->get_id() << "\n"; }); + TRACE(non_linear_bug, if (x_n != 0) { tout << "x_n: " << mk_bounded_pp(x_n, get_manager()) << "\nx_n: #" << x_n->get_id() << "\n"; }); derived_bound * new_lower = nullptr; derived_bound * new_upper = nullptr; if (x_n != nullptr) { @@ -807,16 +807,16 @@ bool theory_arith::propagate_linear_monomial(theory_var v) { // Let m be (* x_1 ... x_n), then assert equality // (= (+ (* x_1 ... x_n) (* -k x_n)) 0) when x_1 ... x_{n-1} are fixed variables. // where k = lower(x_1)*...*lower(x_{n-1}) - TRACE("non_linear", tout << "x_n: " << mk_pp(x_n, get_manager()) << "\n";); + TRACE(non_linear, tout << "x_n: " << mk_pp(x_n, get_manager()) << "\n";); k.neg(); expr * k_x_n = k.is_one() ? x_n : m_util.mk_mul(m_util.mk_numeral(k.to_rational(), is_int(v)), x_n); expr * rhs = m_util.mk_add(m, k_x_n); - TRACE("non_linear_bug", tout << "rhs: " << mk_bounded_pp(rhs, get_manager(),5) << "\ninternalized: " << ctx.e_internalized(rhs) << "\n";); + TRACE(non_linear_bug, tout << "rhs: " << mk_bounded_pp(rhs, get_manager(),5) << "\ninternalized: " << ctx.e_internalized(rhs) << "\n";); if (!has_var(rhs)) { ctx.internalize(rhs, false); ctx.mark_as_relevant(rhs); } - TRACE("non_linear_bug", tout << "enode: " << ctx.get_enode(rhs) << " enode_id: " << ctx.get_enode(rhs)->get_owner_id() << "\n";); + TRACE(non_linear_bug, tout << "enode: " << ctx.get_enode(rhs) << " enode_id: " << ctx.get_enode(rhs)->get_owner_id() << "\n";); IF_VERBOSE(3, for (auto* arg : *to_app(m)) if (is_fixed(expr2var(arg))) @@ -833,7 +833,7 @@ bool theory_arith::propagate_linear_monomial(theory_var v) { // Assert the equality // (= (* x_1 ... x_n) k) - TRACE("non_linear", tout << "all variables are fixed, and bound is: " << k << "\n";); + TRACE(non_linear, tout << "all variables are fixed, and bound is: " << k << "\n";); new_lower = alloc(derived_bound, v, inf_numeral(k), B_LOWER); new_upper = alloc(derived_bound, v, inf_numeral(k), B_UPPER); } @@ -868,7 +868,7 @@ bool theory_arith::propagate_linear_monomial(theory_var v) { } accumulate_justification(*l, *new_lower, numeral::zero(), m_tmp_lit_set, m_tmp_eq_set); - TRACE("non_linear", + TRACE(non_linear, for (literal l : new_lower->m_lits) { ctx.display_detailed_literal(tout, l) << " "; } @@ -876,7 +876,7 @@ bool theory_arith::propagate_linear_monomial(theory_var v) { accumulate_justification(*u, *new_lower, numeral::zero(), m_tmp_lit_set, m_tmp_eq_set); - TRACE("non_linear", + TRACE(non_linear, for (literal l : new_lower->m_lits) { ctx.display_detailed_literal(tout, l) << " "; } @@ -887,7 +887,7 @@ bool theory_arith::propagate_linear_monomial(theory_var v) { new_upper->m_lits.append(new_lower->m_lits); new_upper->m_eqs.append(new_lower->m_eqs); - TRACE("non_linear", + TRACE(non_linear, new_lower->display(*this, tout << "lower: "); tout << "\n"; new_upper->display(*this, tout << "upper: "); tout << "\n"; for (literal lit : new_upper->m_lits) { @@ -909,7 +909,7 @@ bool theory_arith::propagate_linear_monomials() { return false; if (!reflection_enabled()) return false; - TRACE("non_linear_verbose", tout << "propagating linear monomials...\n";); + TRACE(non_linear_verbose, tout << "propagating linear monomials...\n";); bool p = false; // CMW: m_nl_monomials can grow during this loop, so // don't use iterators. @@ -917,7 +917,7 @@ bool theory_arith::propagate_linear_monomials() { if (propagate_linear_monomial(m_nl_monomials[i])) p = true; } - CTRACE("non_linear", p, display(tout);); + CTRACE(non_linear, p, display(tout);); return p; } @@ -1123,7 +1123,7 @@ bool theory_arith::get_polynomial_info(buffer const & p, sbuffe auto add_occ = [&](expr* v) { if (has_var(v) && !is_fixed(expr2var(v))) { - TRACE("nl_info", tout << "adding occ: " << mk_bounded_pp(v, get_manager()) << "\n";); + TRACE(nl_info, tout << "adding occ: " << mk_bounded_pp(v, get_manager()) << "\n";); unsigned occs = 0; m_var2num_occs.find(v, occs); m_var2num_occs.insert(v, 1 + occs); @@ -1162,7 +1162,7 @@ bool theory_arith::get_polynomial_info(buffer const & p, sbuffe template expr_ref theory_arith::p2expr(buffer & p) { SASSERT(!p.empty()); - TRACE("p2expr_bug", display_coeff_exprs(tout, p);); + TRACE(p2expr_bug, display_coeff_exprs(tout, p);); ptr_buffer args; rational c2; for (coeff_expr const& ce : p) { @@ -1349,7 +1349,7 @@ unsigned theory_arith::get_min_degree(buffer & p, expr * var) { */ template expr * theory_arith::factor(expr * m, expr * var, unsigned d) { - TRACE("factor", tout << "m: " << mk_pp(m, get_manager()) << "\nvar: " << mk_pp(var, get_manager()) << "\nd: " << d << "\n";); + TRACE(factor, tout << "m: " << mk_pp(m, get_manager()) << "\nvar: " << mk_pp(var, get_manager()) << "\nd: " << d << "\n";); if (d == 0) return m; if (m == var) { @@ -1376,10 +1376,10 @@ expr * theory_arith::factor(expr * m, expr * var, unsigned d) { } insert(m); SASSERT(idx == d); - TRACE("factor_bug", tout << "new_args:\n"; for(unsigned i = 0; i < new_args.size(); i++) tout << mk_pp(new_args[i], get_manager()) << "\n";); + TRACE(factor_bug, tout << "new_args:\n"; for(unsigned i = 0; i < new_args.size(); i++) tout << mk_pp(new_args[i], get_manager()) << "\n";); expr * result = mk_nary_mul(new_args.size(), new_args.data(), m_util.is_int(var)); m_nl_new_exprs.push_back(result); - TRACE("factor", tout << "result: " << mk_pp(result, get_manager()) << "\n";); + TRACE(factor, tout << "result: " << mk_pp(result, get_manager()) << "\n";); return result; } @@ -1391,7 +1391,7 @@ expr_ref theory_arith::horner(unsigned depth, buffer & p, expr SASSERT(!p.empty()); SASSERT(var != 0); unsigned d = get_min_degree(p, var); - TRACE("horner_bug", tout << "poly:\n"; + TRACE(horner_bug, tout << "poly:\n"; for (unsigned i = 0; i < p.size(); i++) { if (i > 0) tout << " + "; tout << p[i].first << "*" << mk_pp(p[i].second, get_manager()); } tout << "\n"; tout << "var: " << mk_pp(var, get_manager()) << "\n"; tout << "min_degree: " << d << "\n";); @@ -1435,7 +1435,7 @@ expr_ref theory_arith::horner(unsigned depth, buffer & p, expr */ template expr_ref theory_arith::cross_nested(unsigned depth, buffer & p, expr * var) { - TRACE("non_linear", tout << "p.size: " << p.size() << "\n";); + TRACE(non_linear, tout << "p.size: " << p.size() << "\n";); if (var == nullptr) { sbuffer varinfo; if (!get_polynomial_info(p, varinfo)) @@ -1459,7 +1459,7 @@ expr_ref theory_arith::cross_nested(unsigned depth, buffer & p, unsigned n = UINT_MAX; unsigned nm = UINT_MAX; if (in_monovariate_monomials(p, var, i1, a, n, i2, b, nm)) { - CTRACE("in_monovariate_monomials", n == nm, + CTRACE(in_monovariate_monomials, n == nm, for (unsigned i = 0; i < p.size(); i++) { if (i > 0) tout << " + "; tout << p[i].first << "*" << mk_pp(p[i].second, get_manager()); } @@ -1500,7 +1500,7 @@ expr_ref theory_arith::cross_nested(unsigned depth, buffer & p, rhs2 = rhs; new_expr = b.is_one() ? rhs2 : m_util.mk_mul(m_util.mk_numeral(b, m_util.is_int(var)), rhs2); m_nl_new_exprs.push_back(new_expr); - TRACE("non_linear", tout << "new_expr:\n"; display_nested_form(tout, new_expr); tout << "\n";); + TRACE(non_linear, tout << "new_expr:\n"; display_nested_form(tout, new_expr); tout << "\n";); buffer rest; unsigned sz = p.size(); for (unsigned i = 0; i < sz; i++) { @@ -1509,7 +1509,7 @@ expr_ref theory_arith::cross_nested(unsigned depth, buffer & p, } if (rest.empty()) return expr_ref(new_expr, get_manager()); - TRACE("non_linear", tout << "rest size: " << rest.size() << ", i1: " << i1 << ", i2: " << i2 << "\n";); + TRACE(non_linear, tout << "rest size: " << rest.size() << ", i1: " << i1 << ", i2: " << i2 << "\n";); expr_ref h = cross_nested(depth + 1, rest, nullptr); expr * r = m_util.mk_add(new_expr, h); m_nl_new_exprs.push_back(r); @@ -1532,7 +1532,7 @@ bool theory_arith::is_cross_nested_consistent(buffer & p) { if (varinfo.empty()) return true; std::stable_sort(varinfo.begin(), varinfo.end(), var_num_occs_lt()); - TRACE("cross_nested", tout << "var num occs:\n"; + TRACE(cross_nested, tout << "var num occs:\n"; for (auto const& kv : varinfo) { tout << mk_bounded_pp(kv.first, get_manager()) << " -> " << kv.second << "\n"; }); @@ -1544,18 +1544,18 @@ bool theory_arith::is_cross_nested_consistent(buffer & p) { // This is not really a problem, since evaluate_as_interval will work even if cn is not well-sorted. if (!cn) continue; - TRACE("cross_nested", tout << "nested form for var:\n" << mk_ismt2_pp(var, get_manager()) << "\n"; + TRACE(cross_nested, tout << "nested form for var:\n" << mk_ismt2_pp(var, get_manager()) << "\n"; display_nested_form(tout, cn); tout << "\n"; tout << "c:\n" << mk_ismt2_pp(cn, get_manager()) << "\n";); interval i = evaluate_as_interval(cn); - TRACE("cross_nested", tout << "interval: " << i << "\n";); + TRACE(cross_nested, tout << "interval: " << i << "\n";); v_dependency * d = nullptr; if (!i.minus_infinity() && (i.get_lower_value().is_pos() || (i.get_lower_value().is_zero() && i.is_lower_open()))) d = i.get_lower_dependencies(); else if (!i.plus_infinity() && (i.get_upper_value().is_neg() || (i.get_upper_value().is_zero() && i.is_upper_open()))) d = i.get_upper_dependencies(); if (d) { - TRACE("cross_nested", tout << "nested form conflict: " << i << "\n";); + TRACE(cross_nested, tout << "nested form conflict: " << i << "\n";); set_conflict(d); return false; } @@ -1573,7 +1573,7 @@ bool theory_arith::is_cross_nested_consistent(row const & r) { if (!is_problematic_non_linear_row(r)) return true; - TRACE("cross_nested", tout << "is_cross_nested_consistent:\n"; display_row(tout, r, false); + TRACE(cross_nested, tout << "is_cross_nested_consistent:\n"; display_row(tout, r, false); display(tout); ); @@ -1613,13 +1613,13 @@ bool theory_arith::is_cross_nested_consistent(row const & r) { if (!get_manager().int_real_coercions() && is_mixed_real_integer(r)) return true; // giving up... see comment above - TRACE("cross_nested", tout << "checking problematic row...\n";); + TRACE(cross_nested, tout << "checking problematic row...\n";); rational c = rational::one(); if (is_integer(r)) c = r.get_denominators_lcm().to_rational(); - TRACE("non_linear", tout << "check problematic row:\n"; display_row(tout, r); display_row(tout, r, false);); + TRACE(non_linear, tout << "check problematic row:\n"; display_row(tout, r); display_row(tout, r, false);); buffer p; for (auto & col : r) { if (!col.is_dead()) { @@ -1627,7 +1627,7 @@ bool theory_arith::is_cross_nested_consistent(row const & r) { } } SASSERT(!p.empty()); - CTRACE("cross_nested_bug", !c.is_one(), tout << "c: " << c << "\n"; display_row(tout, r); tout << "---> p (coeffs, exprs):\n"; display_coeff_exprs(tout, p);); + CTRACE(cross_nested_bug, !c.is_one(), tout << "c: " << c << "\n"; display_row(tout, r); tout << "---> p (coeffs, exprs):\n"; display_coeff_exprs(tout, p);); return is_cross_nested_consistent(p); } @@ -1741,7 +1741,7 @@ grobner::monomial * theory_arith::mk_gb_monomial(rational const & _coeff, e */ template void theory_arith::add_row_to_gb(row const & r, grobner & gb) { - TRACE("grobner", tout << "adding row to gb\n"; display_row(tout, r);); + TRACE(grobner, tout << "adding row to gb\n"; display_row(tout, r);); ptr_buffer monomials; v_dependency * dep = nullptr; m_tmp_var_set.reset(); @@ -1753,7 +1753,7 @@ void theory_arith::add_row_to_gb(row const & r, grobner & gb) { grobner::monomial * new_m = mk_gb_monomial(coeff, m, gb, dep, m_tmp_var_set); if (new_m) monomials.push_back(new_m); - TRACE("grobner", + TRACE(grobner, tout << "monomial: " << mk_pp(m, get_manager()) << "\n"; tout << "new monomial: "; if (new_m) gb.display_monomial(tout, *new_m); else tout << "null"; tout << "\n";); } @@ -1844,7 +1844,7 @@ void theory_arith::set_conflict(v_dependency * d) { derived_bound b(null_theory_var, inf_numeral(0), B_LOWER); dependency2new_bound(d, b); set_conflict(b, ante, "arith_nl"); - TRACE("non_linear", for (literal lit : b.m_lits) ctx.display_literal_verbose(tout, lit) << "\n"; tout << "\n";); + TRACE(non_linear, for (literal lit : b.m_lits) ctx.display_literal_verbose(tout, lit) << "\n"; tout << "\n";); } /** @@ -1861,22 +1861,22 @@ bool theory_arith::is_inconsistent(interval const & I, unsigned num_monomia if (r.minus_infinity() && r.plus_infinity()) return false; } - TRACE("non_linear_bug", tout << "is_inconsistent, r: " << r << "\n";); + TRACE(non_linear_bug, tout << "is_inconsistent, r: " << r << "\n";); v_dependency * interval_deps = nullptr; bool conflict = false; if (!r.minus_infinity() && (r.get_lower_value().is_pos() || (r.get_lower_value().is_zero() && r.is_lower_open()))) { interval_deps = r.get_lower_dependencies(); conflict = true; - TRACE("non_linear_bug", tout << "is inconsistent, interval_deps: " << interval_deps << "\n";); + TRACE(non_linear_bug, tout << "is inconsistent, interval_deps: " << interval_deps << "\n";); } else if (!r.plus_infinity() && (r.get_upper_value().is_neg() || (r.get_upper_value().is_zero() && r.is_upper_open()))) { interval_deps = r.get_upper_dependencies(); conflict = true; - TRACE("non_linear_bug", tout << "is inconsistent, interval_deps: " << interval_deps << "\n";); + TRACE(non_linear_bug, tout << "is inconsistent, interval_deps: " << interval_deps << "\n";); } // interval_deps cannot be used to check if a conflict was detected, since interval_deps may be 0 even when r does not contain 0 if (conflict) { - TRACE("non_linear", tout << "conflicting interval for = 0 equation: " << r << "\n";); + TRACE(non_linear, tout << "conflicting interval for = 0 equation: " << r << "\n";); set_conflict(m_dep_manager.mk_join(interval_deps, dep)); return true; } @@ -1891,7 +1891,7 @@ template bool theory_arith::is_inconsistent(grobner::equation const * eq, grobner & gb) { interval zero(m_dep_manager, rational(0)); if (is_inconsistent(zero, eq->get_num_monomials(), eq->get_monomials(), eq->get_dependency())) { - TRACE("non_linear", tout << "found conflict\n"; gb.display_equation(tout, *eq);); + TRACE(non_linear, tout << "found conflict\n"; gb.display_equation(tout, *eq);); return true; } return false; @@ -2018,7 +2018,7 @@ bool theory_arith::is_inconsistent2(grobner::equation const * eq, grobner & monomials.push_back(const_cast(m1)); continue; } - TRACE("non_linear", tout << "found perfect square monomial m1: "; gb.display_monomial(tout, *m1); tout << "\n";); + TRACE(non_linear, tout << "found perfect square monomial m1: "; gb.display_monomial(tout, *m1); tout << "\n";); // try to find another perfect square unsigned j = i + 1; for (; j < num; j++) { @@ -2028,7 +2028,7 @@ bool theory_arith::is_inconsistent2(grobner::equation const * eq, grobner & rational b; if (!is_perfect_square(m2, b)) continue; - TRACE("non_linear", tout << "found perfect square monomial m2: "; gb.display_monomial(tout, *m2); tout << "\n";); + TRACE(non_linear, tout << "found perfect square monomial m2: "; gb.display_monomial(tout, *m2); tout << "\n";); // try to find -2*root(m1)*root(m2) // This monomial must be smaller than m1, since m2 is smaller than m1. unsigned k = i + 1; @@ -2040,7 +2040,7 @@ bool theory_arith::is_inconsistent2(grobner::equation const * eq, grobner & continue; // m1, m2, and m1m2 form a perfect square. // check if [0, oo) provides a better lowerbound than adding the intervals of m1, m2 and m1m2; - TRACE("non_linear", tout << "found perfect square (M1-M2)^2:\n"; + TRACE(non_linear, tout << "found perfect square (M1-M2)^2:\n"; gb.display_monomial(tout, *m1); tout << "\n"; gb.display_monomial(tout, *m2); tout << "\n"; gb.display_monomial(tout, *m1m2); tout << "\n";); @@ -2048,7 +2048,7 @@ bool theory_arith::is_inconsistent2(grobner::equation const * eq, grobner & I += intervals[j]; I += intervals[k]; if (I.minus_infinity() || I.get_lower_value().is_neg()) { - TRACE("non_linear", tout << "the lower bound improved when perfect square is eliminated.\n";); + TRACE(non_linear, tout << "the lower bound improved when perfect square is eliminated.\n";); // Found improvement... // mark these monomials as deleted deleted[i] = true; @@ -2069,7 +2069,7 @@ bool theory_arith::is_inconsistent2(grobner::equation const * eq, grobner & return false; // didn't find any perfect square. interval ge_zero(m_dep_manager, rational(0), false, true, nullptr); if (is_inconsistent(ge_zero, monomials.size(), monomials.data(), eq->get_dependency())) { - TRACE("non_linear", tout << "found conflict\n"; gb.display_equation(tout, *eq);); + TRACE(non_linear, tout << "found conflict\n"; gb.display_equation(tout, *eq);); return true; } return false; @@ -2116,10 +2116,10 @@ bool theory_arith::internalize_gb_eq(grobner::equation const * eq) { pol = mk_nary_add(args.size(), args.data()); expr_ref s_pol(get_manager()); proof_ref pr(get_manager()); - TRACE("gb_bug", tout << mk_ll_pp(pol, get_manager()) << "\n";); + TRACE(gb_bug, tout << mk_ll_pp(pol, get_manager()) << "\n";); s(pol, s_pol, pr); if (!has_var(s_pol)) { - TRACE("spol_bug", tout << "internalizing...\n" << mk_ll_pp(s_pol, get_manager()) << "\n";); + TRACE(spol_bug, tout << "internalizing...\n" << mk_ll_pp(s_pol, get_manager()) << "\n";); ctx.internalize(s_pol, false); ctx.mark_as_relevant(s_pol.get()); } @@ -2127,12 +2127,12 @@ bool theory_arith::internalize_gb_eq(grobner::equation const * eq) { // s_pol = k theory_var v = expr2var(s_pol); // v = k - CTRACE("spol_bug", v == null_theory_var, tout << mk_ll_pp(s_pol, get_manager()) << "\n"; display(tout);); + CTRACE(spol_bug, v == null_theory_var, tout << mk_ll_pp(s_pol, get_manager()) << "\n"; display(tout);); SASSERT(v != null_theory_var); // assert bounds for s_pol mk_derived_nl_bound(v, inf_numeral(k), B_LOWER, eq->get_dependency()); mk_derived_nl_bound(v, inf_numeral(k), B_UPPER, eq->get_dependency()); - TRACE("non_linear", tout << "inserted new equation into the tableau\n"; display_var(tout, v);); + TRACE(non_linear, tout << "inserted new equation into the tableau\n"; display_var(tout, v);); return true; } @@ -2157,18 +2157,18 @@ bool theory_arith::get_gb_eqs_and_look_for_conflict(ptr_vector _fn = [&](std::ostream& out, expr* v) { out << "v" << expr2var(v); }; for (grobner::equation* eq : eqs) gb.display_equation(tout, *eq, _fn); ); for (grobner::equation* eq : eqs) { if (is_inconsistent(eq, gb) || is_inconsistent2(eq, gb)) { - TRACE("grobner", tout << "inconsistent: "; gb.display_equation(tout, *eq);); + TRACE(grobner, tout << "inconsistent: "; gb.display_equation(tout, *eq);); return true; } } - TRACE("grobner", tout << "not found\n"; ); + TRACE(grobner, tout << "not found\n"; ); return false; } @@ -2180,7 +2180,7 @@ bool theory_arith::try_to_modify_eqs(ptr_vector& eqs, gr bool modified = false; for (grobner::equation const* eq : eqs) { unsigned num_monomials = eq->get_num_monomials(); - CTRACE("grobner_bug", num_monomials <= 0, gb.display_equation(tout, *eq);); + CTRACE(grobner_bug, num_monomials <= 0, gb.display_equation(tout, *eq);); if (num_monomials == 0) continue; // HACK: the equation 0 = 0, should have been discarded by the GB module. if (eq->get_monomial(0)->get_degree() != 1) @@ -2192,11 +2192,11 @@ bool theory_arith::try_to_modify_eqs(ptr_vector& eqs, gr expr * var = m->get_var(0); if (gb.get_weight(var) > MAX_DEFAULT_WEIGHT) continue; // variable was already updated - TRACE("non_linear", tout << "increased weight of: " << mk_bounded_pp(var, get_manager()) << "\n";); + TRACE(non_linear, tout << "increased weight of: " << mk_bounded_pp(var, get_manager()) << "\n";); gb.set_weight(var, next_weight); next_weight++; gb.update_order(); - TRACE("non_linear", tout << "after updating order\n"; gb.display(tout);); + TRACE(non_linear, tout << "after updating order\n"; gb.display(tout);); modified = true; break; } @@ -2215,8 +2215,8 @@ bool theory_arith::scan_for_linear(ptr_vector& eqs, grob SASSERT(false); for (grobner::equation* eq : eqs) { if (!eq->is_linear_combination()) { - TRACE("non_linear", tout << "processing new equality:\n"; gb.display_equation(tout, *eq);); - TRACE("non_linear_bug", tout << "processing new equality:\n"; gb.display_equation(tout, *eq);); + TRACE(non_linear, tout << "processing new equality:\n"; gb.display_equation(tout, *eq);); + TRACE(non_linear_bug, tout << "processing new equality:\n"; gb.display_equation(tout, *eq);); if (internalize_gb_eq(eq)) result = true; } @@ -2254,18 +2254,18 @@ typename theory_arith::gb_result theory_arith::compute_grobner(svector return GB_FAIL; grobner gb(get_manager(), m_dep_manager); init_grobner(nl_cluster, gb); - TRACE("non_linear", display(tout);); + TRACE(non_linear, display(tout);); bool warn = false; unsigned next_weight = MAX_DEFAULT_WEIGHT + 1; // next weight using during perturbation phase. ptr_vector eqs; do { - TRACE("grobner", tout << "before grobner:\n"; + TRACE(grobner, tout << "before grobner:\n"; std::function _fn = [&](std::ostream& out, expr* v) { out << "v" << expr2var(v); }; gb.display(tout, _fn)); compute_basis(gb, warn); update_statistics(gb); - TRACE("non_linear_gb", tout << "after:\n"; gb.display(tout);); + TRACE(non_linear_gb, tout << "after:\n"; gb.display(tout);); if (ctx.get_cancel_flag()) return GB_FAIL; if (get_gb_eqs_and_look_for_conflict(eqs, gb)) @@ -2319,14 +2319,14 @@ final_check_status theory_arith::process_non_linear() { } if (!m_params.m_nl_arith) { - TRACE("non_linear", tout << "Non-linear is not enabled\n";); + TRACE(non_linear, tout << "Non-linear is not enabled\n";); return FC_GIVEUP; } - TRACE("process_non_linear", display(tout);); + TRACE(process_non_linear, display(tout);); if (m_nl_rounds > m_params.m_nl_arith_rounds) { - TRACE("non_linear", tout << "GIVEUP non linear problem...\n";); + TRACE(non_linear, tout << "GIVEUP non linear problem...\n";); IF_VERBOSE(3, verbose_stream() << "Max. non linear arithmetic rounds. Increase threshold using NL_ARITH_ROUNDS=\n";); return FC_GIVEUP; } @@ -2336,9 +2336,9 @@ final_check_status theory_arith::process_non_linear() { elim_quasi_base_rows(); move_non_base_vars_to_bounds(); - TRACE("non_linear_verbose", tout << "processing non linear constraints...\n"; ctx.display(tout);); + TRACE(non_linear_verbose, tout << "processing non linear constraints...\n"; ctx.display(tout);); if (!make_feasible()) { - TRACE("non_linear", tout << "failed to move variables to bounds.\n";); + TRACE(non_linear, tout << "failed to move variables to bounds.\n";); failed(); return FC_CONTINUE; } @@ -2404,7 +2404,7 @@ final_check_status theory_arith::process_non_linear() { return m_liberal_final_check || !m_changed_assignment ? FC_DONE : FC_CONTINUE; } - TRACE("non_linear", display(tout);); + TRACE(non_linear, display(tout);); return FC_GIVEUP; } diff --git a/src/smt/theory_array.cpp b/src/smt/theory_array.cpp index a788224ad..4da9e5bca 100644 --- a/src/smt/theory_array.cpp +++ b/src/smt/theory_array.cpp @@ -40,7 +40,7 @@ namespace smt { void theory_array::merge_eh(theory_var v1, theory_var v2, theory_var, theory_var) { // v1 is the new root - TRACE("array", + TRACE(array, tout << "merging v" << v1 << " v" << v2 << "\n"; display_var(tout, v1); tout << mk_pp(get_enode(v1)->get_expr(), m) << " <- " << mk_pp(get_enode(v2)->get_expr(), m) << "\n";); SASSERT(v1 == find(v1)); @@ -54,7 +54,7 @@ namespace smt { add_parent_store(v1, d2->m_parent_stores[i]); for (unsigned i = 0; i < d2->m_parent_selects.size(); ++i) add_parent_select(v1, d2->m_parent_selects[i]); - TRACE("array", tout << "after merge\n"; display_var(tout, v1);); + TRACE(array, tout << "after merge\n"; display_var(tout, v1);); } void theory_array::unmerge_eh(theory_var v1, theory_var v2) { @@ -67,7 +67,7 @@ namespace smt { SASSERT(r == static_cast(m_var_data.size())); m_var_data.push_back(alloc(var_data)); var_data * d = m_var_data[r]; - TRACE("array", tout << mk_bounded_pp(n->get_expr(), m) << "\nis_array: " << is_array_sort(n) << ", is_select: " << is_select(n) << + TRACE(array, tout << mk_bounded_pp(n->get_expr(), m) << "\nis_array: " << is_array_sort(n) << ", is_select: " << is_select(n) << ", is_store: " << is_store(n) << "\n";); d->m_is_array = is_array_sort(n); if (d->m_is_array) @@ -88,7 +88,7 @@ namespace smt { v = find(v); var_data * d = m_var_data[v]; d->m_parent_selects.push_back(s); - TRACE("array", tout << v << " " << mk_pp(s->get_expr(), m) << " " << mk_pp(get_enode(v)->get_expr(), m) << "\n";); + TRACE(array, tout << v << " " << mk_pp(s->get_expr(), m) << " " << mk_pp(get_enode(v)->get_expr(), m) << "\n";); m_trail_stack.push(push_back_trail(d->m_parent_selects)); for (enode* n : d->m_stores) instantiate_axiom2a(s, n); @@ -141,7 +141,7 @@ namespace smt { add_weak_var(v); return; } - TRACE("array", tout << "#" << v << "\n";); + TRACE(array, tout << "#" << v << "\n";); m_trail_stack.push(reset_flag_trail(d->m_prop_upward)); d->m_prop_upward = true; if (!m_params.m_array_delay_exp_axiom) @@ -195,14 +195,14 @@ namespace smt { } void theory_array::instantiate_axiom1(enode * store) { - TRACE("array", tout << "axiom 1:\n" << mk_bounded_pp(store->get_expr(), m) << "\n";); + TRACE(array, tout << "axiom 1:\n" << mk_bounded_pp(store->get_expr(), m) << "\n";); SASSERT(is_store(store)); m_stats.m_num_axiom1++; assert_store_axiom1(store); } void theory_array::instantiate_axiom2a(enode * select, enode * store) { - TRACE("array", tout << "axiom 2a: #" << select->get_owner_id() << " #" << store->get_owner_id() << "\n";); + TRACE(array, tout << "axiom 2a: #" << select->get_owner_id() << " #" << store->get_owner_id() << "\n";); SASSERT(is_select(select)); SASSERT(is_store(store)); if (assert_store_axiom2(store, select)) @@ -210,7 +210,7 @@ namespace smt { } bool theory_array::instantiate_axiom2b(enode * select, enode * store) { - TRACE("array_axiom2b", tout << "axiom 2b: #" << select->get_owner_id() << " #" << store->get_owner_id() << "\n";); + TRACE(array_axiom2b, tout << "axiom 2b: #" << select->get_owner_id() << " #" << store->get_owner_id() << "\n";); SASSERT(is_select(select)); SASSERT(is_store(store)); if (assert_store_axiom2(store, select)) { @@ -221,7 +221,7 @@ namespace smt { } void theory_array::instantiate_extensionality(enode * a1, enode * a2) { - TRACE("array", tout << "extensionality: #" << a1->get_owner_id() << " #" << a2->get_owner_id() << "\n";); + TRACE(array, tout << "extensionality: #" << a1->get_owner_id() << " #" << a2->get_owner_id() << "\n";); SASSERT(is_array_sort(a1)); SASSERT(is_array_sort(a2)); if (m_params.m_array_extensional && assert_extensionality(a1, a2)) @@ -238,7 +238,7 @@ namespace smt { // bool theory_array::internalize_term_core(app * n) { - TRACE("array_bug", tout << mk_bounded_pp(n, m) << "\n";); + TRACE(array_bug, tout << mk_bounded_pp(n, m) << "\n";); for (expr* arg : *n) ctx.internalize(arg, false); // force merge-tf by re-internalizing expression. @@ -266,7 +266,7 @@ namespace smt { found_unsupported_op(n); return false; } - TRACE("array_bug", tout << mk_bounded_pp(n, m) << "\n";); + TRACE(array_bug, tout << mk_bounded_pp(n, m) << "\n";); if (!internalize_term_core(n)) { return true; } @@ -309,7 +309,7 @@ namespace smt { v1 = find(v1); v2 = find(v2); var_data * d1 = m_var_data[v1]; - TRACE("ext", tout << "extensionality: " << d1->m_is_array << "\n" + TRACE(ext, tout << "extensionality: " << d1->m_is_array << "\n" << mk_bounded_pp(get_enode(v1)->get_expr(), m, 5) << "\n" << mk_bounded_pp(get_enode(v2)->get_expr(), m, 5) << "\n";); @@ -323,7 +323,7 @@ namespace smt { if (laziness() == 0) return; if (m.is_ite(n)) { - TRACE("array", tout << "relevant ite " << mk_pp(n, m) << "\n";); + TRACE(array, tout << "relevant ite " << mk_pp(n, m) << "\n";); } if (!is_store(n) && !is_select(n)) return; @@ -394,7 +394,7 @@ namespace smt { bool should_giveup = m_found_unsupported_op || has_propagate_up_trail(); if (r == FC_DONE && should_giveup && !ctx.get_fparams().m_array_fake_support) r = FC_GIVEUP; - CTRACE("array", r != FC_DONE || m_found_unsupported_op, tout << r << "\n";); + CTRACE(array, r != FC_DONE || m_found_unsupported_op, tout << r << "\n";); return r; } diff --git a/src/smt/theory_array_bapa.cpp b/src/smt/theory_array_bapa.cpp index 226c2abb4..72aea761d 100644 --- a/src/smt/theory_array_bapa.cpp +++ b/src/smt/theory_array_bapa.cpp @@ -151,7 +151,7 @@ namespace smt { mk_th_axiom(3, lits); } void mk_th_axiom(unsigned n, literal* lits) { - TRACE("card", ctx().display_literals_verbose(tout, n, lits) << "\n";); + TRACE(card, ctx().display_literals_verbose(tout, n, lits) << "\n";); IF_VERBOSE(10, ctx().display_literals_verbose(verbose_stream(), n, lits) << "\n"); ctx().mk_th_axiom(th.get_id(), n, lits); } @@ -359,7 +359,7 @@ namespace smt { expr_ref idx = mk_index_skolem(set_sz, set, k); app_ref sel(mk_select(set, idx), m); mk_th_axiom(~sz_lit, le_lit, mk_literal(sel)); - TRACE("card", tout << idx << " " << sel << " " << i.m_size << "\n";); + TRACE(card, tout << idx << " " << sel << " " << i.m_size << "\n";); } return l_false; } @@ -543,7 +543,7 @@ namespace smt { if (r == l_true) r = trace_call("ensure_values_assigned", ensure_values_assigned()); if (r == l_true) r = trace_call("ensure_non_empty", ensure_non_empty()); if (r == l_true) r = trace_call("ensure_no_overflow", ensure_no_overflow()); - CTRACE("card", r != l_true, display(tout);); + CTRACE(card, r != l_true, display(tout);); switch (r) { case l_true: return FC_DONE; @@ -622,7 +622,7 @@ namespace smt { expr* sz = kv.m_key->get_arg(1); assumptions.push_back(mk_size_limit(set, sz)); } - TRACE("card", tout << "ASSUMPTIONS: " << assumptions << "\n";); + TRACE(card, tout << "ASSUMPTIONS: " << assumptions << "\n";); } }; diff --git a/src/smt/theory_array_base.cpp b/src/smt/theory_array_base.cpp index db6b3da3c..9d1775a3b 100644 --- a/src/smt/theory_array_base.cpp +++ b/src/smt/theory_array_base.cpp @@ -40,7 +40,7 @@ namespace smt { void theory_array_base::found_unsupported_op(expr * n) { if (!ctx.get_fparams().m_array_fake_support && !m_found_unsupported_op) { - TRACE("array", tout << mk_ll_pp(n, m) << "\n";); + TRACE(array, tout << mk_ll_pp(n, m) << "\n";); ctx.push_trail(value_trail(m_found_unsupported_op)); m_found_unsupported_op = true; } @@ -48,7 +48,7 @@ namespace smt { app * theory_array_base::mk_select(unsigned num_args, expr * const * args) { app * r = m.mk_app(get_family_id(), OP_SELECT, 0, nullptr, num_args, args); - TRACE("mk_var_bug", tout << "mk_select: " << r->get_id() << " num_args: " << num_args; + TRACE(mk_var_bug, tout << "mk_select: " << r->get_id() << " num_args: " << num_args; for (unsigned i = 0; i < num_args; i++) tout << " " << args[i]->get_id(); tout << "\n";); return r; @@ -86,7 +86,7 @@ namespace smt { } void theory_array_base::assert_axiom(unsigned num_lits, literal * lits) { - TRACE("array_axiom", + TRACE(array_axiom, tout << "literals:\n"; for (unsigned i = 0; i < num_lits; ++i) { expr * e = ctx.bool_var2expr(lits[i].var()); @@ -120,7 +120,7 @@ namespace smt { expr_ref sel(m); sel = mk_select(sel_args.size(), sel_args.data()); expr * val = n->get_arg(num_args - 1); - TRACE("array", tout << mk_bounded_pp(sel, m) << " = " << mk_bounded_pp(val, m) << "\n";); + TRACE(array, tout << mk_bounded_pp(sel, m) << " = " << mk_bounded_pp(val, m) << "\n";); if (m.proofs_enabled()) { literal l(mk_eq(sel, val, true)); ctx.mark_as_relevant(l); @@ -129,7 +129,7 @@ namespace smt { if (m.has_trace_stream()) m.trace_stream() << "[end-of-instance]\n"; } else { - TRACE("mk_var_bug", tout << "mk_sel: " << sel->get_id() << "\n";); + TRACE(mk_var_bug, tout << "mk_sel: " << sel->get_id() << "\n";); ctx.internalize(sel, false); ctx.assign_eq(ctx.get_enode(sel), ctx.get_enode(val), eq_justification::mk_axiom()); ctx.mark_as_relevant(sel.get()); @@ -147,7 +147,7 @@ namespace smt { i_n /= j_n => select(store(a, i_1, ..., i_n, v), j_1, ..., j_n) = select(a, j_1, ..., j_n) */ void theory_array_base::assert_store_axiom2_core(enode * store, enode * select) { - TRACE("array", tout << "generating axiom2: #" << store->get_owner_id() << " #" << select->get_owner_id() << "\n"; + TRACE(array, tout << "generating axiom2: #" << store->get_owner_id() << " #" << select->get_owner_id() << "\n"; tout << mk_bounded_pp(store->get_expr(), m) << "\n" << mk_bounded_pp(select->get_expr(), m) << "\n";); SASSERT(is_store(store)); SASSERT(is_select(select)); @@ -176,7 +176,7 @@ namespace smt { enode * idx2 = is[i]; if (idx1->get_root() == idx2->get_root()) { - TRACE("array_bug", tout << "indexes are equal... skipping...\n";); + TRACE(array_bug, tout << "indexes are equal... skipping...\n";); continue; } @@ -184,11 +184,11 @@ namespace smt { sel1 = mk_select(sel1_args.size(), sel1_args.data()); sel2 = mk_select(sel2_args.size(), sel2_args.data()); if (sel1 == sel2) { - TRACE("array_bug", tout << "sel1 and sel2 are equal:\n";); + TRACE(array_bug, tout << "sel1 and sel2 are equal:\n";); break; } init = true; - TRACE("array", tout << mk_bounded_pp(sel1, m) << " " << mk_bounded_pp(sel2, m) << "\n";); + TRACE(array, tout << mk_bounded_pp(sel1, m) << " " << mk_bounded_pp(sel2, m) << "\n";); conseq = mk_eq(sel1, sel2, true); conseq_expr = ctx.bool_var2expr(conseq.var()); } @@ -204,8 +204,8 @@ namespace smt { // ctx.force_phase(ante); ctx.add_rel_watch(~ante, conseq_expr); // ctx.mark_as_relevant(conseq_expr); - TRACE("array", tout << "asserting axiom2: " << ante << "\n";); - TRACE("array_map_bug", tout << "axiom2:\n"; + TRACE(array, tout << "asserting axiom2: " << ante << "\n";); + TRACE(array_map_bug, tout << "axiom2:\n"; tout << mk_ismt2_pp(idx1->get_expr(), m) << "\n=\n" << mk_ismt2_pp(idx2->get_expr(), m); tout << "\nimplies\n" << mk_ismt2_pp(conseq_expr, m) << "\n";); if (m.has_trace_stream()) { @@ -227,11 +227,11 @@ namespace smt { if (i == num_args) return false; if (ctx.add_fingerprint(store, store->get_owner_id(), select->get_num_args() - 1, select->get_args() + 1)) { - TRACE("array", tout << "adding axiom2 to todo queue\n";); + TRACE(array, tout << "adding axiom2 to todo queue\n";); m_axiom2_todo.push_back(std::make_pair(store, select)); return true; } - TRACE("array", tout << "axiom already instantiated: #" << store->get_owner_id() << " #" << select->get_owner_id() << "\n";); + TRACE(array, tout << "axiom already instantiated: #" << store->get_owner_id() << " #" << select->get_owner_id() << "\n";); return false; } @@ -299,7 +299,7 @@ namespace smt { m_array_value.find(parent, other)) { if (ctx.is_diseq(parent, other)) { - TRACE("array_ext", tout << "selects are disequal\n";); + TRACE(array_ext, tout << "selects are disequal\n";); return true; } } @@ -320,7 +320,7 @@ namespace smt { } void theory_array_base::assert_congruent(enode * a1, enode * a2) { - TRACE("array", tout << "congruent: #" << a1->get_owner_id() << " #" << a2->get_owner_id() << "\n";); + TRACE(array, tout << "congruent: #" << a1->get_owner_id() << " #" << a2->get_owner_id() << "\n";); SASSERT(is_array_sort(a1)); SASSERT(is_array_sort(a2)); if (a1->get_owner_id() > a2->get_owner_id()) @@ -353,7 +353,7 @@ namespace smt { } expr_ref sel1(mk_select(args1.size(), args1.data()), m); expr_ref sel2(mk_select(args2.size(), args2.data()), m); - TRACE("ext", tout << mk_bounded_pp(sel1, m) << "\n" << mk_bounded_pp(sel2, m) << "\n";); + TRACE(ext, tout << mk_bounded_pp(sel1, m) << "\n" << mk_bounded_pp(sel2, m) << "\n";); literal n1_eq_n2 = mk_eq(e1, e2, true); literal sel1_eq_sel2 = mk_eq(sel1, sel2, true); ctx.mark_as_relevant(n1_eq_n2); @@ -529,7 +529,7 @@ namespace smt { // issue #3532, #3529 // if (ctx.is_shared(r) || is_select_arg(r)) { - TRACE("array", tout << "new shared var: #" << r->get_owner_id() << " " << is_select_arg(r) << "\n";); + TRACE(array, tout << "new shared var: #" << r->get_owner_id() << " " << is_select_arg(r) << "\n";); theory_var r_th_var = r->get_th_var(get_id()); SASSERT(r_th_var != null_theory_var); result.push_back(r_th_var); @@ -537,7 +537,7 @@ namespace smt { r->set_mark(); to_unmark.push_back(r); } - TRACE("array", tout << "collecting shared vars...\n" << unsigned_vector(result.size(), (unsigned*)result.data()) << "\n";); + TRACE(array, tout << "collecting shared vars...\n" << unsigned_vector(result.size(), (unsigned*)result.data()) << "\n";); unmark_enodes(to_unmark.size(), to_unmark.data()); } @@ -552,7 +552,7 @@ namespace smt { sbuffer::iterator it1 = roots.begin(); sbuffer::iterator end1 = roots.end(); for (; it1 != end1; ++it1) { - TRACE("array_bug", tout << "mk_interface_eqs: processing: v" << *it1 << "\n";); + TRACE(array_bug, tout << "mk_interface_eqs: processing: v" << *it1 << "\n";); theory_var v1 = *it1; enode * n1 = get_enode(v1); sort * s1 = n1->get_expr()->get_sort(); @@ -615,7 +615,7 @@ namespace smt { void theory_array_base::set_default(theory_var v, enode* n) { - TRACE("array", tout << "set default: " << v << " " << pp(n, m) << "\n";); + TRACE(array, tout << "set default: " << v << " " << pp(n, m) << "\n";); v = mg_find(v); if (m_defaults[v] == 0) { m_defaults[v] = n; @@ -662,7 +662,7 @@ namespace smt { if (m_defaults[u] == 0) { m_defaults[u] = m_defaults[v]; } - CTRACE("array", m_defaults[v], + CTRACE(array, m_defaults[v], tout << pp(m_defaults[v]->get_root(), m) << "\n"; tout << pp(m_defaults[u]->get_root(), m) << "\n"; ); @@ -739,7 +739,7 @@ namespace smt { mg_merge(v, get_representative(w)); - TRACE("array", tout << "merge: " << pp(n, m) << " " << v << " " << w << "\n";); + TRACE(array, tout << "merge: " << pp(n, m) << " " << v << " " << w << "\n";); } else if (is_const(n)) { set_default(v, n->get_arg(0)); @@ -996,7 +996,7 @@ namespace smt { // The implementation should not assume a fresh value is created for // the else_val if the range is finite - TRACE("array", tout << pp(n, m) << " " << mk_pp(range, m) << " " << range->is_infinite() << "\n";); + TRACE(array, tout << pp(n, m) << " " << mk_pp(range, m) << " " << range->is_infinite() << "\n";); if (range->is_infinite()) else_val = TAG(void*, mg.mk_extra_fresh_value(n->get_expr(), range), 1); else @@ -1025,7 +1025,7 @@ namespace smt { result->add_entry(args.size(), args.data(), select); } } - TRACE("array", + TRACE(array, tout << pp(n->get_root(), m) << "\n"; if (sel_set) { for (enode* s : *sel_set) { diff --git a/src/smt/theory_array_full.cpp b/src/smt/theory_array_full.cpp index b92c0e560..40220e830 100644 --- a/src/smt/theory_array_full.cpp +++ b/src/smt/theory_array_full.cpp @@ -111,7 +111,7 @@ namespace smt { } m_trail_stack.push(reset_flag_trail(d->m_prop_upward)); d->m_prop_upward = true; - TRACE("array", tout << "#" << v << "\n";); + TRACE(array, tout << "#" << v << "\n";); if (!m_params.m_array_delay_exp_axiom) { instantiate_axiom2b_for(v); instantiate_axiom_map_for(v); @@ -133,7 +133,7 @@ namespace smt { // call set_prop_upward on array arguments. // void theory_array_full::set_prop_upward(enode * n) { - TRACE("array", tout << pp(n, m) << "\n";); + TRACE(array, tout << pp(n, m) << "\n";); if (is_store(n)) { set_prop_upward(n->get_arg(0)->get_th_var(get_id())); } @@ -265,7 +265,7 @@ namespace smt { if (ctx.e_internalized(n)) { return true; } - TRACE("array", tout << mk_pp(n, m) << "\n";); + TRACE(array, tout << mk_pp(n, m) << "\n";); if (is_store(n) || is_select(n)) { return theory_array::internalize_term(n); @@ -358,7 +358,7 @@ namespace smt { add_as_array(v1, n); for (enode* n : d2->m_lambdas) add_lambda(v1, n); - TRACE("array", + TRACE(array, tout << pp(get_enode(v1), m) << "\n"; tout << pp(get_enode(v2), m) << "\n"; tout << "merge in\n"; display_var(tout, v2); @@ -369,7 +369,7 @@ namespace smt { SASSERT(v != null_theory_var); v = find(v); var_data* d = m_var_data[v]; - TRACE("array", tout << "v" << v << " " << pp(get_enode(v), m) << " " + TRACE(array, tout << "v" << v << " " << pp(get_enode(v), m) << " " << d->m_prop_upward << " " << m_params.m_array_delay_exp_axiom << "\n";); for (enode * store : d->m_stores) { SASSERT(is_store(store)); @@ -382,7 +382,7 @@ namespace smt { } void theory_array_full::add_parent_select(theory_var v, enode * s) { - TRACE("array", + TRACE(array, tout << v << " select parent: " << pp(s, m) << "\n"; display_var(tout, v); ); @@ -408,7 +408,7 @@ namespace smt { } void theory_array_full::relevant_eh(app* n) { - TRACE("array", tout << mk_pp(n, m) << "\n";); + TRACE(array, tout << mk_pp(n, m) << "\n";); theory_array::relevant_eh(n); if (!is_default(n) && !is_select(n) && !is_map(n) && !is_const(n) && !is_as_array(n)){ return; @@ -469,7 +469,7 @@ namespace smt { func_decl* f = to_func_decl(map->get_decl()->get_parameter(0).get_ast()); - TRACE("array_map_bug", tout << "invoked instantiate_select_map_axiom\n"; + TRACE(array_map_bug, tout << "invoked instantiate_select_map_axiom\n"; tout << sl->get_owner_id() << " " << mp->get_owner_id() << "\n"; tout << mk_ismt2_pp(sl->get_expr(), m) << "\n" << mk_ismt2_pp(mp->get_expr(), m) << "\n";); @@ -477,10 +477,10 @@ namespace smt { return false; } - TRACE("array_map_bug", tout << "new axiom\n";); + TRACE(array_map_bug, tout << "new axiom\n";); m_stats.m_num_map_axiom++; - TRACE("array", + TRACE(array, tout << mk_bounded_pp(mp->get_expr(), m) << "\n"; tout << mk_bounded_pp(sl->get_expr(), m) << "\n";); unsigned num_args = select->get_num_args(); @@ -512,7 +512,7 @@ namespace smt { ctx.internalize(sel1, false); ctx.internalize(sel2, false); - TRACE("array_map_bug", + TRACE(array_map_bug, tout << "select-map axiom\n" << mk_ismt2_pp(sel1, m) << "\n=\n" << mk_ismt2_pp(sel2,m) << "\n";); return try_assign_eq(sel1, sel2); @@ -532,7 +532,7 @@ namespace smt { if (!ctx.add_fingerprint(this, m_default_map_fingerprint, 1, &mp)) { return false; } - TRACE("array", tout << mk_bounded_pp(map, m) << "\n";); + TRACE(array, tout << mk_bounded_pp(map, m) << "\n";); m_stats.m_num_default_map_axiom++; @@ -558,7 +558,7 @@ namespace smt { } m_stats.m_num_default_const_axiom++; SASSERT(is_const(cnst)); - TRACE("array", tout << mk_bounded_pp(cnst->get_expr(), m) << "\n";); + TRACE(array, tout << mk_bounded_pp(cnst->get_expr(), m) << "\n";); expr* val = cnst->get_arg(0)->get_expr(); expr_ref def(mk_default(cnst->get_expr()), m); ctx.internalize(def, false); @@ -578,7 +578,7 @@ namespace smt { } m_stats.m_num_default_as_array_axiom++; SASSERT(is_as_array(arr)); - TRACE("array", tout << mk_bounded_pp(arr->get_owner(), m) << "\n";); + TRACE(array, tout << mk_bounded_pp(arr->get_owner(), m) << "\n";); expr* def = mk_default(arr->get_owner()); func_decl * f = array_util(m).get_as_array_func_decl(arr->get_owner()); ptr_vector args; @@ -599,7 +599,7 @@ namespace smt { expr* e = arr->get_expr(); expr_ref def(mk_default(e), m); quantifier* lam = m.is_lambda_def(arr->get_decl()); - TRACE("array", tout << mk_pp(lam, m) << "\n" << mk_pp(e, m) << "\n"); + TRACE(array, tout << mk_pp(lam, m) << "\n" << mk_pp(e, m) << "\n"); expr_ref_vector args(m); var_subst subst(m, false); args.push_back(subst(lam, to_app(e)->get_num_args(), to_app(e)->get_args())); @@ -675,7 +675,7 @@ namespace smt { } expr * sel = mk_select(sel_args.size(), sel_args.data()); expr * val = cnst->get_expr()->get_arg(0); - TRACE("array", tout << "new select-const axiom...\n"; + TRACE(array, tout << "new select-const axiom...\n"; tout << "const: " << mk_bounded_pp(cnst->get_expr(), m) << "\n"; tout << "select: " << mk_bounded_pp(select->get_expr(), m) << "\n"; tout << " sel/const: " << mk_bounded_pp(sel, m) << "\n"; @@ -710,7 +710,7 @@ namespace smt { expr * sel = mk_select(sel_args.size(), sel_args.data()); func_decl * f = array_util(m).get_as_array_func_decl(arr->get_expr()); expr_ref val(m.mk_app(f, sel_args.size()-1, sel_args.data()+1), m); - TRACE("array", tout << "new select-as-array axiom...\n"; + TRACE(array, tout << "new select-as-array axiom...\n"; tout << "as-array: " << mk_bounded_pp(arr->get_expr(), m) << "\n"; tout << "select: " << mk_bounded_pp(select->get_expr(), m) << "\n"; tout << " sel/as-array: " << mk_bounded_pp(sel, m) << "\n"; @@ -736,7 +736,7 @@ namespace smt { expr_ref def1(m), def2(m); - TRACE("array", tout << mk_bounded_pp(store_app, m) << "\n";); + TRACE(array, tout << mk_bounded_pp(store_app, m) << "\n";); unsigned num_args = store_app->get_num_args(); @@ -827,14 +827,14 @@ namespace smt { for (enode* n : m_as_array) { for (enode* p : n->get_parents()) if (!ctx.is_beta_redex(p, n)) { - TRACE("array", tout << "not a beta redex " << enode_pp(p, ctx) << "\n"); + TRACE(array, tout << "not a beta redex " << enode_pp(p, ctx) << "\n"); return true; } } for (enode* n : m_lambdas) for (enode* p : n->get_parents()) if (!is_default(p) && !ctx.is_beta_redex(p, n)) { - TRACE("array", tout << "lambda is not a beta redex " << enode_pp(p, ctx) << "\n"); + TRACE(array, tout << "lambda is not a beta redex " << enode_pp(p, ctx) << "\n"); return true; } return false; @@ -843,7 +843,7 @@ namespace smt { bool theory_array_full::instantiate_parent_stores_default(theory_var v) { SASSERT(v != null_theory_var); - TRACE("array", tout << "v" << v << "\n";); + TRACE(array, tout << "v" << v << "\n";); v = find(v); var_data* d = m_var_data[v]; bool result = false; @@ -859,7 +859,7 @@ namespace smt { } bool theory_array_full::try_assign_eq(expr* v1, expr* v2) { - TRACE("array", tout << mk_bounded_pp(v1, m) << "\n==\n" << mk_bounded_pp(v2, m) << "\n";); + TRACE(array, tout << mk_bounded_pp(v1, m) << "\n==\n" << mk_bounded_pp(v2, m) << "\n";); if (m_eqs.contains(v1, v2)) { return false; diff --git a/src/smt/theory_bv.cpp b/src/smt/theory_bv.cpp index b6ebcbbc5..93f09f639 100644 --- a/src/smt/theory_bv.cpp +++ b/src/smt/theory_bv.cpp @@ -65,7 +65,7 @@ namespace smt { } } - TRACE("bv", tout << "v" << v << " #" << owner->get_id() << "\n"; + TRACE(bv, tout << "v" << v << " #" << owner->get_id() << "\n"; for (unsigned i = 0; i < bv_size; i++) tout << mk_bounded_pp(m_bits_expr[i], m) << "\n"; ); @@ -87,7 +87,7 @@ namespace smt { void theory_bv::mk_bit2bool(app * n) { SASSERT(!ctx.b_internalized(n)); - TRACE("bv", tout << "bit2bool: " << mk_pp(n, ctx.get_manager()) << "\n";); + TRACE(bv, tout << "bit2bool: " << mk_pp(n, ctx.get_manager()) << "\n";); expr* first_arg = n->get_arg(0); if (!ctx.e_internalized(first_arg)) { @@ -233,7 +233,7 @@ namespace smt { */ void theory_bv::assert_new_diseq_axiom(theory_var v1, theory_var v2, unsigned idx) { SASSERT(m_bits[v1][idx] == ~m_bits[v2][idx]); - TRACE("bv_diseq_axiom", tout << "found new diseq axiom\n"; display_var(tout, v1); display_var(tout, v2);); + TRACE(bv_diseq_axiom, tout << "found new diseq axiom\n"; display_var(tout, v1); display_var(tout, v2);); // found new disequality m_stats.m_num_diseq_static++; app * e1 = get_expr(v1); @@ -286,7 +286,7 @@ namespace smt { } else { theory_id th_id = ctx.get_var_theory(l.var()); - TRACE("init_bits", tout << l << " " << th_id << "\n";); + TRACE(init_bits, tout << l << " " << th_id << "\n";); if (th_id == get_id()) { atom * a = get_bv2a(l.var()); SASSERT(a && a->is_bit()); @@ -327,7 +327,7 @@ namespace smt { for (unsigned i = 0; i < sz; i++) { expr * bit = bits.get(i); literal l = ctx.get_literal(bit); - TRACE("init_bits", tout << "bit " << i << " of #" << n->get_owner_id() << "\n" << mk_bounded_pp(bit, m) << "\n";); + TRACE(init_bits, tout << "bit " << i << " of #" << n->get_owner_id() << "\n" << mk_bounded_pp(bit, m) << "\n";); add_bit(v, l); } find_wpos(v); @@ -342,20 +342,20 @@ namespace smt { unsigned & wpos = m_wpos[v]; unsigned init = wpos; for (; wpos < sz; wpos++) { - TRACE("find_wpos", tout << "curr bit: " << bits[wpos] << "\n";); + TRACE(find_wpos, tout << "curr bit: " << bits[wpos] << "\n";); if (ctx.get_assignment(bits[wpos]) == l_undef) { - TRACE("find_wpos", tout << "moved wpos of v" << v << " to " << wpos << "\n";); + TRACE(find_wpos, tout << "moved wpos of v" << v << " to " << wpos << "\n";); return; } } wpos = 0; for (; wpos < init; wpos++) { if (ctx.get_assignment(bits[wpos]) == l_undef) { - TRACE("find_wpos", tout << "moved wpos of v" << v << " to " << wpos << "\n";); + TRACE(find_wpos, tout << "moved wpos of v" << v << " to " << wpos << "\n";); return; } } - TRACE("find_wpos", tout << "v" << v << " is a fixed variable.\n";); + TRACE(find_wpos, tout << "v" << v << " is a fixed variable.\n";); fixed_var_eh(v); } @@ -444,7 +444,7 @@ namespace smt { ctx.mark_as_relevant(oeq); unsigned sz = get_bv_size(v1); - TRACE("bv", + TRACE(bv, tout << mk_pp(o1, m) << " = " << mk_pp(o2, m) << " " << ctx.get_scope_level() << "\n";); literal_vector eqs; @@ -494,7 +494,7 @@ namespace smt { get_bv_size(v2) == sz && get_fixed_value(v2, val2) && val == val2) { if (get_enode(v)->get_root() != get_enode(v2)->get_root()) { SASSERT(get_bv_size(v) == get_bv_size(v2)); - TRACE("fixed_var_eh", tout << "detected equality: v" << v << " = v" << v2 << "\n"; + TRACE(fixed_var_eh, tout << "detected equality: v" << v << " = v" << v2 << "\n"; display_var(tout, v); display_var(tout, v2);); m_stats.m_num_th2core_eq++; @@ -551,7 +551,7 @@ namespace smt { } bool theory_bv::get_fixed_value(app* x, numeral & result) const { - CTRACE("bv", !ctx.e_internalized(x), tout << "not internalized " << mk_pp(x, m) << "\n";); + CTRACE(bv, !ctx.e_internalized(x), tout << "not internalized " << mk_pp(x, m) << "\n";); if (!ctx.e_internalized(x)) return false; enode * e = ctx.get_enode(x); theory_var v = e->get_th_var(get_id()); @@ -596,7 +596,7 @@ namespace smt { void theory_bv::internalize_bv2int(app* n) { SASSERT(!ctx.e_internalized(n)); - TRACE("bv", tout << mk_bounded_pp(n, m) << "\n";); + TRACE(bv, tout << mk_bounded_pp(n, m) << "\n";); process_args(n); mk_enode(n); m_bv2int.push_back(ctx.get_enode(n)); @@ -613,7 +613,7 @@ namespace smt { // SASSERT(ctx.e_internalized(n)); SASSERT(m_util.is_ubv2int(n)); - TRACE("bv2int_bug", tout << "bv2int:\n" << mk_pp(n, m) << "\n";); + TRACE(bv2int_bug, tout << "bv2int:\n" << mk_pp(n, m) << "\n";); sort * int_sort = n->get_sort(); app * k = to_app(n->get_arg(0)); SASSERT(m_util.is_bv_sort(k->get_sort())); @@ -649,7 +649,7 @@ namespace smt { th_rewriter rw(m); rw(sum); literal l(mk_eq(n, sum, false)); - TRACE("bv", + TRACE(bv, tout << mk_pp(n, m) << "\n"; tout << mk_pp(sum, m) << "\n"; ctx.display_literal_verbose(tout, l); @@ -705,7 +705,7 @@ namespace smt { ctx.mk_th_axiom(get_id(), 1, &l); } - TRACE("bv", + TRACE(bv, tout << mk_pp(lhs, m) << " == \n"; tout << mk_pp(rhs, m) << "\n"; ); @@ -721,7 +721,7 @@ namespace smt { rhs = m_autil.mk_mod(div_rhs, m_autil.mk_numeral(mod, true)); rhs = ctx.mk_eq_atom(rhs, m_autil.mk_int(1)); lhs = n_bits.get(i); - TRACE("bv", tout << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << "\n";); + TRACE(bv, tout << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << "\n";); l = literal(mk_eq(lhs, rhs, false)); ctx.mark_as_relevant(l); { @@ -793,7 +793,7 @@ namespace smt { bits.swap(new_bits); \ } \ init_bits(e, bits); \ - TRACE("bv_verbose", tout << arg_bits << " " << bits << " " << new_bits << "\n";); \ + TRACE(bv_verbose, tout << arg_bits << " " << bits << " " << new_bits << "\n";); \ } void theory_bv::internalize_sub(app *n) { @@ -889,7 +889,7 @@ namespace smt { bool theory_bv::internalize_term_core(app * term) { SASSERT(term->get_family_id() == get_family_id()); - TRACE("bv", tout << "internalizing term: " << mk_bounded_pp(term, m) << "\n";); + TRACE(bv, tout << "internalizing term: " << mk_bounded_pp(term, m) << "\n";); if (approximate_term(term)) { return false; } @@ -951,7 +951,7 @@ namespace smt { case OP_BUREM: return false; case OP_BSMOD: return false; default: - TRACE("bv_op", tout << "unsupported operator: " << mk_ll_pp(term, m) << "\n";); + TRACE(bv_op, tout << "unsupported operator: " << mk_ll_pp(term, m) << "\n";); UNREACHABLE(); return false; } @@ -1095,7 +1095,7 @@ namespace smt { } bool theory_bv::internalize_atom(app * atom, bool gate_ctx) { - TRACE("bv", tout << "internalizing atom: " << mk_bounded_pp(atom, m) << "\n";); + TRACE(bv, tout << "internalizing atom: " << mk_bounded_pp(atom, m) << "\n";); SASSERT(atom->get_family_id() == get_family_id()); if (approximate_term(atom)) { return false; @@ -1129,7 +1129,7 @@ namespace smt { sort* s = arg->get_sort(); if (m_util.is_bv_sort(s) && m_util.get_bv_size(arg) > params().m_bv_blast_max_size) { if (!m_approximates_large_bvs) { - TRACE("bv", tout << "found large size bit-vector:\n" << mk_pp(n, m) << "\n";); + TRACE(bv, tout << "found large size bit-vector:\n" << mk_pp(n, m) << "\n";); ctx.push_trail(value_trail(m_approximates_large_bvs)); m_approximates_large_bvs = true; } @@ -1149,8 +1149,8 @@ namespace smt { } void theory_bv::new_eq_eh(theory_var v1, theory_var v2) { - TRACE("bv_eq", tout << "new_eq: " << mk_pp(get_enode(v1)->get_expr(), m) << " = " << mk_pp(get_enode(v2)->get_expr(), m) << "\n";); - TRACE("bv", tout << "new_eq_eh v" << v1 << " = v" << v2 << " @ " << ctx.get_scope_level() << + TRACE(bv_eq, tout << "new_eq: " << mk_pp(get_enode(v1)->get_expr(), m) << " = " << mk_pp(get_enode(v2)->get_expr(), m) << "\n";); + TRACE(bv, tout << "new_eq_eh v" << v1 << " = v" << v2 << " @ " << ctx.get_scope_level() << " relevant1: " << ctx.is_relevant(get_enode(v1)) << " relevant2: " << ctx.is_relevant(get_enode(v2)) << "\n";); m_find.merge(v1, v2); @@ -1226,7 +1226,7 @@ namespace smt { literal arg = ctx.get_literal(diff); lits.push_back(arg); } - TRACE("bv", + TRACE(bv, tout << mk_pp(get_enode(v1)->get_expr(), m) << " = " << mk_pp(get_enode(v2)->get_expr(), m) << " " << ctx.get_scope_level() << "\n"; @@ -1239,7 +1239,7 @@ namespace smt { void theory_bv::assign_eh(bool_var v, bool is_true) { atom * a = get_bv2a(v); - TRACE("bv", tout << "assert: p" << v << " #" << ctx.bool_var2expr(v)->get_id() << " is_true: " << is_true << " " << ctx.inconsistent() << "\n";); + TRACE(bv, tout << "assert: p" << v << " #" << ctx.bool_var2expr(v)->get_id() << " is_true: " << is_true << " " << ctx.inconsistent() << "\n";); if (a->is_bit()) { m_prop_queue.reset(); bit_atom * b = static_cast(a); @@ -1277,7 +1277,7 @@ namespace smt { continue; } theory_var v2 = next(v); - TRACE("bv", tout << "propagating v" << v << " #" << get_enode(v)->get_owner_id() << "[" << idx << "] = " << val << " " << ctx.get_scope_level() << "\n";); + TRACE(bv, tout << "propagating v" << v << " #" << get_enode(v)->get_owner_id() << "[" << idx << "] = " << val << " " << ctx.get_scope_level() << "\n";); literal antecedent = bit; if (val == l_false) { @@ -1287,8 +1287,8 @@ namespace smt { literal_vector & bits2 = m_bits[v2]; literal bit2 = bits2[idx]; lbool val2 = ctx.get_assignment(bit2); - TRACE("bv_bit_prop", tout << "propagating #" << get_enode(v2)->get_owner_id() << "[" << idx << "] = " << val2 << "\n";); - TRACE("bv", tout << bit << " -> " << bit2 << " " << val << " -> " << val2 << " " << ctx.get_scope_level() << "\n";); + TRACE(bv_bit_prop, tout << "propagating #" << get_enode(v2)->get_owner_id() << "[" << idx << "] = " << val2 << "\n";); + TRACE(bv, tout << bit << " -> " << bit2 << " " << val << " -> " << val2 << " " << ctx.get_scope_level() << "\n";); if (bit == ~bit2) { add_new_diseq_axiom(v, v2, idx); @@ -1302,7 +1302,7 @@ namespace smt { } assign_bit(consequent, v, v2, idx, antecedent, false); if (ctx.inconsistent()) { - TRACE("bv", tout << "inconsistent " << bit << " " << bit2 << "\n";); + TRACE(bv, tout << "inconsistent " << bit << " " << bit2 << "\n";); m_prop_queue.reset(); return; } @@ -1311,7 +1311,7 @@ namespace smt { } } m_prop_queue.reset(); - TRACE("bv_bit_prop", tout << "done propagating\n";); + TRACE(bv_bit_prop, tout << "done propagating\n";); } void theory_bv::assign_bit(literal consequent, theory_var v1, theory_var v2, unsigned idx, literal antecedent, bool propagate_eqc) { @@ -1320,7 +1320,7 @@ namespace smt { SASSERT(ctx.get_assignment(antecedent) == l_true); SASSERT(m_bits[v2][idx].var() == consequent.var()); SASSERT(consequent.var() != antecedent.var()); - TRACE("bv_bit_prop", tout << "assigning: " << consequent << " @ " << ctx.get_scope_level(); + TRACE(bv_bit_prop, tout << "assigning: " << consequent << " @ " << ctx.get_scope_level(); tout << " using "; ctx.display_literal(tout, antecedent); tout << " " << enode_pp(get_enode(v1), ctx) << " " << enode_pp(get_enode(v2), ctx) << " idx: " << idx << "\n"; tout << "propagate_eqc: " << propagate_eqc << "\n";); @@ -1360,14 +1360,14 @@ namespace smt { // So, we need to propagate the assignment to other bits. bool_var bv = consequent.var(); atom * a = get_bv2a(bv); - CTRACE("bv", !a, tout << ctx.literal2expr(literal(bv, false)) << "\n"); + CTRACE(bv, !a, tout << ctx.literal2expr(literal(bv, false)) << "\n"); if (!a) return; SASSERT(a->is_bit()); bit_atom * b = static_cast(a); var_pos_occ * curr = b->m_occs; while (curr) { - TRACE("assign_bit_bug", tout << "curr->m_var: v" << curr->m_var << ", curr->m_idx: " << curr->m_idx << ", v2: v" << v2 << ", idx: " << idx << "\n"; + TRACE(assign_bit_bug, tout << "curr->m_var: v" << curr->m_var << ", curr->m_idx: " << curr->m_idx << ", v2: v" << v2 << ", idx: " << idx << "\n"; tout << "find(curr->m_var): v" << find(curr->m_var) << ", find(v2): v" << find(v2) << "\n"; tout << "is bit of #" << get_enode(curr->m_var)->get_owner_id() << "\n"; ); @@ -1381,8 +1381,8 @@ namespace smt { } void theory_bv::relevant_eh(app * n) { - TRACE("arith", tout << "relevant: #" << n->get_id() << " " << ctx.e_internalized(n) << ": " << mk_bounded_pp(n, m) << "\n";); - TRACE("bv", tout << "relevant: #" << n->get_id() << " " << ctx.e_internalized(n) << ": " << mk_pp(n, m) << "\n";); + TRACE(arith, tout << "relevant: #" << n->get_id() << " " << ctx.e_internalized(n) << ": " << mk_bounded_pp(n, m) << "\n";); + TRACE(bv, tout << "relevant: #" << n->get_id() << " " << ctx.e_internalized(n) << ": " << mk_pp(n, m) << "\n";); if (m.is_bool(n)) { bool_var v = ctx.get_bool_var(n); atom * a = get_bv2a(v); @@ -1415,7 +1415,7 @@ namespace smt { theory_var v = e->get_th_var(get_id()); if (v != null_theory_var) { literal_vector & bits = m_bits[v]; - TRACE("bv", tout << "mark bits relevant: " << bits.size() << ": " << bits << "\n";); + TRACE(bv, tout << "mark bits relevant: " << bits.size() << ": " << bits << "\n";); SASSERT(!is_bv(v) || bits.size() == get_bv_size(v)); for (literal lit : bits) { ctx.mark_as_relevant(lit); @@ -1446,7 +1446,7 @@ namespace smt { m_diseq_watch_trail.shrink(old_trail_sz); m_diseq_watch_lim.shrink(m_diseq_watch_lim.size()-num_scopes); theory::pop_scope_eh(num_scopes); - TRACE("bv_verbose", m_find.display(tout << ctx.get_scope_level() << " - " + TRACE(bv_verbose, m_find.display(tout << ctx.get_scope_level() << " - " << num_scopes << " = " << (ctx.get_scope_level() - num_scopes) << "\n");); } @@ -1503,17 +1503,17 @@ namespace smt { void theory_bv::merge_eh(theory_var r1, theory_var r2, theory_var v1, theory_var v2) { - TRACE("bv", tout << "merging: v" << v1 << " #" << get_enode(v1)->get_owner_id() << " v" << v2 << " #" << get_enode(v2)->get_owner_id() << "\n";); - TRACE("bv_bit_prop", tout << "merging: #" << get_enode(v1)->get_owner_id() << " #" << get_enode(v2)->get_owner_id() << "\n";); + TRACE(bv, tout << "merging: v" << v1 << " #" << get_enode(v1)->get_owner_id() << " v" << v2 << " #" << get_enode(v2)->get_owner_id() << "\n";); + TRACE(bv_bit_prop, tout << "merging: #" << get_enode(v1)->get_owner_id() << " #" << get_enode(v2)->get_owner_id() << "\n";); if (!merge_zero_one_bits(r1, r2)) { - TRACE("bv", tout << "conflict detected\n";); + TRACE(bv, tout << "conflict detected\n";); return; // conflict was detected } m_prop_queue.reset(); SASSERT(m_bits[v1].size() == m_bits[v2].size()); unsigned sz = m_bits[v1].size(); bool changed = true; - TRACE("bv", tout << "bits size: " << sz << "\n";); + TRACE(bv, tout << "bits size: " << sz << "\n";); if (sz == 0 && !m_bv2int.empty()) { // int2bv(bv2int(x)) = x when int2bv(bv2int(x)) has same sort as x enode* n1 = get_enode(r1); @@ -1568,7 +1568,7 @@ namespace smt { } lbool val1 = ctx.get_assignment(bit1); lbool val2 = ctx.get_assignment(bit2); - TRACE("bv", tout << "merge v" << v1 << " " << bit1 << ":= " << val1 << " " << bit2 << ":= " << val2 << "\n";); + TRACE(bv, tout << "merge v" << v1 << " " << bit1 << ":= " << val1 << " " << bit2 << ":= " << val2 << "\n";); if (val1 == l_undef && !ctx.is_relevant(bit1)) ctx.mark_as_relevant(bit1); if (val2 == l_undef && !ctx.is_relevant(bit2)) @@ -1577,7 +1577,7 @@ namespace smt { continue; changed = true; if (val1 != l_undef && val2 != l_undef) { - TRACE("bv", tout << "inconsistent "; display_var(tout, v1); display_var(tout, v2); tout << "idx: " << idx << "\n";); + TRACE(bv, tout << "inconsistent "; display_var(tout, v1); display_var(tout, v2); tout << "idx: " << idx << "\n";); } if (val1 != l_undef && bit2 != false_literal && bit2 != true_literal) { literal antecedent = bit1; @@ -1793,7 +1793,7 @@ namespace smt { void theory_bv::initialize_value(expr* var, expr* value) { rational val; unsigned sz; - TRACE("bv", tout << "initializing " << mk_pp(var, m) << " := " << mk_pp(value, m) << "\n"); + TRACE(bv, tout << "initializing " << mk_pp(var, m) << " := " << mk_pp(value, m) << "\n"); if (!m_util.is_numeral(value, val, sz)) { IF_VERBOSE(5, verbose_stream() << "value should be a bit-vector " << mk_pp(value, m) << "\n"); return; @@ -1934,7 +1934,7 @@ namespace smt { literal bit2 = bits2[i]; lbool val1 = ctx.get_assignment(bit1); lbool val2 = ctx.get_assignment(bit2); - CTRACE("bv_bug", val1 != val2, + CTRACE(bv_bug, val1 != val2, tout << "equivalence class is inconsistent, i: " << i << "\n"; display_var(tout, v1); display_var(tout, v2); diff --git a/src/smt/theory_char.cpp b/src/smt/theory_char.cpp index dc41dfec5..a5a52b4b2 100644 --- a/src/smt/theory_char.cpp +++ b/src/smt/theory_char.cpp @@ -307,7 +307,7 @@ namespace smt { * 2. Assign values to characters that haven't been assigned. */ bool theory_char::final_check() { - TRACE("seq", tout << "final check " << get_num_vars() << "\n";); + TRACE(seq, tout << "final check " << get_num_vars() << "\n";); m_var2value.reset(); m_var2value.resize(get_num_vars(), UINT_MAX); m_value2var.reset(); @@ -318,7 +318,7 @@ namespace smt { for (unsigned v = get_num_vars(); v-- > 0; ) { expr* e = get_expr(v); if (seq.is_char(e) && m_var2value[v] == UINT_MAX && get_char_value(v, c)) { - CTRACE("seq_verbose", seq.is_char(e), tout << mk_pp(e, m) << " root: " << get_enode(v)->is_root() << " is_value: " << get_char_value(v, c) << "\n";); + CTRACE(seq_verbose, seq.is_char(e), tout << mk_pp(e, m) << " root: " << get_enode(v)->is_root() << " is_value: " << get_char_value(v, c) << "\n";); enode* r = get_enode(v)->get_root(); m_value2var.reserve(c + 1, null_theory_var); theory_var u = m_value2var[c]; @@ -358,7 +358,7 @@ namespace smt { return false; } } - TRACE("seq", tout << "fresh: " << mk_pp(e, m) << " := " << c << "\n";); + TRACE(seq, tout << "fresh: " << mk_pp(e, m) << " := " << c << "\n";); for (enode* n : *get_enode(v)) m_var2value[n->get_th_var(get_id())] = c; m_value2var.reserve(c + 1, null_theory_var); @@ -370,7 +370,7 @@ namespace smt { } void theory_char::enforce_bits() { - TRACE("seq", tout << "enforce bits\n";); + TRACE(seq, tout << "enforce bits\n";); for (unsigned v = get_num_vars(); v-- > 0; ) { expr* e = get_expr(v); if (seq.is_char(e) && get_enode(v)->is_root() && !has_bits(v)) @@ -379,7 +379,7 @@ namespace smt { } void theory_char::enforce_value_bound(theory_var v) { - TRACE("seq", tout << "enforce bound " << v << "\n";); + TRACE(seq, tout << "enforce bound " << v << "\n";); enode* n = ensure_enode(seq.mk_char(seq.max_char())); theory_var w = n->get_th_var(get_id()); SASSERT(has_bits(w)); @@ -395,7 +395,7 @@ namespace smt { void theory_char::enforce_ackerman(theory_var v, theory_var w) { if (v > w) std::swap(v, w); - TRACE("seq", tout << "enforce ackerman " << v << " " << w << "\n";); + TRACE(seq, tout << "enforce ackerman " << v << " " << w << "\n";); literal eq = mk_literal(m.mk_eq(get_expr(v), get_expr(w))); ctx.mark_as_relevant(eq); literal_vector lits; diff --git a/src/smt/theory_datatype.cpp b/src/smt/theory_datatype.cpp index 3302199a2..d541781ea 100644 --- a/src/smt/theory_datatype.cpp +++ b/src/smt/theory_datatype.cpp @@ -109,7 +109,7 @@ namespace smt { } else { ctx.internalize(rhs, false); - TRACE("datatype", tout << "adding axiom:\n" << pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n";); + TRACE(datatype, tout << "adding axiom:\n" << pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n";); if (antecedent == null_literal) { ctx.assign_eq(lhs, ctx.get_enode(rhs), eq_justification::mk_axiom()); } @@ -124,9 +124,9 @@ namespace smt { SASSERT(ctx.get_assignment(antecedent) == l_true); enode * _rhs = ctx.get_enode(rhs); justification * js = ctx.mk_justification(dt_eq_justification(get_id(), ctx, antecedent, lhs, _rhs)); - TRACE("datatype", tout << "assigning... #" << lhs->get_owner_id() << " #" << _rhs->get_owner_id() << "\n"; + TRACE(datatype, tout << "assigning... #" << lhs->get_owner_id() << " #" << _rhs->get_owner_id() << "\n"; tout << "v" << lhs->get_th_var(get_id()) << " v" << _rhs->get_th_var(get_id()) << "\n";); - TRACE("datatype_detail", display(tout);); + TRACE(datatype_detail, display(tout);); ctx.assign_eq(lhs, _rhs, eq_justification(js)); } } @@ -138,7 +138,7 @@ namespace smt { */ void theory_datatype::assert_is_constructor_axiom(enode * n, func_decl * c, literal antecedent) { app* e = n->get_expr(); - TRACE("datatype_bug", tout << "creating axiom (= n (c (acc_1 n) ... (acc_m n))) for\n" + TRACE(datatype_bug, tout << "creating axiom (= n (c (acc_1 n) ... (acc_m n))) for\n" << mk_pp(c, m) << " " << mk_pp(e, m) << "\n";); m_stats.m_assert_cnstr++; SASSERT(m_util.is_constructor(c)); @@ -201,7 +201,7 @@ namespace smt { SASSERT(is_recognizer(r)); SASSERT(m_util.get_recognizer_constructor(r->get_decl()) == c->get_decl()); SASSERT(c->get_root() == r->get_arg(0)->get_root()); - TRACE("recognizer_conflict", + TRACE(recognizer_conflict, tout << mk_ismt2_pp(c->get_expr(), m) << "\n" << mk_ismt2_pp(r->get_expr(), m) << "\n";); literal l(ctx.enode2bool_var(r)); SASSERT(ctx.get_assignment(l) == l_false); @@ -289,13 +289,13 @@ namespace smt { } bool theory_datatype::internalize_atom(app * atom, bool gate_ctx) { - TRACE("datatype", tout << "internalizing atom:\n" << mk_pp(atom, m) << "\n";); + TRACE(datatype, tout << "internalizing atom:\n" << mk_pp(atom, m) << "\n";); return internalize_term(atom); } bool theory_datatype::internalize_term(app * term) { force_push(); - TRACE("datatype", tout << "internalizing term:\n" << mk_pp(term, m) << "\n";); + TRACE(datatype, tout << "internalizing term:\n" << mk_pp(term, m) << "\n";); unsigned num_args = term->get_num_args(); for (unsigned i = 0; i < num_args; i++) ctx.internalize(term->get_arg(i), m.is_bool(term) && has_quantifiers(term)); @@ -382,8 +382,8 @@ namespace smt { // (assert (> (len a) 1) // // If the theory variable is not created for 'a', then a wrong model will be generated. - TRACE("datatype", tout << "apply_sort_cnstr: #" << n->get_owner_id() << " " << pp(n, m) << "\n";); - TRACE("datatype_bug", + TRACE(datatype, tout << "apply_sort_cnstr: #" << n->get_owner_id() << " " << pp(n, m) << "\n";); + TRACE(datatype_bug, tout << "apply_sort_cnstr:\n" << pp(n, m) << " "; tout << m_util.is_datatype(s) << " "; if (m_util.is_datatype(s)) tout << "is-infinite: " << s->is_infinite() << " "; @@ -416,7 +416,7 @@ namespace smt { enode * n = ctx.bool_var2enode(v); if (!is_recognizer(n)) return; - TRACE("datatype", tout << "assigning recognizer: #" << n->get_owner_id() << " is_true: " << is_true << "\n" + TRACE(datatype, tout << "assigning recognizer: #" << n->get_owner_id() << " is_true: " << is_true << "\n" << enode_pp(n, ctx) << "\n";); SASSERT(n->get_num_args() == 1); enode * arg = n->get_arg(0); @@ -446,7 +446,7 @@ namespace smt { void theory_datatype::relevant_eh(app * n) { force_push(); - TRACE("datatype", tout << "relevant_eh: " << mk_pp(n, m) << "\n";); + TRACE(datatype, tout << "relevant_eh: " << mk_pp(n, m) << "\n";); SASSERT(ctx.relevancy()); if (is_recognizer(n)) { SASSERT(ctx.e_internalized(n)); @@ -562,7 +562,7 @@ namespace smt { // explain the cycle root -> ... -> app -> root void theory_datatype::occurs_check_explain(enode * app, enode * root) { - TRACE("datatype", tout << "occurs_check_explain " << mk_bounded_pp(app->get_expr(), m) << " <-> " << mk_bounded_pp(root->get_expr(), m) << "\n";); + TRACE(datatype, tout << "occurs_check_explain " << mk_bounded_pp(app->get_expr(), m) << " <-> " << mk_bounded_pp(root->get_expr(), m) << "\n";); // first: explain that root=v, given that app=cstor(...,v,...) @@ -581,7 +581,7 @@ namespace smt { m_used_eqs.push_back(enode_pair(app, root)); } - TRACE("datatype", + TRACE(datatype, tout << "occurs_check\n"; for (enode_pair const& p : m_used_eqs) tout << enode_eq_pp(p, ctx); @@ -700,7 +700,7 @@ namespace smt { a3 = cons(v3, a1) */ bool theory_datatype::occurs_check(enode * n) { - TRACE("datatype_verbose", tout << "occurs check: " << enode_pp(n, ctx) << "\n";); + TRACE(datatype_verbose, tout << "occurs check: " << enode_pp(n, ctx) << "\n";); m_stats.m_occurs_check++; bool res = false; @@ -715,7 +715,7 @@ namespace smt { if (oc_cycle_free(app)) continue; - TRACE("datatype_verbose", tout << "occurs check loop: " << enode_pp(app, ctx) << (op==ENTER?" enter":" exit")<< "\n";); + TRACE(datatype_verbose, tout << "occurs check loop: " << enode_pp(app, ctx) << (op==ENTER?" enter":" exit")<< "\n";); switch (op) { case ENTER: @@ -839,7 +839,7 @@ namespace smt { datatype_value_proc * result = alloc(datatype_value_proc, c_decl); for (enode* arg : enode::args(d->m_constructor)) result->add_dependency(arg); - TRACE("datatype", + TRACE(datatype, tout << pp(n, m) << "\n"; tout << "depends on\n"; for (enode* arg : enode::args(d->m_constructor)) @@ -850,7 +850,7 @@ namespace smt { void theory_datatype::merge_eh(theory_var v1, theory_var v2, theory_var, theory_var) { // v1 is the new root - TRACE("datatype", tout << "merging v" << v1 << " v" << v2 << "\n";); + TRACE(datatype, tout << "merging v" << v1 << " v" << v2 << "\n";); SASSERT(v1 == static_cast(m_find.find(v1))); var_data * d1 = m_var_data[v1]; var_data * d2 = m_var_data[v2]; @@ -896,7 +896,7 @@ namespace smt { unsigned c_idx = m_util.get_recognizer_constructor_idx(recognizer->get_decl()); if (d->m_recognizers[c_idx] == nullptr) { lbool val = ctx.get_assignment(recognizer); - TRACE("datatype", tout << "adding recognizer to v" << v << " rec: #" << recognizer->get_owner_id() << " val: " << val << "\n";); + TRACE(datatype, tout << "adding recognizer to v" << v << " rec: #" << recognizer->get_owner_id() << " val: " << val << "\n";); if (val == l_true) { // do nothing... // If recognizer assignment was already processed, then @@ -938,7 +938,7 @@ namespace smt { SASSERT(w != null_theory_var); add_recognizer(w, recognizer); } - CTRACE("datatype", d->m_recognizers.empty(), ctx.display(tout);); + CTRACE(datatype, d->m_recognizers.empty(), ctx.display(tout);); SASSERT(!d->m_recognizers.empty()); literal_vector lits; enode_pair_vector eqs; @@ -964,11 +964,11 @@ namespace smt { unassigned_idx = idx; num_unassigned++; } - TRACE("datatype", tout << "propagate " << num_unassigned << " eqs: " << eqs.size() << "\n";); + TRACE(datatype, tout << "propagate " << num_unassigned << " eqs: " << eqs.size() << "\n";); if (num_unassigned == 0) { // conflict SASSERT(!lits.empty()); - TRACE("datatype_conflict", tout << mk_ismt2_pp(recognizer->get_expr(), m) << "\n"; + TRACE(datatype_conflict, tout << mk_ismt2_pp(recognizer->get_expr(), m) << "\n"; for (literal l : lits) ctx.display_detailed_literal(tout, l) << "\n"; for (auto const& p : eqs) @@ -1019,7 +1019,7 @@ namespace smt { func_decl * r = nullptr; m_stats.m_splits++; - TRACE("datatype_bug", tout << "non_rec_c: " << non_rec_c->get_name() << " #rec: " << d->m_recognizers.size() << "\n";); + TRACE(datatype_bug, tout << "non_rec_c: " << non_rec_c->get_name() << " #rec: " << d->m_recognizers.size() << "\n";); if (d->m_recognizers.empty()) { r = m_util.get_constructor_is(non_rec_c); @@ -1063,7 +1063,7 @@ namespace smt { } SASSERT(r != nullptr); app_ref r_app(m.mk_app(r, n->get_expr()), m); - TRACE("datatype", tout << "creating split: " << mk_pp(r_app, m) << "\n";); + TRACE(datatype, tout << "creating split: " << mk_pp(r_app, m) << "\n";); ctx.internalize(r_app, false); bool_var bv = ctx.get_bool_var(r_app); ctx.set_true_first_flag(bv); diff --git a/src/smt/theory_dense_diff_logic_def.h b/src/smt/theory_dense_diff_logic_def.h index 8f69c9489..96ac78d99 100644 --- a/src/smt/theory_dense_diff_logic_def.h +++ b/src/smt/theory_dense_diff_logic_def.h @@ -123,7 +123,7 @@ namespace smt { template void theory_dense_diff_logic::found_non_diff_logic_expr(expr * n) { if (!m_non_diff_logic_exprs) { - TRACE("non_diff_logic", tout << "found non diff logic expression:\n" << mk_pp(n, m) << "\n";); + TRACE(non_diff_logic, tout << "found non diff logic expression:\n" << mk_pp(n, m) << "\n";); ctx.push_trail(value_trail(m_non_diff_logic_exprs)); IF_VERBOSE(0, verbose_stream() << "(smt.diff_logic: non-diff logic expression " << mk_pp(n, m) << ")\n";); m_non_diff_logic_exprs = true; @@ -136,7 +136,7 @@ namespace smt { found_non_diff_logic_expr(n); // little hack... TODO: change to no_memory and return l_undef if SAT return false; } - TRACE("ddl", tout << "internalizing atom:\n" << mk_pp(n, m) << "\n";); + TRACE(ddl, tout << "internalizing atom:\n" << mk_pp(n, m) << "\n";); SASSERT(!ctx.b_internalized(n)); SASSERT(m_autil.is_le(n) || m_autil.is_ge(n)); theory_var source, target; @@ -167,15 +167,15 @@ namespace smt { s = mk_zero_for(t); } else { - TRACE("ddl", tout << "failed to internalize:\n" << mk_pp(n, m) << "\n";); + TRACE(ddl, tout << "failed to internalize:\n" << mk_pp(n, m) << "\n";); found_non_diff_logic_expr(n); return false; } - TRACE("arith", tout << expr_ref(lhs, m) << " " << expr_ref(s, m) << " " << expr_ref(t, m) << "\n";); + TRACE(arith, tout << expr_ref(lhs, m) << " " << expr_ref(s, m) << " " << expr_ref(t, m) << "\n";); source = internalize_term_core(s); target = internalize_term_core(t); if (source == null_theory_var || target == null_theory_var) { - TRACE("ddl", tout << "failed to internalize:\n" << mk_pp(n, m) << "\n";); + TRACE(ddl, tout << "failed to internalize:\n" << mk_pp(n, m) << "\n";); found_non_diff_logic_expr(n); return false; } @@ -192,7 +192,7 @@ namespace smt { m_bv2atoms.setx(bv, a, 0); m_matrix[source][target].m_occs.push_back(a); m_matrix[target][source].m_occs.push_back(a); - TRACE("ddl", tout << "succeeded internalizing:\n" << mk_pp(n, m) << "\n";); + TRACE(ddl, tout << "succeeded internalizing:\n" << mk_pp(n, m) << "\n";); return true; } @@ -212,9 +212,9 @@ namespace smt { found_non_diff_logic_expr(term); // little hack... TODO: change to no_memory and return l_undef if SAT return false; } - TRACE("ddl", tout << "internalizing term: " << mk_pp(term, m) << "\n";); + TRACE(ddl, tout << "internalizing term: " << mk_pp(term, m) << "\n";); theory_var v = internalize_term_core(term); - TRACE("ddl", tout << mk_pp(term, m) << "\ninternalization result: " << (v != null_theory_var) << "\n";); + TRACE(ddl, tout << mk_pp(term, m) << "\ninternalization result: " << (v != null_theory_var) << "\n";); if (v == null_theory_var) found_non_diff_logic_expr(term); return v != null_theory_var; @@ -222,7 +222,7 @@ namespace smt { template void theory_dense_diff_logic::internalize_eq_eh(app * atom, bool_var v) { - TRACE("ddl", tout << "eq-eh: " << mk_pp(atom, m) << "\n";); + TRACE(ddl, tout << "eq-eh: " << mk_pp(atom, m) << "\n";); if (memory::above_high_watermark()) return; app * lhs = to_app(atom->get_arg(0)); @@ -255,7 +255,7 @@ namespace smt { template void theory_dense_diff_logic::assign_eh(bool_var v, bool is_true) { if (ctx.has_th_justification(v, get_id())) { - TRACE("ddl", tout << "ignoring atom propagated by the theory.\n";); + TRACE(ddl, tout << "ignoring atom propagated by the theory.\n";); return; } atom * a = m_bv2atoms.get(v, 0); @@ -268,7 +268,7 @@ namespace smt { theory_var s = a->get_source(); theory_var t = a->get_target(); numeral k = a->get_offset(); - TRACE("assign_profile", tout << "#" << get_enode(s)->get_owner_id() << " #" << get_enode(t)->get_owner_id() << " " << k << "\n";); + TRACE(assign_profile, tout << "#" << get_enode(s)->get_owner_id() << " #" << get_enode(t)->get_owner_id() << " " << k << "\n";); if (l.sign()) { k.neg(); k -= get_epsilon(s); @@ -277,7 +277,7 @@ namespace smt { else { add_edge(s, t, k, l); } - TRACE("ddl_detail", display(tout);); + TRACE(ddl_detail, display(tout);); } template @@ -345,11 +345,11 @@ namespace smt { while (it != begin) { --it; atom * a = *it; - TRACE("del_atoms", tout << "deleting: p" << a->get_bool_var() << "\n";); + TRACE(del_atoms, tout << "deleting: p" << a->get_bool_var() << "\n";); m_bv2atoms[a->get_bool_var()] = 0; theory_var s = a->get_source(); theory_var t = a->get_target(); - TRACE("del_atoms", tout << "m_matrix.size() " << m_matrix.size() << + TRACE(del_atoms, tout << "m_matrix.size() " << m_matrix.size() << ", m_matrix[s].size() " << m_matrix[s].size() << ", m_matrix[t].size(): " << m_matrix[t].size() << ", t: " << t << ", s: " << s << "\n";); @@ -435,8 +435,8 @@ namespace smt { */ template void theory_dense_diff_logic::get_antecedents(theory_var source, theory_var target, literal_vector & result) { - TRACE("ddl", tout << "get_antecedents, source: #" << get_enode(source)->get_owner_id() << ", target: #" << get_enode(target)->get_owner_id() << "\n";); - CTRACE("ddl", !is_connected(source, target), display(tout);); + TRACE(ddl, tout << "get_antecedents, source: #" << get_enode(source)->get_owner_id() << ", target: #" << get_enode(target)->get_owner_id() << "\n";); + CTRACE(ddl, !is_connected(source, target), display(tout);); SASSERT(is_connected(source, target)); svector & todo = m_tmp_pairs; todo.reset(); @@ -488,7 +488,7 @@ namespace smt { new_dist = k; new_dist += it->m_distance; cell & s_x = m_matrix[s][x]; - TRACE("ddl", + TRACE(ddl, tout << "s: #" << get_enode(s)->get_owner_id() << " x: #" << get_enode(x)->get_owner_id() << " new_dist: " << new_dist << "\n"; tout << "already has edge: " << s_x.m_edge_id << " old dist: " << s_x.m_distance << "\n";); if (s_x.m_edge_id == null_edge_id || new_dist < s_x.m_distance) { @@ -557,7 +557,7 @@ namespace smt { SASSERT(a->get_target() == target); if (c.m_distance <= a->get_offset()) { m_stats.m_num_propagations++; - TRACE("ddl", tout << "asserting atom to true: "; display_atom(tout, a); + TRACE(ddl, tout << "asserting atom to true: "; display_atom(tout, a); tout << "distance(#" << get_enode(source)->get_owner_id() << ", #" << get_enode(target)->get_owner_id() << "): " << c.m_distance << "\n";); assign_literal(literal(a->get_bool_var(), false), source, target); @@ -568,7 +568,7 @@ namespace smt { SASSERT(a->get_target() == source); if (neg_dist > a->get_offset()) { m_stats.m_num_propagations++; - TRACE("ddl", tout << "asserting atom to true: "; display_atom(tout, a); + TRACE(ddl, tout << "asserting atom to true: "; display_atom(tout, a); tout << "distance(#" << get_enode(source)->get_owner_id() << ", #" << get_enode(target)->get_owner_id() << "): " << c.m_distance << "\n";); assign_literal(literal(a->get_bool_var(), true), source, target); @@ -580,11 +580,11 @@ namespace smt { template inline void theory_dense_diff_logic::add_edge(theory_var source, theory_var target, numeral const & offset, literal l) { - TRACE("ddl", tout << "trying adding edge: #" << get_enode(source)->get_owner_id() << " -- " << offset << " --> #" << get_enode(target)->get_owner_id() << "\n";); + TRACE(ddl, tout << "trying adding edge: #" << get_enode(source)->get_owner_id() << " -- " << offset << " --> #" << get_enode(target)->get_owner_id() << "\n";); cell & c_inv = m_matrix[target][source]; if (c_inv.m_edge_id != null_edge_id && - c_inv.m_distance > offset) { // conflict detected. - TRACE("ddl", tout << "conflict detected: #" << get_enode(source)->get_owner_id() << " #" << get_enode(target)->get_owner_id() << + TRACE(ddl, tout << "conflict detected: #" << get_enode(source)->get_owner_id() << " #" << get_enode(target)->get_owner_id() << " offset: " << offset << ", c_inv.m_edge_id: " << c_inv.m_edge_id << ", c_inv.m_distance: " << c_inv.m_distance << "\n";); literal_vector & antecedents = m_tmp_literals; antecedents.reset(); @@ -598,7 +598,7 @@ namespace smt { cell & c = m_matrix[source][target]; if (c.m_edge_id == null_edge_id || offset < c.m_distance) { - TRACE("ddl", tout << "adding edge: #" << get_enode(source)->get_owner_id() << " -- " << offset << " --> #" << get_enode(target)->get_owner_id() << "\n";); + TRACE(ddl, tout << "adding edge: #" << get_enode(source)->get_owner_id() << " -- " << offset << " --> #" << get_enode(target)->get_owner_id() << "\n";); m_edges.push_back(edge(source, target, offset, l)); update_cells(); } @@ -636,7 +636,7 @@ namespace smt { k += e.m_offset; k += get_distance(t, j); if (c.m_distance != k) { - CTRACE("ddl", c.m_distance != k, tout << "i: " << i << " j: " << j << " k: " << k << " c.m_distance: " << c.m_distance << "\n"; + CTRACE(ddl, c.m_distance != k, tout << "i: " << i << " j: " << j << " k: " << k << " c.m_distance: " << c.m_distance << "\n"; display(tout);); SASSERT(c.m_distance == k); } @@ -718,7 +718,7 @@ namespace smt { } for (int i = 0; i < num_vars; i++) m_assignment[i].neg(); - TRACE("ddl_model", + TRACE(ddl_model, tout << "ddl model\n"; for (theory_var v = 0; v < num_vars; v++) { tout << "#" << mk_pp(get_enode(v)->get_expr(), m) << " = " << m_assignment[v] << "\n"; @@ -762,7 +762,7 @@ namespace smt { template void theory_dense_diff_logic::compute_epsilon() { m_epsilon = rational(1, 2); - TRACE("ddl", display(tout);); + TRACE(ddl, display(tout);); typename edges::const_iterator it = m_edges.begin(); typename edges::const_iterator end = m_edges.end(); // first edge is null @@ -777,7 +777,7 @@ namespace smt { rational k_y = m_assignment[e.m_source].get_infinitesimal().to_rational(); rational n_c = e.m_offset.get_rational().to_rational(); rational k_c = e.m_offset.get_infinitesimal().to_rational(); - TRACE("ddl", + TRACE(ddl, tout << e.m_source << " - " << e.m_target << " <= " << e.m_offset << "\n"; tout << "(n_x,k_x): " << n_x << ", " << k_x << ", (n_y,k_y): " << n_y << ", " << k_y << @@ -785,7 +785,7 @@ namespace smt { if (n_x < n_y + n_c && k_x > k_y + k_c) { rational new_epsilon = (n_y + n_c - n_x) / (2*(k_x - k_y - k_c)); if (new_epsilon < m_epsilon) { - TRACE("ddl", tout << "new epsilon: " << new_epsilon << "\n";); + TRACE(ddl, tout << "new epsilon: " << new_epsilon << "\n";); m_epsilon = new_epsilon; } } @@ -810,7 +810,7 @@ namespace smt { SASSERT(m_assignment[v].is_zero()); } } - TRACE("ddl_model", + TRACE(ddl_model, tout << "ddl model\n"; for (theory_var v = 0; v < num_vars; v++) { tout << "#" << mk_pp(get_enode(v)->get_expr(), m) << " = " << m_assignment[v] << "\n"; @@ -981,7 +981,7 @@ namespace smt { vars.push_back(w); Simplex::row row = S.add_row(w, vars.size(), vars.data(), coeffs.data()); - TRACE("opt", S.display(tout); display(tout);); + TRACE(opt, S.display(tout); display(tout);); // optimize lbool is_sat = S.make_feasible(); @@ -989,7 +989,7 @@ namespace smt { blocker = m.mk_false(); return inf_eps::infinity(); } - TRACE("opt", S.display(tout); ); + TRACE(opt, S.display(tout); ); SASSERT(is_sat != l_false); lbool is_fin = S.minimize(w); @@ -999,7 +999,7 @@ namespace smt { case l_true: { simplex::mpq_ext::eps_numeral const& val = S.get_value(w); inf_rational r(-rational(val.first), -rational(val.second)); - TRACE("opt", tout << r << " " << "\n"; + TRACE(opt, tout << r << " " << "\n"; S.display_row(tout, row, true);); Simplex::row_iterator it = S.row_begin(row), end = S.row_end(row); expr_ref_vector& core = m_objective_assignments[v]; @@ -1015,7 +1015,7 @@ namespace smt { core.push_back(tmp); } } - TRACE("opt", tout << core << "\n";); + TRACE(opt, tout << core << "\n";); } for (unsigned i = 0; i < num_nodes; ++i) { mpq_inf const& val = S.get_value(i); @@ -1031,7 +1031,7 @@ namespace smt { return inf_eps(rational(0), r); } default: - TRACE("opt", tout << "unbounded\n"; ); + TRACE(opt, tout << "unbounded\n"; ); blocker = m.mk_false(); return inf_eps::infinity(); } @@ -1039,7 +1039,7 @@ namespace smt { template theory_var theory_dense_diff_logic::add_objective(app* term) { - TRACE("opt", tout << mk_pp(term, m) << "\n";); + TRACE(opt, tout << mk_pp(term, m) << "\n";); objective_term objective; theory_var result = m_objectives.size(); rational q(1), r(0); @@ -1073,7 +1073,7 @@ namespace smt { expr_ref theory_dense_diff_logic::mk_ineq(theory_var v, inf_eps const& val, bool is_strict) { objective_term const& t = m_objectives[v]; expr_ref e(m), f(m), f2(m); - TRACE("opt", tout << "mk_ineq " << v << " " << val << "\n";); + TRACE(opt, tout << "mk_ineq " << v << " " << val << "\n";); if (t.size() == 1 && t[0].second.is_one()) { f = get_enode(t[0].first)->get_expr(); } @@ -1097,7 +1097,7 @@ namespace smt { if (is_strict) { f = m.mk_not(f); } - TRACE("arith", tout << "block: " << f << "\n";); + TRACE(arith, tout << "block: " << f << "\n";); return f; } diff --git a/src/smt/theory_diff_logic_def.h b/src/smt/theory_diff_logic_def.h index 807eb6cb6..18ac30fbc 100644 --- a/src/smt/theory_diff_logic_def.h +++ b/src/smt/theory_diff_logic_def.h @@ -90,9 +90,9 @@ bool theory_diff_logic::internalize_term(app * term) { if (!m_consistent) return false; bool result = null_theory_var != mk_term(term); - CTRACE("arith", !result, tout << "Did not internalize " << mk_pp(term, m) << "\n";); + CTRACE(arith, !result, tout << "Did not internalize " << mk_pp(term, m) << "\n";); if (!result) { - TRACE("non_diff_logic", tout << "Terms may not be internalized\n";); + TRACE(non_diff_logic, tout << "Terms may not be internalized\n";); found_non_diff_logic_expr(term); } return result; @@ -169,7 +169,7 @@ public: template void theory_diff_logic::found_non_diff_logic_expr(expr * n) { if (!m_non_diff_logic_exprs) { - TRACE("non_diff_logic", tout << "found non diff logic expression:\n" << mk_pp(n, m) << "\n";); + TRACE(non_diff_logic, tout << "found non diff logic expression:\n" << mk_pp(n, m) << "\n";); IF_VERBOSE(0, verbose_stream() << "(smt.diff_logic: non-diff logic expression " << mk_pp(n, m) << ")\n";); ctx.push_trail(value_trail(m_non_diff_logic_exprs)); m_non_diff_logic_exprs = true; @@ -277,7 +277,7 @@ bool theory_diff_logic::internalize_atom(app * n, bool gate_ctx) { m_atoms.push_back(a); m_bool_var2atom.insert(bv, a); - TRACE("arith", + TRACE(arith, tout << mk_pp(n, m) << "\n"; m_graph.display_edge(tout << "pos: ", pos); m_graph.display_edge(tout << "neg: ", neg); @@ -288,7 +288,7 @@ bool theory_diff_logic::internalize_atom(app * n, bool gate_ctx) { template void theory_diff_logic::internalize_eq_eh(app * atom, bool_var v) { - TRACE("arith", tout << mk_pp(atom, m) << "\n";); + TRACE(arith, tout << mk_pp(atom, m) << "\n";); app * lhs = to_app(atom->get_arg(0)); app * rhs = to_app(atom->get_arg(1)); app * s; @@ -335,7 +335,7 @@ void theory_diff_logic::collect_statistics(::statistics & st) const { template void theory_diff_logic::push_scope_eh() { - TRACE("arith", tout << "push\n";); + TRACE(arith, tout << "push\n";); theory::push_scope_eh(); m_graph.push(); m_scopes.push_back(scope()); @@ -347,7 +347,7 @@ void theory_diff_logic::push_scope_eh() { template void theory_diff_logic::pop_scope_eh(unsigned num_scopes) { - TRACE("arith", tout << "pop " << num_scopes << "\n";); + TRACE(arith, tout << "pop " << num_scopes << "\n";); unsigned lvl = m_scopes.size(); SASSERT(num_scopes <= lvl); unsigned new_lvl = lvl - num_scopes; @@ -358,7 +358,7 @@ void theory_diff_logic::pop_scope_eh(unsigned num_scopes) { m_scopes.shrink(new_lvl); unsigned num_edges = m_graph.get_num_edges(); m_graph.pop(num_scopes); - CTRACE("arith", !m_graph.is_feasible_dbg(), m_graph.display(tout);); + CTRACE(arith, !m_graph.is_feasible_dbg(), m_graph.display(tout);); if (num_edges != m_graph.get_num_edges() && m_num_simplex_edges > 0) { m_S.reset(); m_num_simplex_edges = 0; @@ -375,7 +375,7 @@ final_check_status theory_diff_logic::final_check_eh() { return FC_CONTINUE; } - TRACE("arith_final", display(tout); ); + TRACE(arith_final, display(tout); ); if (!is_consistent()) return FC_CONTINUE; SASSERT(is_consistent()); @@ -388,7 +388,7 @@ final_check_status theory_diff_logic::final_check_eh() { if (fid != get_family_id() && fid != m.get_basic_family_id() && !is_uninterp_const(n->get_expr())) { - TRACE("arith", tout << mk_pp(n->get_expr(), m) << "\n";); + TRACE(arith, tout << mk_pp(n->get_expr(), m) << "\n";); return FC_GIVEUP; } } @@ -518,11 +518,11 @@ void theory_diff_logic::propagate() { if (m_num_propagation_calls * (m_stats.m_num_conflicts + 1) > m_params.m_arith_adaptive_propagation_threshold * ctx.m_stats.m_num_conflicts) { m_num_propagation_calls = 1; - TRACE("arith_prop", tout << "propagating: " << m_num_propagation_calls << "\n";); + TRACE(arith_prop, tout << "propagating: " << m_num_propagation_calls << "\n";); propagate_core(); } else { - TRACE("arith_prop", tout << "skipping propagation " << m_num_propagation_calls << "\n";); + TRACE(arith_prop, tout << "skipping propagation " << m_num_propagation_calls << "\n";); } break; } @@ -536,7 +536,7 @@ void theory_diff_logic::propagate() { } ++m_num_propagation_calls; bool do_propagate = (m_num_propagation_calls * m_agility > m_params.m_arith_adaptive_propagation_threshold); - TRACE("arith_prop", tout << (do_propagate?"propagating: ":"skipping ") + TRACE(arith_prop, tout << (do_propagate?"propagating: ":"skipping ") << " " << m_num_propagation_calls << " agility: " << m_agility << "\n";); if (do_propagate) { @@ -578,13 +578,13 @@ void theory_diff_logic::propagate_core() { template bool theory_diff_logic::propagate_atom(atom* a) { - TRACE("arith", a->display(*this, tout); tout << "\n";); + TRACE(arith, a->display(*this, tout); tout << "\n";); if (ctx.inconsistent()) { return false; } int edge_id = a->get_asserted_edge(); if (!m_graph.enable_edge(edge_id)) { - TRACE("arith", display(tout);); + TRACE(arith, display(tout);); set_neg_cycle_conflict(); return false; @@ -599,7 +599,7 @@ void theory_diff_logic::new_edge(dl_var src, dl_var dst, unsigned num_edges return; } - TRACE("dl_activity", tout << "\n";); + TRACE(dl_activity, tout << "\n";); numeral w(0); for (unsigned i = 0; i < num_edges; ++i) { @@ -648,7 +648,7 @@ void theory_diff_logic::new_edge(dl_var src, dl_var dst, unsigned num_edges } lits.push_back(lit); - TRACE("dl_activity", + TRACE(dl_activity, tout << mk_pp(le, m) << "\n"; tout << "edge: " << a->get_pos() << "\n"; ctx.display_literals_verbose(tout, lits.size(), lits.data()); @@ -667,7 +667,7 @@ void theory_diff_logic::new_edge(dl_var src, dl_var dst, unsigned num_edges ctx.mk_clause(lits.size(), lits.data(), js, CLS_TH_LEMMA, nullptr); #if 0 - TRACE("arith", + TRACE(arith, tout << "shortcut:\n"; for (unsigned i = 0; i < num_edges; ++i) { edge_id e = edges[i]; @@ -698,7 +698,7 @@ void theory_diff_logic::set_neg_cycle_conflict() { m_graph.traverse_neg_cycle2(m_params.m_arith_stronger_lemmas, m_nc_functor); inc_conflicts(); literal_vector const& lits = m_nc_functor.get_lits(); - TRACE("arith_conflict", + TRACE(arith_conflict, tout << "conflict: "; for (literal lit : lits) ctx.display_literal_info(tout, lit); tout << "\n";); @@ -746,7 +746,7 @@ theory_var theory_diff_logic::mk_term(app* n) { theory_var source, target; enode* e; - TRACE("arith", tout << mk_pp(n, m) << "\n";); + TRACE(arith, tout << mk_pp(n, m) << "\n";); rational r; if (m_util.is_numeral(n, r)) { @@ -809,7 +809,7 @@ theory_var theory_diff_logic::mk_num(app* n, rational const& r) { template theory_var theory_diff_logic::mk_var(enode* n) { theory_var v = theory::mk_var(n); - TRACE("diff_logic_vars", tout << "mk_var: " << v << "\n";); + TRACE(diff_logic_vars, tout << "mk_var: " << v << "\n";); m_graph.init_var(v); ctx.attach_th_var(n, this, v); set_sort(n->get_expr()); @@ -849,10 +849,10 @@ theory_var theory_diff_logic::mk_var(app* n) { v = mk_var(e); } if (is_interpreted(n)) { - TRACE("non_diff_logic", tout << "Variable should not be interpreted\n";); + TRACE(non_diff_logic, tout << "Variable should not be interpreted\n";); found_non_diff_logic_expr(n); } - TRACE("arith", tout << mk_pp(n, m) << " |-> " << v << "\n";); + TRACE(arith, tout << mk_pp(n, m) << " |-> " << v << "\n";); return v; } @@ -902,12 +902,12 @@ void theory_diff_logic::compute_delta() { rational k_y = m_graph.get_assignment(src).get_infinitesimal().to_rational(); rational n_c = w.get_rational().to_rational(); rational k_c = w.get_infinitesimal().to_rational(); - TRACE("arith", tout << "(n_x,k_x): " << n_x << ", " << k_x << ", (n_y,k_y): " + TRACE(arith, tout << "(n_x,k_x): " << n_x << ", " << k_x << ", (n_y,k_y): " << n_y << ", " << k_y << ", (n_c,k_c): " << n_c << ", " << k_c << "\n";); if (n_x < n_y + n_c && k_x > k_y + k_c) { rational new_delta = (n_y + n_c - n_x) / (2*(k_x - k_y - k_c)); if (new_delta < m_delta) { - TRACE("arith", tout << "new delta: " << new_delta << "\n";); + TRACE(arith, tout << "new delta: " << new_delta << "\n";); m_delta = new_delta; } } @@ -933,7 +933,7 @@ model_value_proc * theory_diff_logic::mk_value(enode * n, model_generator & numeral val = m_graph.get_assignment(v); num = val.get_rational().to_rational() + m_delta * val.get_infinitesimal().to_rational(); } - TRACE("arith", tout << mk_pp(n->get_expr(), m) << " |-> " << num << "\n";); + TRACE(arith, tout << mk_pp(n->get_expr(), m) << " |-> " << num << "\n";); bool is_int = m_util.is_int(n->get_expr()); if (is_int && !num.is_int()) throw default_exception("difference logic solver was used on mixed int/real problem"); @@ -1036,7 +1036,7 @@ void theory_diff_logic::new_eq_or_diseq(bool is_eq, theory_var v1, theory_v log_axiom_instantiation(body); } - TRACE("diff_logic", + TRACE(diff_logic, tout << v1 << " .. " << v2 << "\n"; tout << mk_pp(eq.get(), m) <<"\n";); @@ -1233,12 +1233,12 @@ theory_diff_logic::maximize(theory_var v, expr_ref& blocker, bool& has_shar has_shared = false; Simplex& S = m_S; - CTRACE("arith",!m_graph.is_feasible_dbg(), m_graph.display(tout);); + CTRACE(arith,!m_graph.is_feasible_dbg(), m_graph.display(tout);); SASSERT(m_graph.is_feasible_dbg()); update_simplex(S); - TRACE("arith", + TRACE(arith, objective_term const& objective = m_objectives[v]; for (auto const& o : objective) { tout << "Coefficient " << o.second @@ -1247,7 +1247,7 @@ theory_diff_logic::maximize(theory_var v, expr_ref& blocker, bool& has_shar tout << "Free coefficient " << m_objective_consts[v] << "\n"; ); - TRACE("opt", + TRACE(opt, S.display(tout); for (unsigned i = 0; i < m_graph.get_num_nodes(); ++i) tout << "$" << i << ": " << node2simplex(i) << "\n"; @@ -1260,7 +1260,7 @@ theory_diff_logic::maximize(theory_var v, expr_ref& blocker, bool& has_shar blocker = m.mk_false(); return inf_eps::infinity(); } - TRACE("opt", S.display(tout); ); + TRACE(opt, S.display(tout); ); SASSERT(is_sat != l_false); unsigned w = obj2simplex(v); lbool is_fin = S.minimize(w); @@ -1285,7 +1285,7 @@ theory_diff_logic::maximize(theory_var v, expr_ref& blocker, bool& has_shar } } ensure_rational_solution(S); - TRACE("opt", tout << r << " " << "\n"; + TRACE(opt, tout << r << " " << "\n"; S.display_row(tout, row, true); S.display(tout); ); @@ -1297,14 +1297,14 @@ theory_diff_logic::maximize(theory_var v, expr_ref& blocker, bool& has_shar rational r = rational(val.first); m_graph.set_assignment(i, numeral(r)); } - CTRACE("arith",!m_graph.is_feasible_dbg(), m_graph.display(tout);); + CTRACE(arith,!m_graph.is_feasible_dbg(), m_graph.display(tout);); SASSERT(m_graph.is_feasible_dbg()); inf_eps r1(rational(0), r); blocker = mk_gt(v, r1); return inf_eps(rational(0), r + m_objective_consts[v]); } default: - TRACE("opt", tout << "unbounded\n"; ); + TRACE(opt, tout << "unbounded\n"; ); blocker = m.mk_false(); return inf_eps::infinity(); } @@ -1445,7 +1445,7 @@ theory* theory_diff_logic::mk_fresh(context* new_ctx) { template void theory_diff_logic::init_zero() { if (m_izero != null_theory_var) return; - TRACE("arith", tout << "init zero\n";); + TRACE(arith, tout << "init zero\n";); app* zero; enode* e; zero = m_util.mk_numeral(rational(0), true); diff --git a/src/smt/theory_dl.cpp b/src/smt/theory_dl.cpp index 794874927..822f7b0e7 100644 --- a/src/smt/theory_dl.cpp +++ b/src/smt/theory_dl.cpp @@ -96,7 +96,7 @@ namespace smt { else { result = m_th.u().mk_numeral(0, s); } - TRACE("theory_dl", tout << mk_pp(result, m_th.m()) << "\n";); + TRACE(theory_dl, tout << mk_pp(result, m_th.m()) << "\n";); return result; } }; @@ -114,7 +114,7 @@ namespace smt { char const * get_name() const override { return "datalog"; } bool internalize_atom(app * atom, bool gate_ctx) override { - TRACE("theory_dl", tout << mk_pp(atom, m()) << "\n";); + TRACE(theory_dl, tout << mk_pp(atom, m()) << "\n";); if (ctx.b_internalized(atom)) { return true; } @@ -136,7 +136,7 @@ namespace smt { } bool internalize_term(app * term) override { - TRACE("theory_dl", tout << mk_pp(term, m()) << "\n";); + TRACE(theory_dl, tout << mk_pp(term, m()) << "\n";); if (u().is_finite_sort(term)) { return mk_rep(term); } @@ -229,7 +229,7 @@ namespace smt { if (is_attached_to_var(e)) { return false; } - TRACE("theory_dl", tout << mk_pp(n, m()) << "\n";); + TRACE(theory_dl, tout << mk_pp(n, m()) << "\n";); theory_var var = mk_var(e); ctx.attach_th_var(e, this, var); return true; @@ -272,7 +272,7 @@ namespace smt { } void assert_cnstr(expr* e) { - TRACE("theory_dl", tout << mk_pp(e, m()) << "\n";); + TRACE(theory_dl, tout << mk_pp(e, m()) << "\n";); if (m().has_trace_stream()) log_axiom_instantiation(e); ctx.internalize(e, false); if (m().has_trace_stream()) m().trace_stream() << "[end-of-instance]\n"; diff --git a/src/smt/theory_fpa.cpp b/src/smt/theory_fpa.cpp index fb31a61ed..f7be2be55 100644 --- a/src/smt/theory_fpa.cpp +++ b/src/smt/theory_fpa.cpp @@ -61,7 +61,7 @@ namespace smt { } app * theory_fpa::fpa_value_proc::mk_value(model_generator & mg, expr_ref_vector const & values) { - TRACE("t_fpa_detail", + TRACE(t_fpa_detail, ast_manager & m = m_th.get_manager(); for (unsigned i = 0; i < values.size(); i++) tout << "value[" << i << "] = " << mk_ismt2_pp(values[i], m) << std::endl;); @@ -126,7 +126,7 @@ namespace smt { mpfm.set(f, m_ebits, m_sbits, mpzm.is_one(sgn_z), mpzm.get_int64(exp_u), sig_z); result = m_fu.mk_value(f); - TRACE("t_fpa", tout << "result: [" << + TRACE(t_fpa, tout << "result: [" << mpzm.to_string(sgn_z) << "," << mpzm.to_string(exp_z) << "," << mpzm.to_string(sig_z) << "] --> " << @@ -138,7 +138,7 @@ namespace smt { app * theory_fpa::fpa_rm_value_proc::mk_value(model_generator & mg, expr_ref_vector const & values) { SASSERT(values.size() == 1); - TRACE("t_fpa_detail", + TRACE(t_fpa_detail, ast_manager & m = m_th.get_manager(); for (unsigned i = 0; i < values.size(); i++) tout << "value[" << i << "] = " << mk_ismt2_pp(values[i], m) << std::endl;); @@ -160,7 +160,7 @@ namespace smt { default: result = m_fu.mk_round_toward_zero(); } - TRACE("t_fpa", tout << "result: " << mk_ismt2_pp(result, m_th.get_manager()) << std::endl;); + TRACE(t_fpa, tout << "result: " << mk_ismt2_pp(result, m_th.get_manager()) << std::endl;); return result; } @@ -170,18 +170,18 @@ namespace smt { { expr_ref res(m); expr * ccnv; - TRACE("t_fpa", tout << "converting " << mk_ismt2_pp(e, m) << std::endl;); + TRACE(t_fpa, tout << "converting " << mk_ismt2_pp(e, m) << std::endl;); if (m_conversions.find(e, ccnv)) { res = ccnv; - TRACE("t_fpa_detail", tout << "cached:" << std::endl; + TRACE(t_fpa_detail, tout << "cached:" << std::endl; tout << mk_ismt2_pp(e, m) << std::endl << " -> " << std::endl << mk_ismt2_pp(res, m) << std::endl;); } else { res = m_rw.convert(m_th_rw, e); - TRACE("t_fpa_detail", tout << "converted; caching:" << std::endl; + TRACE(t_fpa_detail, tout << "converted; caching:" << std::endl; tout << mk_ismt2_pp(e, m) << std::endl << " -> " << std::endl << mk_ismt2_pp(res, m) << std::endl;); @@ -210,14 +210,14 @@ namespace smt { m_th_rw(res); - CTRACE("t_fpa", !m.is_true(res), tout << "side condition: " << mk_ismt2_pp(res, m) << std::endl;); + CTRACE(t_fpa, !m.is_true(res), tout << "side condition: " << mk_ismt2_pp(res, m) << std::endl;); return res; } void theory_fpa::assert_cnstr(expr * e) { expr_ref _e(e, m); if (m.is_true(e)) return; - TRACE("t_fpa_detail", tout << "asserting " << mk_ismt2_pp(e, m) << "\n";); + TRACE(t_fpa_detail, tout << "asserting " << mk_ismt2_pp(e, m) << "\n";); if (m.has_trace_stream()) log_axiom_instantiation(e); ctx.internalize(e, false); if (m.has_trace_stream()) m.trace_stream() << "[end-of-instance]\n"; @@ -229,11 +229,11 @@ namespace smt { void theory_fpa::attach_new_th_var(enode * n) { theory_var v = mk_var(n); ctx.attach_th_var(n, this, v); - TRACE("t_fpa", tout << "new theory var: " << mk_ismt2_pp(n->get_expr(), m) << " := " << v << "\n";); + TRACE(t_fpa, tout << "new theory var: " << mk_ismt2_pp(n->get_expr(), m) << " := " << v << "\n";); } bool theory_fpa::internalize_atom(app * atom, bool gate_ctx) { - TRACE("t_fpa_internalize", tout << "internalizing atom: " << mk_ismt2_pp(atom, m) << std::endl;); + TRACE(t_fpa_internalize, tout << "internalizing atom: " << mk_ismt2_pp(atom, m) << std::endl;); SASSERT(atom->get_family_id() == get_family_id()); if (ctx.b_internalized(atom)) @@ -254,7 +254,7 @@ namespace smt { } bool theory_fpa::internalize_term(app * term) { - TRACE("t_fpa_internalize", tout << "internalizing term: " << mk_ismt2_pp(term, m) << "\n";); + TRACE(t_fpa_internalize, tout << "internalizing term: " << mk_ismt2_pp(term, m) << "\n";); SASSERT(term->get_family_id() == get_family_id()); SASSERT(!ctx.e_internalized(term)); @@ -294,7 +294,7 @@ namespace smt { } void theory_fpa::apply_sort_cnstr(enode * n, sort * s) { - TRACE("t_fpa", tout << "apply sort cnstr for: " << mk_ismt2_pp(n->get_expr(), m) << "\n";); + TRACE(t_fpa, tout << "apply sort cnstr for: " << mk_ismt2_pp(n->get_expr(), m) << "\n";); SASSERT(s->get_family_id() == get_family_id()); SASSERT(m_fpa_util.is_float(s) || m_fpa_util.is_rm(s)); SASSERT(m_fpa_util.is_float(n->get_expr()) || m_fpa_util.is_rm(n->get_expr())); @@ -325,7 +325,7 @@ namespace smt { enode * e_x = get_enode(x); enode * e_y = get_enode(y); - TRACE("t_fpa", tout << "new eq: " << x << " = " << y << std::endl; + TRACE(t_fpa, tout << "new eq: " << x << " = " << y << std::endl; tout << mk_ismt2_pp(e_x->get_expr(), m) << std::endl << " = " << std::endl << mk_ismt2_pp(e_y->get_expr(), m) << std::endl;); @@ -340,7 +340,7 @@ namespace smt { expr_ref xc = convert(xe); expr_ref yc = convert(ye); - TRACE("t_fpa_detail", tout << "xc = " << mk_ismt2_pp(xc, m) << std::endl << + TRACE(t_fpa_detail, tout << "xc = " << mk_ismt2_pp(xc, m) << std::endl << "yc = " << mk_ismt2_pp(yc, m) << std::endl;); expr_ref c(m); @@ -364,7 +364,7 @@ namespace smt { enode * e_x = get_enode(x); enode * e_y = get_enode(y); - TRACE("t_fpa", tout << "new diseq: " << x << " != " << y << std::endl; + TRACE(t_fpa, tout << "new diseq: " << x << " != " << y << std::endl; tout << mk_ismt2_pp(e_x->get_expr(), m) << std::endl << " != " << std::endl << mk_ismt2_pp(e_y->get_expr(), m) << std::endl;); @@ -413,14 +413,14 @@ namespace smt { void theory_fpa::pop_scope_eh(unsigned num_scopes) { m_trail_stack.pop_scope(num_scopes); - TRACE("t_fpa", tout << "pop " << num_scopes << "; now " << m_trail_stack.get_num_scopes() << "\n";); + TRACE(t_fpa, tout << "pop " << num_scopes << "; now " << m_trail_stack.get_num_scopes() << "\n";); theory::pop_scope_eh(num_scopes); } void theory_fpa::assign_eh(bool_var v, bool is_true) { expr * e = ctx.bool_var2expr(v); - TRACE("t_fpa", tout << "assign_eh for: " << v << " (" << is_true << "):\n" << mk_ismt2_pp(e, m) << "\n";); + TRACE(t_fpa, tout << "assign_eh for: " << v << " (" << is_true << "):\n" << mk_ismt2_pp(e, m) << "\n";); expr_ref converted = convert(e); converted = m.mk_and(converted, mk_side_conditions()); @@ -432,7 +432,7 @@ namespace smt { } void theory_fpa::relevant_eh(app * n) { - TRACE("t_fpa", tout << "relevant_eh for: " << mk_ismt2_pp(n, m) << "\n";); + TRACE(t_fpa, tout << "relevant_eh for: " << mk_ismt2_pp(n, m) << "\n";); mpf_manager & mpfm = m_fpa_util.fm(); @@ -465,7 +465,7 @@ namespace smt { else { expr_ref wu(m); wu = m.mk_eq(m_converter.unwrap(wrapped, n->get_sort()), n); - TRACE("t_fpa", tout << "w/u eq: " << std::endl << mk_ismt2_pp(wu, m) << std::endl;); + TRACE(t_fpa, tout << "w/u eq: " << std::endl << mk_ismt2_pp(wu, m) << std::endl;); assert_cnstr(wu); } } @@ -486,7 +486,7 @@ namespace smt { } void theory_fpa::reset_eh() { - TRACE("t_fpa", tout << "reset_eh\n";); + TRACE(t_fpa, tout << "reset_eh\n";); pop_scope_eh(m_trail_stack.get_num_scopes()); m_converter.reset(); m_rw.reset(); @@ -502,13 +502,13 @@ namespace smt { } final_check_status theory_fpa::final_check_eh() { - TRACE("t_fpa", tout << "final_check_eh\n";); + TRACE(t_fpa, tout << "final_check_eh\n";); SASSERT(m_converter.m_extra_assertions.empty()); return FC_DONE; } void theory_fpa::init_model(model_generator & mg) { - TRACE("t_fpa", tout << "initializing model" << std::endl; display(tout);); + TRACE(t_fpa, tout << "initializing model" << std::endl; display(tout);); m_factory = alloc(fpa_value_factory, m, get_family_id()); mg.register_factory(m_factory); } @@ -537,7 +537,7 @@ namespace smt { } model_value_proc * theory_fpa::mk_value(enode * n, model_generator & mg) { - TRACE("t_fpa", tout << "mk_value for: " << mk_ismt2_pp(n->get_expr(), m) << + TRACE(t_fpa, tout << "mk_value for: " << mk_ismt2_pp(n->get_expr(), m) << " (sort " << mk_ismt2_pp(n->get_expr()->get_sort(), m) << ")\n";); app_ref owner(m); @@ -557,7 +557,7 @@ namespace smt { wrapped = m_converter.wrap(owner); SASSERT(m_bv_util.is_bv(wrapped)); - CTRACE("t_fpa_detail", !ctx.e_internalized(wrapped), + CTRACE(t_fpa_detail, !ctx.e_internalized(wrapped), tout << "Model dependency not internalized: " << mk_ismt2_pp(wrapped, m) << " (owner " << (!ctx.e_internalized(owner) ? "not" : "is") << @@ -575,7 +575,7 @@ namespace smt { vp->add_dependency(ctx.get_enode(a0)); vp->add_dependency(ctx.get_enode(a1)); vp->add_dependency(ctx.get_enode(a2)); - TRACE("t_fpa_detail", tout << "Depends on: " << + TRACE(t_fpa_detail, tout << "Depends on: " << mk_ismt2_pp(a0, m) << " eq. cls. #" << get_enode(a0)->get_root()->get_expr()->get_id() << std::endl << mk_ismt2_pp(a1, m) << " eq. cls. #" << get_enode(a1)->get_root()->get_expr()->get_id() << std::endl << mk_ismt2_pp(a2, m) << " eq. cls. #" << get_enode(a2)->get_root()->get_expr()->get_id() << std::endl;); @@ -587,7 +587,7 @@ namespace smt { a0 = to_app(owner->get_arg(0)); fpa_rm_value_proc * vp = alloc(fpa_rm_value_proc, this); vp->add_dependency(ctx.get_enode(a0)); - TRACE("t_fpa_detail", tout << "Depends on: " << + TRACE(t_fpa_detail, tout << "Depends on: " << mk_ismt2_pp(a0, m) << " eq. cls. #" << get_enode(a0)->get_root()->get_expr()->get_id() << std::endl;); res = vp; } @@ -603,7 +603,7 @@ namespace smt { fpa_value_proc * vp = alloc(fpa_value_proc, this, ebits, sbits); enode * en = ctx.get_enode(wrapped); vp->add_dependency(en); - TRACE("t_fpa_detail", tout << "Depends on: " << mk_ismt2_pp(wrapped, m) << " eq. cls. #" << en->get_root()->get_expr()->get_id() << std::endl;); + TRACE(t_fpa_detail, tout << "Depends on: " << mk_ismt2_pp(wrapped, m) << " eq. cls. #" << en->get_root()->get_expr()->get_id() << std::endl;); res = vp; } } diff --git a/src/smt/theory_lra.cpp b/src/smt/theory_lra.cpp index 4bec5e833..1e4414afe 100644 --- a/src/smt/theory_lra.cpp +++ b/src/smt/theory_lra.cpp @@ -242,7 +242,7 @@ class theory_lra::imp { lp().push(); add_def_constraint_and_equality(var, lp::GE, rational(c)); add_def_constraint_and_equality(var, lp::LE, rational(c)); - TRACE("arith", tout << "add " << cnst << ", var = " << var << "\n";); + TRACE(arith, tout << "add " << cnst << ", var = " << var << "\n";); return var; } @@ -272,13 +272,13 @@ class theory_lra::imp { void found_unsupported(expr* n) { ctx().push_trail(push_back_vector>(m_not_handled)); - TRACE("arith", tout << "unsupported " << mk_pp(n, m) << "\n"); + TRACE(arith, tout << "unsupported " << mk_pp(n, m) << "\n"); m_not_handled.push_back(n); } void found_underspecified(expr* n) { if (a.is_underspecified(n)) { - TRACE("arith", tout << "Unhandled: " << mk_pp(n, m) << "\n";); + TRACE(arith, tout << "Unhandled: " << mk_pp(n, m) << "\n";); ctx().push_trail(push_back_vector>(m_underspecified)); m_underspecified.push_back(to_app(n)); } @@ -559,7 +559,7 @@ class theory_lra::imp { theory_var v = mk_var(n); vars.push_back(register_theory_var_in_lar_solver(v)); } - TRACE("arith", tout << "v" << v << " := " << bpp(t) << "\n" << vars << "\n";); + TRACE(arith, tout << "v" << v << " := " << bpp(t) << "\n" << vars << "\n";); m_solver->register_existing_terms(); ensure_nla(); m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.data()); @@ -568,7 +568,7 @@ class theory_lra::imp { } enode * mk_enode(app * n) { - TRACE("arith_verbose", tout << bpp(n) << " internalized: " << ctx().e_internalized(n) << "\n";); + TRACE(arith_verbose, tout << bpp(n) << " internalized: " << ctx().e_internalized(n) << "\n";); if (reflect(n)) for (expr* arg : *n) if (!ctx().e_internalized(arg)) @@ -588,12 +588,12 @@ class theory_lra::imp { void mk_clause(literal l1, literal l2, unsigned num_params, parameter * params) { - TRACE("arith", literal lits[2]; lits[0] = l1; lits[1] = l2; ctx().display_literals_verbose(tout, 2, lits); tout << "\n";); + TRACE(arith, literal lits[2]; lits[0] = l1; lits[1] = l2; ctx().display_literals_verbose(tout, 2, lits); tout << "\n";); ctx().mk_th_axiom(get_id(), l1, l2, num_params, params); } void mk_clause(literal l1, literal l2, literal l3, unsigned num_params, parameter * params) { - TRACE("arith", literal lits[3]; lits[0] = l1; lits[1] = l2; lits[2] = l3; ctx().display_literals_smt2(tout, 3, lits); tout << "\n";); + TRACE(arith, literal lits[3]; lits[0] = l1; lits[1] = l2; lits[2] = l3; ctx().display_literals_smt2(tout, 3, lits); tout << "\n";); ctx().mk_th_axiom(get_id(), l1, l2, l3, num_params, params); } @@ -734,7 +734,7 @@ class theory_lra::imp { } void updt_unassigned_bounds(theory_var v, int inc) { - TRACE("arith_verbose", tout << "v" << v << " " << m_unassigned_bounds[v] << " += " << inc << "\n";); + TRACE(arith_verbose, tout << "v" << v << " " << m_unassigned_bounds[v] << " += " << inc << "\n";); ctx().push_trail(vector_value_trail(m_unassigned_bounds, v)); m_unassigned_bounds[v] += inc; } @@ -745,7 +745,7 @@ class theory_lra::imp { theory_var internalize_def(app* term, scoped_internalize_state& st) { - TRACE("arith", tout << expr_ref(term, m) << "\n";); + TRACE(arith, tout << expr_ref(term, m) << "\n";); if (ctx().e_internalized(term)) { IF_VERBOSE(0, verbose_stream() << "repeated term\n";); return mk_var(term); @@ -787,7 +787,7 @@ class theory_lra::imp { theory_var internalize_linearized_def(app* term, scoped_internalize_state& st) { theory_var v = mk_var(term); - TRACE("arith_internalize", tout << "v" << v << " " << bpp(term) << "\n";); + TRACE(arith_internalize, tout << "v" << v << " " << bpp(term) << "\n";); if (is_unit_var(st) && v == st.vars()[0]) return st.vars()[0]; @@ -804,7 +804,7 @@ class theory_lra::imp { else { vi = lp().add_term(m_left_side, v); SASSERT(lp().column_has_term(vi)); - TRACE("arith_verbose", + TRACE(arith_verbose, tout << "v" << v << " := " << mk_pp(term, m) << " slack: " << vi << " scopes: " << m_scopes.size() << "\n"; lp().print_term(lp().get_term(vi), tout) << "\n";); @@ -884,7 +884,7 @@ public: } bool internalize_atom(app * atom, bool gate_ctx) { - TRACE("arith_internalize", tout << bpp(atom) << "\n";); + TRACE(arith_internalize, tout << bpp(atom) << "\n";); SASSERT(!ctx().b_internalized(atom)); expr* n1, *n2; rational r; @@ -914,7 +914,7 @@ public: return true; } else { - TRACE("arith", tout << "Could not internalize " << mk_pp(atom, m) << "\n";); + TRACE(arith, tout << "Could not internalize " << mk_pp(atom, m) << "\n";); found_unsupported(atom); return true; } @@ -928,7 +928,7 @@ public: m_bounds_trail.push_back(v); m_bool_var2bound.insert(bv, b); mk_bound_axioms(*b); - TRACE("arith_internalize", tout << "Internalized " << bv << ": " << bpp(atom) << "\n";); + TRACE(arith_internalize, tout << "Internalized " << bv << ": " << bpp(atom) << "\n";); return true; } @@ -959,7 +959,7 @@ public: } void assign_eh(bool_var v, bool is_true) { - TRACE("arith", tout << "assign p" << literal(v, !is_true) << ": " << bpp(ctx().bool_var2expr(v)) << "\n";); + TRACE(arith, tout << "assign p" << literal(v, !is_true) << ": " << bpp(ctx().bool_var2expr(v)) << "\n";); m_asserted_atoms.push_back(delayed_atom(v, is_true)); } @@ -996,7 +996,7 @@ public: } void new_eq_eh(theory_var v1, theory_var v2) { - TRACE("arith", tout << "eq " << v1 << " == " << v2 << "\n";); + TRACE(arith, tout << "eq " << v1 << " == " << v2 << "\n";); if (!is_int(v1) && !is_real(v1)) return; m_arith_eq_adapter.new_eq_eh(v1, v2); @@ -1007,13 +1007,13 @@ public: } void new_diseq_eh(theory_var v1, theory_var v2) { - TRACE("arith", tout << "v" << v1 << " != " << "v" << v2 << "\n";); + TRACE(arith, tout << "v" << v1 << " != " << "v" << v2 << "\n";); ++m_stats.m_assert_diseq; m_arith_eq_adapter.new_diseq_eh(v1, v2); } void apply_sort_cnstr(enode* n, sort*) { - TRACE("arith", tout << "sort constraint: " << pp(n) << "\n";); + TRACE(arith, tout << "sort constraint: " << pp(n) << "\n";); #if 0 if (!th.is_attached_to_var(n)) mk_var(n->get_owner()); @@ -1045,7 +1045,7 @@ public: m_bv_to_propagate.reset(); if (m_nla) m_nla->pop(num_scopes); - TRACE("arith", tout << "num scopes: " << num_scopes << " new scope level: " << m_scopes.size() << "\n";); + TRACE(arith, tout << "num scopes: " << num_scopes << " new scope level: " << m_scopes.size() << "\n";); } void restart_eh() { @@ -1219,14 +1219,14 @@ public: add_def_constraint_and_equality(vi, lp::GE, rational::zero()); add_def_constraint_and_equality(vi, lp::LT, abs(r)); SASSERT(!is_infeasible()); - TRACE("arith", tout << term << "\n" << lp().constraints();); + TRACE(arith, tout << term << "\n" << lp().constraints();); } void mk_idiv_mod_axioms(expr * p, expr * q) { if (a.is_zero(q)) { return; } - TRACE("arith", tout << expr_ref(p, m) << " " << expr_ref(q, m) << "\n";); + TRACE(arith, tout << expr_ref(p, m) << " " << expr_ref(q, m) << "\n";); // if q is zero, then idiv and mod are uninterpreted functions. expr_ref div(a.mk_idiv(p, q), m); expr_ref mod(a.mk_mod(p, q), m); @@ -1309,7 +1309,7 @@ public: div_ge = a.mk_ge(a.mk_sub(p, a.mk_mul(q, div)), zero); ctx().get_rewriter()(div_ge); mk_axiom(eqz, mk_literal(div_ge)); - TRACE("arith", tout << eqz << " " << div_ge << "\n"); + TRACE(arith, tout << eqz << " " << div_ge << "\n"); } @@ -1413,7 +1413,7 @@ public: literal mk_literal(expr* e) { expr_ref pinned(e, m); - TRACE("mk_bool_var", tout << pinned << " " << pinned->get_id() << "\n";); + TRACE(mk_bool_var, tout << pinned << " " << pinned->get_id() << "\n";); if (!ctx().e_internalized(e)) { ctx().internalize(e, false); } @@ -1461,7 +1461,7 @@ public: if (m.inc() && m_solver.get() && th.get_num_vars() > 0) { ctx().push_trail(value_trail(m_model_is_initialized)); m_model_is_initialized = lp().init_model(); - TRACE("arith", display(tout << "update variable values " << m_model_is_initialized << "\n");); + TRACE(arith, display(tout << "update variable values " << m_model_is_initialized << "\n");); } } @@ -1498,7 +1498,7 @@ public: } } } - TRACE("arith", + TRACE(arith, for (theory_var v = 0; v < sz; ++v) if (th.is_relevant_and_shared(get_enode(v))) tout << "v" << v << " "; @@ -1513,7 +1513,7 @@ public: if (delayed_assume_eqs()) return true; - TRACE("arith_verbose", display(tout);); + TRACE(arith_verbose, display(tout);); random_update(); m_model_eqs.reset(); @@ -1555,7 +1555,7 @@ public: enode* n1 = get_enode(v1); enode* n2 = get_enode(v2); m_assume_eq_head++; - CTRACE("arith", + CTRACE(arith, is_eq(v1, v2) && n1->get_root() != n2->get_root(), tout << "assuming eq: v" << v1 << " = v" << v2 << "\n";); if (is_eq(v1, v2) && n1->get_root() != n2->get_root() && th.assume_eq(n1, n2)) { @@ -1620,7 +1620,7 @@ public: bool int_undef = false; switch (is_sat) { case l_true: - TRACE("arith", display(tout)); + TRACE(arith, display(tout)); switch (check_lia()) { case FC_DONE: @@ -1629,7 +1629,7 @@ public: return FC_CONTINUE; case FC_GIVEUP: int_undef = true; - TRACE("arith", tout << "check-lia giveup\n";); + TRACE(arith, tout << "check-lia giveup\n";); if (ctx().get_fparams().m_arith_ignore_int) st = FC_CONTINUE; break; @@ -1641,7 +1641,7 @@ public: case FC_CONTINUE: return FC_CONTINUE; case FC_GIVEUP: - TRACE("arith", tout << "check-nra giveup\n";); + TRACE(arith, tout << "check-nra giveup\n";); st = FC_GIVEUP; break; } @@ -1662,7 +1662,7 @@ public: st = FC_CONTINUE; break; case FC_GIVEUP: - TRACE("arith", tout << "give up " << mk_pp(e, m) << "\n"); + TRACE(arith, tout << "give up " << mk_pp(e, m) << "\n"); if (st != FC_CONTINUE) st = FC_GIVEUP; break; @@ -1677,13 +1677,13 @@ public: get_infeasibility_explanation_and_set_conflict(); return FC_CONTINUE; case l_undef: - TRACE("arith", tout << "check feasible is undef\n";); + TRACE(arith, tout << "check feasible is undef\n";); return m.inc() ? FC_CONTINUE : FC_GIVEUP; default: UNREACHABLE(); break; } - TRACE("arith", tout << "default giveup\n";); + TRACE(arith, tout << "default giveup\n";); return FC_GIVEUP; } @@ -1739,11 +1739,11 @@ public: rational g = gcd_reduce(coeffs); if (!g.is_one()) { if (lower_bound) { - TRACE("arith", tout << "lower: " << offset << " / " << g << " = " << offset / g << " >= " << ceil(offset / g) << "\n";); + TRACE(arith, tout << "lower: " << offset << " / " << g << " = " << offset / g << " >= " << ceil(offset / g) << "\n";); offset = ceil(offset / g); } else { - TRACE("arith", tout << "upper: " << offset << " / " << g << " = " << offset / g << " <= " << floor(offset / g) << "\n";); + TRACE(arith, tout << "upper: " << offset << " / " << g << " = " << offset / g << " <= " << floor(offset / g) << "\n";); offset = floor(offset / g); } } @@ -1754,7 +1754,7 @@ public: for (auto& kv : coeffs) kv.m_value.neg(); } - // CTRACE("arith", is_int, + // CTRACE(arith, is_int, // lp().print_term(term, tout << "term: ") << "\n"; // tout << "offset: " << offset << " gcd: " << g << "\n";); @@ -1769,7 +1769,7 @@ public: // Note: it is not safe to rewrite atom because the rewriter can // destroy structure, such as (div x 24) >= 0 becomes x >= 0 and the internal variable // corresponding to (div x 24) is not constrained. - TRACE("arith", tout << t << ": " << atom << "\n"; + TRACE(arith, tout << t << ": " << atom << "\n"; lp().print_term(term, tout << "bound atom: ") << (lower_bound?" >= ":" <= ") << k << "\n";); ctx().internalize(atom, true); ctx().mark_as_relevant(atom.get()); @@ -1883,9 +1883,9 @@ public: } final_check_status check_lia() { - TRACE("arith",); + TRACE(arith,); if (!m.inc()) { - TRACE("arith", tout << "canceled\n";); + TRACE(arith, tout << "canceled\n";); return FC_CONTINUE; } auto cr = m_lia->check(&m_explanation); @@ -1897,7 +1897,7 @@ public: break; case lp::lia_move::branch: { - TRACE("arith", tout << "branch\n";); + TRACE(arith, tout << "branch\n";); bool u = m_lia->is_upper(); auto const & k = m_lia->offset(); rational offset; @@ -1921,7 +1921,7 @@ public: case lp::lia_move::cut: { if (ctx().get_fparams().m_arith_ignore_int) return FC_GIVEUP; - TRACE("arith", tout << "cut\n";); + TRACE(arith, tout << "cut\n";); // m_explanation implies term <= k reset_evidence(); for (auto ev : m_explanation) { @@ -1935,21 +1935,21 @@ public: m.trace_stream() << "[end-of-instance]\n"; } IF_VERBOSE(4, verbose_stream() << "cut " << b << "\n"); - TRACE("arith", dump_cut_lemma(tout, m_lia->get_term(), m_lia->offset(), m_explanation, m_lia->is_upper());); + TRACE(arith, dump_cut_lemma(tout, m_lia->get_term(), m_lia->offset(), m_explanation, m_lia->is_upper());); literal lit(ctx().get_bool_var(b), false); - TRACE("arith", + TRACE(arith, ctx().display_lemma_as_smt_problem(tout << "new cut:\n", m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), lit); display(tout);); assign(lit, m_core, m_eqs, m_params); return FC_CONTINUE; } case lp::lia_move::conflict: - TRACE("arith", tout << "conflict\n";); + TRACE(arith, tout << "conflict\n";); // ex contains unsat core set_conflict(); return FC_CONTINUE; case lp::lia_move::undef: - TRACE("arith", tout << "lia undef\n";); + TRACE(arith, tout << "lia undef\n";); return FC_CONTINUE; case lp::lia_move::continue_with_check: return FC_CONTINUE; @@ -1994,7 +1994,7 @@ public: default: UNREACHABLE(); } - TRACE("arith", tout << "is_lower: " << is_lower << " pos " << pos << "\n";); + TRACE(arith, tout << "is_lower: " << is_lower << " pos " << pos << "\n";); expr_ref atom(m); // TBD utility: lp::lar_term term = mk_term(ineq.m_poly); // then term is used instead of ineq.m_term @@ -2041,10 +2041,10 @@ public: final_check_status check_nla() { if (!m.inc()) { - TRACE("arith", tout << "canceled\n";); + TRACE(arith, tout << "canceled\n";); return FC_GIVEUP; } - CTRACE("arith",!m_nla, tout << "no nla\n";); + CTRACE(arith,!m_nla, tout << "no nla\n";); if (!m_nla) return FC_DONE; if (!m_nla->need_check()) @@ -2071,7 +2071,7 @@ public: enode * n = get_enode(v); enode * r = n->get_root(); unsigned usz = m_underspecified.size(); - TRACE("shared", tout << ctx().get_scope_level() << " " << enode_pp(n, ctx()) << " " << v << " underspecified " << usz << " parents " << r->get_num_parents() << "\n";); + TRACE(shared, tout << ctx().get_scope_level() << " " << enode_pp(n, ctx()) << " " << v << " underspecified " << usz << " parents " << r->get_num_parents() << "\n";); if (r->get_num_parents() > 2*usz) { for (unsigned i = 0; i < usz; ++i) { app* u = m_underspecified[i]; @@ -2130,7 +2130,7 @@ public: auto [bv, is_true] = m_asserted_atoms[m_asserted_qhead]; api_bound* b = nullptr; - TRACE("arith", tout << "propagate: " << literal(bv, !is_true) << "\n"; + TRACE(arith, tout << "propagate: " << literal(bv, !is_true) << "\n"; if (!m_bool_var2bound.contains(bv)) tout << "not found\n"); if (m_bool_var2bound.find(bv, b) && !assert_bound(bv, is_true, *b)) { get_infeasibility_explanation_and_set_conflict(); @@ -2147,7 +2147,7 @@ public: switch(lbl) { case l_false: - TRACE("arith", tout << "propagation conflict\n";); + TRACE(arith, tout << "propagation conflict\n";); get_infeasibility_explanation_and_set_conflict(); break; case l_true: @@ -2169,7 +2169,7 @@ public: } void add_equality(lpvar j, rational const& k, lp::explanation const& exp) { - TRACE("arith", tout << "equality " << j << " " << k << "\n"); + TRACE(arith, tout << "equality " << j << " " << k << "\n"); theory_var v; if (k == 1) v = m_one_var; @@ -2264,12 +2264,12 @@ public: if (v == null_theory_var) return 0; - TRACE("arith", tout << "v" << v << " " << be.kind() << " " << be.m_bound << "\n";); + TRACE(arith, tout << "v" << v << " " << be.kind() << " " << be.m_bound << "\n";); reserve_bounds(v); if (m_unassigned_bounds[v] == 0 && !should_refine_bounds()) { - TRACE("arith", tout << "return\n";); + TRACE(arith, tout << "return\n";); return 0; } lp_bounds const& bounds = m_bounds[v]; @@ -2282,10 +2282,10 @@ public: literal lit = is_bound_implied(be.kind(), be.m_bound, *b); if (lit == null_literal) continue; - TRACE("arith", tout << lit << " bound: " << *b << " first: " << first << "\n";); + TRACE(arith, tout << lit << " bound: " << *b << " first: " << first << "\n";); ctx().display_literal_verbose(verbose_stream() << "miss ", lit) << "\n"; display(verbose_stream()); - TRACE("arith", ctx().display_literal_verbose(tout << "miss ", lit) << "\n"); + TRACE(arith, ctx().display_literal_verbose(tout << "miss ", lit) << "\n"); exit(0); ++count; @@ -2301,12 +2301,12 @@ public: if (v == null_theory_var) return 0; - TRACE("arith", tout << "v" << v << " " << be.kind() << " " << be.m_bound << "\n";); + TRACE(arith, tout << "v" << v << " " << be.kind() << " " << be.m_bound << "\n";); reserve_bounds(v); if (m_unassigned_bounds[v] == 0 && !should_refine_bounds()) { - TRACE("arith", tout << "return\n";); + TRACE(arith, tout << "return\n";); return 0; } lp_bounds const& bounds = m_bounds[v]; @@ -2319,7 +2319,7 @@ public: literal lit = is_bound_implied(be.kind(), be.m_bound, *b); if (lit == null_literal) continue; - TRACE("arith", tout << lit << " bound: " << *b << " first: " << first << "\n";); + TRACE(arith, tout << lit << " bound: " << *b << " first: " << first << "\n";); ++count; @@ -2330,9 +2330,9 @@ public: m_explanation.clear(); lp().explain_implied_bound(be, m_bp); } - CTRACE("arith", m_unassigned_bounds[v] == 0, tout << "missed bound\n";); + CTRACE(arith, m_unassigned_bounds[v] == 0, tout << "missed bound\n";); updt_unassigned_bounds(v, -1); - TRACE("arith", + TRACE(arith, ctx().display_literals_verbose(tout, m_core); tout << "\n --> "; ctx().display_literal_verbose(tout, lit); @@ -2405,7 +2405,7 @@ public: enode* n1 = get_enode(uv); enode* n2 = get_enode(vv); - TRACE("arith", tout << "add-eq " << pp(n1) << " == " << pp(n2) << "\n";); + TRACE(arith, tout << "add-eq " << pp(n1) << " == " << pp(n2) << "\n";); if (n1->get_root() == n2->get_root()) return false; expr* e1 = n1->get_expr(); @@ -2771,7 +2771,7 @@ public: void flush_bound_axioms() { - CTRACE("arith", !m_new_bounds.empty(), tout << "flush bound axioms\n";); + CTRACE(arith, !m_new_bounds.empty(), tout << "flush bound axioms\n";); while (!m_new_bounds.empty()) { lp_bounds atoms; @@ -2786,7 +2786,7 @@ public: --i; } } - CTRACE("arith", atoms.size() > 1, + CTRACE(arith, atoms.size() > 1, for (auto* a : atoms) a->display(tout) << "\n";); lp_bounds occs(m_bounds[v]); @@ -2910,7 +2910,7 @@ public: literal lit1(bv, !is_true); literal lit2 = null_literal; bool find_glb = (is_true == (k == lp_api::lower_t)); - TRACE("arith_verbose", tout << "v" << v << " find_glb: " << find_glb << " is_true: " << is_true << " k: " << k << " is_lower: " << (k == lp_api::lower_t) << "\n";); + TRACE(arith_verbose, tout << "v" << v << " find_glb: " << find_glb << " is_true: " << is_true << " k: " << k << " is_lower: " << (k == lp_api::lower_t) << "\n";); if (find_glb) { rational glb; api_bound* lb = nullptr; @@ -2949,7 +2949,7 @@ public: ++m_stats.m_bound_propagations2; reset_evidence(); m_core.push_back(lit1); - TRACE("arith", + TRACE(arith, ctx().display_literals_verbose(tout, m_core); ctx().display_literal_verbose(tout << " => ", lit2); tout << "\n";); @@ -3019,13 +3019,13 @@ public: // void propagate_bound_compound(bool_var bv, bool is_true, api_bound& b) { theory_var v = b.get_var(); - TRACE("arith", tout << pp(v) << "\n";); + TRACE(arith, tout << pp(v) << "\n";); if (static_cast(v) >= m_use_list.size()) { return; } for (auto const& vb : m_use_list[v]) { if (ctx().get_assignment(vb->get_lit()) != l_undef) { - TRACE("arith_verbose", display_bound(tout << "assigned ", *vb) << "\n";); + TRACE(arith_verbose, display_bound(tout << "assigned ", *vb) << "\n";); continue; } inf_rational r; @@ -3052,7 +3052,7 @@ public: // get_glb and get_lub set m_core, m_eqs, m_params if (lit != null_literal) { - TRACE("arith", + TRACE(arith, ctx().display_literals_verbose(tout, m_core); ctx().display_literal_verbose(tout << "\n --> ", lit) << "\n"; ); @@ -3061,7 +3061,7 @@ public: assign(lit, m_core, m_eqs, m_params); } else { - TRACE("arith_verbose", display_bound(tout << "skip ", *vb) << "\n";); + TRACE(arith_verbose, display_bound(tout << "skip ", *vb) << "\n";); } } } @@ -3113,7 +3113,7 @@ public: r += value * mono.coeff(); set_evidence(ci, m_core, m_eqs); } - TRACE("arith_verbose", tout << (is_lub?"lub":"glb") << " is " << r << "\n";); + TRACE(arith_verbose, tout << (is_lub?"lub":"glb") << " is " << r << "\n";); return true; } @@ -3129,7 +3129,7 @@ public: } bool assert_bound(bool_var bv, bool is_true, api_bound& b) { - TRACE("arith", tout << b << "\n";); + TRACE(arith, tout << b << "\n";); lp::constraint_index ci = b.get_constraint(is_true); lp().activate(ci); if (is_infeasible()) @@ -3222,7 +3222,7 @@ public: } constraint_bound& b = vec[tv]; if (b.first == UINT_MAX || (is_lower? b.second < v : b.second > v)) { - TRACE("arith", tout << "tighter bound " << tv << "\n";); + TRACE(arith, tout << "tighter bound " << tv << "\n";); m_history.push_back(vec[tv]); ctx().push_trail(history_trail(vec, tv, m_history)); b.first = ci; @@ -3264,7 +3264,7 @@ public: if (lp().column_has_term(vi)) { theory_var v = lp().local_to_external(vi); rational val; - TRACE("arith", tout << lp().get_variable_name(vi) << " " << v << "\n";); + TRACE(arith, tout << lp().get_variable_name(vi) << " " << v << "\n";); if (v != null_theory_var && a.is_numeral(get_owner(v), val) && bound == val) { dep = nullptr; return bound == val; @@ -3305,7 +3305,7 @@ public: u_dependency* ci1 = nullptr, *ci2 = nullptr, *ci3 = nullptr, *ci4 = nullptr; theory_var v1 = lp().local_to_external(vi1); theory_var v2 = lp().local_to_external(vi2); - TRACE("arith", tout << "fixed: " << pp(v1) << " " << pp(v2) << "\n";); + TRACE(arith, tout << "fixed: " << pp(v1) << " " << pp(v2) << "\n";); // we expect lp() to ensure that none of these returns happen. if (is_equal(v1, v2)) return; @@ -3337,7 +3337,7 @@ public: ext_theory_eq_propagation_justification( get_id(), ctx(), m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), x, y)); - TRACE("arith", + TRACE(arith, for (auto c : m_core) ctx().display_detailed_literal(tout << ctx().get_assign_level(c.var()) << " " << c << " ", c) << "\n"; for (auto e : m_eqs) @@ -3365,7 +3365,7 @@ public: else return; enode* y = get_enode(w); - TRACE("arith", tout << pp(x) << " == " << pp(y) << "\n"); + TRACE(arith, tout << pp(x) << " == " << pp(y) << "\n"); if (x->get_sort() != y->get_sort()) return; if (x->get_root() == y->get_root()) @@ -3377,15 +3377,15 @@ public: } lbool make_feasible() { - TRACE("pcs", tout << lp().constraints();); - TRACE("arith_verbose", tout << "before calling lp().find_feasible_solution()\n"; display(tout);); + TRACE(pcs, tout << lp().constraints();); + TRACE(arith_verbose, tout << "before calling lp().find_feasible_solution()\n"; display(tout);); auto status = lp().find_feasible_solution(); - TRACE("arith_verbose", display(tout);); + TRACE(arith_verbose, display(tout);); if (lp().is_feasible()) return l_true; if (status == lp::lp_status::INFEASIBLE) return l_false; - TRACE("arith", tout << "status treated as inconclusive: " << status << "\n";); + TRACE(arith, tout << "status treated as inconclusive: " << status << "\n";); // TENTATIVE_UNBOUNDED, UNBOUNDED, TENTATIVE_DUAL_UNBOUNDED, DUAL_UNBOUNDED, // TIME_EXAUSTED, EMPTY, UNSTABLE return l_undef; @@ -3454,7 +3454,7 @@ public: // lp().shrink_explanation_to_minimum(m_explanation); // todo, enable when perf is fixed ++m_num_conflicts; ++m_stats.m_conflicts; - TRACE("arith_conflict", + TRACE(arith_conflict, tout << "@" << ctx().get_scope_level() << (is_conflict ? " conflict":" lemma"); for (auto const& p : m_params) tout << " " << p; tout << "\n"; @@ -3486,7 +3486,7 @@ public: if (ctx().get_assignment(c) == l_true) return; } - TRACE("arith", ctx().display_literals_verbose(tout, m_core) << "\n";); + TRACE(arith, ctx().display_literals_verbose(tout, m_core) << "\n";); ctx().mk_th_axiom(get_id(), m_core.size(), m_core.data()); } } @@ -3521,7 +3521,7 @@ public: m_factory->register_value(val); } - TRACE("arith", display(tout);); + TRACE(arith, display(tout);); } nlsat::anum const& nl_value(theory_var v, scoped_anum& r) const { @@ -3532,8 +3532,8 @@ public: else { m_todo_terms.push_back({t, rational::one()}); - TRACE("nl_value", tout << "v" << v << " " << t << "\n";); - TRACE("nl_value", tout << "v" << v << " := w" << t << "\n"; + TRACE(nl_value, tout << "v" << v << " " << t << "\n";); + TRACE(nl_value, tout << "v" << v << " := w" << t << "\n"; lp().print_term(lp().get_term(t), tout) << "\n";); m_nla->am().set(r, 0); @@ -3542,7 +3542,7 @@ public: t = m_todo_terms.back().first; m_todo_terms.pop_back(); lp::lar_term const& term = lp().get_term(t); - TRACE("nl_value", lp().print_term(term, tout) << "\n";); + TRACE(nl_value, lp().print_term(term, tout) << "\n";); scoped_anum r1(m_nla->am()); rational c1(0); m_nla->am().set(r1, c1.to_mpq()); @@ -3576,7 +3576,7 @@ public: } else { rational r = get_value(v); - TRACE("arith", tout << mk_pp(o, m) << " v" << v << " := " << r << "\n";); + TRACE(arith, tout << mk_pp(o, m) << " v" << v << " := " << r << "\n";); SASSERT("integer variables should have integer values: " && (!a.is_int(o) || r.is_int() || m.limit().is_canceled())); if (a.is_int(o) && !r.is_int()) r = floor(r); return alloc(expr_wrapper_proc, m_factory->mk_value(r, o->get_sort())); @@ -3588,7 +3588,7 @@ public: if (!is_registered_var(v)) return false; lpvar vi = get_lpvar(v); if (lp().has_value(vi, val)) { - TRACE("arith", tout << expr_ref(n->get_expr(), m) << " := " << val << "\n";); + TRACE(arith, tout << expr_ref(n->get_expr(), m) << " := " << val << "\n";); if (is_int(n) && !val.is_int()) return false; return true; } @@ -3817,7 +3817,7 @@ public: cancel_eh eh(m.limit()); scoped_timer timer(1000, &eh); bool result = l_true != nctx.check(); - CTRACE("arith", !result, ctx().display_lemma_as_smt_problem(tout, m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), false_literal);); + CTRACE(arith, !result, ctx().display_lemma_as_smt_problem(tout, m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), false_literal);); return result; } @@ -3831,7 +3831,7 @@ public: cancel_eh eh(m.limit()); scoped_timer timer(1000, &eh); bool result = l_true != nctx.check(); - CTRACE("arith", !result, ctx().display_lemma_as_smt_problem(tout, m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), lit); + CTRACE(arith, !result, ctx().display_lemma_as_smt_problem(tout, m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), lit); display(tout);); return result; } @@ -3879,7 +3879,7 @@ public: lp().backup_x(); } if (!is_registered_var(v)) { - TRACE("arith", tout << "cannot get bound for v" << v << "\n";); + TRACE(arith, tout << "cannot get bound for v" << v << "\n";); st = lp::lp_status::UNBOUNDED; } else if (!m.limit().inc()) { @@ -3913,20 +3913,20 @@ public: switch (st) { case lp::lp_status::OPTIMAL: { init_variable_values(); - TRACE("arith", display(tout << st << " v" << v << " vi: " << vi << "\n");); + TRACE(arith, display(tout << st << " v" << v << " vi: " << vi << "\n");); auto val = value(v); blocker = mk_gt(v); return val; } case lp::lp_status::FEASIBLE: { auto val = value(v); - TRACE("arith", display(tout << st << " v" << v << " vi: " << vi << "\n");); + TRACE(arith, display(tout << st << " v" << v << " vi: " << vi << "\n");); blocker = mk_gt(v); return val; } default: SASSERT(st == lp::lp_status::UNBOUNDED); - TRACE("arith", display(tout << st << " v" << v << " vi: " << vi << "\n");); + TRACE(arith, display(tout << st << " v" << v << " vi: " << vi << "\n");); has_shared = false; blocker = m.mk_false(); return inf_eps(rational::one(), inf_rational()); @@ -3953,12 +3953,12 @@ public: else e = a.mk_gt(obj, e); } - TRACE("opt", tout << "v" << v << " " << val << " " << r << " " << e << "\n";); + TRACE(opt, tout << "v" << v << " " << val << " " << r << " " << e << "\n";); return e; } theory_var add_objective(app* term) { - TRACE("opt", tout << expr_ref(term, m) << "\n";); + TRACE(opt, tout << expr_ref(term, m) << "\n";); theory_var v = internalize_def(term); register_theory_var_in_lar_solver(v); return v; @@ -3969,7 +3969,7 @@ public: } void term2coeffs(lp::lar_term const& term, u_map& coeffs, rational const& coeff) { - TRACE("arith", lp().print_term(term, tout) << "\n";); + TRACE(arith, lp().print_term(term, tout) << "\n";); for (lp::lar_term::ival ti : term) { theory_var w; auto tv = ti.j(); @@ -3982,7 +3982,7 @@ public: else { w = lp().local_to_external(tv); SASSERT(w >= 0); - TRACE("arith", tout << tv << ": " << w << "\n";); + TRACE(arith, tout << tv << ": " << w << "\n";); } rational c0(0); coeffs.find(w, c0); @@ -4055,7 +4055,7 @@ public: bool is_strict = val.get_infinitesimal().is_pos(); app_ref b(m); bool is_int = a.is_int(get_enode(v)->get_expr()); - TRACE("arith", display(tout << "v" << v << "\n");); + TRACE(arith, display(tout << "v" << v << "\n");); if (is_strict) { b = a.mk_le(mk_obj(v), a.mk_numeral(r, is_int)); } @@ -4077,12 +4077,12 @@ public: m_bounds_trail.push_back(v); m_bool_var2bound.insert(bv, a); - TRACE("arith", tout << "internalized " << bv << ": " << mk_pp(b, m) << "\n";); + TRACE(arith, tout << "internalized " << bv << ": " << mk_pp(b, m) << "\n";); } if (is_strict) { b = m.mk_not(b); } - TRACE("arith", tout << b << "\n";); + TRACE(arith, tout << b << "\n";); return expr_ref(b, m); } diff --git a/src/smt/theory_pb.cpp b/src/smt/theory_pb.cpp index ed3ff0942..32670bd63 100644 --- a/src/smt/theory_pb.cpp +++ b/src/smt/theory_pb.cpp @@ -251,7 +251,7 @@ namespace smt { context& ctx = th.get_context(); unsigned sz = size(); unsigned bound = k(); - TRACE("pb", th.display(tout << "assign: " << m_lit << " " << ~alit << " " << bound << "\n", *this, true);); + TRACE(pb, th.display(tout << "assign: " << m_lit << " " << ~alit << " " << bound << "\n", *this, true);); SASSERT(0 < bound && bound < sz); SASSERT(ctx.get_assignment(alit) == l_false); @@ -273,7 +273,7 @@ namespace smt { for (unsigned i = bound + 1; i < sz; ++i) { literal lit2 = lit(i); if (ctx.get_assignment(lit2) != l_false) { - TRACE("pb", tout << "swap " << lit2 << "\n";); + TRACE(pb, tout << "swap " << lit2 << "\n";); std::swap(m_args[index], m_args[i]); th.watch_literal(lit2, this); return l_undef; @@ -282,12 +282,12 @@ namespace smt { // conflict if (bound != index && ctx.get_assignment(lit(bound)) == l_false) { - TRACE("pb", tout << "conflict " << lit(bound) << " " << alit << "\n";); + TRACE(pb, tout << "conflict " << lit(bound) << " " << alit << "\n";); set_conflict(th, alit); return l_false; } - TRACE("pb", tout << "no swap " << index << " " << alit << "\n";); + TRACE(pb, tout << "no swap " << index << " " << alit << "\n";); // there are no literals to swap with, // prepare for unit propagation by swapping the false literal into // position bound. Then literals in positions 0..bound-1 have to be @@ -548,7 +548,7 @@ namespace smt { c->prune(); c->post_prune(); - TRACE("pb", display(tout, *c); tout << " := " << lit << " " << is_true << "\n";); + TRACE(pb, display(tout, *c); tout << " := " << lit << " " << is_true << "\n";); switch (is_true) { case l_false: lit.neg(); @@ -586,7 +586,7 @@ namespace smt { init_watch(abv); m_var_infos[abv].m_ineq = c.detach(); m_ineqs_trail.push_back(abv); - TRACE("pb", display(tout, *c);); + TRACE(pb, display(tout, *c);); return true; } @@ -624,7 +624,7 @@ namespace smt { app_ref tmp(m), fml(m); tmp = pb.mk_fresh_bool(); fml = m.mk_iff(tmp, arg); - TRACE("pb", tout << "create proxy " << fml << "\n";); + TRACE(pb, tout << "create proxy " << fml << "\n";); ctx.internalize(fml, false); SASSERT(ctx.b_internalized(tmp)); bv = ctx.get_bool_var(tmp); @@ -947,7 +947,7 @@ namespace smt { } c.inc_propagations(*this); m_stats.m_num_propagations++; - TRACE("pb", tout << "#prop: " << c.num_propagations() << " - " << c.lit() << " => " << l << "\n"; + TRACE(pb, tout << "#prop: " << c.num_propagations() << " - " << c.lit() << " => " << l << "\n"; display(tout, c, true) << "\n";); SASSERT(validate_unit_propagation(c)); ctx.assign(l, ctx.mk_justification(card_justification(c, l, get_id()))); @@ -986,7 +986,7 @@ namespace smt { } final_check_status theory_pb::final_check_eh() { - TRACE("pb", display(tout);); + TRACE(pb, display(tout);); DEBUG_CODE(validate_final_check();); return FC_DONE; } @@ -995,7 +995,7 @@ namespace smt { ptr_vector* ineqs = nullptr; literal nlit(v, is_true); init_watch(v); - TRACE("pb", tout << "assign: " << ~nlit << "\n";); + TRACE(pb, tout << "assign: " << ~nlit << "\n";); ineqs = m_var_infos[v].m_lit_watch[nlit.sign()]; if (ineqs != nullptr) { for (unsigned i = 0; i < ineqs->size(); ++i) { @@ -1133,7 +1133,7 @@ namespace smt { } } - TRACE("pb", + TRACE(pb, tout << "assign: " << c.lit() << "\n"; display(tout, c); ); @@ -1245,7 +1245,7 @@ namespace smt { // } - TRACE("pb", + TRACE(pb, tout << "assign: " << literal(v,!is_true) << "\n"; display(tout, c); ); @@ -1497,7 +1497,7 @@ namespace smt { void theory_pb::add_assign(ineq& c, literal_vector const& lits, literal l) { inc_propagations(c); m_stats.m_num_propagations++; - TRACE("pb", tout << "#prop:" << c.m_num_propagations << " - " << lits; + TRACE(pb, tout << "#prop:" << c.m_num_propagations << " - " << lits; tout << " => " << l << "\n"; display(tout, c, true);); @@ -1512,7 +1512,7 @@ namespace smt { void theory_pb::add_clause(ineq& c, literal_vector const& lits) { inc_propagations(c); m_stats.m_num_conflicts++; - TRACE("pb", tout << "#prop:" << c.m_num_propagations << " - " << lits << "\n"; + TRACE(pb, tout << "#prop:" << c.m_num_propagations << " - " << lits << "\n"; display(tout, c, true);); justification* js = nullptr; if (proofs_enabled()) { @@ -1673,7 +1673,7 @@ namespace smt { */ literal theory_pb::get_asserting_literal(literal p) { unsigned lvl = 0; - TRACE("pb", tout << p << " " << ctx.get_assignment(p) << "\n";); + TRACE(pb, tout << p << " " << ctx.get_assignment(p) << "\n";); if (ctx.get_assignment(p) == l_false && get_abs_coeff(p.var()) != 0 && p == literal(p.var(), get_coeff(p.var()) < 0)) { return p; @@ -1797,7 +1797,7 @@ namespace smt { m_coeffs[v] /= static_cast(g); } m_bound = (m_bound + g - 1) / g; - TRACE("pb", display_resolved_lemma(tout << "cut\n");); + TRACE(pb, display_resolved_lemma(tout << "cut\n");); } } @@ -1807,7 +1807,7 @@ namespace smt { bool theory_pb::resolve_conflict(card& c, literal_vector const& confl) { - TRACE("pb", display(tout << "resolve conflict\n", c, true); ); + TRACE(pb, display(tout << "resolve conflict\n", c, true); ); bool_var v; m_conflict_lvl = 0; @@ -1851,7 +1851,7 @@ namespace smt { while (m_num_marks > 0) { - TRACE("pb", tout << "conseq: " << conseq << "\n"); + TRACE(pb, tout << "conseq: " << conseq << "\n"); v = conseq.var(); int offset = get_abs_coeff(v); @@ -1869,7 +1869,7 @@ namespace smt { js = ctx.get_justification(v); - TRACE("pb", + TRACE(pb, display_resolved_lemma(tout << conseq << "\n"); ctx.display(tout, js);); @@ -1889,13 +1889,13 @@ namespace smt { clause& cls = *js.get_clause(); justification* cjs = cls.get_justification(); unsigned num_lits = cls.get_num_literals(); - CTRACE("pb", cjs, tout << (typeid(smt::unit_resolution_justification) == typeid(*cjs)) << "\n"); + CTRACE(pb, cjs, tout << (typeid(smt::unit_resolution_justification) == typeid(*cjs)) << "\n"); if (cjs && typeid(smt::unit_resolution_justification) == typeid(*cjs)) { clear_marks(); return false; } else if (cjs && !is_proof_justification(*cjs)) { - TRACE("pb", tout << "not processing justification over: " << conseq << " " << typeid(*cjs).name() << "\n";); + TRACE(pb, tout << "not processing justification over: " << conseq << " " << typeid(*cjs).name() << "\n";); break; } if (cls.get_literal(0) == conseq) { @@ -1908,7 +1908,7 @@ namespace smt { for (unsigned i = 2; i < num_lits; ++i) { process_antecedent(cls.get_literal(i), offset); } - TRACE("pb", tout << literal_vector(cls.get_num_literals(), cls.begin()) << "\n";); + TRACE(pb, tout << literal_vector(cls.get_num_literals(), cls.begin()) << "\n";); break; } case b_justification::BIN_CLAUSE: @@ -1926,7 +1926,7 @@ namespace smt { pbj = dynamic_cast(j); } if (pbj == nullptr) { - TRACE("pb", tout << "skip justification for " << conseq << "\n";); + TRACE(pb, tout << "skip justification for " << conseq << "\n";); bound = 0; // this is possible when conseq is an assumption. // The justification of conseq is itself, @@ -1975,7 +1975,7 @@ namespace smt { } SASSERT(validate_lemma()); - TRACE("pb", display_resolved_lemma(tout << "done\n");); + TRACE(pb, display_resolved_lemma(tout << "done\n");); normalize_active_coeffs(); @@ -2016,7 +2016,7 @@ namespace smt { ++m_stats.m_num_resolves; SASSERT(validate_antecedents(m_antecedents)); - TRACE("pb", tout << "assign " << m_antecedents << " ==> " << alit << "\n";); + TRACE(pb, tout << "assign " << m_antecedents << " ==> " << alit << "\n";); ctx.assign(alit, ctx.mk_justification(theory_propagation_justification(get_id(), ctx, m_antecedents.size(), m_antecedents.data(), alit, 0, nullptr))); DEBUG_CODE( @@ -2082,7 +2082,7 @@ namespace smt { sum += c.coeff(i); } } - CTRACE("pb", (sum >= c.k()), + CTRACE(pb, (sum >= c.k()), display(tout << "invalid assign" , c, true); for (literal lit : lits) tout << lit << " "; tout << " => " << l << "\n";); @@ -2090,7 +2090,7 @@ namespace smt { } void theory_pb::validate_final_check() { - TRACE("pb", tout << "validate " << m_var_infos.size() << "\n";); + TRACE(pb, tout << "validate " << m_var_infos.size() << "\n";); for (auto & vi : m_var_infos) { if (vi.m_ineq) { validate_final_check(*vi.m_ineq); @@ -2103,11 +2103,11 @@ namespace smt { void theory_pb::validate_final_check(card& c) { if (ctx.get_assignment(c.lit()) == l_undef) { - TRACE("pb", display(tout << "is undef ", c, true);); + TRACE(pb, display(tout << "is undef ", c, true);); return; } if (!ctx.is_relevant(c.lit())) { - TRACE("pb", display(tout << "not relevant ", c, true);); + TRACE(pb, display(tout << "not relevant ", c, true);); return; } @@ -2123,7 +2123,7 @@ namespace smt { break; } } - TRACE("pb_verbose", display(tout << "validate: ", c, true); + TRACE(pb_verbose, display(tout << "validate: ", c, true); tout << "sum: " << sum << " " << maxsum << " "; tout << ctx.get_assignment(c.lit()) << "\n";); @@ -2135,11 +2135,11 @@ namespace smt { void theory_pb::validate_final_check(ineq& c) { if (ctx.get_assignment(c.lit()) == l_undef) { - TRACE("pb", tout << c.lit() << " is undef\n";); + TRACE(pb, tout << c.lit() << " is undef\n";); return; } if (!ctx.is_relevant(c.lit())) { - TRACE("pb", tout << c.lit() << " is not relevant\n";); + TRACE(pb, tout << c.lit() << " is not relevant\n";); return; } numeral sum = numeral::zero(), maxsum = numeral::zero(); @@ -2154,7 +2154,7 @@ namespace smt { break; } } - TRACE("pb", display(tout << "validate: ", c, true); + TRACE(pb, display(tout << "validate: ", c, true); tout << "sum: " << sum << " " << maxsum << " "; tout << ctx.get_assignment(c.lit()) << "\n"; ctx.display(tout); diff --git a/src/smt/theory_recfun.cpp b/src/smt/theory_recfun.cpp index 55cc088f4..4247dcb2a 100644 --- a/src/smt/theory_recfun.cpp +++ b/src/smt/theory_recfun.cpp @@ -24,7 +24,7 @@ Revision History: #include "smt/theory_recfun.h" -#define TRACEFN(x) TRACE("recfun", tout << x << '\n';) +#define TRACEFN(x) TRACE(recfun, tout << x << '\n';) namespace smt { @@ -48,7 +48,7 @@ namespace smt { } bool theory_recfun::internalize_atom(app * atom, bool gate_ctx) { - TRACE("recfun", tout << mk_pp(atom, m) << " " << u().has_defs() << "\n"); + TRACE(recfun, tout << mk_pp(atom, m) << " " << u().has_defs() << "\n"); if (!u().has_defs()) { // if (u().is_defined(atom)) // throw default_exception("recursive atom definition is out of scope"); diff --git a/src/smt/theory_seq.cpp b/src/smt/theory_seq.cpp index 182398e9c..b7ecb4685 100644 --- a/src/smt/theory_seq.cpp +++ b/src/smt/theory_seq.cpp @@ -307,7 +307,7 @@ void theory_seq::init() { m_max_unfolding_depth = ctx.get_fparams().m_seq_min_unfolding; } -#define TRACEFIN(s) { TRACE("seq", tout << ">>" << s << "\n";); IF_VERBOSE(20, verbose_stream() << s << "\n"); } +#define TRACEFIN(s) { TRACE(seq, tout << ">>" << s << "\n";); IF_VERBOSE(20, verbose_stream() << s << "\n"); } struct scoped_enable_trace { scoped_enable_trace() { @@ -324,8 +324,8 @@ final_check_status theory_seq::final_check_eh() { } m_new_propagation = false; - TRACE("seq", display(tout << "level: " << ctx.get_scope_level() << "\n");); - TRACE("seq_verbose", ctx.display(tout);); + TRACE(seq, display(tout << "level: " << ctx.get_scope_level() << "\n");); + TRACE(seq_verbose, ctx.display(tout);); if (simplify_and_solve_eqs()) { ++m_stats.m_solve_eqs; @@ -425,13 +425,13 @@ final_check_status theory_seq::final_check_eh() { } if (m_unhandled_expr) { TRACEFIN("give_up"); - TRACE("seq", tout << "unhandled: " << mk_pp(m_unhandled_expr, m) << "\n";); + TRACE(seq, tout << "unhandled: " << mk_pp(m_unhandled_expr, m) << "\n";); return FC_GIVEUP; } if (is_solved()) { //scoped_enable_trace _se; TRACEFIN("is_solved"); - TRACE("seq", display(tout);); + TRACE(seq, display(tout);); return FC_DONE; } TRACEFIN("give_up"); @@ -504,7 +504,7 @@ bool theory_seq::fixed_length(expr* len_e, bool is_zero, bool check_long_strings expr_ref seq(e, m), head(m), tail(m); - TRACE("seq", tout << "Fixed: " << mk_bounded_pp(e, m, 2) << " " << lo << "\n";); + TRACE(seq, tout << "Fixed: " << mk_bounded_pp(e, m, 2) << " " << lo << "\n";); literal a = mk_eq(len_e, m_autil.mk_numeral(lo, true), false); if (ctx.get_assignment(a) == l_false) return false; @@ -545,7 +545,7 @@ void theory_seq::propagate_non_empty(literal lit, expr* s) { } bool theory_seq::propagate_is_conc(expr* e, expr* conc) { - TRACE("seq", tout << mk_pp(conc, m) << " is non-empty\n";); + TRACE(seq, tout << mk_pp(conc, m) << " is non-empty\n";); literal lit = ~mk_eq_empty(e); if (ctx.get_assignment(lit) == l_true) { propagate_lit(nullptr, 1, &lit, mk_eq(e, conc, false)); @@ -592,13 +592,13 @@ bool theory_seq::check_extensionality(expr* e1, enode* n1, enode* n2) { m_new_eqs.reset(); bool change = false; if (!m_seq_rewrite.reduce_eq(e1, e2, m_new_eqs, change)) { - TRACE("seq", tout << "exclude " << mk_pp(o1, m) << " " << mk_pp(o2, m) << "\n";); + TRACE(seq, tout << "exclude " << mk_pp(o1, m) << " " << mk_pp(o2, m) << "\n";); m_exclude.update(o1, o2); return true; } for (auto const& p : m_new_eqs) { if (m_exclude.contains(p.first, p.second)) { - TRACE("seq", tout << "excluded " << mk_pp(p.first, m) << " " << mk_pp(p.second, m) << "\n";); + TRACE(seq, tout << "excluded " << mk_pp(p.first, m) << " " << mk_pp(p.second, m) << "\n";); return true; } } @@ -710,12 +710,12 @@ bool theory_seq::check_lts() { bool theory_seq::is_solved() { if (!m_eqs.empty()) { - TRACE("seq", tout << "(seq.giveup " << m_eqs[0].ls << " = " << m_eqs[0].rs << " is unsolved)\n";); + TRACE(seq, tout << "(seq.giveup " << m_eqs[0].ls << " = " << m_eqs[0].rs << " is unsolved)\n";); IF_VERBOSE(10, verbose_stream() << "(seq.giveup " << m_eqs[0].ls << " = " << m_eqs[0].rs << " is unsolved)\n";); return false; } if (!m_ncs.empty()) { - TRACE("seq", display_nc(tout << "(seq.giveup ", m_ncs[0]); tout << " is unsolved)\n";); + TRACE(seq, display_nc(tout << "(seq.giveup ", m_ncs[0]); tout << " is unsolved)\n";); IF_VERBOSE(10, display_nc(verbose_stream() << "(seq.giveup ", m_ncs[0]); verbose_stream() << " is unsolved)\n";); return false; } @@ -777,7 +777,7 @@ bool theory_seq::propagate_lit(dependency* dep, unsigned n, literal const* _lits ctx.mark_as_relevant(lit); enode_pair_vector eqs; linearize(dep, eqs, lits); - TRACE("seq", + TRACE(seq, tout << "scope: " << ctx.get_scope_level() << "\n"; tout << lits << "\n"; ctx.display_detailed_literal(tout << "assert:", lit); @@ -803,7 +803,7 @@ void theory_seq::set_conflict(dependency* dep, literal_vector const& _lits) { } void theory_seq::set_conflict(enode_pair_vector const& eqs, literal_vector const& lits) { - TRACE("seq", display_deps(tout << "assert conflict:", lits, eqs);); + TRACE(seq, display_deps(tout << "assert conflict:", lits, eqs);); ctx.set_conflict( ctx.mk_justification( ext_theory_conflict_justification( @@ -818,12 +818,12 @@ bool theory_seq::propagate_eq(dependency* dep, enode* n1, enode* n2) { literal_vector lits; enode_pair_vector eqs; linearize(dep, eqs, lits); - TRACE("seq_verbose", + TRACE(seq_verbose, tout << "assert: " << mk_bounded_pp(n1->get_expr(), m) << " = " << mk_bounded_pp(n2->get_expr(), m) << " <-\n"; display_deps(tout, dep); ); - TRACE("seq", + TRACE(seq, tout << "assert: " << mk_bounded_pp(n1->get_expr(), m) << " = " << mk_bounded_pp(n2->get_expr(), m) << " <-\n" << lits << "\n"; @@ -906,14 +906,14 @@ bool theory_seq::simplify_eq(expr_ref_vector& ls, expr_ref_vector& rs, dependenc expr_ref_pair_vector& new_eqs = m_new_eqs; new_eqs.reset(); bool changed = false; - TRACE("seq", + TRACE(seq, for (expr* l : ls) tout << "s#" << l->get_id() << " " << mk_bounded_pp(l, m, 2) << "\n"; tout << " = \n"; for (expr* r : rs) tout << "s#" << r->get_id() << " " << mk_bounded_pp(r, m, 2) << "\n";); if (!m_seq_rewrite.reduce_eq(ls, rs, new_eqs, changed)) { // equality is inconsistent. - TRACE("seq_verbose", tout << ls << " != " << rs << "\n";); + TRACE(seq_verbose, tout << ls << " != " << rs << "\n";); set_conflict(deps); return true; } @@ -922,7 +922,7 @@ bool theory_seq::simplify_eq(expr_ref_vector& ls, expr_ref_vector& rs, dependenc SASSERT(new_eqs.empty()); return false; } - TRACE("seq", + TRACE(seq, tout << "reduced to\n"; for (auto p : new_eqs) { tout << mk_bounded_pp(p.first, m, 2) << "\n"; @@ -932,10 +932,10 @@ bool theory_seq::simplify_eq(expr_ref_vector& ls, expr_ref_vector& rs, dependenc ); m_seq_rewrite.add_seqs(ls, rs, new_eqs); if (new_eqs.empty()) { - TRACE("seq", tout << "solved\n";); + TRACE(seq, tout << "solved\n";); return true; } - TRACE("seq_verbose", + TRACE(seq_verbose, tout << ls << " = " << rs << "\n";); for (auto const& p : new_eqs) { if (ctx.inconsistent()) @@ -950,14 +950,14 @@ bool theory_seq::simplify_eq(expr_ref_vector& ls, expr_ref_vector& rs, dependenc } } else if (m_util.is_seq(li) || m_util.is_re(li)) { - TRACE("seq_verbose", tout << "inserting " << li << " = " << ri << "\n";); + TRACE(seq_verbose, tout << "inserting " << li << " = " << ri << "\n";); m_eqs.push_back(mk_eqdep(li, ri, deps)); } else { propagate_eq(deps, ensure_enode(li), ensure_enode(ri)); } } - TRACE("seq_verbose", + TRACE(seq_verbose, if (!ls.empty() || !rs.empty()) tout << ls << " = " << rs << ";\n"; for (auto const& p : new_eqs) { tout << mk_pp(p.first, m) << " = " << mk_pp(p.second, m) << ";\n"; @@ -994,7 +994,7 @@ bool theory_seq::add_solution(expr* l, expr* r, dependency* deps) { m_rep.update(l, r, deps); enode* n1 = ensure_enode(l); enode* n2 = ensure_enode(r); - TRACE("seq", tout << mk_bounded_pp(l, m, 2) << " ==> " << mk_bounded_pp(r, m, 2) << "\n"; display_deps(tout, deps); + TRACE(seq, tout << mk_bounded_pp(l, m, 2) << " ==> " << mk_bounded_pp(r, m, 2) << "\n"; display_deps(tout, deps); tout << "#" << n1->get_owner_id() << " ==> #" << n2->get_owner_id() << "\n"; tout << (n1->get_root() == n2->get_root()) << "\n";); propagate_eq(deps, n1, n2); @@ -1034,7 +1034,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con SASSERT(!lhs.empty() || !rhs.empty()); deps = mk_join(deps, lits); m_eqs.push_back(depeq(m_eq_id++, lhs, rhs, deps)); - TRACE("seq", tout << "Propagate equal lengths " << l << " " << r << "\n";); + TRACE(seq, tout << "Propagate equal lengths " << l << " " << r << "\n";); propagate_eq(deps, lits, l, r, true); return true; } @@ -1046,7 +1046,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con rhs.append(rs.size()-1, rs.data()); SASSERT(!lhs.empty() || !rhs.empty()); deps = mk_join(deps, lits); - TRACE("seq", tout << "Propagate equal lengths " << l << " " << r << "\n" << "ls: " << ls << "\nrs: " << rs << "\n";); + TRACE(seq, tout << "Propagate equal lengths " << l << " " << r << "\n" << "ls: " << ls << "\nrs: " << rs << "\n";); m_eqs.push_back(depeq(m_eq_id++, lhs, rhs, deps)); propagate_eq(deps, lits, l, r, true); return true; @@ -1059,7 +1059,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con len2 += len; } if (len1 == len2 && 0 < j && j < rs.size() && reduce_length(1, j, true, ls, rs, deps)) { - TRACE("seq", tout << "l equal\n";); + TRACE(seq, tout << "l equal\n";); return true; } } @@ -1069,7 +1069,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con len2 += len; } if (len1 == len2 && 0 < j && j < ls.size() && reduce_length(j, 1, true, ls, rs, deps)) { - TRACE("seq", tout << "r equal\n";); + TRACE(seq, tout << "r equal\n";); return true; } } @@ -1079,7 +1079,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con len2 += len; } if (len1 == len2 && 0 < j && j < rs.size() && reduce_length(ls.size()-1, rs.size()-j, false, ls, rs, deps)) { - TRACE("seq", tout << "l suffix equal\n";); + TRACE(seq, tout << "l suffix equal\n";); return true; } } @@ -1089,7 +1089,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con len2 += len; } if (len1 == len2 && 0 < j && j < ls.size() && reduce_length(ls.size()-j, rs.size()-1, false, ls, rs, deps)) { - TRACE("seq", tout << "r suffix equal\n";); + TRACE(seq, tout << "r suffix equal\n";); return true; } } @@ -1132,7 +1132,7 @@ bool theory_seq::reduce_length(unsigned i, unsigned j, bool front, expr_ref_vect deps = mk_join(deps, lit); m_eqs.push_back(depeq(m_eq_id++, lhs, rhs, deps)); propagate_eq(deps, l, r, true); - TRACE("seq", tout << "propagate eq\n" << m_eqs.size() << "\nlhs: " << lhs << "\nrhs: " << rhs << "\n";); + TRACE(seq, tout << "propagate eq\n" << m_eqs.size() << "\nlhs: " << lhs << "\nrhs: " << rhs << "\n";); return true; } else { @@ -1172,7 +1172,7 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) { lits.append(4, _lits); return true; } - TRACE("seq", tout << mk_pp(e, m) << "\n"; ctx.display_literals_verbose(tout, 4, _lits); tout << "\n"; + TRACE(seq, tout << mk_pp(e, m) << "\n"; ctx.display_literals_verbose(tout, 4, _lits); tout << "\n"; for (unsigned i = 0; i < 4; ++i) tout << ctx.get_assignment(_lits[i]) << "\n";); } else if (m_util.str.is_at(e, s, i)) { @@ -1185,7 +1185,7 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) { ctx.get_assignment(i_lt_len_s) == l_true) { len = m_autil.mk_int(1); lits.append(2, _lits); - TRACE("seq", ctx.display_literals_verbose(tout, 2, _lits); tout << "\n";); + TRACE(seq, ctx.display_literals_verbose(tout, 2, _lits); tout << "\n";); return true; } } @@ -1198,7 +1198,7 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) { ctx.get_assignment(i_lt_len_s) == l_true) { len = i; lits.append(2, _lits); - TRACE("seq", ctx.display_literals_verbose(tout << "pre length", 2, _lits); tout << "\n";); + TRACE(seq, ctx.display_literals_verbose(tout << "pre length", 2, _lits); tout << "\n";); return true; } } @@ -1210,7 +1210,7 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) { ctx.get_assignment(len_s_ge_i) == l_true) { len = mk_sub(mk_len(s), i); lits.append(2, _lits); - TRACE("seq", ctx.display_literals_verbose(tout << "post length " << len << "\n", 2, _lits) << "\n";); + TRACE(seq, ctx.display_literals_verbose(tout << "post length " << len << "\n", 2, _lits) << "\n";); return true; } } @@ -1224,12 +1224,12 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) { case l_true: len = mk_sub(mk_sub(len_s, l), m_autil.mk_int(1)); lits.push_back(len_s_gt_l); - TRACE("seq", ctx.display_literals_verbose(tout << "tail length " << len << "\n", lits) << "\n";); + TRACE(seq, ctx.display_literals_verbose(tout << "tail length " << len << "\n", lits) << "\n";); return true; case l_false: len = m_autil.mk_int(0); lits.push_back(~len_s_gt_l); - TRACE("seq", ctx.display_literals_verbose(tout << "tail length " << len << "\n", lits) << "\n";); + TRACE(seq, ctx.display_literals_verbose(tout << "tail length " << len << "\n", lits) << "\n";); return true; default: break; @@ -1271,7 +1271,7 @@ bool theory_seq::solve_nc(unsigned idx) { expr* a = nullptr, *b = nullptr; VERIFY(m_util.str.is_contains(n.contains(), a, b)); lbool is_gt = ctx.get_assignment(len_gt); - TRACE("seq", ctx.display_literal_smt2(tout << len_gt << " := " << is_gt << "\n", len_gt) << "\n";); + TRACE(seq, ctx.display_literal_smt2(tout << len_gt << " := " << is_gt << "\n", len_gt) << "\n";); switch (is_gt) { case l_true: @@ -1354,7 +1354,7 @@ bool theory_seq::explain_eq(expr* e1, expr* e2, dependency*& dep) { unfold(c2, v2); unsigned i = 0, j = 0; - TRACE("seq", + TRACE(seq, tout << "1:\n"; display_explain(tout, 0, e1); tout << "2:\n"; @@ -1385,7 +1385,7 @@ bool theory_seq::explain_eq(expr* e1, expr* e2, dependency*& dep) { if (e1 == e2) { if (c1->m_parent && c2->m_parent && c1->m_parent->m_expr == c2->m_parent->m_expr) { - TRACE("seq", tout << "parent: " << mk_pp(e1, m) << " " << mk_pp(c1->m_parent->m_expr, m) << "\n";); + TRACE(seq, tout << "parent: " << mk_pp(e1, m) << " " << mk_pp(c1->m_parent->m_expr, m) << "\n";); c1 = c1->m_parent; c2 = c2->m_parent; v1[c1->m_last] = c1; @@ -1420,7 +1420,7 @@ bool theory_seq::explain_eq(expr* e1, expr* e2, dependency*& dep) { } } else { - TRACE("seq", tout << "Could not solve " << mk_pp(e1, m) << " = " << mk_pp(e2, m) << "\n";); + TRACE(seq, tout << "Could not solve " << mk_pp(e1, m) << " = " << mk_pp(e2, m) << "\n";); result = false; break; } @@ -1443,7 +1443,7 @@ bool theory_seq::explain_empty(expr_ref_vector& es, dependency*& dep) { m_util.str.get_concat_units(a, es); continue; } - TRACE("seq", tout << "Could not set to empty: " << es << "\n";); + TRACE(seq, tout << "Could not set to empty: " << es << "\n";); return false; } return true; @@ -1531,7 +1531,7 @@ void theory_seq::add_length(expr* l) { VERIFY(m_util.str.is_length(l, e)); if (has_length(e)) return; - TRACE("seq", tout << mk_bounded_pp(e, m, 2) << "\n";); + TRACE(seq, tout << mk_bounded_pp(e, m, 2) << "\n";); m_length.push_back(l); m_has_length.insert(e); m_trail_stack.push(push_back_vector(m_length)); @@ -2027,7 +2027,7 @@ public: add_buffer(sbuffer, zs); } else { - TRACE("seq", tout << "Not a string: " << tmp << "\n";); + TRACE(seq, tout << "Not a string: " << tmp << "\n";); } ++k; break; @@ -2048,7 +2048,7 @@ public: break; } } - // TRACE("seq", tout << src << " " << sbuffer << "\n";); + // TRACE(seq, tout << src << " " << sbuffer << "\n";); } result = th.m_util.str.mk_string(zstring(sbuffer.size(), sbuffer.data())); } @@ -2070,7 +2070,7 @@ public: th.m_str_rewrite(result); } th.m_factory->add_trail(result); - TRACE("seq", tout << pp(m_node, th.m) << " -> " << result << "\n";); + TRACE(seq, tout << pp(m_node, th.m) << " -> " << result << "\n";); return to_app(result); } }; @@ -2096,7 +2096,7 @@ app* theory_seq::get_ite_value(expr* e) { model_value_proc * theory_seq::mk_value(enode * n, model_generator & mg) { app* e = n->get_expr(); - TRACE("seq", tout << mk_pp(e, m) << "\n";); + TRACE(seq, tout << mk_pp(e, m) << "\n";); // Shortcut for well-founded values to avoid some quadratic overhead expr* x = nullptr, *y = nullptr, *z = nullptr; @@ -2118,18 +2118,18 @@ model_value_proc * theory_seq::mk_value(enode * n, model_generator & mg) { seq_value_proc* sv = alloc(seq_value_proc, *this, n, srt); unsigned end = m_concat.size(); - TRACE("seq", tout << "sequence: " << start << " " << end << " " << mk_pp(e, m) << "\n";); + TRACE(seq, tout << "sequence: " << start << " " << end << " " << mk_pp(e, m) << "\n";); for (unsigned i = start; i < end; ++i) { expr* c = m_concat[i]; expr *c1; - TRACE("seq", tout << "elem: " << mk_pp(c, m) << "\n";); + TRACE(seq, tout << "elem: " << mk_pp(c, m) << "\n";); if (m_util.str.is_unit(c, c1)) { if (ctx.e_internalized(c1)) sv->add_unit(ctx.get_enode(c1)); else if (m.is_value(c1)) sv->add_string(c); else { - TRACE("seq", tout << "not internalized " << mk_pp(c, m) << "\n";); + TRACE(seq, tout << "not internalized " << mk_pp(c, m) << "\n";); } } else if (m_util.str.is_itos(c, c1)) { @@ -2142,7 +2142,7 @@ model_value_proc * theory_seq::mk_value(enode * n, model_generator & mg) { } else { app_ref val(mk_value(to_app(c)), m); - TRACE("seq", tout << "WARNING: " << val << " is prone to result in incorrect model\n";); + TRACE(seq, tout << "WARNING: " << val << " is prone to result in incorrect model\n";); sv->add_string(val); } } @@ -2172,7 +2172,7 @@ app* theory_seq::mk_value(app* e) { m_rewrite(result); } m_factory->add_trail(result); - TRACE("seq", tout << mk_pp(e, m) << " -> " << result << "\n";); + TRACE(seq, tout << mk_pp(e, m) << " -> " << result << "\n";); m_rep.update(e, result, nullptr); return to_app(result); } @@ -2424,7 +2424,7 @@ void theory_seq::validate_fmls(enode_pair_vector const& eqs, literal_vector cons for (auto const& p : eqs) { fmls.push_back(m.mk_eq(p.first->get_expr(), p.second->get_expr())); } - TRACE("seq", tout << fmls << "\n";); + TRACE(seq, tout << fmls << "\n";); for (unsigned i = 0; i < fmls.size(); ++i) { fml = elim_skolem(fmls.get(i)); @@ -2438,7 +2438,7 @@ void theory_seq::validate_fmls(enode_pair_vector const& eqs, literal_vector cons if (r == l_true) { model_ref mdl; k.get_model(mdl); - TRACE("seq", tout << "failed to validate\n" << *mdl << "\n"); + TRACE(seq, tout << "failed to validate\n" << *mdl << "\n"); IF_VERBOSE(0, verbose_stream() << r << "\n" << fmls << "\n"; verbose_stream() << *mdl.get() << "\n"; @@ -2472,9 +2472,9 @@ bool theory_seq::canonize(expr* e, dependency*& eqs, expr_ref& result) { if (!expand(e, eqs, result)) { return false; } - TRACE("seq", tout << mk_bounded_pp(e, m, 2) << " expands to\n" << mk_bounded_pp(result, m, 2) << "\n";); + TRACE(seq, tout << mk_bounded_pp(e, m, 2) << " expands to\n" << mk_bounded_pp(result, m, 2) << "\n";); m_rewrite(result); - TRACE("seq", tout << mk_bounded_pp(e, m, 2) << " rewrites to\n" << mk_bounded_pp(result, m, 2) << "\n";); + TRACE(seq, tout << mk_bounded_pp(e, m, 2) << " rewrites to\n" << mk_bounded_pp(result, m, 2) << "\n";); return true; } @@ -2654,7 +2654,7 @@ bool theory_seq::expand1(expr* e0, dependency*& eqs, expr_ref& result) { case l_undef: ctx.mark_as_relevant(lit); m_new_propagation = true; - TRACE("seq", tout << "undef: " << mk_bounded_pp(e, m, 2) << "\n"; + TRACE(seq, tout << "undef: " << mk_bounded_pp(e, m, 2) << "\n"; tout << lit << "@ level: " << ctx.get_scope_level() << "\n";); return false; } @@ -2668,7 +2668,7 @@ bool theory_seq::expand1(expr* e0, dependency*& eqs, expr_ref& result) { expr_dep edr(e0, result, deps); m_rep.add_cache(edr); eqs = m_dm.mk_join(eqs, deps); - TRACE("seq_verbose", tout << mk_pp(e0, m) << " |--> " << result << "\n"; + TRACE(seq_verbose, tout << mk_pp(e0, m) << " |--> " << result << "\n"; if (eqs) display_deps(tout, eqs);); return true; } @@ -2690,7 +2690,7 @@ void theory_seq::propagate() { ++m_axioms_head; } while (!m_replay.empty() && !ctx.inconsistent()) { - TRACE("seq", tout << "replay at level: " << ctx.get_scope_level() << "\n";); + TRACE(seq, tout << "replay at level: " << ctx.get_scope_level() << "\n";); apply& app = *m_replay[m_replay.size() - 1]; app(*this); m_replay.pop_back(); @@ -2703,7 +2703,7 @@ void theory_seq::propagate() { void theory_seq::enque_axiom(expr* e) { if (!m_axiom_set.contains(e)) { - TRACE("seq", tout << "add axiom " << mk_bounded_pp(e, m) << "\n";); + TRACE(seq, tout << "add axiom " << mk_bounded_pp(e, m) << "\n";); m_axioms.push_back(e); m_axiom_set.insert(e); m_trail_stack.push(push_back_vector(m_axioms)); @@ -2712,7 +2712,7 @@ void theory_seq::enque_axiom(expr* e) { } void theory_seq::deque_axiom(expr* n) { - TRACE("seq", tout << "deque: " << mk_bounded_pp(n, m, 2) << "\n";); + TRACE(seq, tout << "deque: " << mk_bounded_pp(n, m, 2) << "\n";); if (m_util.str.is_length(n)) { add_length(n); m_ax.add_length_axiom(n); @@ -2777,7 +2777,7 @@ void theory_seq::deque_axiom(expr* n) { expr_ref theory_seq::add_elim_string_axiom(expr* n) { zstring s; - TRACE("seq", tout << mk_pp(n, m) << "\n";); + TRACE(seq, tout << mk_pp(n, m) << "\n";); VERIFY(m_util.str.is_string(n, s)); if (s.length() == 0) { return expr_ref(n, m); @@ -2874,18 +2874,18 @@ bool theory_seq::get_length(expr* e, rational& val) { len = mk_len(c); if (!has_length(c)) { add_axiom(mk_literal(m_autil.mk_ge(len, m_autil.mk_int(0)))); - TRACE("seq", tout << "literal has no length " << mk_pp(c, m) << "\n";); + TRACE(seq, tout << "literal has no length " << mk_pp(c, m) << "\n";); return false; } else if (m_arith_value.get_value(len, val1) && !val1.is_neg()) val += val1; else { - TRACE("seq", tout << "length has not been internalized " << mk_pp(c, m) << "\n";); + TRACE(seq, tout << "length has not been internalized " << mk_pp(c, m) << "\n";); return false; } } } - CTRACE("seq", !val.is_int(), tout << "length is not an integer\n";); + CTRACE(seq, !val.is_int(), tout << "length is not an integer\n";); return val.is_int(); } @@ -2894,7 +2894,7 @@ bool theory_seq::get_length(expr* e, rational& val) { lit => s = (nth s 0) ++ (nth s 1) ++ ... ++ (nth s idx) ++ (tail s idx) */ void theory_seq::ensure_nth(literal lit, expr* s, expr* idx) { - TRACE("seq", tout << "ensure-nth: " << lit << " " << mk_bounded_pp(s, m, 2) << " " << mk_bounded_pp(idx, m, 2) << "\n";); + TRACE(seq, tout << "ensure-nth: " << lit << " " << mk_bounded_pp(s, m, 2) << " " << mk_bounded_pp(idx, m, 2) << "\n";); rational r; SASSERT(ctx.get_assignment(lit) == l_true); VERIFY(m_autil.is_numeral(idx, r) && r.is_unsigned()); @@ -2967,7 +2967,7 @@ void theory_seq::add_axiom(literal l1, literal l2, literal l3, literal l4, liter } void theory_seq::add_axiom(literal_vector & lits) { - TRACE("seq", ctx.display_literals_verbose(tout << "assert " << lits << " :", lits) << "\n";); + TRACE(seq, ctx.display_literals_verbose(tout << "assert " << lits << " :", lits) << "\n";); for (literal lit : lits) if (ctx.get_assignment(lit) == l_true) @@ -3024,11 +3024,11 @@ bool theory_seq::propagate_eq(dependency* deps, literal_vector const& _lits, exp deps = mk_join(deps, _lits); new_eq_eh(deps, n1, n2); } - TRACE("seq_verbose", + TRACE(seq_verbose, tout << "assert: #" << e1->get_id() << " " << mk_pp(e1, m) << " = " << mk_pp(e2, m) << " <- \n"; if (!lits.empty()) { ctx.display_literals_verbose(tout, lits) << "\n"; }); - TRACE("seq", + TRACE(seq, tout << "assert:" << mk_bounded_pp(e1, m, 2) << " = " << mk_bounded_pp(e2, m, 2) << " <- \n"; tout << lits << "\n"; tout << "#" << e1->get_id() << "\n"; @@ -3053,8 +3053,8 @@ void theory_seq::assign_eh(bool_var v, bool is_true) { expr* e1 = nullptr, *e2 = nullptr; expr_ref f(m); literal lit(v, !is_true); - TRACE("seq", tout << (is_true?"":"not ") << mk_bounded_pp(e, m) << "\n";); - TRACE("seq", tout << (is_true?"":"not ") << mk_bounded_pp(e, m) << " " << ctx.get_scope_level() << " " << lit << "\n";); + TRACE(seq, tout << (is_true?"":"not ") << mk_bounded_pp(e, m) << "\n";); + TRACE(seq, tout << (is_true?"":"not ") << mk_bounded_pp(e, m) << " " << ctx.get_scope_level() << " " << lit << "\n";); if (m_util.str.is_prefix(e, e1, e2)) { if (is_true) { @@ -3157,7 +3157,7 @@ void theory_seq::assign_eh(bool_var v, bool is_true) { } else { - TRACE("seq", tout << mk_pp(e, m) << "\n";); + TRACE(seq, tout << mk_pp(e, m) << "\n";); IF_VERBOSE(0, verbose_stream() << mk_pp(e, m) << "\n"); UNREACHABLE(); } @@ -3182,7 +3182,7 @@ void theory_seq::new_eq_eh(theory_var v1, theory_var v2) { void theory_seq::new_eq_eh(dependency* deps, enode* n1, enode* n2) { expr* e1 = n1->get_expr(); expr* e2 = n2->get_expr(); - TRACE("seq", tout << mk_bounded_pp(e1, m) << " = " << mk_bounded_pp(e2, m) << "\n";); + TRACE(seq, tout << mk_bounded_pp(e1, m) << " = " << mk_bounded_pp(e2, m) << "\n";); if (n1 != n2 && m_util.is_seq(e1)) { theory_var v1 = n1->get_th_var(get_id()); theory_var v2 = n2->get_th_var(get_id()); @@ -3194,7 +3194,7 @@ void theory_seq::new_eq_eh(dependency* deps, enode* n1, enode* n2) { m_find.merge(v1, v2); expr_ref o1(e1, m); expr_ref o2(e2, m); - TRACE("seq", tout << mk_bounded_pp(o1, m) << " = " << mk_bounded_pp(o2, m) << "\n";); + TRACE(seq, tout << mk_bounded_pp(o1, m) << " = " << mk_bounded_pp(o2, m) << "\n";); m_eqs.push_back(mk_eqdep(o1, o2, deps)); solve_eqs(m_eqs.size()-1); enforce_length_coherence(n1, n2); @@ -3219,7 +3219,7 @@ void theory_seq::new_diseq_eh(theory_var v1, theory_var v2) { return; m_exclude.update(e1, e2); expr_ref eq(m.mk_eq(e1, e2), m); - TRACE("seq", tout << "new disequality " << ctx.get_scope_level() << ": " << mk_bounded_pp(eq, m, 2) << "\n";); + TRACE(seq, tout << "new disequality " << ctx.get_scope_level() << ": " << mk_bounded_pp(eq, m, 2) << "\n";); m_rewrite(eq); if (!m.is_false(eq)) { literal lit = mk_eq(e1, e2, false); @@ -3336,7 +3336,7 @@ void theory_seq::add_unhandled_expr(expr* n) { void theory_seq::add_theory_assumptions(expr_ref_vector & assumptions) { if (m_has_seq) { - TRACE("seq", tout << "add_theory_assumption\n";); + TRACE(seq, tout << "add_theory_assumption\n";); expr_ref dlimit = m_sk.mk_max_unfolding_depth(m_max_unfolding_depth); m_trail_stack.push(value_trail(m_max_unfolding_lit)); m_max_unfolding_lit = mk_literal(dlimit); @@ -3349,7 +3349,7 @@ void theory_seq::add_theory_assumptions(expr_ref_vector & assumptions) { } bool theory_seq::should_research(expr_ref_vector & unsat_core) { - TRACE("seq", tout << unsat_core << " " << m_util.has_re() << "\n";); + TRACE(seq, tout << unsat_core << " " << m_util.has_re() << "\n";); if (!m_has_seq) return false; unsigned k_min = UINT_MAX, k = 0, n = 0; @@ -3451,11 +3451,11 @@ bool theory_seq::canonizes(bool is_true, expr* e) { dependency* deps = nullptr; expr_ref cont(m); if (!canonize(e, deps, cont)) cont = e; - TRACE("seq", tout << is_true << ": " << mk_bounded_pp(e, m, 2) << " -> " << mk_bounded_pp(cont, m, 2) << "\n"; + TRACE(seq, tout << is_true << ": " << mk_bounded_pp(e, m, 2) << " -> " << mk_bounded_pp(cont, m, 2) << "\n"; if (deps) display_deps(tout, deps);); if ((m.is_true(cont) && !is_true) || (m.is_false(cont) && is_true)) { - TRACE("seq", display(tout); tout << ctx.get_assignment(ctx.get_literal(e)) << "\n";); + TRACE(seq, display(tout); tout << ctx.get_assignment(ctx.get_literal(e)) << "\n";); literal lit = ctx.get_literal(e); if (is_true) lit.neg(); propagate_lit(deps, 0, nullptr, lit); @@ -3463,7 +3463,7 @@ bool theory_seq::canonizes(bool is_true, expr* e) { } if ((m.is_false(cont) && !is_true) || (m.is_true(cont) && is_true)) { - TRACE("seq", display(tout);); + TRACE(seq, display(tout);); return true; } return false; diff --git a/src/smt/theory_special_relations.cpp b/src/smt/theory_special_relations.cpp index 096633d4e..9daf3ab2e 100644 --- a/src/smt/theory_special_relations.cpp +++ b/src/smt/theory_special_relations.cpp @@ -155,7 +155,7 @@ namespace smt { ctx.set_var_theory(v, get_id()); atom* a = alloc(atom, v, *r, v0, v1); m_atoms.push_back(a); - TRACE("special_relations", tout << mk_pp(atm, m) << " : bv" << v << " v" << a->v1() << " v" << a->v2() << ' ' << gate_ctx << "\n";); + TRACE(special_relations, tout << mk_pp(atm, m) << " : bv" << v << " v" << a->v1() << " v" << a->v2() << ' ' << gate_ctx << "\n";); m_bool_var2atom.insert(v, a); return true; } @@ -167,7 +167,7 @@ namespace smt { theory_var v = n->get_th_var(get_id()); if (null_theory_var == v) { v = theory::mk_var(n); - TRACE("special_relations", tout << "v" << v << " := " << mk_pp(e, get_manager()) << "\n";); + TRACE(special_relations, tout << "v" << v << " := " << mk_pp(e, get_manager()) << "\n";); ctx.attach_th_var(n, this, v); } return v; @@ -187,7 +187,7 @@ namespace smt { } final_check_status theory_special_relations::final_check_eh() { - TRACE("special_relations", tout << "\n";); + TRACE(special_relations, tout << "\n";); for (auto const& kv : m_relations) { lbool r = final_check(*kv.m_value); switch (r) { @@ -286,12 +286,12 @@ namespace smt { literal consequent = ctx.get_literal(tc_app); ctx.mark_as_relevant(consequent); justification* j = ctx.mk_justification(theory_propagation_justification(get_id(), ctx, 1, &lit, consequent)); - TRACE("special_relations", tout << "propagate: " << tc_app << "\n";); + TRACE(special_relations, tout << "propagate: " << tc_app << "\n";); ctx.assign(consequent, j); new_assertion = true; } else { - TRACE("special_relations", tout << "add edge " << tc_app << " relevant: " << ctx.is_relevant(tcn) << "\n"); + TRACE(special_relations, tout << "add edge " << tc_app << " relevant: " << ctx.is_relevant(tcn) << "\n"); theory_var v1 = get_representative(get_th_var(arg1)); theory_var v2 = get_representative(get_th_var(arg2)); r_graph.init_var(v1); @@ -325,7 +325,7 @@ namespace smt { theory_var r1 = get_representative(a.v1()); theory_var r2 = get_representative(a.v2()); if (r_graph.can_reach(r1, r2)) { - TRACE("special_relations", + TRACE(special_relations, tout << a.v1() << ": " << mk_pp(arg1, m) << " -> " << a.v2() << ": " << mk_pp(arg2, m) << " is positive reachable\n"; r.m_graph.display(tout); @@ -386,14 +386,14 @@ namespace smt { } case l_undef: ctx.set_true_first_flag(bv); - TRACE("special_relations", tout << f_app << " is undefined\n";); + TRACE(special_relations, tout << f_app << " is undefined\n";); new_assertion = true; break; } } } if (new_assertion) { - TRACE("special_relations", tout << "new assertion\n";); + TRACE(special_relations, tout << "new assertion\n";); return l_false; } return final_check_po(r); @@ -407,14 +407,14 @@ namespace smt { if (a.phase()) { continue; } - TRACE("special_relations", tout << a.v1() << " !<= " << a.v2() << "\n";); + TRACE(special_relations, tout << a.v1() << " !<= " << a.v2() << "\n";); target.reset(); theory_var w; // v1 !<= v2 is asserted target.insert(a.v1()); if (r.m_graph.reachable(a.v2(), target, visited, w)) { // we already have v2 <= v1 - TRACE("special_relations", tout << "already: " << a.v2() << " <= " << a.v1() << "\n";); + TRACE(special_relations, tout << "already: " << a.v2() << " <= " << a.v1() << "\n";); continue; } if (a.v1() == a.v2()) { @@ -439,7 +439,7 @@ namespace smt { r.m_explanation.reset(); r.m_graph.find_shortest_reachable_path(a.v1(), w, timestamp, r); r.m_graph.find_shortest_reachable_path(a.v2(), w, timestamp, r); - TRACE("special_relations", tout << "added edge\n";); + TRACE(special_relations, tout << "added edge\n";); r.m_explanation.push_back(a.explanation()); literal_vector const& lits = r.m_explanation; if (!r.m_graph.add_non_strict_edge(a.v2(), a.v1(), lits)) { @@ -482,7 +482,7 @@ namespace smt { void theory_special_relations::set_conflict(relation& r) { literal_vector const& lits = r.m_explanation; - TRACE("special_relations", ctx.display_literals_verbose(tout, lits) << "\n";); + TRACE(special_relations, ctx.display_literals_verbose(tout, lits) << "\n";); vector params; ctx.set_conflict( ctx.mk_justification( @@ -515,7 +515,7 @@ namespace smt { res = l_undef; break; } - TRACE("special_relations", r.display(*this, tout << res << "\n");); + TRACE(special_relations, r.display(*this, tout << res << "\n");); return res; } @@ -548,7 +548,7 @@ namespace smt { r.m_graph.find_shortest_zero_edge_path(i, j, timestamp, r); r.m_graph.find_shortest_zero_edge_path(j, i, timestamp, r); literal_vector const& lits = r.m_explanation; - TRACE("special_relations", ctx.display_literals_verbose(tout << mk_pp(x->get_expr(), m) << " = " << mk_pp(y->get_expr(), m) << "\n", lits) << "\n";); + TRACE(special_relations, ctx.display_literals_verbose(tout << mk_pp(x->get_expr(), m) << " = " << mk_pp(y->get_expr(), m) << "\n", lits) << "\n";); IF_VERBOSE(20, ctx.display_literals_verbose(verbose_stream() << mk_pp(x->get_expr(), m) << " = " << mk_pp(y->get_expr(), m) << "\n", lits) << "\n";); eq_justification js(ctx.mk_justification(ext_theory_eq_propagation_justification(get_id(), ctx, lits.size(), lits.data(), 0, nullptr, x, y))); @@ -607,9 +607,9 @@ namespace smt { r.m_explanation.reset(); unsigned timestamp = r.m_graph.get_timestamp(); bool found_path = a.v1() == a.v2() || r.m_graph.find_shortest_reachable_path(a.v1(), a.v2(), timestamp, r); - TRACE("special_relations", tout << "check " << a.v1() << " -> " << a.v2() << " found_path: " << found_path << "\n"); + TRACE(special_relations, tout << "check " << a.v1() << " -> " << a.v2() << " found_path: " << found_path << "\n"); if (found_path) { - TRACE("special_relations", tout << "check po conflict\n";); + TRACE(special_relations, tout << "check po conflict\n";); r.m_explanation.push_back(a.explanation()); set_conflict(r); return l_false; @@ -663,7 +663,7 @@ namespace smt { } void theory_special_relations::assign_eh(bool_var v, bool is_true) { - TRACE("special_relations", tout << "assign bv" << v << " " << (is_true?" <- true":" <- false") << "\n";); + TRACE(special_relations, tout << "assign bv" << v << " " << (is_true?" <- true":" <- false") << "\n";); atom* a = m_bool_var2atom[v]; a->set_phase(is_true); a->get_relation().m_asserted_atoms.push_back(a); @@ -722,7 +722,7 @@ namespace smt { if (get_enode(src)->get_root() == get_enode(dst)->get_root()) continue; VERIFY(g.add_strict_edge(src, dst, literal_vector())); } - TRACE("special_relations", g.display(tout);); + TRACE(special_relations, g.display(tout);); } /** @@ -749,7 +749,7 @@ namespace smt { } } } - TRACE("special_relations", g.display(tout);); + TRACE(special_relations, g.display(tout);); } bool theory_special_relations::disconnected(graph const& g, dl_var u, dl_var v) const { @@ -799,7 +799,7 @@ namespace smt { expr* arg = get_expr(i); fi->insert_new_entry(&arg, arith.mk_numeral(val.to_rational(), true)); } - TRACE("special_relations", r.m_graph.display(tout);); + TRACE(special_relations, r.m_graph.display(tout);); r.pop(1); fi->set_else(arith.mk_numeral(rational(0), true)); mg.get_model().register_decl(fn, fi); @@ -985,7 +985,7 @@ namespace smt { m.mk_ite(m.mk_app(memf, dst, Ap), T, m.mk_app(connectedf, Ap, dst, Sp))); - TRACE("special_relations", tout << connected_body << "\n";); + TRACE(special_relations, tout << connected_body << "\n";); recfun_replace rep(m); var* vars[3] = { AV, dstV, SV }; p.set_definition(rep, connected, false, 3, vars, connected_body); @@ -1037,7 +1037,7 @@ namespace smt { } bool theory_special_relations::is_neighbour_edge(graph const& g, edge_id edge) const { - CTRACE("special_relations_verbose", g.is_enabled(edge), + CTRACE(special_relations_verbose, g.is_enabled(edge), tout << edge << ": " << g.get_source(edge) << " " << g.get_target(edge) << " "; tout << (g.get_assignment(g.get_target(edge)) - g.get_assignment(g.get_source(edge))) << "\n";); @@ -1067,7 +1067,7 @@ namespace smt { for (edge_id e : g.get_out_edges(v)) { if (is_strict_neighbour_edge(g, e)) { dl_var dst = g.get_target(e); - TRACE("special_relations", tout << v << " -> " << dst << "\n";); + TRACE(special_relations, tout << v << " -> " << dst << "\n";); if (!processed[dst]) { all_p = false; nodes.push_back(dst); @@ -1081,7 +1081,7 @@ namespace smt { processed[v] = true; } } - TRACE("special_relations", + TRACE(special_relations, for (unsigned i = 0; i < sz; ++i) { tout << i << ": " << num_children[i] << "\n"; }); diff --git a/src/smt/theory_str.cpp b/src/smt/theory_str.cpp index f88887feb..984cea972 100644 --- a/src/smt/theory_str.cpp +++ b/src/smt/theory_str.cpp @@ -210,7 +210,7 @@ namespace smt { SASSERT(!m.is_true(_e)); if (m.is_true(_e)) return; - TRACE("str", tout << "asserting " << mk_ismt2_pp(_e, m) << std::endl;); + TRACE(str, tout << "asserting " << mk_ismt2_pp(_e, m) << std::endl;); expr_ref e(_e, m); if (!ctx.b_internalized(e)) { ctx.internalize(e, false); @@ -224,7 +224,7 @@ namespace smt { // crash/error avoidance: add all axioms to the trail m_trail.push_back(e); - //TRACE("str", tout << "done asserting " << mk_ismt2_pp(e, get_manager()) << std::endl;); + //TRACE(str, tout << "done asserting " << mk_ismt2_pp(e, get_manager()) << std::endl;); } void theory_str::assert_axiom_rw(expr * e) { @@ -244,7 +244,7 @@ namespace smt { void theory_str::assert_implication(expr * premise, expr * conclusion) { ast_manager & m = get_manager(); - TRACE("str", tout << "asserting implication " << mk_ismt2_pp(premise, m) << " -> " << mk_ismt2_pp(conclusion, m) << std::endl;); + TRACE(str, tout << "asserting implication " << mk_ismt2_pp(premise, m) << " -> " << mk_ismt2_pp(conclusion, m) << std::endl;); expr_ref axiom(m.mk_or(mk_not(m, premise), conclusion), m); assert_axiom(axiom); } @@ -257,7 +257,7 @@ namespace smt { ast_manager & m = get_manager(); SASSERT(term->get_family_id() == get_family_id()); - TRACE("str", tout << "internalizing term: " << mk_ismt2_pp(term, get_manager()) << std::endl;); + TRACE(str, tout << "internalizing term: " << mk_ismt2_pp(term, get_manager()) << std::endl;); // emulation of user_smt_theory::internalize_term() @@ -281,14 +281,14 @@ namespace smt { for (unsigned i = 0; i < num_args; ++i) { enode * arg = e->get_arg(i); theory_var v_arg = mk_var(arg); - TRACE("str", tout << "arg has theory var #" << v_arg << std::endl;); (void)v_arg; + TRACE(str, tout << "arg has theory var #" << v_arg << std::endl;); (void)v_arg; } theory_var v = mk_var(e); - TRACE("str", tout << "term has theory var #" << v << std::endl;); (void)v; + TRACE(str, tout << "term has theory var #" << v << std::endl;); (void)v; if (opt_EagerStringConstantLengthAssertions && u.str.is_string(term)) { - TRACE("str", tout << "eagerly asserting length of string term " << mk_pp(term, m) << std::endl;); + TRACE(str, tout << "eagerly asserting length of string term " << mk_pp(term, m) << std::endl;); m_basicstr_axiom_todo.insert(e); } return true; @@ -306,24 +306,24 @@ namespace smt { void theory_str::refresh_theory_var(expr * e) { enode * en = ensure_enode(e); theory_var v = mk_var(en); (void)v; - TRACE("str", tout << "refresh " << mk_pp(e, get_manager()) << ": v#" << v << std::endl;); + TRACE(str, tout << "refresh " << mk_pp(e, get_manager()) << ": v#" << v << std::endl;); if (e->get_sort() == u.str.mk_string_sort()) { m_basicstr_axiom_todo.push_back(en); } } theory_var theory_str::mk_var(enode* n) { - TRACE("str", tout << "mk_var for " << mk_pp(n->get_expr(), get_manager()) << std::endl;); + TRACE(str, tout << "mk_var for " << mk_pp(n->get_expr(), get_manager()) << std::endl;); if (!(n->get_expr()->get_sort() == u.str.mk_string_sort())) { return null_theory_var; } if (is_attached_to_var(n)) { - TRACE("str", tout << "already attached to theory var" << std::endl;); + TRACE(str, tout << "already attached to theory var" << std::endl;); return n->get_th_var(get_id()); } else { theory_var v = theory::mk_var(n); m_find.mk_var(); - TRACE("str", tout << "new theory var v#" << v << " find " << m_find.find(v) << std::endl;); + TRACE(str, tout << "new theory var v#" << v << " find " << m_find.find(v) << std::endl;); ctx.attach_th_var(n, this, v); ctx.mark_as_relevant(n); return v; @@ -366,7 +366,7 @@ namespace smt { varInfo->vars.insert(node, 1); cut_var_map.insert(baseNode, std::stack()); cut_var_map[baseNode].push(varInfo); - TRACE("str", tout << "add var info for baseNode=" << mk_pp(baseNode, get_manager()) << ", node=" << mk_pp(node, get_manager()) << " [" << slevel << "]" << std::endl;); + TRACE(str, tout << "add var info for baseNode=" << mk_pp(baseNode, get_manager()) << ", node=" << mk_pp(node, get_manager()) << " [" << slevel << "]" << std::endl;); } else { if (cut_var_map[baseNode].empty()) { T_cut * varInfo = alloc(T_cut); @@ -374,7 +374,7 @@ namespace smt { varInfo->level = slevel; varInfo->vars.insert(node, 1); cut_var_map[baseNode].push(varInfo); - TRACE("str", tout << "add var info for baseNode=" << mk_pp(baseNode, get_manager()) << ", node=" << mk_pp(node, get_manager()) << " [" << slevel << "]" << std::endl;); + TRACE(str, tout << "add var info for baseNode=" << mk_pp(baseNode, get_manager()) << ", node=" << mk_pp(node, get_manager()) << " [" << slevel << "]" << std::endl;); } else { if (cut_var_map[baseNode].top()->level < slevel) { T_cut * varInfo = alloc(T_cut); @@ -383,10 +383,10 @@ namespace smt { cut_vars_map_copy(varInfo->vars, cut_var_map[baseNode].top()->vars); varInfo->vars.insert(node, 1); cut_var_map[baseNode].push(varInfo); - TRACE("str", tout << "add var info for baseNode=" << mk_pp(baseNode, get_manager()) << ", node=" << mk_pp(node, get_manager()) << " [" << slevel << "]" << std::endl;); + TRACE(str, tout << "add var info for baseNode=" << mk_pp(baseNode, get_manager()) << ", node=" << mk_pp(node, get_manager()) << " [" << slevel << "]" << std::endl;); } else if (cut_var_map[baseNode].top()->level == slevel) { cut_var_map[baseNode].top()->vars.insert(node, 1); - TRACE("str", tout << "add var info for baseNode=" << mk_pp(baseNode, get_manager()) << ", node=" << mk_pp(node, get_manager()) << " [" << slevel << "]" << std::endl;); + TRACE(str, tout << "add var info for baseNode=" << mk_pp(baseNode, get_manager()) << ", node=" << mk_pp(node, get_manager()) << " [" << slevel << "]" << std::endl;); } else { get_manager().raise_exception("entered illegal state during add_cut_info_one_node()"); } @@ -413,7 +413,7 @@ namespace smt { cut_vars_map_copy(varInfo->vars, cut_var_map[srcNode].top()->vars); cut_var_map.insert(destNode, std::stack()); cut_var_map[destNode].push(varInfo); - TRACE("str", tout << "merge var info for destNode=" << mk_pp(destNode, get_manager()) << ", srcNode=" << mk_pp(srcNode, get_manager()) << " [" << slevel << "]" << std::endl;); + TRACE(str, tout << "merge var info for destNode=" << mk_pp(destNode, get_manager()) << ", srcNode=" << mk_pp(srcNode, get_manager()) << " [" << slevel << "]" << std::endl;); } else { if (cut_var_map[destNode].empty() || cut_var_map[destNode].top()->level < slevel) { T_cut * varInfo = alloc(T_cut); @@ -422,10 +422,10 @@ namespace smt { cut_vars_map_copy(varInfo->vars, cut_var_map[destNode].top()->vars); cut_vars_map_copy(varInfo->vars, cut_var_map[srcNode].top()->vars); cut_var_map[destNode].push(varInfo); - TRACE("str", tout << "merge var info for destNode=" << mk_pp(destNode, get_manager()) << ", srcNode=" << mk_pp(srcNode, get_manager()) << " [" << slevel << "]" << std::endl;); + TRACE(str, tout << "merge var info for destNode=" << mk_pp(destNode, get_manager()) << ", srcNode=" << mk_pp(srcNode, get_manager()) << " [" << slevel << "]" << std::endl;); } else if (cut_var_map[destNode].top()->level == slevel) { cut_vars_map_copy(cut_var_map[destNode].top()->vars, cut_var_map[srcNode].top()->vars); - TRACE("str", tout << "merge var info for destNode=" << mk_pp(destNode, get_manager()) << ", srcNode=" << mk_pp(srcNode, get_manager()) << " [" << slevel << "]" << std::endl;); + TRACE(str, tout << "merge var info for destNode=" << mk_pp(destNode, get_manager()) << ", srcNode=" << mk_pp(srcNode, get_manager()) << " [" << slevel << "]" << std::endl;); } else { get_manager().raise_exception("illegal state in add_cut_info_merge(): inconsistent slevels"); } @@ -479,7 +479,7 @@ namespace smt { app * theory_str::mk_int_var(std::string name) { ast_manager & m = get_manager(); - TRACE("str", tout << "creating integer variable " << name << " at scope level " << sLevel << std::endl;); + TRACE(str, tout << "creating integer variable " << name << " at scope level " << sLevel << std::endl;); sort * int_sort = m.mk_sort(m_autil.get_family_id(), INT_SORT); app * a = mk_fresh_const(name.c_str(), int_sort); @@ -501,13 +501,13 @@ namespace smt { app * theory_str::mk_str_var(std::string name) { - TRACE("str", tout << "creating string variable " << name << " at scope level " << sLevel << std::endl;); + TRACE(str, tout << "creating string variable " << name << " at scope level " << sLevel << std::endl;); sort * string_sort = u.str.mk_string_sort(); app * a = mk_fresh_const(name.c_str(), string_sort); m_trail.push_back(a); - TRACE("str", tout << "a->get_family_id() = " << a->get_family_id() << std::endl + TRACE(str, tout << "a->get_family_id() = " << a->get_family_id() << std::endl << "this->get_family_id() = " << this->get_family_id() << std::endl;); // I have a hunch that this may not get internalized for free... @@ -517,7 +517,7 @@ namespace smt { // this might help?? mk_var(ctx.get_enode(a)); m_basicstr_axiom_todo.push_back(ctx.get_enode(a)); - TRACE("str", tout << "add " << mk_pp(a, get_manager()) << " to m_basicstr_axiom_todo" << std::endl;); + TRACE(str, tout << "add " << mk_pp(a, get_manager()) << " to m_basicstr_axiom_todo" << std::endl;); variable_set.insert(a); internal_variable_set.insert(a); @@ -555,7 +555,7 @@ namespace smt { tmpStringVarCount++; std::string name = "$$_str" + ss.str(); - TRACE("str", tout << "creating nonempty string variable " << name << " at scope level " << sLevel << std::endl;); + TRACE(str, tout << "creating nonempty string variable " << name << " at scope level " << sLevel << std::endl;); sort * string_sort = u.str.mk_string_sort(); app_ref a(mk_fresh_const(name.c_str(), string_sort), m); @@ -767,7 +767,7 @@ namespace smt { void theory_str::propagate() { candidate_model.reset(); while (can_propagate()) { - TRACE("str", tout << "propagating..." << std::endl;); + TRACE(str, tout << "propagating..." << std::endl;); while(true) { // this can potentially recursively activate itself unsigned start_count = m_basicstr_axiom_todo.size(); @@ -777,14 +777,14 @@ namespace smt { } unsigned end_count = m_basicstr_axiom_todo.size(); if (end_count > start_count) { - TRACE("str", tout << "new basic string axiom terms added -- checking again" << std::endl;); + TRACE(str, tout << "new basic string axiom terms added -- checking again" << std::endl;); continue; } else { break; } } m_basicstr_axiom_todo.reset(); - TRACE("str", tout << "reset m_basicstr_axiom_todo" << std::endl;); + TRACE(str, tout << "reset m_basicstr_axiom_todo" << std::endl;); for (auto const& el : m_concat_axiom_todo) { instantiate_concat_axiom(el); @@ -835,13 +835,13 @@ namespace smt { } else if (u.str.is_to_code(a)) { instantiate_axiom_str_to_code(e); } else { - TRACE("str", tout << "BUG: unhandled library-aware term " << mk_pp(e->get_expr(), get_manager()) << std::endl;); + TRACE(str, tout << "BUG: unhandled library-aware term " << mk_pp(e->get_expr(), get_manager()) << std::endl;); NOT_IMPLEMENTED_YET(); } } unsigned end_count = m_library_aware_axiom_todo.size(); if (end_count > start_count) { - TRACE("str", tout << "new library-aware terms added during axiom setup -- checking again" << std::endl;); + TRACE(str, tout << "new library-aware terms added during axiom setup -- checking again" << std::endl;); continue; } else { break; @@ -887,7 +887,7 @@ namespace smt { ast_manager & m = get_manager(); - TRACE("str", tout << "attempting to flatten " << mk_pp(a_cat, m) << std::endl;); + TRACE(str, tout << "attempting to flatten " << mk_pp(a_cat, m) << std::endl;); std::stack worklist; zstring flattenedString(""); @@ -913,13 +913,13 @@ namespace smt { worklist.push(arg1); worklist.push(arg0); } else { - TRACE("str", tout << "non-constant term in concat -- giving up." << std::endl;); + TRACE(str, tout << "non-constant term in concat -- giving up." << std::endl;); constOK = false; break; } } if (constOK) { - TRACE("str", tout << "flattened to \"" << flattenedString.encode() << '"' << std::endl;); + TRACE(str, tout << "flattened to \"" << flattenedString.encode() << '"' << std::endl;); expr_ref constStr(mk_string(flattenedString), m); expr_ref axiom(ctx.mk_eq_atom(a_cat, constStr), m); assert_axiom(axiom); @@ -933,7 +933,7 @@ namespace smt { void theory_str::instantiate_concat_axiom(enode * cat) { ast_manager & m = get_manager(); app * a_cat = cat->get_expr(); - TRACE("str", tout << "instantiating concat axiom for " << mk_ismt2_pp(a_cat, m) << std::endl;); + TRACE(str, tout << "instantiating concat axiom for " << mk_ismt2_pp(a_cat, m) << std::endl;); if (!u.str.is_concat(a_cat)) { return; } @@ -977,20 +977,20 @@ namespace smt { void theory_str::instantiate_basic_string_axioms(enode * str) { ast_manager & m = get_manager(); - TRACE("str", tout << "set up basic string axioms on " << mk_pp(str->get_expr(), m) << std::endl;); + TRACE(str, tout << "set up basic string axioms on " << mk_pp(str->get_expr(), m) << std::endl;); { sort * a_sort = str->get_expr()->get_sort(); sort * str_sort = u.str.mk_string_sort(); if (a_sort != str_sort) { - TRACE("str", tout << "WARNING: not setting up string axioms on non-string term " << mk_pp(str->get_expr(), m) << std::endl;); + TRACE(str, tout << "WARNING: not setting up string axioms on non-string term " << mk_pp(str->get_expr(), m) << std::endl;); return; } } // TESTING: attempt to avoid a crash here when a variable goes out of scope if (str->get_iscope_lvl() > ctx.get_scope_level()) { - TRACE("str", tout << "WARNING: skipping axiom setup on out-of-scope string term" << std::endl;); + TRACE(str, tout << "WARNING: skipping axiom setup on out-of-scope string term" << std::endl;); return; } @@ -1004,7 +1004,7 @@ namespace smt { zstring strconst; u.str.is_string(str->get_expr(), strconst); - TRACE("str", tout << "instantiating constant string axioms for \"" << strconst.encode() << '"' << std::endl;); + TRACE(str, tout << "instantiating constant string axioms for \"" << strconst.encode() << '"' << std::endl;); unsigned int l = strconst.length(); expr_ref len(m_autil.mk_numeral(rational(l), true), m); @@ -1027,7 +1027,7 @@ namespace smt { // build LHS >= RHS and assert app * lhs_ge_rhs = m_autil.mk_ge(len_str, zero); SASSERT(lhs_ge_rhs); - TRACE("str", tout << "string axiom 1: " << mk_ismt2_pp(lhs_ge_rhs, m) << std::endl;); + TRACE(str, tout << "string axiom 1: " << mk_ismt2_pp(lhs_ge_rhs, m) << std::endl;); assert_axiom(lhs_ge_rhs); } @@ -1051,7 +1051,7 @@ namespace smt { rhs = ctx.mk_eq_atom(a_str, empty_str); SASSERT(rhs); // build LHS <=> RHS and assert - TRACE("str", tout << "string axiom 2: " << mk_ismt2_pp(lhs, m) << " <=> " << mk_ismt2_pp(rhs, m) << std::endl;); + TRACE(str, tout << "string axiom 2: " << mk_ismt2_pp(lhs, m) << " <=> " << mk_ismt2_pp(rhs, m) << std::endl;); literal l(mk_eq(lhs, rhs, true)); ctx.mark_as_relevant(l); if (m.has_trace_stream()) log_axiom_instantiation(ctx.bool_var2expr(l.var())); @@ -1082,7 +1082,7 @@ namespace smt { SASSERT(len_rhs); expr_ref conclusion(ctx.mk_eq_atom(len_lhs, len_rhs), m); - TRACE("str", tout << "string-eq length-eq axiom: " + TRACE(str, tout << "string-eq length-eq axiom: " << mk_ismt2_pp(premise, m) << " -> " << mk_ismt2_pp(conclusion, m) << std::endl;); assert_implication(premise, conclusion); } @@ -1092,13 +1092,13 @@ namespace smt { expr* arg0 = nullptr, *arg1 = nullptr; app * expr = e->get_expr(); if (axiomatized_terms.contains(expr)) { - TRACE("str", tout << "already set up CharAt axiom for " << mk_pp(expr, m) << std::endl;); + TRACE(str, tout << "already set up CharAt axiom for " << mk_pp(expr, m) << std::endl;); return; } axiomatized_terms.insert(expr); VERIFY(u.str.is_at(expr, arg0, arg1)); - TRACE("str", tout << "instantiate CharAt axiom for " << mk_pp(expr, m) << std::endl;); + TRACE(str, tout << "instantiate CharAt axiom for " << mk_pp(expr, m) << std::endl;); // change subvaribale names to solve some invalide model problems expr_ref ts0(mk_str_var("ch_ts0"), m); @@ -1128,12 +1128,12 @@ namespace smt { app * expr = e->get_expr(); if (axiomatized_terms.contains(expr)) { - TRACE("str", tout << "already set up prefixof axiom for " << mk_pp(expr, m) << std::endl;); + TRACE(str, tout << "already set up prefixof axiom for " << mk_pp(expr, m) << std::endl;); return; } axiomatized_terms.insert(expr); - TRACE("str", tout << "instantiate prefixof axiom for " << mk_pp(expr, m) << std::endl;); + TRACE(str, tout << "instantiate prefixof axiom for " << mk_pp(expr, m) << std::endl;); // change subvaribale names to solve some invalide model problems expr_ref ts0(mk_str_var("p_ts0"), m); @@ -1165,12 +1165,12 @@ namespace smt { app * expr = e->get_expr(); if (axiomatized_terms.contains(expr)) { - TRACE("str", tout << "already set up suffixof axiom for " << mk_pp(expr, m) << std::endl;); + TRACE(str, tout << "already set up suffixof axiom for " << mk_pp(expr, m) << std::endl;); return; } axiomatized_terms.insert(expr); - TRACE("str", tout << "instantiate suffixof axiom for " << mk_pp(expr, m) << std::endl;); + TRACE(str, tout << "instantiate suffixof axiom for " << mk_pp(expr, m) << std::endl;); // change subvaribale names to solve some invalide model problems expr_ref ts0(mk_str_var("s_ts0"), m); @@ -1202,7 +1202,7 @@ namespace smt { app * ex = e->get_expr(); if (axiomatized_terms.contains(ex)) { - TRACE("str", tout << "already set up Contains axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "already set up Contains axiom for " << mk_pp(ex, m) << std::endl;); return; } axiomatized_terms.insert(ex); @@ -1211,7 +1211,7 @@ namespace smt { // at minimum it should fix z3str/concat-006.smt2 zstring haystackStr, needleStr; if (u.str.is_string(ex->get_arg(0), haystackStr) && u.str.is_string(ex->get_arg(1), needleStr)) { - TRACE("str", tout << "eval constant Contains term " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "eval constant Contains term " << mk_pp(ex, m) << std::endl;); if (haystackStr.contains(needleStr)) { assert_axiom(ex); } else { @@ -1236,7 +1236,7 @@ namespace smt { contain_pair_idx_map[substr].insert(key); } - TRACE("str", tout << "instantiate Contains axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "instantiate Contains axiom for " << mk_pp(ex, m) << std::endl;); // change subvaribale names to solve some invalide model problems expr_ref ts0(mk_str_var("c_ts0"), m); @@ -1253,7 +1253,7 @@ namespace smt { app * ex = e->get_expr(); if (axiomatized_terms.contains(ex)) { - TRACE("str", tout << "already set up str.indexof axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "already set up str.indexof axiom for " << mk_pp(ex, m) << std::endl;); return; } SASSERT(ex->get_num_args() == 3); @@ -1267,7 +1267,7 @@ namespace smt { expr_ref rwex(ex, m); rw(rwex); if (m_autil.is_numeral(rwex)) { - TRACE("str", tout << "constant expression " << mk_pp(ex, m) << " simplifies to " << mk_pp(rwex, m) << std::endl;); + TRACE(str, tout << "constant expression " << mk_pp(ex, m) << " simplifies to " << mk_pp(rwex, m) << std::endl;); assert_axiom(ctx.mk_eq_atom(ex, rwex)); axiomatized_terms.insert(ex); return; @@ -1289,7 +1289,7 @@ namespace smt { } axiomatized_terms.insert(ex); - TRACE("str", tout << "instantiate str.indexof axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "instantiate str.indexof axiom for " << mk_pp(ex, m) << std::endl;); // change subvaribale names to solve some invalide model problems expr_ref x1(mk_str_var("i_x1"), m); @@ -1356,13 +1356,13 @@ namespace smt { app * e = _e->get_expr(); if (axiomatized_terms.contains(e)) { - TRACE("str", tout << "already set up extended str.indexof axiom for " << mk_pp(e, m) << std::endl;); + TRACE(str, tout << "already set up extended str.indexof axiom for " << mk_pp(e, m) << std::endl;); return; } SASSERT(e->get_num_args() == 3); axiomatized_terms.insert(e); - TRACE("str", tout << "instantiate extended str.indexof axiom for " << mk_pp(e, m) << std::endl;); + TRACE(str, tout << "instantiate extended str.indexof axiom for " << mk_pp(e, m) << std::endl;); // str.indexof(H, N, i): // i < 0 --> -1 @@ -1500,12 +1500,12 @@ namespace smt { app * expr = e->get_expr(); if (axiomatized_terms.contains(expr)) { - TRACE("str", tout << "already set up LastIndexof axiom for " << mk_pp(expr, m) << std::endl;); + TRACE(str, tout << "already set up LastIndexof axiom for " << mk_pp(expr, m) << std::endl;); return; } axiomatized_terms.insert(expr); - TRACE("str", tout << "instantiate LastIndexof axiom for " << mk_pp(expr, m) << std::endl;); + TRACE(str, tout << "instantiate LastIndexof axiom for " << mk_pp(expr, m) << std::endl;); // change subvaribale names to solve some invalide model problems expr_ref x1(mk_str_var("li_x1"), m); @@ -1573,12 +1573,12 @@ namespace smt { app * e = _e->get_expr(); if (axiomatized_terms.contains(e)) { - TRACE("str", tout << "already set up Substr axiom for " << mk_pp(e, m) << std::endl;); + TRACE(str, tout << "already set up Substr axiom for " << mk_pp(e, m) << std::endl;); return; } axiomatized_terms.insert(e); - TRACE("str", tout << "instantiate Substr axiom for " << mk_pp(e, m) << std::endl;); + TRACE(str, tout << "instantiate Substr axiom for " << mk_pp(e, m) << std::endl;); VERIFY(u.str.is_extract(e, s, i, l)); @@ -1691,12 +1691,12 @@ namespace smt { app * ex = e->get_expr(); if (axiomatized_terms.contains(ex)) { - TRACE("str", tout << "already set up Replace axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "already set up Replace axiom for " << mk_pp(ex, m) << std::endl;); return; } axiomatized_terms.insert(ex); - TRACE("str", tout << "instantiate Replace axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "instantiate Replace axiom for " << mk_pp(ex, m) << std::endl;); // change subvaribale names to solve some invalide model problems expr_ref x1(mk_str_var("rp_x1"), m); @@ -1750,12 +1750,12 @@ namespace smt { app * ex = e->get_expr(); if (axiomatized_terms.contains(ex)) { - TRACE("str", tout << "already set up str.to-int axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "already set up str.to-int axiom for " << mk_pp(ex, m) << std::endl;); return; } axiomatized_terms.insert(ex); - TRACE("str", tout << "instantiate str.to-int axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "instantiate str.to-int axiom for " << mk_pp(ex, m) << std::endl;); // let expr = (str.to-int S) // axiom 1: expr >= -1 @@ -1800,12 +1800,12 @@ namespace smt { app * ex = e->get_expr(); if (axiomatized_terms.contains(ex)) { - TRACE("str", tout << "already set up str.from-int axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "already set up str.from-int axiom for " << mk_pp(ex, m) << std::endl;); return; } axiomatized_terms.insert(ex); - TRACE("str", tout << "instantiate str.from-int axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "instantiate str.from-int axiom for " << mk_pp(ex, m) << std::endl;); // axiom 1: N < 0 <==> (str.from-int N) = "" expr * N = ex->get_arg(0); @@ -1835,12 +1835,12 @@ namespace smt { app * ex = e->get_expr(); if (axiomatized_terms.contains(ex)) { - TRACE("str", tout << "already set up str.is_digit axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "already set up str.is_digit axiom for " << mk_pp(ex, m) << std::endl;); return; } axiomatized_terms.insert(ex); - TRACE("str", tout << "instantiate str.is_digit axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "instantiate str.is_digit axiom for " << mk_pp(ex, m) << std::endl;); expr * string_term = nullptr; u.str.is_is_digit(ex, string_term); SASSERT(string_term); @@ -1863,11 +1863,11 @@ namespace smt { app * ex = e->get_expr(); if (axiomatized_terms.contains(ex)) { - TRACE("str", tout << "already set up str.from_code axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "already set up str.from_code axiom for " << mk_pp(ex, m) << std::endl;); return; } axiomatized_terms.insert(ex); - TRACE("str", tout << "instantiate str.from_code axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "instantiate str.from_code axiom for " << mk_pp(ex, m) << std::endl;); expr * arg = nullptr; VERIFY(u.str.is_from_code(ex, arg)); @@ -1899,11 +1899,11 @@ namespace smt { app * ex = e->get_expr(); if (axiomatized_terms.contains(ex)) { - TRACE("str", tout << "already set up str.to_code axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "already set up str.to_code axiom for " << mk_pp(ex, m) << std::endl;); return; } axiomatized_terms.insert(ex); - TRACE("str", tout << "instantiate str.to_code axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "instantiate str.to_code axiom for " << mk_pp(ex, m) << std::endl;); expr * arg = nullptr; VERIFY(u.str.is_to_code(ex, arg)); @@ -1936,12 +1936,12 @@ namespace smt { app * ex = e->get_expr(); if (axiomatized_terms.contains(ex)) { - TRACE("str", tout << "already set up RegexIn axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "already set up RegexIn axiom for " << mk_pp(ex, m) << std::endl;); return; } axiomatized_terms.insert(ex); - TRACE("str", tout << "instantiate RegexIn axiom for " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "instantiate RegexIn axiom for " << mk_pp(ex, m) << std::endl;); expr_ref str(ex->get_arg(0), m); @@ -1955,11 +1955,11 @@ namespace smt { void theory_str::attach_new_th_var(enode * n) { theory_var v = mk_var(n); ctx.attach_th_var(n, this, v); - TRACE("str", tout << "new theory var: " << mk_ismt2_pp(n->get_expr(), get_manager()) << " := v#" << v << std::endl;); + TRACE(str, tout << "new theory var: " << mk_ismt2_pp(n->get_expr(), get_manager()) << " := v#" << v << std::endl;); } void theory_str::reset_eh() { - TRACE("str", tout << "resetting" << std::endl;); + TRACE(str, tout << "resetting" << std::endl;); m_trail_stack.reset(); m_library_aware_trail_stack.reset(); @@ -1997,19 +1997,19 @@ namespace smt { do { expr * eqc_nn2 = rhs; do { - TRACE("str", tout << "checking whether " << mk_pp(eqc_nn1, m) << " and " << mk_pp(eqc_nn2, m) << " can be equal" << std::endl;); + TRACE(str, tout << "checking whether " << mk_pp(eqc_nn1, m) << " and " << mk_pp(eqc_nn2, m) << " can be equal" << std::endl;); // inconsistency check: value if (!can_two_nodes_eq(eqc_nn1, eqc_nn2)) { - TRACE("str", tout << "inconsistency detected: " << mk_pp(eqc_nn1, m) << " cannot be equal to " << mk_pp(eqc_nn2, m) << std::endl;); + TRACE(str, tout << "inconsistency detected: " << mk_pp(eqc_nn1, m) << " cannot be equal to " << mk_pp(eqc_nn2, m) << std::endl;); expr_ref to_assert(mk_not(m, m.mk_eq(eqc_nn1, eqc_nn2)), m); assert_axiom(to_assert); // this shouldn't use the integer theory at all, so we don't allow the option of quick-return return false; } if (!check_length_consistency(eqc_nn1, eqc_nn2)) { - TRACE("str", tout << "inconsistency detected: " << mk_pp(eqc_nn1, m) << " and " << mk_pp(eqc_nn2, m) << " have inconsistent lengths" << std::endl;); + TRACE(str, tout << "inconsistency detected: " << mk_pp(eqc_nn1, m) << " and " << mk_pp(eqc_nn2, m) << " have inconsistent lengths" << std::endl;); if (opt_NoQuickReturn_IntegerTheory){ - TRACE("str", tout << "continuing in new_eq_check() due to opt_NoQuickReturn_IntegerTheory" << std::endl;); + TRACE(str, tout << "continuing in new_eq_check() due to opt_NoQuickReturn_IntegerTheory" << std::endl;); } else { return false; } @@ -2149,7 +2149,7 @@ namespace smt { void theory_str::simplify_parent(expr * nn, expr * eq_str) { ast_manager & m = get_manager(); - TRACE("str", tout << "simplifying parents of " << mk_ismt2_pp(nn, m) + TRACE(str, tout << "simplifying parents of " << mk_ismt2_pp(nn, m) << " with respect to " << mk_ismt2_pp(eq_str, m) << std::endl;); ctx.internalize(nn, false); @@ -2159,7 +2159,7 @@ namespace smt { expr * n_eqNode = nn; do { enode * n_eq_enode = ctx.get_enode(n_eqNode); - TRACE("str", tout << "considering all parents of " << mk_ismt2_pp(n_eqNode, m) << std::endl + TRACE(str, tout << "considering all parents of " << mk_ismt2_pp(n_eqNode, m) << std::endl << "associated n_eq_enode has " << n_eq_enode->get_num_parents() << " parents" << std::endl;); // the goal of this next bit is to avoid dereferencing a bogus e_parent in the following loop. @@ -2175,7 +2175,7 @@ namespace smt { SASSERT(e_parent != nullptr); app * a_parent = e_parent->get_expr(); - TRACE("str", tout << "considering parent " << mk_ismt2_pp(a_parent, m) << std::endl;); + TRACE(str, tout << "considering parent " << mk_ismt2_pp(a_parent, m) << std::endl;); if (u.str.is_concat(a_parent)) { expr * arg0 = a_parent->get_arg(0); @@ -2189,7 +2189,7 @@ namespace smt { bool arg0Len_exists = get_len_value(eq_str, arg0Len); bool arg1Len_exists = get_len_value(arg1, arg1Len); - TRACE("str", + TRACE(str, tout << "simplify_parent #1:" << std::endl << "* parent = " << mk_ismt2_pp(a_parent, m) << std::endl << "* |parent| = " << rational_to_string_if_exists(parentLen, parentLen_exists) << std::endl @@ -2198,7 +2198,7 @@ namespace smt { ); (void)arg0Len_exists; if (parentLen_exists && !arg1Len_exists) { - TRACE("str", tout << "make up len for arg1" << std::endl;); + TRACE(str, tout << "make up len for arg1" << std::endl;); expr_ref implyL11(m.mk_and(ctx.mk_eq_atom(mk_strlen(a_parent), mk_int(parentLen)), ctx.mk_eq_atom(mk_strlen(arg0), mk_int(arg0Len))), m); rational makeUpLenArg1 = parentLen - arg0Len; @@ -2260,7 +2260,7 @@ namespace smt { bool arg0Len_exists = get_len_value(arg0, arg0Len); bool arg1Len_exists = get_len_value(eq_str, arg1Len); - TRACE("str", + TRACE(str, tout << "simplify_parent #2:" << std::endl << "* parent = " << mk_ismt2_pp(a_parent, m) << std::endl << "* |parent| = " << rational_to_string_if_exists(parentLen, parentLen_exists) << std::endl @@ -2269,7 +2269,7 @@ namespace smt { ); (void)arg1Len_exists; if (parentLen_exists && !arg0Len_exists) { - TRACE("str", tout << "make up len for arg0" << std::endl;); + TRACE(str, tout << "make up len for arg0" << std::endl;); expr_ref implyL11(m.mk_and(ctx.mk_eq_atom(mk_strlen(a_parent), mk_int(parentLen)), ctx.mk_eq_atom(mk_strlen(arg1), mk_int(arg1Len))), m); rational makeUpLenArg0 = parentLen - arg1Len; @@ -2330,7 +2330,7 @@ namespace smt { // Case (2-1) begin: (Concat n_eqNode (Concat str var)) if (arg0 == n_eqNode && u.str.is_concat(to_app(arg1))) { app * a_arg1 = to_app(arg1); - TRACE("str", tout << "simplify_parent #3" << std::endl;); + TRACE(str, tout << "simplify_parent #3" << std::endl;); expr * r_concat_arg0 = a_arg1->get_arg(0); if (u.str.is_string(r_concat_arg0)) { expr * combined_str = eval_concat(eq_str, r_concat_arg0); @@ -2354,7 +2354,7 @@ namespace smt { // Case (2-2) begin: (Concat (Concat var str) n_eqNode) if (u.str.is_concat(to_app(arg0)) && arg1 == n_eqNode) { app * a_arg0 = to_app(arg0); - TRACE("str", tout << "simplify_parent #4" << std::endl;); + TRACE(str, tout << "simplify_parent #4" << std::endl;); expr * l_concat_arg1 = a_arg0->get_arg(1); if (u.str.is_string(l_concat_arg1)) { expr * combined_str = eval_concat(l_concat_arg1, eq_str); @@ -2387,7 +2387,7 @@ namespace smt { expr * concat_parent_arg0 = concat_parent->get_arg(0); expr * concat_parent_arg1 = concat_parent->get_arg(1); if (concat_parent_arg0 == a_parent && u.str.is_string(concat_parent_arg1)) { - TRACE("str", tout << "simplify_parent #5" << std::endl;); + TRACE(str, tout << "simplify_parent #5" << std::endl;); expr * combinedStr = eval_concat(eq_str, concat_parent_arg1); SASSERT(combinedStr); expr_ref implyL(m); @@ -2415,7 +2415,7 @@ namespace smt { expr * concat_parent_arg0 = concat_parent->get_arg(0); expr * concat_parent_arg1 = concat_parent->get_arg(1); if (concat_parent_arg1 == a_parent && u.str.is_string(concat_parent_arg0)) { - TRACE("str", tout << "simplify_parent #6" << std::endl;); + TRACE(str, tout << "simplify_parent #6" << std::endl;); expr * combinedStr = eval_concat(concat_parent_arg0, eq_str); SASSERT(combinedStr); expr_ref implyL(m); @@ -2464,10 +2464,10 @@ namespace smt { expr * vArg = get_eqc_value(argVec[i], vArgHasEqcValue); resultAst = mk_concat(resultAst, vArg); } - TRACE("str", tout << mk_ismt2_pp(node, m) << " is simplified to " << mk_ismt2_pp(resultAst, m) << std::endl;); + TRACE(str, tout << mk_ismt2_pp(node, m) << " is simplified to " << mk_ismt2_pp(resultAst, m) << std::endl;); if (in_same_eqc(node, resultAst)) { - TRACE("str", tout << "SKIP: both concats are already in the same equivalence class" << std::endl;); + TRACE(str, tout << "SKIP: both concats are already in the same equivalence class" << std::endl;); } else { expr_ref_vector items(m); for (auto itor : resolvedMap) { @@ -2512,7 +2512,7 @@ namespace smt { expr_ref axl(m.mk_and(l_items.size(), l_items.data()), m); rational nnLen = arg0_len + arg1_len; expr_ref axr(ctx.mk_eq_atom(mk_strlen(n), mk_int(nnLen)), m); - TRACE("str", tout << "inferred (Length " << mk_pp(n, m) << ") = " << nnLen << std::endl;); + TRACE(str, tout << "inferred (Length " << mk_pp(n, m) << ") = " << nnLen << std::endl;); assert_implication(axl, axr); nLen = nnLen; return true; @@ -2686,10 +2686,10 @@ namespace smt { bool a2_arg0_len_exists = get_len_value(a2_arg0, a2_arg0_len); bool a2_arg1_len_exists = get_len_value(a2_arg1, a2_arg1_len); - TRACE("str", tout << "nn1 = " << mk_ismt2_pp(nn1, m) << std::endl + TRACE(str, tout << "nn1 = " << mk_ismt2_pp(nn1, m) << std::endl << "nn2 = " << mk_ismt2_pp(nn2, m) << std::endl;); - TRACE("str", tout + TRACE(str, tout << "len(" << mk_pp(a1_arg0, m) << ") = " << (a1_arg0_len_exists ? a1_arg0_len.to_string() : "?") << std::endl << "len(" << mk_pp(a1_arg1, m) << ") = " << (a1_arg1_len_exists ? a1_arg1_len.to_string() : "?") << std::endl << "len(" << mk_pp(a2_arg0, m) << ") = " << (a2_arg0_len_exists ? a2_arg0_len.to_string() : "?") << std::endl @@ -2706,7 +2706,7 @@ namespace smt { expr_ref conclusion(m.mk_and(eq1, eq2), m); assert_implication(premise, conclusion); } - TRACE("str", tout << "SKIP: a1_arg0 == a2_arg0" << std::endl;); + TRACE(str, tout << "SKIP: a1_arg0 == a2_arg0" << std::endl;); return; } @@ -2718,7 +2718,7 @@ namespace smt { expr_ref conclusion(m.mk_and(eq1, eq2), m); assert_implication(premise, conclusion); } - TRACE("str", tout << "SKIP: a1_arg1 == a2_arg1" << std::endl;); + TRACE(str, tout << "SKIP: a1_arg1 == a2_arg1" << std::endl;); return; } @@ -2726,10 +2726,10 @@ namespace smt { if (in_same_eqc(a1_arg0, a2_arg0)) { if (in_same_eqc(a1_arg1, a2_arg1)) { - TRACE("str", tout << "SKIP: a1_arg0 =~ a2_arg0 and a1_arg1 =~ a2_arg1" << std::endl;); + TRACE(str, tout << "SKIP: a1_arg0 =~ a2_arg0 and a1_arg1 =~ a2_arg1" << std::endl;); return; } else { - TRACE("str", tout << "quick path 1-1: a1_arg0 =~ a2_arg0" << std::endl;); + TRACE(str, tout << "quick path 1-1: a1_arg0 =~ a2_arg0" << std::endl;); expr_ref premise(m.mk_and(ctx.mk_eq_atom(nn1, nn2), ctx.mk_eq_atom(a1_arg0, a2_arg0)), m); expr_ref conclusion(m.mk_and(ctx.mk_eq_atom(a1_arg1, a2_arg1), ctx.mk_eq_atom(mk_strlen(a1_arg1), mk_strlen(a2_arg1))), m); assert_implication(premise, conclusion); @@ -2737,7 +2737,7 @@ namespace smt { } } else { if (in_same_eqc(a1_arg1, a2_arg1)) { - TRACE("str", tout << "quick path 1-2: a1_arg1 =~ a2_arg1" << std::endl;); + TRACE(str, tout << "quick path 1-2: a1_arg1 =~ a2_arg1" << std::endl;); expr_ref premise(m.mk_and(ctx.mk_eq_atom(nn1, nn2), ctx.mk_eq_atom(a1_arg1, a2_arg1)), m); expr_ref conclusion(m.mk_and(ctx.mk_eq_atom(a1_arg0, a2_arg0), ctx.mk_eq_atom(mk_strlen(a1_arg0), mk_strlen(a2_arg0))), m); assert_implication(premise, conclusion); @@ -2748,7 +2748,7 @@ namespace smt { // quick path 2-1 if (a1_arg0_len_exists && a2_arg0_len_exists && a1_arg0_len == a2_arg0_len) { if (!in_same_eqc(a1_arg0, a2_arg0)) { - TRACE("str", tout << "quick path 2-1: len(nn1.arg0) == len(nn2.arg0)" << std::endl;); + TRACE(str, tout << "quick path 2-1: len(nn1.arg0) == len(nn2.arg0)" << std::endl;); expr_ref ax_l1(ctx.mk_eq_atom(nn1, nn2), m); expr_ref ax_l2(ctx.mk_eq_atom(mk_strlen(a1_arg0), mk_strlen(a2_arg0)), m); expr_ref ax_r1(ctx.mk_eq_atom(a1_arg0, a2_arg0), m); @@ -2760,7 +2760,7 @@ namespace smt { assert_implication(premise, conclusion); if (opt_NoQuickReturn_IntegerTheory) { - TRACE("str", tout << "bypassing quick return from the end of this case" << std::endl;); + TRACE(str, tout << "bypassing quick return from the end of this case" << std::endl;); } else { return; } @@ -2769,7 +2769,7 @@ namespace smt { if (a1_arg1_len_exists && a2_arg1_len_exists && a1_arg1_len == a2_arg1_len) { if (!in_same_eqc(a1_arg1, a2_arg1)) { - TRACE("str", tout << "quick path 2-2: len(nn1.arg1) == len(nn2.arg1)" << std::endl;); + TRACE(str, tout << "quick path 2-2: len(nn1.arg1) == len(nn2.arg1)" << std::endl;); expr_ref ax_l1(ctx.mk_eq_atom(nn1, nn2), m); expr_ref ax_l2(ctx.mk_eq_atom(mk_strlen(a1_arg1), mk_strlen(a2_arg1)), m); expr_ref ax_r1(ctx.mk_eq_atom(a1_arg0, a2_arg0), m); @@ -2780,7 +2780,7 @@ namespace smt { assert_implication(premise, conclusion); if (opt_NoQuickReturn_IntegerTheory) { - TRACE("str", tout << "bypassing quick return from the end of this case" << std::endl;); + TRACE(str, tout << "bypassing quick return from the end of this case" << std::endl;); } else { return; } @@ -2792,17 +2792,17 @@ namespace smt { app * a_new_nn1 = to_app(new_nn1); app * a_new_nn2 = to_app(new_nn2); - TRACE("str", tout << "new_nn1 = " << mk_ismt2_pp(new_nn1, m) << std::endl + TRACE(str, tout << "new_nn1 = " << mk_ismt2_pp(new_nn1, m) << std::endl << "new_nn2 = " << mk_ismt2_pp(new_nn2, m) << std::endl;); if (new_nn1 == new_nn2) { - TRACE("str", tout << "equal concats, return" << std::endl;); + TRACE(str, tout << "equal concats, return" << std::endl;); return; } if (!can_two_nodes_eq(new_nn1, new_nn2)) { expr_ref detected(mk_not(m, ctx.mk_eq_atom(new_nn1, new_nn2)), m); - TRACE("str", tout << "inconsistency detected: " << mk_ismt2_pp(detected, m) << std::endl;); + TRACE(str, tout << "inconsistency detected: " << mk_ismt2_pp(detected, m) << std::endl;); assert_axiom(detected); return; } @@ -2812,13 +2812,13 @@ namespace smt { bool n1IsConcat = u.str.is_concat(a_new_nn1); bool n2IsConcat = u.str.is_concat(a_new_nn2); if (!n1IsConcat && n2IsConcat) { - TRACE("str", tout << "nn1_new is not a concat" << std::endl;); + TRACE(str, tout << "nn1_new is not a concat" << std::endl;); if (u.str.is_string(a_new_nn1)) { simplify_parent(new_nn2, new_nn1); } return; } else if (n1IsConcat && !n2IsConcat) { - TRACE("str", tout << "nn2_new is not a concat" << std::endl;); + TRACE(str, tout << "nn2_new is not a concat" << std::endl;); if (u.str.is_string(a_new_nn2)) { simplify_parent(new_nn1, new_nn2); } @@ -2826,7 +2826,7 @@ namespace smt { } else if (!n1IsConcat && !n2IsConcat) { // normally this should never happen, because group_terms_by_eqc() should have pre-simplified // as much as possible. however, we make a defensive check here just in case - TRACE("str", tout << "WARNING: nn1_new and nn2_new both simplify to non-concat terms" << std::endl;); + TRACE(str, tout << "WARNING: nn1_new and nn2_new both simplify to non-concat terms" << std::endl;); return; } @@ -2929,7 +2929,7 @@ namespace smt { expr * v2_arg0 = a_new_nn2->get_arg(0); expr * v2_arg1 = a_new_nn2->get_arg(1); - TRACE("str", tout << "checking whether " << mk_pp(new_nn1, m) << " and " << mk_pp(new_nn1, m) << " might overlap." << std::endl;); + TRACE(str, tout << "checking whether " << mk_pp(new_nn1, m) << " and " << mk_pp(new_nn1, m) << " might overlap." << std::endl;); check_and_init_cut_var(v1_arg0); check_and_init_cut_var(v1_arg1); @@ -2940,17 +2940,17 @@ namespace smt { // case 1: concat(x, y) = concat(m, n) //************************************************************* if (is_concat_eq_type1(new_nn1, new_nn2)) { - TRACE("str", tout << "Type 1 check." << std::endl;); + TRACE(str, tout << "Type 1 check." << std::endl;); expr * x = to_app(new_nn1)->get_arg(0); expr * y = to_app(new_nn1)->get_arg(1); expr * m = to_app(new_nn2)->get_arg(0); expr * n = to_app(new_nn2)->get_arg(1); if (has_self_cut(m, y)) { - TRACE("str", tout << "Possible overlap found" << std::endl; print_cut_var(m, tout); print_cut_var(y, tout);); + TRACE(str, tout << "Possible overlap found" << std::endl; print_cut_var(m, tout); print_cut_var(y, tout);); return true; } else if (has_self_cut(x, n)) { - TRACE("str", tout << "Possible overlap found" << std::endl; print_cut_var(x, tout); print_cut_var(n, tout);); + TRACE(str, tout << "Possible overlap found" << std::endl; print_cut_var(x, tout); print_cut_var(n, tout);); return true; } else { return false; @@ -2978,7 +2978,7 @@ namespace smt { } if (has_self_cut(m, y)) { - TRACE("str", tout << "Possible overlap found" << std::endl; print_cut_var(m, tout); print_cut_var(y, tout);); + TRACE(str, tout << "Possible overlap found" << std::endl; print_cut_var(m, tout); print_cut_var(y, tout);); return true; } else { return false; @@ -3005,7 +3005,7 @@ namespace smt { x = v1_arg0; } if (has_self_cut(x, n)) { - TRACE("str", tout << "Possible overlap found" << std::endl; print_cut_var(x, tout); print_cut_var(n, tout);); + TRACE(str, tout << "Possible overlap found" << std::endl; print_cut_var(x, tout); print_cut_var(n, tout);); return true; } else { return false; @@ -3047,14 +3047,14 @@ namespace smt { m = v1_arg0; } if (has_self_cut(m, y)) { - TRACE("str", tout << "Possible overlap found" << std::endl; print_cut_var(m, tout); print_cut_var(y, tout);); + TRACE(str, tout << "Possible overlap found" << std::endl; print_cut_var(m, tout); print_cut_var(y, tout);); return true; } else { return false; } } - TRACE("str", tout << "warning: unrecognized concat case" << std::endl;); + TRACE(str, tout << "warning: unrecognized concat case" << std::endl;); return false; } @@ -3080,17 +3080,17 @@ namespace smt { bool overlapAssumptionUsed = false; - TRACE("str", tout << "process_concat_eq TYPE 1" << std::endl + TRACE(str, tout << "process_concat_eq TYPE 1" << std::endl << "concatAst1 = " << mk_ismt2_pp(concatAst1, mgr) << std::endl << "concatAst2 = " << mk_ismt2_pp(concatAst2, mgr) << std::endl; ); if (!u.str.is_concat(to_app(concatAst1))) { - TRACE("str", tout << "concatAst1 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst1 is not a concat function" << std::endl;); return; } if (!u.str.is_concat(to_app(concatAst2))) { - TRACE("str", tout << "concatAst2 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst2 is not a concat function" << std::endl;); return; } expr * x = to_app(concatAst1)->get_arg(0); @@ -3106,7 +3106,7 @@ namespace smt { int splitType = -1; if (x_len_exists && m_len_exists) { - TRACE("str", tout << "length values found: x/m" << std::endl;); + TRACE(str, tout << "length values found: x/m" << std::endl;); if (x_len < m_len) { splitType = 0; } else if (x_len == m_len) { @@ -3117,7 +3117,7 @@ namespace smt { } if (splitType == -1 && y_len_exists && n_len_exists) { - TRACE("str", tout << "length values found: y/n" << std::endl;); + TRACE(str, tout << "length values found: y/n" << std::endl;); if (y_len > n_len) { splitType = 0; } else if (y_len == n_len) { @@ -3127,7 +3127,7 @@ namespace smt { } } - TRACE("str", tout + TRACE(str, tout << "len(x) = " << (x_len_exists ? x_len.to_string() : "?") << std::endl << "len(y) = " << (y_len_exists ? y_len.to_string() : "?") << std::endl << "len(m) = " << (m_len_exists ? m_len.to_string() : "?") << std::endl @@ -3173,7 +3173,7 @@ namespace smt { } } - TRACE("str", tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl + TRACE(str, tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl << "entry 2 " << (entry2InScope ? "in scope" : "not in scope") << std::endl;); if (!entry1InScope && !entry2InScope) { @@ -3248,8 +3248,8 @@ namespace smt { } } else { loopDetected = true; - TRACE("str", tout << "AVOID LOOP: SKIPPED" << std::endl;); - TRACE("str", {print_cut_var(m, tout); print_cut_var(y, tout);}); + TRACE(str, tout << "AVOID LOOP: SKIPPED" << std::endl;); + TRACE(str, {print_cut_var(m, tout); print_cut_var(y, tout);}); if (!overlapAssumptionUsed) { overlapAssumptionUsed = true; @@ -3310,8 +3310,8 @@ namespace smt { } else { loopDetected = true; - TRACE("str", tout << "AVOID LOOP: SKIPPED" << std::endl;); - TRACE("str", {print_cut_var(m, tout); print_cut_var(y, tout);}); + TRACE(str, tout << "AVOID LOOP: SKIPPED" << std::endl;); + TRACE(str, {print_cut_var(m, tout); print_cut_var(y, tout);}); if (!overlapAssumptionUsed) { overlapAssumptionUsed = true; @@ -3366,8 +3366,8 @@ namespace smt { } else { loopDetected = true; - TRACE("str", tout << "AVOID LOOP: SKIPPED" << std::endl;); - TRACE("str", {print_cut_var(m, tout); print_cut_var(y, tout);}); + TRACE(str, tout << "AVOID LOOP: SKIPPED" << std::endl;); + TRACE(str, {print_cut_var(m, tout); print_cut_var(y, tout);}); if (!overlapAssumptionUsed) { overlapAssumptionUsed = true; @@ -3415,8 +3415,8 @@ namespace smt { } else { loopDetected = true; - TRACE("str", tout << "AVOID LOOP: SKIPPED" << std::endl;); - TRACE("str", {print_cut_var(x, tout); print_cut_var(n, tout);}); + TRACE(str, tout << "AVOID LOOP: SKIPPED" << std::endl;); + TRACE(str, {print_cut_var(x, tout); print_cut_var(n, tout);}); if (!overlapAssumptionUsed) { overlapAssumptionUsed = true; @@ -3457,7 +3457,7 @@ namespace smt { // assert mutual exclusion between each branch of the arrangement generate_mutual_exclusion(arrangement_disjunction); } else { - TRACE("str", tout << "STOP: no split option found for two EQ concats." << std::endl;); + TRACE(str, tout << "STOP: no split option found for two EQ concats." << std::endl;); } } // (splitType == -1) } @@ -3487,17 +3487,17 @@ namespace smt { bool overlapAssumptionUsed = false; - TRACE("str", tout << "process_concat_eq TYPE 2" << std::endl + TRACE(str, tout << "process_concat_eq TYPE 2" << std::endl << "concatAst1 = " << mk_ismt2_pp(concatAst1, mgr) << std::endl << "concatAst2 = " << mk_ismt2_pp(concatAst2, mgr) << std::endl; ); if (!u.str.is_concat(to_app(concatAst1))) { - TRACE("str", tout << "concatAst1 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst1 is not a concat function" << std::endl;); return; } if (!u.str.is_concat(to_app(concatAst2))) { - TRACE("str", tout << "concatAst2 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst2 is not a concat function" << std::endl;); return; } @@ -3574,7 +3574,7 @@ namespace smt { } } - TRACE("str", tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl + TRACE(str, tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl << "entry 2 " << (entry2InScope ? "in scope" : "not in scope") << std::endl;); @@ -3613,7 +3613,7 @@ namespace smt { splitType = 2; } - TRACE("str", tout << "Split type " << splitType << std::endl;); + TRACE(str, tout << "Split type " << splitType << std::endl;); // Provide fewer split options when length information is available. @@ -3660,8 +3660,8 @@ namespace smt { } else { loopDetected = true; - TRACE("str", tout << "AVOID LOOP: SKIP" << std::endl;); - TRACE("str", {print_cut_var(m, tout); print_cut_var(y, tout);}); + TRACE(str, tout << "AVOID LOOP: SKIP" << std::endl;); + TRACE(str, {print_cut_var(m, tout); print_cut_var(y, tout);}); if (!overlapAssumptionUsed) { overlapAssumptionUsed = true; @@ -3699,7 +3699,7 @@ namespace smt { l_items.push_back(ctx.mk_eq_atom(mk_strlen(y), mk_int(y_len))); lenDelta = str_len - y_len; } - TRACE("str", + TRACE(str, tout << "xLen? " << (x_len_exists ? "yes" : "no") << std::endl << "mLen? " << (m_len_exists ? "yes" : "no") << std::endl @@ -3735,7 +3735,7 @@ namespace smt { } } else { // negate! It's impossible to split str with these lengths - TRACE("str", tout << "CONFLICT: Impossible to split str with these lengths." << std::endl;); + TRACE(str, tout << "CONFLICT: Impossible to split str with these lengths." << std::endl;); expr_ref ax_l(mk_and(l_items), mgr); assert_axiom(mgr.mk_not(ax_l)); } @@ -3765,8 +3765,8 @@ namespace smt { add_cut_info_merge(temp1, ctx.get_scope_level(), m); } else { loopDetected = true; - TRACE("str", tout << "AVOID LOOP: SKIPPED" << std::endl;); - TRACE("str", {print_cut_var(m, tout); print_cut_var(y, tout);}); + TRACE(str, tout << "AVOID LOOP: SKIPPED" << std::endl;); + TRACE(str, {print_cut_var(m, tout); print_cut_var(y, tout);}); if (!overlapAssumptionUsed) { overlapAssumptionUsed = true; @@ -3816,7 +3816,7 @@ namespace smt { } generate_mutual_exclusion(arrangement_disjunction); } else { - TRACE("str", tout << "STOP: Should not split two EQ concats." << std::endl;); + TRACE(str, tout << "STOP: Should not split two EQ concats." << std::endl;); } } // (splitType == -1) } @@ -3846,17 +3846,17 @@ namespace smt { bool overlapAssumptionUsed = false; - TRACE("str", tout << "process_concat_eq TYPE 3" << std::endl + TRACE(str, tout << "process_concat_eq TYPE 3" << std::endl << "concatAst1 = " << mk_ismt2_pp(concatAst1, mgr) << std::endl << "concatAst2 = " << mk_ismt2_pp(concatAst2, mgr) << std::endl; ); if (!u.str.is_concat(to_app(concatAst1))) { - TRACE("str", tout << "concatAst1 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst1 is not a concat function" << std::endl;); return; } if (!u.str.is_concat(to_app(concatAst2))) { - TRACE("str", tout << "concatAst2 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst2 is not a concat function" << std::endl;); return; } @@ -3926,7 +3926,7 @@ namespace smt { } } - TRACE("str", tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl + TRACE(str, tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl << "entry 2 " << (entry2InScope ? "in scope" : "not in scope") << std::endl;); @@ -3968,7 +3968,7 @@ namespace smt { splitType = 2; } - TRACE("str", tout << "Split type " << splitType << std::endl;); + TRACE(str, tout << "Split type " << splitType << std::endl;); // Provide fewer split options when length information is available. if (splitType == 0) { @@ -4006,7 +4006,7 @@ namespace smt { } } else { // negate! It's impossible to split str with these lengths - TRACE("str", tout << "CONFLICT: Impossible to split str with these lengths." << std::endl;); + TRACE(str, tout << "CONFLICT: Impossible to split str with these lengths." << std::endl;); assert_axiom(mgr.mk_not(ax_l)); } } @@ -4064,8 +4064,8 @@ namespace smt { } } else { loopDetected = true; - TRACE("str", tout << "AVOID LOOP: SKIPPED" << std::endl;); - TRACE("str", {print_cut_var(x, tout); print_cut_var(n, tout);}); + TRACE(str, tout << "AVOID LOOP: SKIPPED" << std::endl;); + TRACE(str, {print_cut_var(x, tout); print_cut_var(n, tout);}); if (!overlapAssumptionUsed) { overlapAssumptionUsed = true; @@ -4148,8 +4148,8 @@ namespace smt { add_cut_info_merge(temp1, sLevel, n); } else { loopDetected = true; - TRACE("str", tout << "AVOID LOOP: SKIPPED." << std::endl;); - TRACE("str", {print_cut_var(x, tout); print_cut_var(n, tout);}); + TRACE(str, tout << "AVOID LOOP: SKIPPED." << std::endl;); + TRACE(str, {print_cut_var(x, tout); print_cut_var(n, tout);}); if (!overlapAssumptionUsed) { overlapAssumptionUsed = true; @@ -4175,7 +4175,7 @@ namespace smt { } generate_mutual_exclusion(arrangement_disjunction); } else { - TRACE("str", tout << "STOP: should not split two eq. concats" << std::endl;); + TRACE(str, tout << "STOP: should not split two eq. concats" << std::endl;); } } @@ -4200,17 +4200,17 @@ namespace smt { void theory_str::process_concat_eq_type4(expr * concatAst1, expr * concatAst2) { ast_manager & mgr = get_manager(); - TRACE("str", tout << "process_concat_eq TYPE 4" << std::endl + TRACE(str, tout << "process_concat_eq TYPE 4" << std::endl << "concatAst1 = " << mk_ismt2_pp(concatAst1, mgr) << std::endl << "concatAst2 = " << mk_ismt2_pp(concatAst2, mgr) << std::endl; ); if (!u.str.is_concat(to_app(concatAst1))) { - TRACE("str", tout << "concatAst1 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst1 is not a concat function" << std::endl;); return; } if (!u.str.is_concat(to_app(concatAst2))) { - TRACE("str", tout << "concatAst2 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst2 is not a concat function" << std::endl;); return; } @@ -4233,7 +4233,7 @@ namespace smt { int commonLen = (str1Len > str2Len) ? str2Len : str1Len; if (str1Value.extract(0, commonLen) != str2Value.extract(0, commonLen)) { - TRACE("str", tout << "Conflict: " << mk_ismt2_pp(concatAst1, mgr) + TRACE(str, tout << "Conflict: " << mk_ismt2_pp(concatAst1, mgr) << " has no common prefix with " << mk_ismt2_pp(concatAst2, mgr) << std::endl;); expr_ref toNegate(mgr.mk_not(ctx.mk_eq_atom(concatAst1, concatAst2)), mgr); assert_axiom(toNegate); @@ -4300,17 +4300,17 @@ namespace smt { void theory_str::process_concat_eq_type5(expr * concatAst1, expr * concatAst2) { ast_manager & mgr = get_manager(); - TRACE("str", tout << "process_concat_eq TYPE 5" << std::endl + TRACE(str, tout << "process_concat_eq TYPE 5" << std::endl << "concatAst1 = " << mk_ismt2_pp(concatAst1, mgr) << std::endl << "concatAst2 = " << mk_ismt2_pp(concatAst2, mgr) << std::endl; ); if (!u.str.is_concat(to_app(concatAst1))) { - TRACE("str", tout << "concatAst1 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst1 is not a concat function" << std::endl;); return; } if (!u.str.is_concat(to_app(concatAst2))) { - TRACE("str", tout << "concatAst2 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst2 is not a concat function" << std::endl;); return; } @@ -4333,7 +4333,7 @@ namespace smt { int cLen = (str1Len > str2Len) ? str2Len : str1Len; if (str1Value.extract(str1Len - cLen, cLen) != str2Value.extract(str2Len - cLen, cLen)) { - TRACE("str", tout << "Conflict: " << mk_ismt2_pp(concatAst1, mgr) + TRACE(str, tout << "Conflict: " << mk_ismt2_pp(concatAst1, mgr) << " has no common suffix with " << mk_ismt2_pp(concatAst2, mgr) << std::endl;); expr_ref toNegate(mgr.mk_not(ctx.mk_eq_atom(concatAst1, concatAst2)), mgr); assert_axiom(toNegate); @@ -4400,17 +4400,17 @@ namespace smt { void theory_str::process_concat_eq_type6(expr * concatAst1, expr * concatAst2) { ast_manager & mgr = get_manager(); - TRACE("str", tout << "process_concat_eq TYPE 6" << std::endl + TRACE(str, tout << "process_concat_eq TYPE 6" << std::endl << "concatAst1 = " << mk_ismt2_pp(concatAst1, mgr) << std::endl << "concatAst2 = " << mk_ismt2_pp(concatAst2, mgr) << std::endl; ); if (!u.str.is_concat(to_app(concatAst1))) { - TRACE("str", tout << "concatAst1 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst1 is not a concat function" << std::endl;); return; } if (!u.str.is_concat(to_app(concatAst2))) { - TRACE("str", tout << "concatAst2 is not a concat function" << std::endl;); + TRACE(str, tout << "concatAst2 is not a concat function" << std::endl;); return; } @@ -4499,7 +4499,7 @@ namespace smt { } } - TRACE("str", tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl + TRACE(str, tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl << "entry 2 " << (entry2InScope ? "in scope" : "not in scope") << std::endl;); if (!entry1InScope && !entry2InScope) { @@ -4551,8 +4551,8 @@ namespace smt { } else { loopDetected = true; - TRACE("str", tout << "AVOID LOOP: SKIPPED." << std::endl;); - TRACE("str", print_cut_var(m, tout); print_cut_var(y, tout);); + TRACE(str, tout << "AVOID LOOP: SKIPPED." << std::endl;); + TRACE(str, print_cut_var(m, tout); print_cut_var(y, tout);); // only add the overlap assumption one time if (!overlapAssumptionUsed) { @@ -4669,10 +4669,10 @@ namespace smt { enode * en_e = ctx.get_enode(e); enode * root_e = en_e->get_root(); if (m_autil.is_numeral(root_e->get_expr(), val) && val.is_int()) { - TRACE("str", tout << mk_pp(e, get_manager()) << " ~= " << mk_pp(root_e->get_expr(), get_manager()) << std::endl;); + TRACE(str, tout << mk_pp(e, get_manager()) << " ~= " << mk_pp(root_e->get_expr(), get_manager()) << std::endl;); return true; } else { - TRACE("str", tout << "root of eqc of " << mk_pp(e, get_manager()) << " is not a numeral" << std::endl;); + TRACE(str, tout << "root of eqc of " << mk_pp(e, get_manager()) << " is not a numeral" << std::endl;); return false; } @@ -4680,7 +4680,7 @@ namespace smt { bool theory_str::lower_bound(expr* _e, rational& lo) { if (opt_DisableIntegerTheoryIntegration) { - TRACE("str", tout << "WARNING: integer theory integration disabled" << std::endl;); + TRACE(str, tout << "WARNING: integer theory integration disabled" << std::endl;); return false; } @@ -4692,7 +4692,7 @@ namespace smt { bool theory_str::upper_bound(expr* _e, rational& hi) { if (opt_DisableIntegerTheoryIntegration) { - TRACE("str", tout << "WARNING: integer theory integration disabled" << std::endl;); + TRACE(str, tout << "WARNING: integer theory integration disabled" << std::endl;); return false; } @@ -4704,13 +4704,13 @@ namespace smt { bool theory_str::get_len_value(expr* e, rational& val) { if (opt_DisableIntegerTheoryIntegration) { - TRACE("str", tout << "WARNING: integer theory integration disabled" << std::endl;); + TRACE(str, tout << "WARNING: integer theory integration disabled" << std::endl;); return false; } ast_manager & m = get_manager(); - TRACE("str", tout << "checking len value of " << mk_ismt2_pp(e, m) << std::endl;); + TRACE(str, tout << "checking len value of " << mk_ismt2_pp(e, m) << std::endl;); rational val1; expr_ref len(m), len_val(m); @@ -4737,7 +4737,7 @@ namespace smt { len = mk_strlen(c); // debugging - TRACE("str", { + TRACE(str, { tout << mk_pp(len, m) << ":" << std::endl << (ctx.is_relevant(len.get()) ? "relevant" : "not relevant") << std::endl << (ctx.e_internalized(len) ? "internalized" : "not internalized") << std::endl @@ -4762,16 +4762,16 @@ namespace smt { if (ctx.e_internalized(len) && get_arith_value(len, val1)) { val += val1; - TRACE("str", tout << "integer theory: subexpression " << mk_ismt2_pp(len, m) << " has length " << val1 << std::endl;); + TRACE(str, tout << "integer theory: subexpression " << mk_ismt2_pp(len, m) << " has length " << val1 << std::endl;); } else { - TRACE("str", tout << "integer theory: subexpression " << mk_ismt2_pp(len, m) << " has no length assignment; bailing out" << std::endl;); + TRACE(str, tout << "integer theory: subexpression " << mk_ismt2_pp(len, m) << " has no length assignment; bailing out" << std::endl;); return false; } } } - TRACE("str", tout << "length of " << mk_ismt2_pp(e, m) << " is " << val << std::endl;); + TRACE(str, tout << "length of " << mk_ismt2_pp(e, m) << " is " << val << std::endl;); return val.is_int() && val.is_nonneg(); } @@ -4787,11 +4787,11 @@ namespace smt { // that we've set this up properly for the context if (!ctx.e_internalized(n1)) { - TRACE("str", tout << "WARNING: expression " << mk_ismt2_pp(n1, get_manager()) << " was not internalized" << std::endl;); + TRACE(str, tout << "WARNING: expression " << mk_ismt2_pp(n1, get_manager()) << " was not internalized" << std::endl;); ctx.internalize(n1, false); } if (!ctx.e_internalized(n2)) { - TRACE("str", tout << "WARNING: expression " << mk_ismt2_pp(n2, get_manager()) << " was not internalized" << std::endl;); + TRACE(str, tout << "WARNING: expression " << mk_ismt2_pp(n2, get_manager()) << " was not internalized" << std::endl;); ctx.internalize(n2, false); } @@ -4842,7 +4842,7 @@ namespace smt { void theory_str::check_contain_by_eqc_val(expr * varNode, expr * constNode) { ast_manager & m = get_manager(); - TRACE("str", tout << "varNode = " << mk_pp(varNode, m) << ", constNode = " << mk_pp(constNode, m) << std::endl;); + TRACE(str, tout << "varNode = " << mk_pp(varNode, m) << ", constNode = " << mk_pp(constNode, m) << std::endl;); expr_ref_vector litems(m); @@ -4853,19 +4853,19 @@ namespace smt { expr * boolVar = nullptr; if (!contain_pair_bool_map.find(strAst, substrAst, boolVar)) { - TRACE("str", tout << "warning: no entry for boolVar in contain_pair_bool_map" << std::endl;); + TRACE(str, tout << "warning: no entry for boolVar in contain_pair_bool_map" << std::endl;); } // we only want to inspect the Contains terms where either of strAst or substrAst // are equal to varNode. - TRACE("t_str_detail", tout << "considering Contains with strAst = " << mk_pp(strAst, m) << ", substrAst = " << mk_pp(substrAst, m) << "..." << std::endl;); + TRACE(t_str_detail, tout << "considering Contains with strAst = " << mk_pp(strAst, m) << ", substrAst = " << mk_pp(substrAst, m) << "..." << std::endl;); if (varNode != strAst && varNode != substrAst) { - TRACE("str", tout << "varNode not equal to strAst or substrAst, skip" << std::endl;); + TRACE(str, tout << "varNode not equal to strAst or substrAst, skip" << std::endl;); continue; } - TRACE("str", tout << "varNode matched one of strAst or substrAst. Continuing" << std::endl;); + TRACE(str, tout << "varNode matched one of strAst or substrAst. Continuing" << std::endl;); // varEqcNode is str if (strAst == varNode) { @@ -4888,7 +4888,7 @@ namespace smt { zstring subStrConst; u.str.is_string(substrValue, subStrConst); - TRACE("t_str_detail", tout << "strConst = " << strConst << ", subStrConst = " << subStrConst << "\n";); + TRACE(t_str_detail, tout << "strConst = " << strConst << ", subStrConst = " << subStrConst << "\n";); if (strConst.contains(subStrConst)) { //implyR = ctx.mk_eq(ctx, boolVar, Z3_mk_true(ctx)); @@ -4924,7 +4924,7 @@ namespace smt { } } if (counterEgFound) { - TRACE("str", tout << "Inconsistency found!" << std::endl;); + TRACE(str, tout << "Inconsistency found!" << std::endl;); break; } } @@ -4983,25 +4983,25 @@ namespace smt { expr * boolVar = nullptr; if (!contain_pair_bool_map.find(strAst, substrAst, boolVar)) { - TRACE("str", tout << "warning: no entry for boolVar in contain_pair_bool_map" << std::endl;); + TRACE(str, tout << "warning: no entry for boolVar in contain_pair_bool_map" << std::endl;); } // we only want to inspect the Contains terms where either of strAst or substrAst // are equal to varNode. - TRACE("t_str_detail", tout << "considering Contains with strAst = " << mk_pp(strAst, m) << ", substrAst = " << mk_pp(substrAst, m) << "..." << std::endl;); + TRACE(t_str_detail, tout << "considering Contains with strAst = " << mk_pp(strAst, m) << ", substrAst = " << mk_pp(substrAst, m) << "..." << std::endl;); if (varNode != strAst && varNode != substrAst) { - TRACE("str", tout << "varNode not equal to strAst or substrAst, skip" << std::endl;); + TRACE(str, tout << "varNode not equal to strAst or substrAst, skip" << std::endl;); continue; } - TRACE("str", tout << "varNode matched one of strAst or substrAst. Continuing" << std::endl;); + TRACE(str, tout << "varNode matched one of strAst or substrAst. Continuing" << std::endl;); if (substrAst == varNode) { bool strAstHasVal = false; expr * strValue = get_eqc_value(strAst, strAstHasVal); if (strAstHasVal) { - TRACE("str", tout << mk_pp(strAst, m) << " has constant eqc value " << mk_pp(strValue, m) << std::endl;); + TRACE(str, tout << mk_pp(strAst, m) << " has constant eqc value " << mk_pp(strValue, m) << std::endl;); if (strValue != strAst) { litems.push_back(ctx.mk_eq_atom(strAst, strValue)); } @@ -5019,7 +5019,7 @@ namespace smt { zstring pieceStr; u.str.is_string(cst, pieceStr); if (!strConst.contains(pieceStr)) { - TRACE("str", tout << "Inconsistency found!" << std::endl;); + TRACE(str, tout << "Inconsistency found!" << std::endl;); counterEgFound = true; if (aConcat != substrAst) { litems.push_back(ctx.mk_eq_atom(substrAst, aConcat)); @@ -5082,7 +5082,7 @@ namespace smt { expr * subValue1 = get_eqc_value(subAst1, subAst1HasValue); expr * subValue2 = get_eqc_value(subAst2, subAst2HasValue); - TRACE("str", + TRACE(str, tout << "(Contains " << mk_pp(n1, m) << " " << mk_pp(subAst1, m) << ")" << std::endl; tout << "(Contains " << mk_pp(n2, m) << " " << mk_pp(subAst2, m) << ")" << std::endl; if (subAst1 != subValue1) { @@ -5180,7 +5180,7 @@ namespace smt { } std::pair tryKey1 = std::make_pair(eqSubVar1, eqSubVar2); if (contain_pair_bool_map.contains(tryKey1)) { - TRACE("str", tout << "(Contains " << mk_pp(eqSubVar1, m) << " " << mk_pp(eqSubVar2, m) << ")" << std::endl;); + TRACE(str, tout << "(Contains " << mk_pp(eqSubVar1, m) << " " << mk_pp(eqSubVar2, m) << ")" << std::endl;); litems3.push_back(contain_pair_bool_map[tryKey1]); expr_ref implR(rewrite_implication(contain_pair_bool_map[key1], contain_pair_bool_map[key2]), m); assert_implication(mk_and(litems3), implR); @@ -5205,7 +5205,7 @@ namespace smt { } std::pair tryKey2 = std::make_pair(eqSubVar2, eqSubVar1); if (contain_pair_bool_map.contains(tryKey2)) { - TRACE("str", tout << "(Contains " << mk_pp(eqSubVar2, m) << " " << mk_pp(eqSubVar1, m) << ")" << std::endl;); + TRACE(str, tout << "(Contains " << mk_pp(eqSubVar2, m) << " " << mk_pp(eqSubVar1, m) << ")" << std::endl;); litems4.push_back(contain_pair_bool_map[tryKey2]); expr_ref implR(rewrite_implication(contain_pair_bool_map[key2], contain_pair_bool_map[key1]), m); assert_implication(mk_and(litems4), implR); @@ -5227,7 +5227,7 @@ namespace smt { expr * strVal1 = get_eqc_value(str1, str1HasValue); expr * strVal2 = get_eqc_value(str2, str2HasValue); - TRACE("str", + TRACE(str, tout << "(Contains " << mk_pp(str1, m) << " " << mk_pp(n1, m) << ")" << std::endl; tout << "(Contains " << mk_pp(str2, m) << " " << mk_pp(n2, m) << ")" << std::endl; if (str1 != strVal1) { @@ -5324,7 +5324,7 @@ namespace smt { } std::pair tryKey1 = std::make_pair(eqStrVar1, eqStrVar2); if (contain_pair_bool_map.contains(tryKey1)) { - TRACE("str", tout << "(Contains " << mk_pp(eqStrVar1, m) << " " << mk_pp(eqStrVar2, m) << ")" << std::endl;); + TRACE(str, tout << "(Contains " << mk_pp(eqStrVar1, m) << " " << mk_pp(eqStrVar2, m) << ")" << std::endl;); litems3.push_back(contain_pair_bool_map[tryKey1]); // ------------ @@ -5350,7 +5350,7 @@ namespace smt { std::pair tryKey2 = std::make_pair(eqStrVar2, eqStrVar1); if (contain_pair_bool_map.contains(tryKey2)) { - TRACE("str", tout << "(Contains " << mk_pp(eqStrVar2, m) << " " << mk_pp(eqStrVar1, m) << ")" << std::endl;); + TRACE(str, tout << "(Contains " << mk_pp(eqStrVar2, m) << " " << mk_pp(eqStrVar1, m) << ")" << std::endl;); litems4.push_back(contain_pair_bool_map[tryKey2]); // ------------ // key1.first = key2.first /\ containPairBoolMap[] @@ -5381,14 +5381,14 @@ namespace smt { } ast_manager & m = get_manager(); - TRACE("str", tout << "consistency check for contains wrt. " << mk_pp(n1, m) << " and " << mk_pp(n2, m) << std::endl;); + TRACE(str, tout << "consistency check for contains wrt. " << mk_pp(n1, m) << " and " << mk_pp(n2, m) << std::endl;); expr_ref_vector willEqClass(m); expr * constStrAst_1 = collect_eq_nodes(n1, willEqClass); expr * constStrAst_2 = collect_eq_nodes(n2, willEqClass); expr * constStrAst = (constStrAst_1 != nullptr) ? constStrAst_1 : constStrAst_2; - TRACE("str", tout << "eqc of n1 is {"; + TRACE(str, tout << "eqc of n1 is {"; for (expr * el : willEqClass) { tout << " " << mk_pp(el, m); } @@ -5570,11 +5570,11 @@ namespace smt { } void theory_str::print_grounded_concat(expr * node, std::map, std::set > > & groundedMap) { - TRACE("str", tout << mk_pp(node, get_manager()) << std::endl;); + TRACE(str, tout << mk_pp(node, get_manager()) << std::endl;); if (groundedMap.find(node) != groundedMap.end()) { for (auto const &itor : groundedMap[node]) { (void) itor; - TRACE("str", + TRACE(str, tout << "\t[grounded] "; for (auto const &vIt : itor.first) { tout << mk_pp(vIt, get_manager()) << ", "; @@ -5588,7 +5588,7 @@ namespace smt { ); } } else { - TRACE("str", tout << "not found" << std::endl;); + TRACE(str, tout << "not found" << std::endl;); } } @@ -5849,7 +5849,7 @@ namespace smt { // case 0: n1_curr is const string, n2_curr is const string zstring n1_curr_str, n2_curr_str; if (u.str.is_string(n1_curr, n1_curr_str) && u.str.is_string(n2_curr, n2_curr_str)) { - TRACE("str", tout << "checking string constants: n1=" << n1_curr_str << ", n2=" << n2_curr_str << std::endl;); + TRACE(str, tout << "checking string constants: n1=" << n1_curr_str << ", n2=" << n2_curr_str << std::endl;); if (n1_curr_str == n2_curr_str) { // TODO(mtrberzi) potential correction: if n1_curr != n2_curr, // assert that these two terms are in fact equal, because they ought to be @@ -5908,12 +5908,12 @@ namespace smt { if (!u.str.is_string(args[i])) { items.push_back(ctx.mk_eq_atom(mk_strlen(args[i]), mk_int(argLen))); } - TRACE("str", tout << "concat arg: " << mk_pp(args[i], mgr) << " has len = " << argLen.to_string() << std::endl;); + TRACE(str, tout << "concat arg: " << mk_pp(args[i], mgr) << " has len = " << argLen.to_string() << std::endl;); sumLen += argLen; if (sumLen > strLen) { items.push_back(ctx.mk_eq_atom(n1, constStr)); expr_ref toAssert(mgr.mk_not(mk_and(items)), mgr); - TRACE("str", tout << "inconsistent length: concat (len = " << sumLen << ") <==> string constant (len = " << strLen << ")" << std::endl;); + TRACE(str, tout << "inconsistent length: concat (len = " << sumLen << ") <==> string constant (len = " << strLen << ")" << std::endl;); assert_axiom(toAssert); return false; } @@ -5923,7 +5923,7 @@ namespace smt { rational oLen; bool oLen_exists = get_len_value(n1, oLen); if (oLen_exists && oLen != strLen) { - TRACE("str", tout << "inconsistent length: var (len = " << oLen << ") <==> string constant (len = " << strLen << ")" << std::endl;); + TRACE(str, tout << "inconsistent length: var (len = " << oLen << ") <==> string constant (len = " << strLen << ")" << std::endl;); expr_ref l(ctx.mk_eq_atom(n1, constStr), mgr); expr_ref r(ctx.mk_eq_atom(mk_strlen(n1), mk_strlen(constStr)), mgr); assert_implication(l, r); @@ -6001,7 +6001,7 @@ namespace smt { } if (conflict) { - TRACE("str", tout << "inconsistent length detected in concat <==> concat" << std::endl;); + TRACE(str, tout << "inconsistent length detected in concat <==> concat" << std::endl;); expr_ref toAssert(mgr.mk_not(mk_and(items)), mgr); assert_axiom(toAssert); return false; @@ -6031,7 +6031,7 @@ namespace smt { } sumLen += argLen; if (sumLen > varLen) { - TRACE("str", tout << "inconsistent length detected in concat <==> var" << std::endl;); + TRACE(str, tout << "inconsistent length detected in concat <==> var" << std::endl;); items.push_back(ctx.mk_eq_atom(mk_strlen(var), mk_int(varLen))); items.push_back(ctx.mk_eq_atom(concat, var)); expr_ref toAssert(mgr.mk_not(mk_and(items)), mgr); @@ -6052,7 +6052,7 @@ namespace smt { bool var2Len_exists = get_len_value(var2, var2Len); if (var1Len_exists && var2Len_exists && var1Len != var2Len) { - TRACE("str", tout << "inconsistent length detected in var <==> var" << std::endl;); + TRACE(str, tout << "inconsistent length detected in var <==> var" << std::endl;); expr_ref_vector items(mgr); items.push_back(ctx.mk_eq_atom(mk_strlen(var1), mk_int(var1Len))); items.push_back(ctx.mk_eq_atom(mk_strlen(var2), mk_int(var2Len))); @@ -6134,7 +6134,7 @@ namespace smt { void theory_str::solve_concat_eq_str(expr * concat, expr * str) { ast_manager & m = get_manager(); - TRACE("str", tout << mk_ismt2_pp(concat, m) << " == " << mk_ismt2_pp(str, m) << std::endl;); + TRACE(str, tout << mk_ismt2_pp(concat, m) << " == " << mk_ismt2_pp(str, m) << std::endl;); zstring const_str; if (u.str.is_concat(to_app(concat)) && u.str.is_string(to_app(str), const_str)) { @@ -6144,7 +6144,7 @@ namespace smt { expr * a2 = a_concat->get_arg(1); if (const_str.empty()) { - TRACE("str", tout << "quick path: concat == \"\"" << std::endl;); + TRACE(str, tout << "quick path: concat == \"\"" << std::endl;); // assert the following axiom: // ( (Concat a1 a2) == "" ) -> ( (a1 == "") AND (a2 == "") ) @@ -6163,7 +6163,7 @@ namespace smt { expr * arg2 = get_eqc_value(a2, arg2_has_eqc_value); expr_ref newConcat(m); if (arg1 != a1 || arg2 != a2) { - TRACE("str", tout << "resolved concat argument(s) to eqc string constants" << std::endl;); + TRACE(str, tout << "resolved concat argument(s) to eqc string constants" << std::endl;); expr_ref_vector item1(m); if (a1 != arg1) { item1.push_back(ctx.mk_eq_atom(a1, arg1)); @@ -6188,7 +6188,7 @@ namespace smt { } if (arg1_has_eqc_value && arg2_has_eqc_value) { // Case 1: Concat(const, const) == const - TRACE("str", tout << "Case 1: Concat(const, const) == const" << std::endl;); + TRACE(str, tout << "Case 1: Concat(const, const) == const" << std::endl;); zstring arg1_str, arg2_str; u.str.is_string(arg1, arg1_str); u.str.is_string(arg2, arg2_str); @@ -6196,7 +6196,7 @@ namespace smt { zstring result_str = arg1_str + arg2_str; if (result_str != const_str) { // Inconsistency - TRACE("str", tout << "inconsistency detected: \"" + TRACE(str, tout << "inconsistency detected: \"" << arg1_str << "\" + \"" << arg2_str << "\" != \"" << const_str << "\"" << "\n";); expr_ref equality(ctx.mk_eq_atom(concat, str), m); @@ -6206,14 +6206,14 @@ namespace smt { } } else if (!arg1_has_eqc_value && arg2_has_eqc_value) { // Case 2: Concat(var, const) == const - TRACE("str", tout << "Case 2: Concat(var, const) == const" << std::endl;); + TRACE(str, tout << "Case 2: Concat(var, const) == const" << std::endl;); zstring arg2_str; u.str.is_string(arg2, arg2_str); unsigned int resultStrLen = const_str.length(); unsigned int arg2StrLen = arg2_str.length(); if (resultStrLen < arg2StrLen) { // Inconsistency - TRACE("str", tout << "inconsistency detected: \"" + TRACE(str, tout << "inconsistency detected: \"" << arg2_str << "\" is longer than \"" << const_str << "\"," << " so cannot be concatenated with anything to form it" << "\n";); @@ -6227,7 +6227,7 @@ namespace smt { zstring secondPart = const_str.extract(varStrLen, arg2StrLen); if (arg2_str != secondPart) { // Inconsistency - TRACE("str", tout << "inconsistency detected: " + TRACE(str, tout << "inconsistency detected: " << "suffix of concatenation result expected \"" << secondPart << "\", " << "actually \"" << arg2_str << "\"" << "\n";); @@ -6245,14 +6245,14 @@ namespace smt { } } else if (arg1_has_eqc_value && !arg2_has_eqc_value) { // Case 3: Concat(const, var) == const - TRACE("str", tout << "Case 3: Concat(const, var) == const" << std::endl;); + TRACE(str, tout << "Case 3: Concat(const, var) == const" << std::endl;); zstring arg1_str; u.str.is_string(arg1, arg1_str); unsigned int resultStrLen = const_str.length(); unsigned int arg1StrLen = arg1_str.length(); if (resultStrLen < arg1StrLen) { // Inconsistency - TRACE("str", tout << "inconsistency detected: \"" + TRACE(str, tout << "inconsistency detected: \"" << arg1_str << "\" is longer than \"" << const_str << "\"," << " so cannot be concatenated with anything to form it" << "\n";); @@ -6266,7 +6266,7 @@ namespace smt { zstring secondPart = const_str.extract(arg1StrLen, varStrLen); if (arg1_str != firstPart) { // Inconsistency - TRACE("str", tout << "inconsistency detected: " + TRACE(str, tout << "inconsistency detected: " << "prefix of concatenation result expected \"" << secondPart << "\", " << "actually \"" << arg1_str << "\"" << "\n";); @@ -6284,7 +6284,7 @@ namespace smt { } } else { // Case 4: Concat(var, var) == const - TRACE("str", tout << "Case 4: Concat(var, var) == const" << std::endl;); + TRACE(str, tout << "Case 4: Concat(var, var) == const" << std::endl;); if (eval_concat(arg1, arg2) == nullptr) { rational arg1Len, arg2Len; bool arg1Len_exists = get_len_value(arg1, arg1Len); @@ -6296,12 +6296,12 @@ namespace smt { zstring prefixStr, suffixStr; if (arg1Len_exists) { if (arg1Len.is_neg()) { - TRACE("str", tout << "length conflict: arg1Len = " << arg1Len << ", concatStrLen = " << concatStrLen << std::endl;); + TRACE(str, tout << "length conflict: arg1Len = " << arg1Len << ", concatStrLen = " << concatStrLen << std::endl;); expr_ref toAssert(m_autil.mk_ge(mk_strlen(arg1), mk_int(0)), m); assert_axiom(toAssert); return; } else if (arg1Len > concatStrLen) { - TRACE("str", tout << "length conflict: arg1Len = " << arg1Len << ", concatStrLen = " << concatStrLen << std::endl;); + TRACE(str, tout << "length conflict: arg1Len = " << arg1Len << ", concatStrLen = " << concatStrLen << std::endl;); expr_ref ax_r1(m_autil.mk_le(mk_strlen(arg1), mk_int(concatStrLen)), m); assert_implication(ax_l1, ax_r1); return; @@ -6314,12 +6314,12 @@ namespace smt { } else { // arg2's length is available if (arg2Len.is_neg()) { - TRACE("str", tout << "length conflict: arg2Len = " << arg2Len << ", concatStrLen = " << concatStrLen << std::endl;); + TRACE(str, tout << "length conflict: arg2Len = " << arg2Len << ", concatStrLen = " << concatStrLen << std::endl;); expr_ref toAssert(m_autil.mk_ge(mk_strlen(arg2), mk_int(0)), m); assert_axiom(toAssert); return; } else if (arg2Len > concatStrLen) { - TRACE("str", tout << "length conflict: arg2Len = " << arg2Len << ", concatStrLen = " << concatStrLen << std::endl;); + TRACE(str, tout << "length conflict: arg2Len = " << arg2Len << ", concatStrLen = " << concatStrLen << std::endl;); expr_ref ax_r1(m_autil.mk_le(mk_strlen(arg2), mk_int(concatStrLen)), m); assert_implication(ax_l1, ax_r1); return; @@ -6366,18 +6366,18 @@ namespace smt { bool entry1InScope; if (entry1 == varForBreakConcat.end()) { - TRACE("str", tout << "key1 no entry" << std::endl;); + TRACE(str, tout << "key1 no entry" << std::endl;); entry1InScope = false; } else { // OVERRIDE. entry1InScope = true; - TRACE("str", tout << "key1 entry" << std::endl;); + TRACE(str, tout << "key1 entry" << std::endl;); /* if (internal_variable_set.find((entry1->second)[0]) == internal_variable_set.end()) { - TRACE("str", tout << "key1 entry not in scope" << std::endl;); + TRACE(str, tout << "key1 entry not in scope" << std::endl;); entry1InScope = false; } else { - TRACE("str", tout << "key1 entry in scope" << std::endl;); + TRACE(str, tout << "key1 entry in scope" << std::endl;); entry1InScope = true; } */ @@ -6385,24 +6385,24 @@ namespace smt { bool entry2InScope; if (entry2 == varForBreakConcat.end()) { - TRACE("str", tout << "key2 no entry" << std::endl;); + TRACE(str, tout << "key2 no entry" << std::endl;); entry2InScope = false; } else { // OVERRIDE. entry2InScope = true; - TRACE("str", tout << "key2 entry" << std::endl;); + TRACE(str, tout << "key2 entry" << std::endl;); /* if (internal_variable_set.find((entry2->second)[0]) == internal_variable_set.end()) { - TRACE("str", tout << "key2 entry not in scope" << std::endl;); + TRACE(str, tout << "key2 entry not in scope" << std::endl;); entry2InScope = false; } else { - TRACE("str", tout << "key2 entry in scope" << std::endl;); + TRACE(str, tout << "key2 entry in scope" << std::endl;); entry2InScope = true; } */ } - TRACE("str", tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl + TRACE(str, tout << "entry 1 " << (entry1InScope ? "in scope" : "not in scope") << std::endl << "entry 2 " << (entry2InScope ? "in scope" : "not in scope") << std::endl;); if (!entry1InScope && !entry2InScope) { @@ -6487,7 +6487,7 @@ namespace smt { } if (lhs_sort != str_sort || rhs_sort != str_sort) { - TRACE("str", tout << "skip equality: not String sort" << std::endl;); + TRACE(str, tout << "skip equality: not String sort" << std::endl;); return; } @@ -6508,18 +6508,18 @@ namespace smt { expr * nn2_arg0 = to_app(rhs)->get_arg(0); expr * nn2_arg1 = to_app(rhs)->get_arg(1); if (nn1_arg0 == nn2_arg0 && in_same_eqc(nn1_arg1, nn2_arg1)) { - TRACE("str", tout << "skip: lhs arg0 == rhs arg0" << std::endl;); + TRACE(str, tout << "skip: lhs arg0 == rhs arg0" << std::endl;); return; } if (nn1_arg1 == nn2_arg1 && in_same_eqc(nn1_arg0, nn2_arg0)) { - TRACE("str", tout << "skip: lhs arg1 == rhs arg1" << std::endl;); + TRACE(str, tout << "skip: lhs arg1 == rhs arg1" << std::endl;); return; } } if (opt_DeferEQCConsistencyCheck) { - TRACE("str", tout << "opt_DeferEQCConsistencyCheck is set; deferring new_eq_check call" << std::endl;); + TRACE(str, tout << "opt_DeferEQCConsistencyCheck is set; deferring new_eq_check call" << std::endl;); } else { // newEqCheck() -- check consistency wrt. existing equivalence classes if (!new_eq_check(lhs, rhs)) { @@ -6544,7 +6544,7 @@ namespace smt { std::set eqc_const_rhs; group_terms_by_eqc(rhs, eqc_concat_rhs, eqc_var_rhs, eqc_const_rhs); - TRACE("str", + TRACE(str, tout << "lhs eqc:" << std::endl; tout << "Concats:" << std::endl; for (auto const &ex : eqc_concat_lhs) { @@ -6662,10 +6662,10 @@ namespace smt { } for (auto const &concat_rhs : eqc_concat_rhs) { if (will_result_in_overlap(concat_lhs, concat_rhs)) { - TRACE("str", tout << "Concats " << mk_pp(concat_lhs, m) << " and " + TRACE(str, tout << "Concats " << mk_pp(concat_lhs, m) << " and " << mk_pp(concat_rhs, m) << " will result in overlap; skipping." << std::endl;); } else { - TRACE("str", tout << "Concats " << mk_pp(concat_lhs, m) << " and " + TRACE(str, tout << "Concats " << mk_pp(concat_lhs, m) << " and " << mk_pp(concat_rhs, m) << " won't overlap. Simplifying here." << std::endl;); simplify_concat_equality(concat_lhs, concat_rhs); found = true; @@ -6674,7 +6674,7 @@ namespace smt { } } if (!found) { - TRACE("str", tout << "All pairs of concats expected to overlap, falling back." << std::endl;); + TRACE(str, tout << "All pairs of concats expected to overlap, falling back." << std::endl;); simplify_concat_equality(*(eqc_concat_lhs.begin()), *(eqc_concat_rhs.begin())); } } else { @@ -6718,18 +6718,18 @@ namespace smt { // reject unhandled expressions if (u.str.is_replace_all(ex) || u.str.is_replace_re(ex) || u.str.is_replace_re_all(ex)) { - TRACE("str", tout << "ERROR: Z3str3 has encountered an unsupported operator. Aborting." << std::endl;); + TRACE(str, tout << "ERROR: Z3str3 has encountered an unsupported operator. Aborting." << std::endl;); m.raise_exception("Z3str3 encountered an unsupported operator."); } if (ex_sort == str_sort) { - TRACE("str", tout << "setting up axioms for " << mk_ismt2_pp(ex, get_manager()) << + TRACE(str, tout << "setting up axioms for " << mk_ismt2_pp(ex, get_manager()) << ": expr is of sort String" << std::endl;); // set up basic string axioms enode * n = ctx.get_enode(ex); SASSERT(n); m_basicstr_axiom_todo.push_back(n); - TRACE("str", tout << "add " << mk_pp(ex, m) << " to m_basicstr_axiom_todo" << std::endl;); + TRACE(str, tout << "add " << mk_pp(ex, m) << " to m_basicstr_axiom_todo" << std::endl;); if (is_app(ex)) { @@ -6744,28 +6744,28 @@ namespace smt { m_library_aware_axiom_todo.push_back(n); m_library_aware_trail_stack.push(push_back_trail(m_library_aware_axiom_todo)); } else if (u.str.is_itos(ap)) { - TRACE("str", tout << "found string-integer conversion term: " << mk_pp(ex, get_manager()) << std::endl;); + TRACE(str, tout << "found string-integer conversion term: " << mk_pp(ex, get_manager()) << std::endl;); string_int_conversion_terms.push_back(ap); m_library_aware_axiom_todo.push_back(n); m_library_aware_trail_stack.push(push_back_trail(m_library_aware_axiom_todo)); } else if (u.str.is_from_code(ap)) { - TRACE("str", tout << "found string-codepoint conversion term: " << mk_pp(ex, get_manager()) << std::endl;); + TRACE(str, tout << "found string-codepoint conversion term: " << mk_pp(ex, get_manager()) << std::endl;); string_int_conversion_terms.push_back(ap); m_library_aware_axiom_todo.push_back(n); m_library_aware_trail_stack.push(push_back_trail(m_library_aware_axiom_todo)); } else if (is_var(ex)) { // if ex is a variable, add it to our list of variables - TRACE("str", tout << "tracking variable " << mk_ismt2_pp(ap, get_manager()) << std::endl;); + TRACE(str, tout << "tracking variable " << mk_ismt2_pp(ap, get_manager()) << std::endl;); variable_set.insert(ex); ctx.mark_as_relevant(ex); // this might help?? theory_var v = mk_var(n); - TRACE("str", tout << "variable " << mk_ismt2_pp(ap, get_manager()) << " is #" << v << std::endl;); + TRACE(str, tout << "variable " << mk_ismt2_pp(ap, get_manager()) << " is #" << v << std::endl;); (void)v; } } } else if (ex_sort == bool_sort && !is_quantifier(ex)) { - TRACE("str", tout << "setting up axioms for " << mk_ismt2_pp(ex, get_manager()) << + TRACE(str, tout << "setting up axioms for " << mk_ismt2_pp(ex, get_manager()) << ": expr is of sort Bool" << std::endl;); // set up axioms for boolean terms @@ -6782,13 +6782,13 @@ namespace smt { } } } else { - TRACE("str", tout << "WARNING: Bool term " << mk_ismt2_pp(ex, get_manager()) << " not internalized. Delaying axiom setup to prevent a crash." << std::endl;); + TRACE(str, tout << "WARNING: Bool term " << mk_ismt2_pp(ex, get_manager()) << " not internalized. Delaying axiom setup to prevent a crash." << std::endl;); ENSURE(!search_started); // infinite loop prevention m_delayed_axiom_setup_terms.push_back(ex); return; } } else if (ex_sort == int_sort) { - TRACE("str", tout << "setting up axioms for " << mk_ismt2_pp(ex, get_manager()) << + TRACE(str, tout << "setting up axioms for " << mk_ismt2_pp(ex, get_manager()) << ": expr is of sort Int" << std::endl;); // set up axioms for integer terms enode * n = ensure_enode(ex); @@ -6800,12 +6800,12 @@ namespace smt { m_library_aware_axiom_todo.push_back(n); m_library_aware_trail_stack.push(push_back_trail(m_library_aware_axiom_todo)); } else if (u.str.is_stoi(ap)) { - TRACE("str", tout << "found string-integer conversion term: " << mk_pp(ex, get_manager()) << std::endl;); + TRACE(str, tout << "found string-integer conversion term: " << mk_pp(ex, get_manager()) << std::endl;); string_int_conversion_terms.push_back(ap); m_library_aware_axiom_todo.push_back(n); m_library_aware_trail_stack.push(push_back_trail(m_library_aware_axiom_todo)); } else if (u.str.is_to_code(ex)) { - TRACE("str", tout << "found string-codepoint conversion term: " << mk_pp(ex, get_manager()) << std::endl;); + TRACE(str, tout << "found string-codepoint conversion term: " << mk_pp(ex, get_manager()) << std::endl;); string_int_conversion_terms.push_back(ap); m_library_aware_axiom_todo.push_back(n); m_library_aware_trail_stack.push(push_back_trail(m_library_aware_axiom_todo)); @@ -6813,10 +6813,10 @@ namespace smt { } } else { if (u.str.is_non_string_sequence(ex)) { - TRACE("str", tout << "ERROR: Z3str3 does not support non-string sequence terms. Aborting." << std::endl;); + TRACE(str, tout << "ERROR: Z3str3 does not support non-string sequence terms. Aborting." << std::endl;); m.raise_exception("Z3str3 does not support non-string sequence terms."); } - TRACE("str", tout << "setting up axioms for " << mk_ismt2_pp(ex, get_manager()) << + TRACE(str, tout << "setting up axioms for " << mk_ismt2_pp(ex, get_manager()) << ": expr is of wrong sort, ignoring" << std::endl;); } @@ -6831,7 +6831,7 @@ namespace smt { } void theory_str::add_theory_assumptions(expr_ref_vector & assumptions) { - TRACE("str", tout << "add overlap assumption for theory_str" << std::endl;); + TRACE(str, tout << "add overlap assumption for theory_str" << std::endl;); const char* strOverlap = "!!TheoryStrOverlapAssumption!!"; sort * s = get_manager().mk_bool_sort(); m_theoryStrOverlapAssumption_term = expr_ref(mk_fresh_const(strOverlap, s), get_manager()); @@ -6848,7 +6848,7 @@ namespace smt { if (!ctx.e_internalized(core_term)) continue; enode *e2 = ctx.get_enode(core_term); if (e1 == e2) { - TRACE("str", tout << "overlap detected in unsat core, changing UNSAT to UNKNOWN" << std::endl;); + TRACE(str, tout << "overlap detected in unsat core, changing UNSAT to UNKNOWN" << std::endl;); return l_undef; } } @@ -6860,7 +6860,7 @@ namespace smt { reset_internal_data_structures(); - TRACE("str", + TRACE(str, tout << "dumping all asserted formulas:" << std::endl; unsigned nFormulas = ctx.get_num_asserted_formulas(); for (unsigned i = 0; i < nFormulas; ++i) { @@ -6869,7 +6869,7 @@ namespace smt { } ); - TRACE("str", + TRACE(str, expr_ref_vector formulas(get_manager()); ctx.get_assignments(formulas); tout << "dumping all formulas:" << std::endl; @@ -6889,13 +6889,13 @@ namespace smt { set_up_axioms(ex); } - TRACE("str", tout << "search started" << std::endl;); + TRACE(str, tout << "search started" << std::endl;); search_started = true; } void theory_str::new_eq_eh(theory_var x, theory_var y) { - //TRACE("str", tout << "new eq: v#" << x << " = v#" << y << std::endl;); - TRACE("str", tout << "new eq: " << mk_ismt2_pp(get_enode(x)->get_expr(), get_manager()) << " = " << + //TRACE(str, tout << "new eq: v#" << x << " = v#" << y << std::endl;); + TRACE(str, tout << "new eq: " << mk_ismt2_pp(get_enode(x)->get_expr(), get_manager()) << " = " << mk_ismt2_pp(get_enode(y)->get_expr(), get_manager()) << std::endl;); candidate_model.reset(); @@ -6911,20 +6911,20 @@ namespace smt { } void theory_str::new_diseq_eh(theory_var x, theory_var y) { - //TRACE("str", tout << "new diseq: v#" << x << " != v#" << y << std::endl;); - TRACE("str", tout << "new diseq: " << mk_ismt2_pp(get_enode(x)->get_expr(), get_manager()) << " != " << + //TRACE(str, tout << "new diseq: v#" << x << " != v#" << y << std::endl;); + TRACE(str, tout << "new diseq: " << mk_ismt2_pp(get_enode(x)->get_expr(), get_manager()) << " != " << mk_ismt2_pp(get_enode(y)->get_expr(), get_manager()) << std::endl;); candidate_model.reset(); } void theory_str::relevant_eh(app * n) { - TRACE("str", tout << "relevant: " << mk_ismt2_pp(n, get_manager()) << std::endl;); + TRACE(str, tout << "relevant: " << mk_ismt2_pp(n, get_manager()) << std::endl;); } void theory_str::assign_eh(bool_var v, bool is_true) { candidate_model.reset(); expr * e = ctx.bool_var2expr(v); - TRACE("str", tout << "assert: v" << v << " " << mk_pp(e, get_manager()) << " is_true: " << is_true << std::endl;); + TRACE(str, tout << "assert: v" << v << " " << mk_pp(e, get_manager()) << " is_true: " << is_true << std::endl;); DEBUG_CODE( for (auto * f : existing_toplevel_exprs) { SASSERT(f->get_ref_count() > 0); @@ -6955,7 +6955,7 @@ namespace smt { expr * haystack = nullptr; VERIFY(u.str.is_prefix(e, needle, haystack)); - TRACE("str", tout << "check consistency of prefix predicate: " << mk_pp(needle, m) << " prefixof " << mk_pp(haystack, m) << std::endl;); + TRACE(str, tout << "check consistency of prefix predicate: " << mk_pp(needle, m) << " prefixof " << mk_pp(haystack, m) << std::endl;); zstring needleStringConstant; if (get_string_constant_eqc(needle, needleStringConstant)) { @@ -6963,7 +6963,7 @@ namespace smt { // needle cannot contain non-digit characters for (unsigned i = 0; i < needleStringConstant.length(); ++i) { if (! ('0' <= needleStringConstant[i] && needleStringConstant[i] <= '9')) { - TRACE("str", tout << "conflict: needle = \"" << needleStringConstant << "\" contains non-digit character, but is a prefix of int-to-string term" << std::endl;); + TRACE(str, tout << "conflict: needle = \"" << needleStringConstant << "\" contains non-digit character, but is a prefix of int-to-string term" << std::endl;); expr_ref premise(ctx.mk_eq_atom(needle, mk_string(needleStringConstant)), m); expr_ref conclusion(m.mk_not(e), m); expr_ref conflict(rewrite_implication(premise, conclusion), m); @@ -6982,7 +6982,7 @@ namespace smt { expr * haystack = nullptr; VERIFY(u.str.is_suffix(e, needle, haystack)); - TRACE("str", tout << "check consistency of suffix predicate: " << mk_pp(needle, m) << " suffixof " << mk_pp(haystack, m) << std::endl;); + TRACE(str, tout << "check consistency of suffix predicate: " << mk_pp(needle, m) << " suffixof " << mk_pp(haystack, m) << std::endl;); zstring needleStringConstant; if (get_string_constant_eqc(needle, needleStringConstant)) { @@ -6990,7 +6990,7 @@ namespace smt { // needle cannot contain non-digit characters for (unsigned i = 0; i < needleStringConstant.length(); ++i) { if (! ('0' <= needleStringConstant[i] && needleStringConstant[i] <= '9')) { - TRACE("str", tout << "conflict: needle = \"" << needleStringConstant << "\" contains non-digit character, but is a suffix of int-to-string term" << std::endl;); + TRACE(str, tout << "conflict: needle = \"" << needleStringConstant << "\" contains non-digit character, but is a suffix of int-to-string term" << std::endl;); expr_ref premise(ctx.mk_eq_atom(needle, mk_string(needleStringConstant)), m); expr_ref conclusion(m.mk_not(e), m); expr_ref conflict(rewrite_implication(premise, conclusion), m); @@ -7009,7 +7009,7 @@ namespace smt { expr * haystack = nullptr; VERIFY(u.str.is_contains(e, haystack, needle)); // first string contains second one - TRACE("str", tout << "check consistency of contains predicate: " << mk_pp(haystack, m) << " contains " << mk_pp(needle, m) << std::endl;); + TRACE(str, tout << "check consistency of contains predicate: " << mk_pp(haystack, m) << " contains " << mk_pp(needle, m) << std::endl;); zstring needleStringConstant; if (get_string_constant_eqc(needle, needleStringConstant)) { @@ -7017,7 +7017,7 @@ namespace smt { // needle cannot contain non-digit characters for (unsigned i = 0; i < needleStringConstant.length(); ++i) { if (! ('0' <= needleStringConstant[i] && needleStringConstant[i] <= '9')) { - TRACE("str", tout << "conflict: needle = \"" << needleStringConstant << "\" contains non-digit character, but int-to-string term contains it" << std::endl;); + TRACE(str, tout << "conflict: needle = \"" << needleStringConstant << "\" contains non-digit character, but int-to-string term contains it" << std::endl;); expr_ref premise(ctx.mk_eq_atom(needle, mk_string(needleStringConstant)), m); expr_ref conclusion(m.mk_not(e), m); expr_ref conflict(rewrite_implication(premise, conclusion), m); @@ -7035,8 +7035,8 @@ namespace smt { m_library_aware_trail_stack.push_scope(); sLevel += 1; - TRACE("str", tout << "push to " << sLevel << std::endl;); - TRACE_CODE(if (is_trace_enabled("t_str_dump_assign_on_scope_change")) { dump_assignments(); }); + TRACE(str, tout << "push to " << sLevel << std::endl;); + TRACE_CODE(if (is_trace_enabled(TraceTag::t_str_dump_assign_on_scope_change)) { dump_assignments(); }); candidate_model.reset(); } @@ -7058,7 +7058,7 @@ namespace smt { // assume var if (variable_set.find(ex) == variable_set.end() && internal_variable_set.find(ex) == internal_variable_set.end()) { - TRACE("str", tout << "WARNING: possible reference to out-of-scope variable " << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "WARNING: possible reference to out-of-scope variable " << mk_pp(ex, m) << std::endl;); } } } else { @@ -7074,11 +7074,11 @@ namespace smt { return; } - if (!is_trace_enabled("t_str_detail")) { + if (!is_trace_enabled(TraceTag::t_str_detail)) { return; } - TRACE("str", tout << "checking scopes of variables in the current assignment" << std::endl;); + TRACE(str, tout << "checking scopes of variables in the current assignment" << std::endl;); ast_manager & m = get_manager(); @@ -7095,7 +7095,7 @@ namespace smt { void theory_str::pop_scope_eh(unsigned num_scopes) { sLevel -= num_scopes; - TRACE("str", tout << "pop " << num_scopes << " to " << sLevel << std::endl;); + TRACE(str, tout << "pop " << num_scopes << " to " << sLevel << std::endl;); candidate_model.reset(); m_basicstr_axiom_todo.reset(); @@ -7104,7 +7104,7 @@ namespace smt { m_delayed_axiom_setup_terms.reset(); m_delayed_assertions_todo.reset(); - TRACE_CODE(if (is_trace_enabled("t_str_dump_assign_on_scope_change")) { dump_assignments(); }); + TRACE_CODE(if (is_trace_enabled(TraceTag::t_str_dump_assign_on_scope_change)) { dump_assignments(); }); // list of expr* to remove from cut_var_map ptr_vector cutvarmap_removes; @@ -7112,7 +7112,7 @@ namespace smt { for (auto const &varItor : cut_var_map) { std::stack & val = cut_var_map[varItor.m_key]; while ((!val.empty()) && (val.top()->level != 0) && (val.top()->level >= sLevel)) { - // TRACE("str", tout << "remove cut info for " << mk_pp(e, get_manager()) << std::endl; print_cut_var(e, tout);); + // TRACE(str, tout << "remove cut info for " << mk_pp(e, get_manager()) << std::endl; print_cut_var(e, tout);); // T_cut * aCut = val.top(); val.pop(); // dealloc(aCut); @@ -7127,7 +7127,7 @@ namespace smt { ptr_vector new_m_basicstr; for (enode* e : m_basicstr_axiom_todo) { - TRACE("str", tout << "consider deleting " << mk_pp(e->get_expr(), get_manager()) + TRACE(str, tout << "consider deleting " << mk_pp(e->get_expr(), get_manager()) << ", enode scope level is " << e->get_iscope_lvl() << std::endl;); if (e->get_iscope_lvl() <= (unsigned)sLevel) { @@ -7139,7 +7139,7 @@ namespace smt { if (ctx.is_searching()) { for (expr * e : m_persisted_axioms) { - TRACE("str", tout << "persist axiom: " << mk_pp(e, get_manager()) << std::endl;); + TRACE(str, tout << "persist axiom: " << mk_pp(e, get_manager()) << std::endl;); m_persisted_axiom_todo.push_back(e); } } @@ -7194,7 +7194,7 @@ namespace smt { // note that internal variables don't count if they're only length tester / value tester vars. if (variable_set.find(node) != variable_set.end()) { if (varMap[node] != 1) { - TRACE("str", tout << "new variable: " << mk_pp(node, get_manager()) << std::endl;); + TRACE(str, tout << "new variable: " << mk_pp(node, get_manager()) << std::endl;); } varMap[node] = 1; } @@ -7248,7 +7248,7 @@ namespace smt { // so we bypass a huge amount of work by doing the following... if (m.is_eq(argAst)) { - TRACE("str", tout + TRACE(str, tout << "eq ast " << mk_pp(argAst, m) << " is between args of sort " << to_app(argAst)->get_arg(0)->get_sort()->get_name() << std::endl;); @@ -7423,7 +7423,7 @@ namespace smt { // so we avoid computing the set difference (but this might be slower) for (expr* var : variable_set) { if (internal_variable_set.find(var) == internal_variable_set.end()) { - TRACE("str", tout << "new variable: " << mk_pp(var, m) << std::endl;); + TRACE(str, tout << "new variable: " << mk_pp(var, m) << std::endl;); strVarMap[var] = 1; } } @@ -7576,7 +7576,7 @@ namespace smt { } // print some debugging info - TRACE("str", trace_ctx_dep(tout, aliasIndexMap, var_eq_constStr_map, + TRACE(str, trace_ctx_dep(tout, aliasIndexMap, var_eq_constStr_map, var_eq_concat_map, var_eq_unroll_map, concat_eq_constStr_map, concat_eq_concat_map);); @@ -7624,7 +7624,7 @@ namespace smt { for (auto const &itor2 : inVarMap) { expr * varInFunc = get_alias_index_ast(aliasIndexMap, itor2.first); - TRACE("str", tout << "var in unroll = " << + TRACE(str, tout << "var in unroll = " << mk_ismt2_pp(itor2.first, m) << std::endl << "dealiased var = " << mk_ismt2_pp(varInFunc, m) << std::endl;); @@ -7793,7 +7793,7 @@ namespace smt { } // print the dependence map - TRACE("str", + TRACE(str, tout << "Dependence Map" << std::endl; for(auto const &itor : depMap) { tout << mk_pp(itor.first, m); @@ -7978,7 +7978,7 @@ namespace smt { rational Ival; bool Ival_exists = get_arith_value(a, Ival); if (Ival_exists) { - TRACE("str", tout << "integer theory assigns " << mk_pp(a, m) << " = " << Ival.to_string() << std::endl;); + TRACE(str, tout << "integer theory assigns " << mk_pp(a, m) << " = " << Ival.to_string() << std::endl;); // if that value is not -1, and we know the length of S, we can assert (str.to.int S) = Ival --> S = "0...(len(S)-len(Ival))...0" ++ "Ival" if (!Ival.is_minus_one()) { rational Slen; @@ -8008,11 +8008,11 @@ namespace smt { } } } else { - TRACE("str", tout << "integer theory has no assignment for " << mk_pp(a, m) << std::endl;); + TRACE(str, tout << "integer theory has no assignment for " << mk_pp(a, m) << std::endl;); expr_ref is_zero(ctx.mk_eq_atom(a, m_autil.mk_int(0)), m); /* literal is_zero_l = */ mk_literal(is_zero); axiomAdd = true; - TRACE("str", ctx.display(tout);); + TRACE(str, ctx.display(tout);); } bool S_hasEqcValue; @@ -8061,7 +8061,7 @@ namespace smt { if (Sval_expr_exists) { zstring Sval; u.str.is_string(Sval_expr, Sval); - TRACE("str", tout << "string theory assigns " << mk_pp(a, m) << " = \"" << Sval << "\"\n";); + TRACE(str, tout << "string theory assigns " << mk_pp(a, m) << " = \"" << Sval << "\"\n";); // empty string --> integer value < 0 if (Sval.empty()) { // ignore this. we should already assert the axiom for what happens when the string is "" @@ -8069,7 +8069,7 @@ namespace smt { // check for leading zeroes. if the first character is '0', the entire string must be "0" char firstChar = (int)Sval[0]; if (firstChar == '0' && !(Sval == zstring("0"))) { - TRACE("str", tout << "str.from-int argument " << Sval << " contains leading zeroes" << std::endl;); + TRACE(str, tout << "str.from-int argument " << Sval << " contains leading zeroes" << std::endl;); expr_ref axiom(m.mk_not(ctx.mk_eq_atom(a, mk_string(Sval))), m); assert_axiom(axiom); return true; @@ -8094,7 +8094,7 @@ namespace smt { } } } else { - TRACE("str", tout << "string theory has no assignment for " << mk_pp(a, m) << std::endl;); + TRACE(str, tout << "string theory has no assignment for " << mk_pp(a, m) << std::endl;); // see if the integer theory has assigned N yet arith_value v(m); v.init(&ctx); @@ -8114,11 +8114,11 @@ namespace smt { assert_axiom(axiom); axiomAdd = true; } else { - TRACE("str", tout << "integer theory has no assignment for " << mk_pp(N, m) << std::endl;); + TRACE(str, tout << "integer theory has no assignment for " << mk_pp(N, m) << std::endl;); expr_ref is_zero(ctx.mk_eq_atom(N, m_autil.mk_int(0)), m); /* literal is_zero_l = */ mk_literal(is_zero); axiomAdd = true; - TRACE("str", ctx.display(tout);); + TRACE(str, ctx.display(tout);); } } return axiomAdd; @@ -8151,7 +8151,7 @@ namespace smt { bool res = false; ast_manager & m = get_manager(); - TRACE("str", tout << "propagate_length_within_eqc: " << mk_ismt2_pp(var, m) << std::endl ;); + TRACE(str, tout << "propagate_length_within_eqc: " << mk_ismt2_pp(var, m) << std::endl ;); rational varLen; if (! get_len_value(var, varLen)) { @@ -8180,7 +8180,7 @@ namespace smt { expr_ref varLen(mk_strlen(var), m); expr_ref axr(ctx.mk_eq_atom(varLen, mk_int(varLen)), m); assert_implication(axl, axr); - TRACE("str", tout << mk_ismt2_pp(axl, m) << std::endl << " ---> " << std::endl << mk_ismt2_pp(axr, m);); + TRACE(str, tout << mk_ismt2_pp(axl, m) << std::endl << " ---> " << std::endl << mk_ismt2_pp(axr, m);); res = true; } } @@ -8211,7 +8211,7 @@ namespace smt { // the length of concat is unresolved yet if (get_len_value(concat, lenValue)) { // but all leaf nodes have length information - TRACE("str", tout << "* length pop-up: " << mk_ismt2_pp(concat, m) << "| = " << lenValue << std::endl;); + TRACE(str, tout << "* length pop-up: " << mk_ismt2_pp(concat, m) << "| = " << lenValue << std::endl;); std::set leafNodes; get_unique_non_concat_nodes(concat, leafNodes); expr_ref_vector l_items(m); @@ -8232,7 +8232,7 @@ namespace smt { expr_ref lenValueExpr (mk_int(lenValue), m); expr_ref axr(ctx.mk_eq_atom(concatlenExpr, lenValueExpr), m); assert_implication(axl, axr); - TRACE("str", tout << mk_ismt2_pp(axl, m) << std::endl << " ---> " << std::endl << mk_ismt2_pp(axr, m)<< std::endl;); + TRACE(str, tout << mk_ismt2_pp(axl, m) << std::endl << " ---> " << std::endl << mk_ismt2_pp(axr, m)<< std::endl;); axiomAdded = true; } } @@ -8278,12 +8278,12 @@ namespace smt { finalCheckProgressIndicator = false; } - TRACE("str", tout << "final check" << std::endl;); - TRACE_CODE(if (is_trace_enabled("t_str_dump_assign")) { dump_assignments(); }); + TRACE(str, tout << "final check" << std::endl;); + TRACE_CODE(if (is_trace_enabled(TraceTag::t_str_dump_assign)) { dump_assignments(); }); check_variable_scope(); if (opt_DeferEQCConsistencyCheck) { - TRACE("str", tout << "performing deferred EQC consistency check" << std::endl;); + TRACE(str, tout << "performing deferred EQC consistency check" << std::endl;); std::set eqc_roots; for (auto const &e : ctx.enodes()) { enode * root = e->get_root(); @@ -8295,16 +8295,16 @@ namespace smt { for (auto const &e : eqc_roots) { app * a = e->get_expr(); if (!(a->get_sort() == u.str.mk_string_sort())) { - TRACE("str", tout << "EQC root " << mk_pp(a, m) << " not a string term; skipping" << std::endl;); + TRACE(str, tout << "EQC root " << mk_pp(a, m) << " not a string term; skipping" << std::endl;); } else { - TRACE("str", tout << "EQC root " << mk_pp(a, m) << " is a string term. Checking this EQC" << std::endl;); + TRACE(str, tout << "EQC root " << mk_pp(a, m) << " is a string term. Checking this EQC" << std::endl;); // first call check_concat_len_in_eqc() on each member of the eqc enode * e_it = e; enode * e_root = e_it; do { bool status = check_concat_len_in_eqc(e_it->get_expr()); if (!status) { - TRACE("str", tout << "concat-len check asserted an axiom on " << mk_pp(e_it->get_expr(), m) << std::endl;); + TRACE(str, tout << "concat-len check asserted an axiom on " << mk_pp(e_it->get_expr(), m) << std::endl;); found_inconsistency = true; } e_it = e_it->get_next(); @@ -8314,10 +8314,10 @@ namespace smt { enode * e1 = e; enode * e2 = e1->get_next(); if (e1 != e2) { - TRACE("str", tout << "deferred new_eq_check() over EQC of " << mk_pp(e1->get_expr(), m) << " and " << mk_pp(e2->get_expr(), m) << std::endl;); + TRACE(str, tout << "deferred new_eq_check() over EQC of " << mk_pp(e1->get_expr(), m) << " and " << mk_pp(e2->get_expr(), m) << std::endl;); bool result = new_eq_check(e1->get_expr(), e2->get_expr()); if (!result) { - TRACE("str", tout << "new_eq_check found inconsistencies" << std::endl;); + TRACE(str, tout << "new_eq_check found inconsistencies" << std::endl;); found_inconsistency = true; } } @@ -8325,10 +8325,10 @@ namespace smt { } if (found_inconsistency) { - TRACE("str", tout << "Found inconsistency in final check! Returning to search." << std::endl;); + TRACE(str, tout << "Found inconsistency in final check! Returning to search." << std::endl;); return FC_CONTINUE; } else { - TRACE("str", tout << "Deferred consistency check passed. Continuing in final check." << std::endl;); + TRACE(str, tout << "Deferred consistency check passed. Continuing in final check." << std::endl;); } } @@ -8358,7 +8358,7 @@ namespace smt { expr * concat_rhs_str = get_eqc_value(concat_rhs, concat_rhs_haseqc); get_eqc_value(var, var_haseqc); if (concat_lhs_haseqc && concat_rhs_haseqc && !var_haseqc) { - TRACE("str", tout << "backpropagate into " << mk_pp(var, m) << " = " << mk_pp(concat, m) << std::endl + TRACE(str, tout << "backpropagate into " << mk_pp(var, m) << " = " << mk_pp(concat, m) << std::endl << "LHS ~= " << mk_pp(concat_lhs_str, m) << " RHS ~= " << mk_pp(concat_rhs_str, m) << std::endl;); zstring lhsString, rhsString; @@ -8392,7 +8392,7 @@ namespace smt { } if (backpropagation_occurred) { - TRACE("str", tout << "Resuming search due to axioms added by backpropagation." << std::endl;); + TRACE(str, tout << "Resuming search due to axioms added by backpropagation." << std::endl;); return FC_CONTINUE; } @@ -8404,13 +8404,13 @@ namespace smt { bool length_propagation_occurred = propagate_length(varSet, concatSet, exprLenMap); if (length_propagation_occurred) { - TRACE("str", tout << "Resuming search due to axioms added by length propagation." << std::endl;); + TRACE(str, tout << "Resuming search due to axioms added by length propagation." << std::endl;); return FC_CONTINUE; } } if (!solve_regex_automata()) { - TRACE("str", tout << "regex engine requested to give up!" << std::endl;); + TRACE(str, tout << "regex engine requested to give up!" << std::endl;); return FC_GIVEUP; } @@ -8421,19 +8421,19 @@ namespace smt { for (auto const &itor : varAppearInAssign) { if (internal_variable_set.find(itor.first) != internal_variable_set.end()) { // this can be ignored, I think - TRACE("str", tout << "free internal variable " << mk_pp(itor.first, m) << " ignored" << std::endl;); + TRACE(str, tout << "free internal variable " << mk_pp(itor.first, m) << " ignored" << std::endl;); continue; } bool hasEqcValue = false; get_eqc_value(itor.first, hasEqcValue); if (!hasEqcValue) { - TRACE("str", tout << "found free variable " << mk_pp(itor.first, m) << std::endl;); + TRACE(str, tout << "found free variable " << mk_pp(itor.first, m) << std::endl;); needToAssignFreeVars = true; free_variables.push_back(itor.first); // break; } else { // debug - // TRACE("str", tout << "variable " << mk_pp(itor->first, m) << " = " << mk_pp(eqcString, m) << std::endl;); + // TRACE(str, tout << "variable " << mk_pp(itor->first, m) << " = " << mk_pp(eqcString, m) << std::endl;); } } } @@ -8465,7 +8465,7 @@ namespace smt { } } if (addedStrIntAxioms) { - TRACE("str", tout << "Resuming search due to addition of string-integer conversion axioms." << std::endl;); + TRACE(str, tout << "Resuming search due to addition of string-integer conversion axioms." << std::endl;); return FC_CONTINUE; } @@ -8488,7 +8488,7 @@ namespace smt { ctx.get_rewriter()(valueInRe); if (m.is_true(valueInRe)) { if (current_assignment == l_false) { - TRACE("str", tout << "regex conflict: " << mk_pp(str, m) << " = \"" << strValue << "\" but must not be in the language " << mk_pp(re, m) << std::endl;); + TRACE(str, tout << "regex conflict: " << mk_pp(str, m) << " = \"" << strValue << "\" but must not be in the language " << mk_pp(re, m) << std::endl;); expr_ref conflictClause(m.mk_or(m.mk_not(ctx.mk_eq_atom(str, mk_string(strValue))), str_in_re), m); assert_axiom(conflictClause); add_persisted_axiom(conflictClause); @@ -8496,7 +8496,7 @@ namespace smt { } } else if (m.is_false(valueInRe)) { if (current_assignment == l_true) { - TRACE("str", tout << "regex conflict: " << mk_pp(str, m) << " = \"" << strValue << "\" but must be in the language " << mk_pp(re, m) << std::endl;); + TRACE(str, tout << "regex conflict: " << mk_pp(str, m) << " = \"" << strValue << "\" but must be in the language " << mk_pp(re, m) << std::endl;); expr_ref conflictClause(m.mk_or(m.mk_not(ctx.mk_eq_atom(str, mk_string(strValue))), m.mk_not(str_in_re)), m); assert_axiom(conflictClause); add_persisted_axiom(conflictClause); @@ -8517,12 +8517,12 @@ namespace smt { if (regexOK) { if (unused_internal_variables.empty()) { if (!existNegativeContains) { - TRACE("str", tout << "All variables are assigned. Done!" << std::endl;); + TRACE(str, tout << "All variables are assigned. Done!" << std::endl;); m_stats.m_solved_by = 2; return FC_DONE; } } else { - TRACE("str", tout << "Assigning decoy values to free internal variables." << std::endl;); + TRACE(str, tout << "Assigning decoy values to free internal variables." << std::endl;); for (auto const &var : unused_internal_variables) { expr_ref assignment(m.mk_eq(var, mk_string("**unused**")), m); assert_axiom(assignment); @@ -8532,7 +8532,7 @@ namespace smt { } } - CTRACE("str", needToAssignFreeVars, + CTRACE(str, needToAssignFreeVars, tout << "Need to assign values to the following free variables:" << std::endl; for (expr* v : free_variables) { tout << mk_ismt2_pp(v, m) << std::endl; @@ -8547,7 +8547,7 @@ namespace smt { // Assign free variables { - TRACE("str", tout << "free var map (#" << freeVar_map.size() << "):" << std::endl; + TRACE(str, tout << "free var map (#" << freeVar_map.size() << "):" << std::endl; for (auto const &freeVarItor1 : freeVar_map) { expr * freeVar = freeVarItor1.first; rational lenValue; @@ -8562,16 +8562,16 @@ namespace smt { { // TODO if we're using fixed-length testing, do we care about finding free variables any more? // that work might be useless - TRACE("str", tout << "using fixed-length model construction" << std::endl;); + TRACE(str, tout << "using fixed-length model construction" << std::endl;); arith_value v(get_manager()); v.init(&ctx); final_check_status arith_fc_status = v.final_check(); if (arith_fc_status != FC_DONE) { - TRACE("str", tout << "arithmetic solver not done yet, continuing search" << std::endl;); + TRACE(str, tout << "arithmetic solver not done yet, continuing search" << std::endl;); return FC_CONTINUE; } - TRACE("str", tout << "arithmetic solver done in final check" << std::endl;); + TRACE(str, tout << "arithmetic solver done in final check" << std::endl;); expr_ref_vector precondition(m); expr_ref_vector cex(m); @@ -8588,13 +8588,13 @@ namespace smt { add_persisted_axiom(conflict); return FC_CONTINUE; } else { // model_status == l_undef - TRACE("str", tout << "fixed-length model construction found missing side conditions; continuing search" << std::endl;); + TRACE(str, tout << "fixed-length model construction found missing side conditions; continuing search" << std::endl;); return FC_CONTINUE; } } if (opt_VerifyFinalCheckProgress && !finalCheckProgressIndicator) { - TRACE("str", tout << "BUG: no progress in final check, giving up!!" << std::endl;); + TRACE(str, tout << "BUG: no progress in final check, giving up!!" << std::endl;); m.raise_exception("no progress in theory_str final check"); } @@ -8629,7 +8629,7 @@ namespace smt { } void theory_str::init_model(model_generator & mg) { - //TRACE("str", tout << "initializing model" << std::endl; display(tout);); + //TRACE(str, tout << "initializing model" << std::endl; display(tout);); m_factory = alloc(str_value_factory, get_manager(), get_family_id()); mg.register_factory(m_factory); } @@ -8703,7 +8703,7 @@ namespace smt { } model_value_proc * theory_str::mk_value(enode * n, model_generator & mg) { - TRACE("str", tout << "mk_value for: " << mk_ismt2_pp(n->get_expr(), get_manager()) << + TRACE(str, tout << "mk_value for: " << mk_ismt2_pp(n->get_expr(), get_manager()) << " (sort " << mk_ismt2_pp(n->get_expr()->get_sort(), get_manager()) << ")" << std::endl;); ast_manager & m = get_manager(); app_ref owner(m); @@ -8716,7 +8716,7 @@ namespace smt { if (val != nullptr) { return alloc(expr_wrapper_proc, val); } else { - TRACE("str", tout << "WARNING: failed to find a concrete value, falling back" << std::endl;); + TRACE(str, tout << "WARNING: failed to find a concrete value, falling back" << std::endl;); std::ostringstream unused; unused << "**UNUSED**" << (m_unused_id++); return alloc(expr_wrapper_proc, to_app(mk_string(unused.str()))); @@ -8732,7 +8732,7 @@ namespace smt { rational theory_str::get_refine_length(expr* ex, expr_ref_vector& extra_deps){ ast_manager & m = get_manager(); - TRACE("str_fl", tout << "finding length for " << mk_ismt2_pp(ex, m) << std::endl;); + TRACE(str_fl, tout << "finding length for " << mk_ismt2_pp(ex, m) << std::endl;); if (u.str.is_string(ex)) { bool str_exists; expr * str = get_eqc_value(ex, str_exists); @@ -8780,7 +8780,7 @@ namespace smt { return len; } else if (u.str.is_replace(ex)) { - TRACE("str_fl", tout << "replace is like contains---not in conjunctive fragment!" << std::endl;); + TRACE(str_fl, tout << "replace is like contains---not in conjunctive fragment!" << std::endl;); UNREACHABLE(); } //find asserts that it exists @@ -8788,7 +8788,7 @@ namespace smt { } expr* theory_str::refine(expr* lhs, expr* rhs, rational offset) { - // TRACE("str", tout << "refine with " << offset.get_unsigned() << std::endl;); + // TRACE(str, tout << "refine with " << offset.get_unsigned() << std::endl;); if (offset >= rational(0)) { ++m_stats.m_refine_eq; return refine_eq(lhs, rhs, offset.get_unsigned()); @@ -8814,7 +8814,7 @@ namespace smt { } expr* theory_str::refine_eq(expr* lhs, expr* rhs, unsigned _offset) { - TRACE("str_fl", tout << "refine eq " << _offset << std::endl;); + TRACE(str_fl, tout << "refine eq " << _offset << std::endl;); ast_manager & m = get_manager(); expr_ref_vector Gamma(m); @@ -8923,23 +8923,23 @@ namespace smt { } // len(Gamma[:i]) == len(Delta[:j]) expr* sublen_eq = ctx.mk_eq_atom(left_sublen, right_sublen); - TRACE("str", tout << "sublen_eq " << mk_pp(sublen_eq, m) << std::endl;); + TRACE(str, tout << "sublen_eq " << mk_pp(sublen_eq, m) << std::endl;); diseqs.push_back(sublen_eq); } if (extra_left_cond != nullptr) { - TRACE("str", tout << "extra_left_cond " << mk_pp(extra_left_cond, m) << std::endl;); + TRACE(str, tout << "extra_left_cond " << mk_pp(extra_left_cond, m) << std::endl;); diseqs.push_back(extra_left_cond); } if (extra_right_cond != nullptr) { - TRACE("str", tout << "extra_right_cond " << mk_pp(extra_right_cond, m) << std::endl;); + TRACE(str, tout << "extra_right_cond " << mk_pp(extra_right_cond, m) << std::endl;); diseqs.push_back(extra_right_cond); } if (extra_deps.size() > 0) { diseqs.push_back(m.mk_and(extra_deps.size(), extra_deps.data())); - TRACE("str", tout << "extra_deps " << mk_pp(diseqs.get(diseqs.size()-1), m) << std::endl;); + TRACE(str, tout << "extra_deps " << mk_pp(diseqs.get(diseqs.size()-1), m) << std::endl;); } expr* final_diseq = m.mk_and(diseqs.size(), diseqs.data()); - TRACE("str", tout << "learning not " << mk_pp(final_diseq, m) << std::endl;); + TRACE(str, tout << "learning not " << mk_pp(final_diseq, m) << std::endl;); return final_diseq; } @@ -8948,13 +8948,13 @@ namespace smt { expr_ref lesson(m); lesson = m.mk_not(m.mk_eq(lhs, rhs)); - TRACE("str", tout << "learning not " << mk_pp(lesson, m) << std::endl;); + TRACE(str, tout << "learning not " << mk_pp(lesson, m) << std::endl;); return lesson; } expr* theory_str::refine_function(expr* f) { //Can we learn something better? - TRACE("str", tout << "learning not " << mk_pp(f, get_manager()) << std::endl;); + TRACE(str, tout << "learning not " << mk_pp(f, get_manager()) << std::endl;); return f; } @@ -8979,7 +8979,7 @@ namespace smt { } } } - TRACE("str", tout << "non string term!" << mk_pp(ex, m) << std::endl;); + TRACE(str, tout << "non string term!" << mk_pp(ex, m) << std::endl;); return false; } }; /* namespace smt */ diff --git a/src/smt/theory_str.h b/src/smt/theory_str.h index 27ee97c97..47d69345a 100644 --- a/src/smt/theory_str.h +++ b/src/smt/theory_str.h @@ -76,7 +76,7 @@ public: expr* v0 = get_fresh_value(seq); return u.re.mk_to_re(v0); } - TRACE("t_str", tout << "unexpected sort in get_fresh_value(): " << mk_pp(s, m_manager) << std::endl;); + TRACE(t_str, tout << "unexpected sort in get_fresh_value(): " << mk_pp(s, m_manager) << std::endl;); UNREACHABLE(); return nullptr; } void register_value(expr * n) override { /* Ignore */ } @@ -93,15 +93,15 @@ public: binary_search_trail(obj_map > & target, expr * entry) : target(target), entry(entry) {} void undo() override { - TRACE("t_str_binary_search", tout << "in binary_search_trail::undo()" << std::endl;); + TRACE(t_str_binary_search, tout << "in binary_search_trail::undo()" << std::endl;); if (target.contains(entry)) { if (!target[entry].empty()) { target[entry].pop_back(); } else { - TRACE("t_str_binary_search", tout << "WARNING: attempt to remove length tester from an empty stack" << std::endl;); + TRACE(t_str_binary_search, tout << "WARNING: attempt to remove length tester from an empty stack" << std::endl;); } } else { - TRACE("t_str_binary_search", tout << "WARNING: attempt to access length tester map via invalid key" << std::endl;); + TRACE(t_str_binary_search, tout << "WARNING: attempt to access length tester map via invalid key" << std::endl;); } } }; diff --git a/src/smt/theory_str_mc.cpp b/src/smt/theory_str_mc.cpp index 49efa1077..f434363e2 100644 --- a/src/smt/theory_str_mc.cpp +++ b/src/smt/theory_str_mc.cpp @@ -129,7 +129,7 @@ namespace smt { expr_ref final_diseq(mk_and(branch), sub_m); fixed_length_assumptions.push_back(final_diseq); - TRACE("str_fl", tout << "inserting into fixed_lesson" <= rational(base_chars.size()) || len.is_neg()) { @@ -724,7 +724,7 @@ namespace smt { cex = m.mk_or(m_autil.mk_ge(pos, mk_int(0)), m_autil.mk_le(pos, mk_int(0))); return false; } - TRACE("str_fl", tout << "reduce str.at: base=" << mk_pp(base, m) << ", pos=" << pos_value.to_string() << std::endl;); + TRACE(str_fl, tout << "reduce str.at: base=" << mk_pp(base, m) << ", pos=" << pos_value.to_string() << std::endl;); if (pos_value.is_neg() || pos_value >= rational(base_chars.size())) { // return the empty string eqc_chars.reset(); @@ -751,7 +751,7 @@ namespace smt { cex = expr_ref(m.mk_or(m_autil.mk_ge(mk_strlen(term), mk_int(0)), m_autil.mk_le(mk_strlen(term), mk_int(0))), m); return false; } - TRACE("str_fl", tout << "reduce int.to.str: n=" << iValue << std::endl;); + TRACE(str_fl, tout << "reduce int.to.str: n=" << iValue << std::endl;); if (iValue.is_neg()) { if (!termLen.is_zero()) { // conflict @@ -776,17 +776,17 @@ namespace smt { return true; } } else { - TRACE("str_fl", tout << "string term " << mk_pp(term, m) << " handled as uninterpreted function" << std::endl;); + TRACE(str_fl, tout << "string term " << mk_pp(term, m) << " handled as uninterpreted function" << std::endl;); expr_ref_vector *chars = nullptr; if (!uninterpreted_to_char_subterm_map.find(term, chars)) { rational ufLen_value; bool uf_hasLen = fixed_length_get_len_value(term, ufLen_value); if (!uf_hasLen || ufLen_value.is_neg()) { - TRACE("str_fl", tout << "uninterpreted function " << mk_pp(term, m) << " has no length assignment or impossible length assignment - asserting conflict axiom" << std::endl;); + TRACE(str_fl, tout << "uninterpreted function " << mk_pp(term, m) << " has no length assignment or impossible length assignment - asserting conflict axiom" << std::endl;); cex = expr_ref(m_autil.mk_ge(mk_strlen(term), mk_int(0)), m); return false; } - TRACE("str_fl", tout << "creating character terms for uninterpreted function " << mk_pp(term, m) << ", length = " << ufLen_value << std::endl;); + TRACE(str_fl, tout << "creating character terms for uninterpreted function " << mk_pp(term, m) << ", length = " << ufLen_value << std::endl;); chars = alloc(expr_ref_vector, m); for (rational i = rational::zero(); i < ufLen_value; ++i) { expr_ref ch(mk_fresh_const("char", u.mk_char_sort()), m); @@ -816,7 +816,7 @@ namespace smt { } if (lhs_chars.size() != rhs_chars.size()) { - TRACE("str_fl", tout << "length information inconsistent: " << mk_pp(lhs, m) << " has " << lhs_chars.size() << + TRACE(str_fl, tout << "length information inconsistent: " << mk_pp(lhs, m) << " has " << lhs_chars.size() << " chars, " << mk_pp(rhs, m) << " has " << rhs_chars.size() << " chars" << std::endl;); // equal strings ought to have equal lengths cex = m.mk_or(m.mk_not(ctx.mk_eq_atom(lhs, rhs)), ctx.mk_eq_atom(mk_strlen(lhs), mk_strlen(rhs))); @@ -827,7 +827,7 @@ namespace smt { expr_ref cRHS(rhs_chars.get(i), sub_m); expr_ref _e(sub_m.mk_eq(cLHS, cRHS), sub_m); fixed_length_assumptions.push_back(_e); - TRACE("str_fl", tout << "inserting into fixed_lesson" <get_sort(); if (lhs_sort == str_sort) { - TRACE("str_fl", tout << "reduce string equality: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << std::endl;); + TRACE(str_fl, tout << "reduce string equality: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << std::endl;); expr_ref cex(m); expr_ref left(lhs, m); expr_ref right(rhs, m); @@ -975,10 +975,10 @@ namespace smt { } fixed_length_reduced_boolean_formulas.push_back(f); } else { - TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not an equality over strings" << std::endl;); + TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not an equality over strings" << std::endl;); } } else if (u.str.is_in_re(f)) { - TRACE("str_fl", tout << "reduce regex membership: " << mk_pp(f, m) << std::endl;); + TRACE(str_fl, tout << "reduce regex membership: " << mk_pp(f, m) << std::endl;); expr_ref cex_clause(m); expr_ref re(f, m); if (!fixed_length_reduce_regex_membership(subsolver, re, cex_clause, true)) { @@ -991,10 +991,10 @@ namespace smt { // TODO in some cases (e.g. len(haystack) is only slightly greater than len(needle)) // we might be okay to assert the full disjunction because there are very few disjuncts if (m_params.m_FixedLengthRefinement) { - TRACE("str_fl", tout << "abstracting out positive contains: " << mk_pp(f, m) << std::endl;); + TRACE(str_fl, tout << "abstracting out positive contains: " << mk_pp(f, m) << std::endl;); abstracted_boolean_formulas.push_back(f); } else { - TRACE("str_fl", tout << "reduce positive contains: " << mk_pp(f, m) << std::endl;); + TRACE(str_fl, tout << "reduce positive contains: " << mk_pp(f, m) << std::endl;); expr_ref cex(m); expr_ref cont(f, m); if (!fixed_length_reduce_contains(subsolver, cont, cex)) { @@ -1005,7 +1005,7 @@ namespace smt { fixed_length_reduced_boolean_formulas.push_back(f); } } else if (u.str.is_prefix(f)) { - TRACE("str_fl", tout << "reduce positive prefix: " << mk_pp(f, m) << std::endl;); + TRACE(str_fl, tout << "reduce positive prefix: " << mk_pp(f, m) << std::endl;); expr_ref cex(m); expr_ref pref(f, m); if (!fixed_length_reduce_prefix(subsolver, pref, cex)) { @@ -1015,7 +1015,7 @@ namespace smt { } fixed_length_reduced_boolean_formulas.push_back(f); } else if (u.str.is_suffix(f)) { - TRACE("str_fl", tout << "reduce positive suffix: " << mk_pp(f, m) << std::endl;); + TRACE(str_fl, tout << "reduce positive suffix: " << mk_pp(f, m) << std::endl;); expr_ref cex(m); expr_ref suf(f, m); if (!fixed_length_reduce_suffix(subsolver, suf, cex)) { @@ -1029,7 +1029,7 @@ namespace smt { if (m.is_eq(subterm, lhs, rhs)) { sort * lhs_sort = lhs->get_sort(); if (lhs_sort == str_sort) { - TRACE("str_fl", tout << "reduce string disequality: " << mk_pp(lhs, m) << " != " << mk_pp(rhs, m) << std::endl;); + TRACE(str_fl, tout << "reduce string disequality: " << mk_pp(lhs, m) << " != " << mk_pp(rhs, m) << std::endl;); expr_ref cex(m); expr_ref left(lhs, m); expr_ref right(rhs, m); @@ -1042,7 +1042,7 @@ namespace smt { fixed_length_reduced_boolean_formulas.push_back(f); } } else if (u.str.is_in_re(subterm)) { - TRACE("str_fl", tout << "reduce negative regex membership: " << mk_pp(f, m) << std::endl;); + TRACE(str_fl, tout << "reduce negative regex membership: " << mk_pp(f, m) << std::endl;); expr_ref cex_clause(m); expr_ref re(subterm, m); if (!fixed_length_reduce_regex_membership(subsolver, re, cex_clause, false)) { @@ -1052,7 +1052,7 @@ namespace smt { } fixed_length_reduced_boolean_formulas.push_back(f); } else if (u.str.is_contains(subterm)) { - TRACE("str_fl", tout << "reduce negative contains: " << mk_pp(subterm, m) << std::endl;); + TRACE(str_fl, tout << "reduce negative contains: " << mk_pp(subterm, m) << std::endl;); expr_ref cex(m); expr_ref cont(subterm, m); if (!fixed_length_reduce_negative_contains(subsolver, cont, cex)) { @@ -1062,7 +1062,7 @@ namespace smt { } fixed_length_reduced_boolean_formulas.push_back(f); } else if (u.str.is_prefix(subterm)) { - TRACE("str_fl", tout << "reduce negative prefix: " << mk_pp(subterm, m) << std::endl;); + TRACE(str_fl, tout << "reduce negative prefix: " << mk_pp(subterm, m) << std::endl;); expr_ref cex(m); expr_ref pref(subterm, m); if (!fixed_length_reduce_negative_prefix(subsolver, pref, cex)) { @@ -1072,7 +1072,7 @@ namespace smt { } fixed_length_reduced_boolean_formulas.push_back(f); } else if (u.str.is_suffix(subterm)) { - TRACE("str_fl", tout << "reduce negative suffix: " << mk_pp(subterm, m) << std::endl;); + TRACE(str_fl, tout << "reduce negative suffix: " << mk_pp(subterm, m) << std::endl;); expr_ref cex(m); expr_ref suf(subterm, m); if (!fixed_length_reduce_negative_suffix(subsolver, suf, cex)) { @@ -1082,14 +1082,14 @@ namespace smt { } fixed_length_reduced_boolean_formulas.push_back(f); } else { - TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not a boolean formula we handle" << std::endl;); + TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not a boolean formula we handle" << std::endl;); } } else { - TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not a boolean formula we handle" << std::endl;); + TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not a boolean formula we handle" << std::endl;); continue; } } else { - TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not relevant to strings" << std::endl;); + TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not relevant to strings" << std::endl;); continue; } } @@ -1100,7 +1100,7 @@ namespace smt { arith_value v(get_manager()); v.init(&get_context()); for (auto e : string_int_conversion_terms) { - TRACE("str_fl", tout << "pre-run check str-int term " << mk_pp(e, get_manager()) << std::endl;); + TRACE(str_fl, tout << "pre-run check str-int term " << mk_pp(e, get_manager()) << std::endl;); expr* _arg; if (u.str.is_stoi(e, _arg)) { expr_ref arg(_arg, m); @@ -1111,11 +1111,11 @@ namespace smt { add_persisted_axiom(stoi_cex); return l_undef; } - TRACE("str_fl", tout << "length of term is " << slen << std::endl;); + TRACE(str_fl, tout << "length of term is " << slen << std::endl;); rational ival; if (v.get_value(e, ival)) { - TRACE("str_fl", tout << "integer theory assigns " << ival << " to " << mk_pp(e, get_manager()) << std::endl;); + TRACE(str_fl, tout << "integer theory assigns " << ival << " to " << mk_pp(e, get_manager()) << std::endl;); // if ival is non-negative, because we know the length of arg, we can add a character constraint for arg if (ival.is_nonneg()) { zstring ival_str(ival.to_string()); @@ -1145,14 +1145,14 @@ namespace smt { fixed_length_reduced_boolean_formulas.push_back(m.mk_eq(e, mk_int(ival))); } } else { - TRACE("str_fl", tout << "integer theory has no assignment for " << mk_pp(e, get_manager()) << std::endl;); + TRACE(str_fl, tout << "integer theory has no assignment for " << mk_pp(e, get_manager()) << std::endl;); // consistency needs to be checked after the string is assigned } } else if (u.str.is_to_code(e, _arg)) { expr_ref arg(_arg, m); rational ival; if (v.get_value(e, ival)) { - TRACE("str_fl", tout << "integer theory assigns " << ival << " to " << mk_pp(e, m) << std::endl;); + TRACE(str_fl, tout << "integer theory assigns " << ival << " to " << mk_pp(e, m) << std::endl;); if (ival >= rational::zero() && ival <= rational(u.max_char())) { zstring ival_str(ival.get_unsigned()); expr_ref arg_char_expr(mk_string(ival_str), m); @@ -1169,7 +1169,7 @@ namespace smt { fixed_length_reduced_boolean_formulas.push_back(m.mk_eq(e, mk_int(ival))); } } else { - TRACE("str_fl", tout << "integer theory has no assignment for " << mk_pp(e, m) << std::endl;); + TRACE(str_fl, tout << "integer theory has no assignment for " << mk_pp(e, m) << std::endl;); // consistency needs to be checked after the string is assigned } } else if (u.str.is_itos(e, _arg)) { @@ -1181,10 +1181,10 @@ namespace smt { add_persisted_axiom(stoi_cex); return l_undef; } - TRACE("str_fl", tout << "length of term is " << slen << std::endl;); + TRACE(str_fl, tout << "length of term is " << slen << std::endl;); rational ival; if (v.get_value(arg, ival)) { - TRACE("str_fl", tout << "integer theory assigns " << ival << " to " << mk_pp(arg, get_manager()) << std::endl;); + TRACE(str_fl, tout << "integer theory assigns " << ival << " to " << mk_pp(arg, get_manager()) << std::endl;); zstring ival_str; if (ival.is_neg()) { // e must be the empty string, i.e. have length 0 @@ -1211,14 +1211,14 @@ namespace smt { } fixed_length_reduced_boolean_formulas.push_back(m.mk_eq(arg, mk_int(ival))); } else { - TRACE("str_fl", tout << "integer theory has no assignment for " << mk_pp(arg, get_manager()) << std::endl;); + TRACE(str_fl, tout << "integer theory has no assignment for " << mk_pp(arg, get_manager()) << std::endl;); // consistency needs to be checked after the string is assigned } } else if (u.str.is_from_code(e, _arg)) { expr_ref arg(_arg, m); rational ival; if (v.get_value(arg, ival)) { - TRACE("str_fl", tout << "integer theory assigns " << ival << " to " << mk_pp(arg, m) << std::endl;); + TRACE(str_fl, tout << "integer theory assigns " << ival << " to " << mk_pp(arg, m) << std::endl;); if (ival >= rational::zero() && ival <= rational(u.max_char())) { zstring ival_str(ival.get_unsigned()); expr_ref arg_char_expr(mk_string(ival_str), m); @@ -1236,7 +1236,7 @@ namespace smt { fixed_length_reduced_boolean_formulas.push_back(m.mk_eq(e, mk_int(ival))); } } else { - TRACE("str_fl", tout << "integer theory has no assignment for " << mk_pp(arg, m) << std::endl;); + TRACE(str_fl, tout << "integer theory has no assignment for " << mk_pp(arg, m) << std::endl;); // consistency needs to be checked after the string is assigned } } @@ -1249,7 +1249,7 @@ namespace smt { precondition.push_back(m.mk_eq(u.str.mk_length(var), mk_int(val))); } - TRACE("str_fl", + TRACE(str_fl, tout << "formulas asserted to subsolver:" << std::endl; for (auto e : fixed_length_assumptions) { tout << mk_pp(e, subsolver.m()) << std::endl; @@ -1268,12 +1268,12 @@ namespace smt { } ); - TRACE("str_fl", tout << "calling subsolver" << std::endl;); + TRACE(str_fl, tout << "calling subsolver" << std::endl;); lbool subproblem_status = subsolver.check(fixed_length_assumptions); if (subproblem_status == l_true) { - TRACE("str_fl", tout << "subsolver found SAT; reconstructing model" << std::endl;); + TRACE(str_fl, tout << "subsolver found SAT; reconstructing model" << std::endl;); model_ref subModel; subsolver.get_model(subModel); @@ -1296,7 +1296,7 @@ namespace smt { model.insert(var, strValue); subst.insert(var, mk_string(strValue)); } - TRACE("str_fl", + TRACE(str_fl, for (auto entry : model) { tout << mk_pp(entry.m_key, m) << " = " << entry.m_value << std::endl; } @@ -1326,7 +1326,7 @@ namespace smt { arith_value v(get_manager()); v.init(&get_context()); for (auto e : string_int_conversion_terms) { - TRACE("str_fl", tout << "post-run check str-int term " << mk_pp(e, get_manager()) << std::endl;); + TRACE(str_fl, tout << "post-run check str-int term " << mk_pp(e, get_manager()) << std::endl;); expr* _arg; if (u.str.is_stoi(e, _arg)) { expr_ref arg(_arg, m); @@ -1335,7 +1335,7 @@ namespace smt { expr_ref arg_subst(arg, m); (*replacer)(arg, arg_subst); rw(arg_subst); - TRACE("str_fl", tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(arg_subst, m) << std::endl;); + TRACE(str_fl, tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(arg_subst, m) << std::endl;); zstring arg_zstr; if (u.str.is_string(arg_subst, arg_zstr)) { @@ -1363,7 +1363,7 @@ namespace smt { expr_ref arg_subst(arg, m); (*replacer)(arg, arg_subst); rw(arg_subst); - TRACE("str_fl", tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(arg_subst, m) << std::endl;); + TRACE(str_fl, tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(arg_subst, m) << std::endl;); zstring arg_zstr; if (u.str.is_string(arg_subst, arg_zstr)) { if (ival >= rational::zero() && ival <= rational(u.max_char())) { @@ -1392,7 +1392,7 @@ namespace smt { expr_ref e_subst(e, m); (*replacer)(e, e_subst); rw(e_subst); - TRACE("str_fl", tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(e_subst, m) << std::endl;); + TRACE(str_fl, tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(e_subst, m) << std::endl;); zstring e_zstr; if (u.str.is_string(e_subst, e_zstr)) { @@ -1432,7 +1432,7 @@ namespace smt { expr_ref e_subst(e, m); (*replacer)(e, e_subst); rw(e_subst); - TRACE("str_fl", tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(e_subst, m) << std::endl;); + TRACE(str_fl, tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(e_subst, m) << std::endl;); zstring e_zstr; if (u.str.is_string(e_subst, e_zstr)) { // if arg is out of range, e must be empty @@ -1470,11 +1470,11 @@ namespace smt { th_rewriter rw(m); if (!abstracted_boolean_formulas.empty()) { for (auto f : abstracted_boolean_formulas) { - TRACE("str_fl", tout << "refinement of boolean formula: " << mk_pp(f, m) << std::endl;); + TRACE(str_fl, tout << "refinement of boolean formula: " << mk_pp(f, m) << std::endl;); expr_ref f_new(m); (*replacer)(f, f_new); rw(f_new); - TRACE("str_fl", tout << "after substitution and simplification, evaluates to: " << mk_pp(f_new, m) << std::endl;); + TRACE(str_fl, tout << "after substitution and simplification, evaluates to: " << mk_pp(f_new, m) << std::endl;); // now there are three cases, depending on what f_new evaluates to: // true -> OK, do nothing // false -> refine abstraction by generating conflict clause @@ -1493,7 +1493,7 @@ namespace smt { cex.push_back(ctx.mk_eq_atom(needle, needle_assignment)); return l_false; } else { - TRACE("str_fl", tout << "error: unhandled refinement term " << mk_pp(f, m) << std::endl;); + TRACE(str_fl, tout << "error: unhandled refinement term " << mk_pp(f, m) << std::endl;); NOT_IMPLEMENTED_YET(); } } else { @@ -1506,7 +1506,7 @@ namespace smt { return l_true; } else if (subproblem_status == l_false) { if (m_params.m_FixedLengthNaiveCounterexamples) { - TRACE("str_fl", tout << "subsolver found UNSAT; constructing length counterexample" << std::endl;); + TRACE(str_fl, tout << "subsolver found UNSAT; constructing length counterexample" << std::endl;); for (auto e : fixed_length_used_len_terms) { expr * var = &e.get_key(); rational val = e.get_value(); @@ -1517,17 +1517,17 @@ namespace smt { } return l_false; } else { - TRACE("str_fl", tout << "subsolver found UNSAT; reconstructing unsat core" << std::endl;); - TRACE("str_fl", tout << "unsat core has size " << subsolver.get_unsat_core_size() << std::endl;); + TRACE(str_fl, tout << "subsolver found UNSAT; reconstructing unsat core" << std::endl;); + TRACE(str_fl, tout << "unsat core has size " << subsolver.get_unsat_core_size() << std::endl;); bool negate_pre = false; for (unsigned i = 0; i < subsolver.get_unsat_core_size(); ++i) { - TRACE("str", tout << "entry " << i << " = " << mk_pp(subsolver.get_unsat_core_expr(i), m) << std::endl;); + TRACE(str, tout << "entry " << i << " = " << mk_pp(subsolver.get_unsat_core_expr(i), m) << std::endl;); rational index; expr* lhs; expr* rhs; - TRACE("str_fl", tout << fixed_length_lesson.size() << std::endl;); + TRACE(str_fl, tout << fixed_length_lesson.size() << std::endl;); std::tie(index, lhs, rhs) = fixed_length_lesson.find(subsolver.get_unsat_core_expr(i)); - TRACE("str_fl", tout << "lesson: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << " at index " << index << std::endl;); + TRACE(str_fl, tout << "lesson: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << " at index " << index << std::endl;); cex.push_back(refine(lhs, rhs, index)); if (index < rational(0)) { negate_pre = true; @@ -1541,7 +1541,7 @@ namespace smt { return l_false; } } else { // l_undef - TRACE("str_fl", tout << "WARNING: subsolver found UNKNOWN" << std::endl;); + TRACE(str_fl, tout << "WARNING: subsolver found UNKNOWN" << std::endl;); return l_undef; } } diff --git a/src/smt/theory_str_regex.cpp b/src/smt/theory_str_regex.cpp index 0fb5f92df..094220d7b 100644 --- a/src/smt/theory_str_regex.cpp +++ b/src/smt/theory_str_regex.cpp @@ -50,20 +50,20 @@ namespace smt { expr * re = nullptr; u.str.is_in_re(str_in_re, str, re); if (!ctx.b_internalized(str_in_re)) { - TRACE("str", tout << "regex term " << mk_pp(str_in_re, m) << " not internalized; fixing and continuing" << std::endl;); + TRACE(str, tout << "regex term " << mk_pp(str_in_re, m) << " not internalized; fixing and continuing" << std::endl;); ctx.internalize(str_in_re, false); finalCheckProgressIndicator = true; continue; } lbool current_assignment = ctx.get_assignment(str_in_re); - TRACE("str", tout << "regex term: " << mk_pp(str, m) << " in " << mk_pp(re, m) << " : " << current_assignment << std::endl;); + TRACE(str, tout << "regex term: " << mk_pp(str, m) << " in " << mk_pp(re, m) << " : " << current_assignment << std::endl;); if (current_assignment == l_undef) { continue; } if (!regex_terms_with_length_constraints.contains(str_in_re)) { if (current_assignment == l_true && check_regex_length_linearity(re)) { - TRACE("str", tout << "regex length constraints expected to be linear -- generating and asserting them" << std::endl;); + TRACE(str, tout << "regex length constraints expected to be linear -- generating and asserting them" << std::endl;); if (regex_term_to_length_constraint.contains(str_in_re)) { // use existing length constraint @@ -87,7 +87,7 @@ namespace smt { expr_ref top_level_length_constraint(m.mk_implies(premise, _top_level_length_constraint), m); th_rewriter rw(m); rw(top_level_length_constraint); - TRACE("str", tout << "top-level length constraint: " << mk_pp(top_level_length_constraint, m) << std::endl;); + TRACE(str, tout << "top-level length constraint: " << mk_pp(top_level_length_constraint, m) << std::endl;); // assert and track length constraint assert_axiom(top_level_length_constraint); for(auto v : extra_length_vars) { @@ -110,10 +110,10 @@ namespace smt { rational exact_length_value; if (get_len_value(str, exact_length_value)) { - TRACE("str", tout << "exact length of " << mk_pp(str, m) << " is " << exact_length_value << std::endl;); + TRACE(str, tout << "exact length of " << mk_pp(str, m) << " is " << exact_length_value << std::endl;); if (regex_terms_with_path_constraints.contains(str_in_re)) { - TRACE("str", tout << "term " << mk_pp(str_in_re, m) << " already has path constraints set up" << std::endl;); + TRACE(str, tout << "term " << mk_pp(str_in_re, m) << " already has path constraints set up" << std::endl;); continue; } @@ -163,7 +163,7 @@ namespace smt { } if (zero_solution) { - TRACE("str", tout << "zero-length solution OK -- asserting empty path constraint" << std::endl;); + TRACE(str, tout << "zero-length solution OK -- asserting empty path constraint" << std::endl;); expr_ref_vector lhs_terms(m); if (current_assignment == l_true) { lhs_terms.push_back(str_in_re); @@ -177,7 +177,7 @@ namespace smt { regex_terms_with_path_constraints.insert(str_in_re); m_trail_stack.push(insert_obj_trail(regex_terms_with_path_constraints, str_in_re)); } else { - TRACE("str", tout << "zero-length solution not admitted by this automaton -- asserting conflict clause" << std::endl;); + TRACE(str, tout << "zero-length solution not admitted by this automaton -- asserting conflict clause" << std::endl;); expr_ref_vector lhs_terms(m); if (current_assignment == l_true) { lhs_terms.push_back(str_in_re); @@ -199,11 +199,11 @@ namespace smt { // no automata available, or else all bounds assumptions are invalid unsigned expected_complexity = estimate_regex_complexity(re); if (expected_complexity <= m_params.m_RegexAutomata_DifficultyThreshold || regex_get_counter(regex_fail_count, str_in_re) >= m_params.m_RegexAutomata_FailedAutomatonThreshold) { - CTRACE("str", regex_get_counter(regex_fail_count, str_in_re) >= m_params.m_RegexAutomata_FailedAutomatonThreshold, + CTRACE(str, regex_get_counter(regex_fail_count, str_in_re) >= m_params.m_RegexAutomata_FailedAutomatonThreshold, tout << "failed automaton threshold reached for " << mk_pp(str_in_re, m) << " -- automatically constructing full automaton" << std::endl;); eautomaton * aut = m_mk_aut(re); if (aut == nullptr) { - TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); + TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); return false; } aut->compress(); @@ -213,7 +213,7 @@ namespace smt { regex_automaton_assumptions.insert(re, svector()); } regex_automaton_assumptions[re].push_back(new_aut); - TRACE("str", tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;); + TRACE(str, tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;); find_automaton_initial_bounds(str_in_re, aut); } else { regex_inc_counter(regex_fail_count, str_in_re); @@ -226,8 +226,8 @@ namespace smt { rational upper_bound_value; bool lower_bound_exists = lower_bound(str_len, lower_bound_value); bool upper_bound_exists = upper_bound(str_len, upper_bound_value); - CTRACE("str", lower_bound_exists, tout << "lower bound of " << mk_pp(str, m) << " is " << lower_bound_value << std::endl;); - CTRACE("str", upper_bound_exists, tout << "upper bound of " << mk_pp(str, m) << " is " << upper_bound_value << std::endl;); + CTRACE(str, lower_bound_exists, tout << "lower bound of " << mk_pp(str, m) << " is " << lower_bound_value << std::endl;); + CTRACE(str, upper_bound_exists, tout << "upper bound of " << mk_pp(str, m) << " is " << upper_bound_value << std::endl;); bool new_lower_bound_info = true; bool new_upper_bound_info = true; @@ -284,13 +284,13 @@ namespace smt { } } if (!last_ub.is_minus_one() || !need_assumption) { - CTRACE("str", !need_assumption, tout << "using automaton with full length information" << std::endl;); - CTRACE("str", need_assumption, tout << "using automaton with assumed upper bound of " << last_ub << std::endl;); + CTRACE(str, !need_assumption, tout << "using automaton with full length information" << std::endl;); + CTRACE(str, need_assumption, tout << "using automaton with assumed upper bound of " << last_ub << std::endl;); rational refined_upper_bound; bool solution_at_upper_bound = refine_automaton_upper_bound(last_assumption.get_automaton(), upper_bound_value, refined_upper_bound); - TRACE("str", tout << "refined upper bound is " << refined_upper_bound << + TRACE(str, tout << "refined upper bound is " << refined_upper_bound << (solution_at_upper_bound?", solution at upper bound":", no solution at upper bound") << std::endl;); expr_ref_vector lhs(m); @@ -341,7 +341,7 @@ namespace smt { if (expected_complexity <= m_params.m_RegexAutomata_DifficultyThreshold || failureThresholdExceeded) { eautomaton * aut = m_mk_aut(re); if (aut == nullptr) { - TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); + TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); return false; } aut->compress(); @@ -351,7 +351,7 @@ namespace smt { regex_automaton_assumptions.insert(re, svector()); } regex_automaton_assumptions[re].push_back(new_aut); - TRACE("str", tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;); + TRACE(str, tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;); find_automaton_initial_bounds(str_in_re, aut); } else { regex_inc_counter(regex_fail_count, str_in_re); @@ -392,12 +392,12 @@ namespace smt { } } if (!last_lb.is_zero() || !need_assumption) { - CTRACE("str", !need_assumption, tout << "using automaton with full length information" << std::endl;); - CTRACE("str", need_assumption, tout << "using automaton with assumed lower bound of " << last_lb << std::endl;); + CTRACE(str, !need_assumption, tout << "using automaton with full length information" << std::endl;); + CTRACE(str, need_assumption, tout << "using automaton with assumed lower bound of " << last_lb << std::endl;); rational refined_lower_bound; bool solution_at_lower_bound = refine_automaton_lower_bound(last_assumption.get_automaton(), lower_bound_value, refined_lower_bound); - TRACE("str", tout << "refined lower bound is " << refined_lower_bound << + TRACE(str, tout << "refined lower bound is " << refined_lower_bound << (solution_at_lower_bound?", solution at lower bound":", no solution at lower bound") << std::endl;); expr_ref_vector lhs(m); @@ -451,7 +451,7 @@ namespace smt { if (expected_complexity <= m_params.m_RegexAutomata_DifficultyThreshold || failureThresholdExceeded) { eautomaton * aut = m_mk_aut(re); if (aut == nullptr) { - TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); + TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); return false; } aut->compress(); @@ -461,7 +461,7 @@ namespace smt { regex_automaton_assumptions.insert(re, svector()); } regex_automaton_assumptions[re].push_back(new_aut); - TRACE("str", tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;); + TRACE(str, tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;); find_automaton_initial_bounds(str_in_re, aut); } else { // TODO check negation? @@ -487,7 +487,7 @@ namespace smt { || failureThresholdExceeded) { eautomaton * aut = m_mk_aut(re); if (aut == nullptr) { - TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); + TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); return false; } aut->compress(); @@ -497,7 +497,7 @@ namespace smt { regex_automaton_assumptions.insert(re, svector()); } regex_automaton_assumptions[re].push_back(new_aut); - TRACE("str", tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;); + TRACE(str, tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;); find_automaton_initial_bounds(str_in_re, aut); } else { regex_inc_counter(regex_fail_count, str_in_re); @@ -579,9 +579,9 @@ namespace smt { } // foreach(term in str_in_re_terms) eautomaton * aut_inter = nullptr; - CTRACE("str", !intersect_constraints.empty(), tout << "check intersection of automata constraints for " << mk_pp(str, m) << std::endl;); + CTRACE(str, !intersect_constraints.empty(), tout << "check intersection of automata constraints for " << mk_pp(str, m) << std::endl;); for (auto aut : intersect_constraints) { - TRACE("str", + TRACE(str, { unsigned v = regex_get_counter(regex_length_attempt_count, aut.get_regex_term()); tout << "length attempt count of " << mk_pp(aut.get_regex_term(), m) << " is " << v @@ -593,7 +593,7 @@ namespace smt { if (aut_inter != nullptr) { intersectionDifficulty = estimate_automata_intersection_difficulty(aut_inter, aut.get_automaton()); } - TRACE("str", tout << "intersection difficulty is " << intersectionDifficulty << std::endl;); + TRACE(str, tout << "intersection difficulty is " << intersectionDifficulty << std::endl;); if (intersectionDifficulty <= m_params.m_RegexAutomata_IntersectionDifficultyThreshold || regex_get_counter(regex_intersection_fail_count, aut.get_regex_term()) >= m_params.m_RegexAutomata_FailedIntersectionThreshold) { @@ -616,7 +616,7 @@ namespace smt { expr_ref rc(u.re.mk_complement(aut.get_regex_term()), m); eautomaton * aut_c = m_mk_aut(rc); if (aut_c == nullptr) { - TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); + TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;); return false; } regex_automata.push_back(aut_c); @@ -642,7 +642,7 @@ namespace smt { if (aut_inter != nullptr) { aut_inter->compress(); } - TRACE("str", tout << "intersected " << used_intersect_constraints.size() << " constraints" << std::endl;); + TRACE(str, tout << "intersected " << used_intersect_constraints.size() << " constraints" << std::endl;); expr_ref_vector conflict_terms(m); expr_ref conflict_lhs(m); @@ -667,7 +667,7 @@ namespace smt { } } conflict_lhs = mk_and(conflict_terms); - TRACE("str", tout << "conflict lhs: " << mk_pp(conflict_lhs, m) << std::endl;); + TRACE(str, tout << "conflict lhs: " << mk_pp(conflict_lhs, m) << std::endl;); if (used_intersect_constraints.size() > 1 && aut_inter != nullptr) { // check whether the intersection is only the empty string @@ -677,7 +677,7 @@ namespace smt { // if there are no moves from the initial state, // the only solution is the empty string if (aut_inter->get_moves_from(initial_state).empty()) { - TRACE("str", tout << "product automaton only accepts empty string" << std::endl;); + TRACE(str, tout << "product automaton only accepts empty string" << std::endl;); expr_ref rhs1(ctx.mk_eq_atom(str, mk_string("")), m); expr_ref rhs2(ctx.mk_eq_atom(mk_strlen(str), m_autil.mk_numeral(rational::zero(), true)), m); expr_ref rhs(m.mk_and(rhs1, rhs2), m); @@ -687,7 +687,7 @@ namespace smt { } if (aut_inter != nullptr && aut_inter->is_empty()) { - TRACE("str", tout << "product automaton is empty; asserting conflict clause" << std::endl;); + TRACE(str, tout << "product automaton is empty; asserting conflict clause" << std::endl;); expr_ref conflict_clause(m.mk_not(mk_and(conflict_terms)), m); assert_axiom(conflict_clause); add_persisted_axiom(conflict_clause); @@ -736,7 +736,7 @@ namespace smt { } else if (u.re.is_full_char(re) || u.re.is_full_seq(re)) { return 1; } else { - TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;); + TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;); return 1; } } @@ -776,7 +776,7 @@ namespace smt { } else if (u.re.is_full_char(re) || u.re.is_full_seq(re)) { return 1; } else { - TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;); + TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;); return 1; } } @@ -822,7 +822,7 @@ namespace smt { } else if (u.re.is_loop(re, sub1, lo, hi) || u.re.is_loop(re, sub1, lo)) { return check_regex_length_linearity_helper(sub1, already_star); } else { - TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;); + TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;); return false; } } @@ -898,7 +898,7 @@ namespace smt { } } } else { - TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;); + TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;); lens.reset(); } } @@ -965,7 +965,7 @@ namespace smt { expr_ref retval(m_autil.mk_ge(lenVar, m_autil.mk_numeral(rational::zero(), true)), m); return retval; } else { - TRACE("str", tout << "subterm lengths:"; + TRACE(str, tout << "subterm lengths:"; for(integer_set::iterator it = subterm_lens.begin(); it != subterm_lens.end(); ++it) { tout << " " << *it; } @@ -1023,7 +1023,7 @@ namespace smt { expr_ref retval(m_autil.mk_ge(lenVar, m_autil.mk_numeral(rational::zero(), true)), m); return retval; } else { - TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, m) << std::endl;); + TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, m) << std::endl;); expr_ref retval(m_autil.mk_ge(lenVar, m_autil.mk_numeral(rational::zero(), true)), m); return retval; } @@ -1284,12 +1284,12 @@ namespace smt { if (u.is_const_char(cond, char_val)) { SASSERT(char_val < 256); - TRACE("str", tout << "rewrite character constant " << char_val << std::endl;); + TRACE(str, tout << "rewrite character constant " << char_val << std::endl;); zstring str_const(char_val); retval = u.str.mk_string(str_const); return retval; } else if (is_var(cond)) { - TRACE("str", tout << "substitute var" << std::endl;); + TRACE(str, tout << "substitute var" << std::endl;); retval = ch_var; return retval; } else if (m.is_eq(cond, lhs, rhs)) { @@ -1301,7 +1301,7 @@ namespace smt { retval = ctx.mk_eq_atom(new_lhs, new_rhs); return retval; } else if (m.is_bool(cond)) { - TRACE("str", tout << "rewrite boolean term " << mk_pp(cond, m) << std::endl;); + TRACE(str, tout << "rewrite boolean term " << mk_pp(cond, m) << std::endl;); app * a_cond = to_app(cond); expr_ref_vector rewritten_args(m); for (unsigned i = 0; i < a_cond->get_num_args(); ++i) { @@ -1311,10 +1311,10 @@ namespace smt { rewritten_args.push_back(new_arg); } retval = m.mk_app(a_cond->get_decl(), rewritten_args.data()); - TRACE("str", tout << "final rewritten term is " << mk_pp(retval, m) << std::endl;); + TRACE(str, tout << "final rewritten term is " << mk_pp(retval, m) << std::endl;); return retval; } else { - TRACE("str", tout << "ERROR: unrecognized automaton path constraint " << mk_pp(cond, m) << ", cannot translate" << std::endl;); + TRACE(str, tout << "ERROR: unrecognized automaton path constraint " << mk_pp(cond, m) << ", cannot translate" << std::endl;); retval = nullptr; return retval; } @@ -1432,7 +1432,7 @@ namespace smt { unsigned lo_val, hi_val; if (u.is_const_char(range_lo, lo_val) && u.is_const_char(range_hi, hi_val)) { - TRACE("str", tout << "make range predicate from " << lo_val << " to " << hi_val << std::endl;); + TRACE(str, tout << "make range predicate from " << lo_val << " to " << hi_val << std::endl;); expr_ref cond_rhs(m); expr_ref_vector cond_rhs_terms(m); for (unsigned i = lo_val; i <= hi_val; ++i) { @@ -1446,7 +1446,7 @@ namespace smt { cond = mk_and(m, 2, args); aut_path_add_next(next, trail, mv.dst(), cond); } else { - TRACE("str", tout << "warning: non-bitvectors in automaton range predicate" << std::endl;); + TRACE(str, tout << "warning: non-bitvectors in automaton range predicate" << std::endl;); UNREACHABLE(); } } else if (mv.t()->is_pred()) { @@ -1482,7 +1482,7 @@ namespace smt { } } expr_ref result(mk_or(ors)); - TRACE("str", tout << "regex path constraint: " << mk_pp(result, m) << "\n";); + TRACE(str, tout << "regex path constraint: " << mk_pp(result, m) << "\n";); expr_ref concat_rhs(m); if (pathChars.size() == 1) { diff --git a/src/smt/theory_user_propagator.cpp b/src/smt/theory_user_propagator.cpp index bf6895abd..0dd619f92 100644 --- a/src/smt/theory_user_propagator.cpp +++ b/src/smt/theory_user_propagator.cpp @@ -50,7 +50,7 @@ void theory_user_propagator::add_expr(expr* term, bool ensure_enode) { expr_ref r(m); expr* e = term; ctx.get_rewriter()(e, r); - TRACE("user_propagate", tout << "add " << mk_bounded_pp(e, m) << "\n"); + TRACE(user_propagate, tout << "add " << mk_bounded_pp(e, m) << "\n"); if (!is_ground(r)) { if (m_add_expr_fresh.contains(term)) return; @@ -89,7 +89,7 @@ bool theory_user_propagator::propagate_cb( unsigned num_fixed, expr* const* fixed_ids, unsigned num_eqs, expr* const* eq_lhs, expr* const* eq_rhs, expr* conseq) { - CTRACE("user_propagate", ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true, + CTRACE(user_propagate, ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true, ctx.display(tout << "redundant consequence: " << mk_pp(conseq, m) << "\n")); expr_ref _conseq(conseq, m); @@ -160,9 +160,9 @@ final_check_status theory_user_propagator::final_check_eh() { catch (...) { throw default_exception("Exception thrown in \"final\"-callback"); } - CTRACE("user_propagate", can_propagate(), tout << "can propagate\n"); + CTRACE(user_propagate, can_propagate(), tout << "can propagate\n"); propagate(); - CTRACE("user_propagate", ctx.inconsistent(), tout << "inconsistent\n"); + CTRACE(user_propagate, ctx.inconsistent(), tout << "inconsistent\n"); // check if it became inconsistent or something new was propagated/registered bool done = (sz1 == m_prop.size()) && (sz2 == get_num_vars()) && !ctx.inconsistent(); return done ? FC_DONE : FC_CONTINUE; @@ -313,7 +313,7 @@ void theory_user_propagator::propagate_consequence(prop_info const& prop) { DEBUG_CODE(for (expr* e : prop.m_ids) VERIFY(m_fixed.contains(expr2var(e)));); DEBUG_CODE(for (literal lit : m_lits) VERIFY(ctx.get_assignment(lit) == l_true);); - TRACE("user_propagate", tout << "propagating #" << prop.m_conseq->get_id() << ": " << prop.m_conseq << "\n"; + TRACE(user_propagate, tout << "propagating #" << prop.m_conseq->get_id() << ": " << prop.m_conseq << "\n"; for (auto const& [a,b] : m_eqs) tout << enode_pp(a, ctx) << " == " << enode_pp(b, ctx) << "\n"; for (expr* e : prop.m_ids) tout << mk_pp(e, m) << "\n"; for (literal lit : m_lits) tout << lit << "\n"); @@ -358,7 +358,7 @@ void theory_user_propagator::propagate_consequence(prop_info const& prop) { else ctx.mk_th_lemma(get_id(), m_lits); } - TRACE("user_propagate", ctx.display(tout);); + TRACE(user_propagate, ctx.display(tout);); } @@ -370,7 +370,7 @@ void theory_user_propagator::propagate_new_fixed(prop_info const& prop) { void theory_user_propagator::propagate() { if (m_qhead == m_prop.size() && m_to_add_qhead == m_to_add.size() && m_replay_qhead == m_clauses_to_replay.size()) return; - TRACE("user_propagate", tout << "propagating queue head: " << m_qhead << " prop queue: " << m_prop.size() << "\n"); + TRACE(user_propagate, tout << "propagating queue head: " << m_qhead << " prop queue: " << m_prop.size() << "\n"); force_push(); unsigned qhead = m_replay_qhead; diff --git a/src/smt/theory_utvpi_def.h b/src/smt/theory_utvpi_def.h index d4c6d684c..5f056784f 100644 --- a/src/smt/theory_utvpi_def.h +++ b/src/smt/theory_utvpi_def.h @@ -98,7 +98,7 @@ namespace smt { template theory_var theory_utvpi::mk_var(enode* n) { th_var v = theory::mk_var(n); - TRACE("utvpi", tout << v << " " << mk_pp(n->get_expr(), m) << "\n";); + TRACE(utvpi, tout << v << " " << mk_pp(n->get_expr(), m) << "\n";); m_graph.init_var(to_var(v)); m_graph.init_var(neg(to_var(v))); ctx.attach_th_var(n, this, v); @@ -176,7 +176,7 @@ namespace smt { t2 = a.mk_numeral(k, s2->get_sort()); eq = m.mk_eq(s2.get(), t2.get()); - TRACE("utvpi", tout << v1 << " .. " << v2 << "\n" << eq << "\n";); + TRACE(utvpi, tout << v1 << " .. " << v2 << "\n" << eq << "\n";); VERIFY (internalize_atom(eq.get(), false)); @@ -204,7 +204,7 @@ namespace smt { inc_conflicts(); literal_vector const& lits = m_nc_functor.get_lits(); IF_VERBOSE(20, ctx.display_literals_smt2(verbose_stream() << "conflict:\n", lits)); - TRACE("utvpi", ctx.display_literals_smt2(tout << "conflict:\n", lits);); + TRACE(utvpi, ctx.display_literals_smt2(tout << "conflict:\n", lits);); vector params; if (m.proofs_enabled()) { @@ -231,7 +231,7 @@ namespace smt { std::stringstream msg; msg << "found non utvpi logic expression:\n" << mk_pp(n, m) << '\n'; auto str = msg.str(); - TRACE("utvpi", tout << str;); + TRACE(utvpi, tout << str;); warning_msg("%s", str.c_str()); ctx.push_trail(value_trail(m_non_utvpi_exprs)); m_non_utvpi_exprs = true; @@ -340,7 +340,7 @@ namespace smt { edge_id neg = add_ineq(coeffs, w2, ~l); m_atoms.push_back(atom(bv, pos, neg)); - TRACE("utvpi", + TRACE(utvpi, tout << mk_pp(n, m) << "\n"; m_graph.display_edge(tout << "pos: ", pos); m_graph.display_edge(tout << "neg: ", neg); @@ -354,7 +354,7 @@ namespace smt { if (!m_consistent) return false; bool result = !ctx.inconsistent() && null_theory_var != mk_term(term); - CTRACE("utvpi", !result, tout << "Did not internalize " << mk_pp(term, m) << "\n";); + CTRACE(utvpi, !result, tout << "Did not internalize " << mk_pp(term, m) << "\n";); return result; } @@ -504,7 +504,7 @@ namespace smt { template bool theory_utvpi::propagate_atom(atom const& a) { - TRACE("utvpi", a.display(*this, tout); tout << "\n";); + TRACE(utvpi, a.display(*this, tout); tout << "\n";); int edge_id = a.get_asserted_edge(); if (!enable_edge(edge_id)) { m_graph.traverse_neg_cycle2(m_params.m_arith_stronger_lemmas, m_nc_functor); @@ -516,7 +516,7 @@ namespace smt { template theory_var theory_utvpi::mk_term(app* n) { - TRACE("utvpi", tout << mk_pp(n, m) << "\n";); + TRACE(utvpi, tout << mk_pp(n, m) << "\n";); bool cl = m_test.linearize(n); if (!cl) { @@ -640,7 +640,7 @@ namespace smt { SASSERT(v2 != null_theory_var); SASSERT(pos2 || terms[1].second.is_minus_one()); } - TRACE("utvpi", tout << (pos1?"$":"-$") << v1; + TRACE(utvpi, tout << (pos1?"$":"-$") << v1; if (terms.size() == 2) tout << (pos2?" + $":" - $") << v2; tout << " + " << weight << " <= 0\n";); edge_id id = m_graph.get_num_edges(); @@ -757,7 +757,7 @@ namespace smt { } } - TRACE("utvpi", + TRACE(utvpi, tout << "Disparity: " << v1 << " - " << v2 << "\n"; tout << "decrement: " << zero_v << "\n"; display(tout); @@ -770,7 +770,7 @@ namespace smt { todo.push_back(k); } } - TRACE("utvpi", display(tout);); + TRACE(utvpi, display(tout);); SASSERT(m_graph.is_feasible_dbg()); } DEBUG_CODE( @@ -831,7 +831,7 @@ namespace smt { break; } (void)ok; - CTRACE("utvpi", !ok, + CTRACE(utvpi, !ok, tout << "validation failed:\n"; tout << "Assignment: " << assign << "\n"; tout << mk_pp(e, m) << "\n"; @@ -840,7 +840,7 @@ namespace smt { display(tout); m_graph.display_agl(tout); ); - // CTRACE("utvpi", ok, tout << "validation success: " << mk_pp(e, m) << "\n";); + // CTRACE(utvpi, ok, tout << "validation success: " << mk_pp(e, m) << "\n";); SASSERT(ok); } } @@ -857,7 +857,7 @@ namespace smt { if (m.is_eq(e, e1, e2)) { return eval_num(e1) == eval_num(e2); } - TRACE("utvpi", tout << "expression not handled: " << mk_pp(e, m) << "\n";); + TRACE(utvpi, tout << "expression not handled: " << mk_pp(e, m) << "\n";); return false; } @@ -890,7 +890,7 @@ namespace smt { if (is_uninterp_const(e)) { return mk_value(mk_var(e), a.is_int(e)); } - TRACE("utvpi", tout << "expression not handled: " << mk_pp(e, m) << "\n";); + TRACE(utvpi, tout << "expression not handled: " << mk_pp(e, m) << "\n";); UNREACHABLE(); return rational(0); } @@ -905,7 +905,7 @@ namespace smt { rational num = val.get_rational() + (m_delta * val.get_infinitesimal().to_rational()); num = num/rational(2); SASSERT(!is_int || num.is_int()); - TRACE("utvpi", + TRACE(utvpi, expr* n = get_enode(v)->get_expr(); tout << mk_pp(n, m) << " |-> (" << val1 << " - " << val2 << ")/2 = " << num << "\n";); @@ -917,7 +917,7 @@ namespace smt { theory_var v = n->get_th_var(get_id()); bool is_int = a.is_int(n->get_expr()); rational num = mk_value(v, is_int); - TRACE("utvpi", tout << mk_pp(n->get_expr(), m) << " |-> " << num << "\n";); + TRACE(utvpi, tout << mk_pp(n->get_expr(), m) << " |-> " << num << "\n";); return alloc(expr_wrapper_proc, m_factory->mk_num_value(num, is_int)); } diff --git a/src/smt/theory_wmaxsat.cpp b/src/smt/theory_wmaxsat.cpp index c5960a7b9..13e69da5d 100644 --- a/src/smt/theory_wmaxsat.cpp +++ b/src/smt/theory_wmaxsat.cpp @@ -67,7 +67,7 @@ namespace smt { } } } - TRACE("opt", + TRACE(opt, tout << "cost save: "; for (unsigned i = 0; i < m_cost_save.size(); ++i) { tout << m_cost_save[i] << " "; @@ -102,7 +102,7 @@ namespace smt { m_normalize = true; bool_var bv = register_var(var, true); (void)bv; - TRACE("opt", tout << "inc: " << ctx.inconsistent() << " enable: v" << m_bool2var[bv] + TRACE(opt, tout << "inc: " << ctx.inconsistent() << " enable: v" << m_bool2var[bv] << " b" << bv << " " << mk_pp(var, get_manager()) << "\n" << wfml << "\n";); return var; } @@ -112,7 +112,7 @@ namespace smt { bool_var bv = ctx.get_bool_var(var); theory_var tv = m_bool2var[bv]; m_enabled[tv] = false; - TRACE("opt", tout << "disable: v" << tv << " b" << bv << " " << mk_pp(var, get_manager()) << "\n";); + TRACE(opt, tout << "disable: v" << tv << " b" << bv << " " << mk_pp(var, get_manager()) << "\n";); } bool_var theory_wmaxsat::register_var(app* var, bool attach) { @@ -164,7 +164,7 @@ namespace smt { ctx.push_trail(push_back_vector >(m_costs)); ctx.push_trail(value_trail(m_assigned[tv])); m_zcost += w; - TRACE("opt", tout << "Assign v" << tv << " weight: " << w << " cost: " << m_zcost << " " << mk_pp(m_vars[m_bool2var[v]].get(), get_manager()) << "\n";); + TRACE(opt, tout << "Assign v" << tv << " weight: " << w << " cost: " << m_zcost << " " << mk_pp(m_vars[m_bool2var[v]].get(), get_manager()) << "\n";); m_costs.push_back(tv); m_assigned[tv] = true; if (m_zcost >= m_zmin_cost) { @@ -178,7 +178,7 @@ namespace smt { final_check_status theory_wmaxsat::final_check_eh() { if (m_normalize) normalize(); - TRACE("opt", tout << "cost: " << m_zcost << " min cost: " << m_zmin_cost << "\n";); + TRACE(opt, tout << "cost: " << m_zcost << " min cost: " << m_zmin_cost << "\n";); return FC_DONE; } @@ -245,7 +245,7 @@ namespace smt { m_found_optimal = true; m_cost_save.reset(); m_cost_save.append(m_costs); - TRACE("opt", + TRACE(opt, tout << "costs: "; for (unsigned i = 0; i < m_costs.size(); ++i) { tout << pp(get_enode(m_costs[i]), get_manager()) << " "; @@ -255,7 +255,7 @@ namespace smt { ); } expr_ref result(m.mk_or(disj.size(), disj.data()), m); - TRACE("opt", + TRACE(opt, tout << result << " weight: " << weight << "\n"; tout << "cost: " << m_zcost << " min-cost: " << m_zmin_cost << "\n";); return result; @@ -279,7 +279,7 @@ namespace smt { weight += m_zweights[costs[i]]; lits.push_back(literal(m_var2bool[costs[i]])); } - TRACE("opt", ctx.display_literals_verbose(tout, lits); tout << "\n";); + TRACE(opt, ctx.display_literals_verbose(tout, lits); tout << "\n";); ctx.set_conflict( ctx.mk_justification( @@ -324,7 +324,7 @@ namespace smt { bool_var w = m_var2bool[m_costs[i]]; lits.push_back(literal(w)); } - TRACE("opt", + TRACE(opt, ctx.display_literals_verbose(tout, lits.size(), lits.data()); ctx.display_literal_verbose(tout << " --> ", lit);); diff --git a/src/solver/assertions/asserted_formulas.cpp b/src/solver/assertions/asserted_formulas.cpp index 62f4c1970..f07d1be0a 100644 --- a/src/solver/assertions/asserted_formulas.cpp +++ b/src/solver/assertions/asserted_formulas.cpp @@ -161,7 +161,7 @@ void asserted_formulas::assert_expr(expr * e, proof * _in_pr) { return; if (m_smt_params.m_preprocess) { - TRACE("assert_expr_bug", tout << r << "\n";); + TRACE(assert_expr_bug, tout << r << "\n";); set_eliminate_and(false); // do not eliminate and before nnf. m_rewriter(e, r, pr); if (m.proofs_enabled()) { @@ -170,13 +170,13 @@ void asserted_formulas::assert_expr(expr * e, proof * _in_pr) { else pr = m.mk_modus_ponens(in_pr, pr); } - TRACE("assert_expr_bug", tout << "after...\n" << r << "\n" << pr << "\n";); + TRACE(assert_expr_bug, tout << "after...\n" << r << "\n" << pr << "\n";); } m_has_quantifiers |= ::has_quantifiers(e); push_assertion(r, pr, m_formulas); - TRACE("asserted_formulas_bug", tout << "after assert_expr\n"; display(tout);); + TRACE(asserted_formulas_bug, tout << "after assert_expr\n"; display(tout);); } void asserted_formulas::assert_expr(expr * e) { @@ -195,7 +195,7 @@ void asserted_formulas::push_scope_core() { reduce(); commit(); SASSERT(inconsistent() || m_qhead == m_formulas.size() || m.limit().is_canceled()); - TRACE("asserted_formulas_scopes", tout << "before push: " << m_scopes.size() << "\n"); + TRACE(asserted_formulas_scopes, tout << "before push: " << m_scopes.size() << "\n"); m_scoped_substitution.push(); m_scopes.push_back(scope()); scope & s = m_scopes.back(); @@ -208,7 +208,7 @@ void asserted_formulas::push_scope_core() { m_macro_manager.push_scope(); m_bv_size_reduce.push_scope(); commit(); - TRACE("asserted_formulas_scopes", tout << "after push: " << m_scopes.size() << "\n"); + TRACE(asserted_formulas_scopes, tout << "after push: " << m_scopes.size() << "\n"); } void asserted_formulas::force_push() { @@ -224,7 +224,7 @@ void asserted_formulas::pop_scope(unsigned num_scopes) { num_scopes -= m_lazy_scopes; m_lazy_scopes = 0; - TRACE("asserted_formulas_scopes", tout << "before pop " << num_scopes << " of " << m_scopes.size() << "\n";); + TRACE(asserted_formulas_scopes, tout << "before pop " << num_scopes << " of " << m_scopes.size() << "\n";); m_bv_sharing.pop_scope(num_scopes); m_macro_manager.pop_scope(num_scopes); m_bv_size_reduce.pop_scope(num_scopes); @@ -238,7 +238,7 @@ void asserted_formulas::pop_scope(unsigned num_scopes) { m_qhead = s.m_formulas_lim; m_scopes.shrink(new_lvl); flush_cache(); - TRACE("asserted_formulas_scopes", tout << "after pop " << num_scopes << "\n";); + TRACE(asserted_formulas_scopes, tout << "after pop " << num_scopes << "\n";); } void asserted_formulas::reset() { @@ -275,7 +275,7 @@ void asserted_formulas::reduce() { if (m_macro_manager.has_macros()) invoke(m_find_macros); - TRACE("before_reduce", display(tout);); + TRACE(before_reduce, display(tout);); CASSERT("well_sorted", check_well_sorted()); IF_VERBOSE(10, verbose_stream() << "(smt.simplify-begin :num-exprs " << get_total_size() << ")\n";); @@ -308,9 +308,9 @@ void asserted_formulas::reduce() { // if (!invoke(m_propagate_values)) return; IF_VERBOSE(10, verbose_stream() << "(smt.simplifier-done :num-exprs " << get_total_size() << ")\n";); - TRACE("after_reduce", display(tout);); - TRACE("after_reduce_ll", ast_mark visited; display_ll(tout, visited);); - TRACE("macros", m_macro_manager.display(tout);); + TRACE(after_reduce, display(tout);); + TRACE(after_reduce_ll, ast_mark visited; display_ll(tout, visited);); + TRACE(macros, m_macro_manager.display(tout);); flush_cache(); CASSERT("well_sorted",check_well_sorted()); @@ -331,11 +331,11 @@ bool asserted_formulas::invoke(simplify_fmls& s) { s(); IF_VERBOSE(10, verbose_stream() << "(smt." << s.id() << " :num-exprs " << get_total_size() << ")\n";); IF_VERBOSE(10000, verbose_stream() << "total size: " << get_total_size() << "\n";); - TRACE("reduce_step_ll", ast_mark visited; display_ll(tout, visited);); + TRACE(reduce_step_ll, ast_mark visited; display_ll(tout, visited);); CASSERT("well_sorted",check_well_sorted()); - TRACE("after_reduce", display(tout << s.id() << "\n");); + TRACE(after_reduce, display(tout << s.id() << "\n");); if (inconsistent() || canceled()) { - TRACE("after_reduce_ll", ast_mark visited; display_ll(tout, visited);); + TRACE(after_reduce_ll, ast_mark visited; display_ll(tout, visited);); return false; } else { @@ -430,7 +430,7 @@ void asserted_formulas::flatten_clauses() { void asserted_formulas::apply_quasi_macros() { - TRACE("before_quasi_macros", display(tout);); + TRACE(before_quasi_macros, display(tout);); vector new_fmls; quasi_macros proc(m, m_macro_manager); while (m_qhead == 0 && @@ -440,7 +440,7 @@ void asserted_formulas::apply_quasi_macros() { swap_asserted_formulas(new_fmls); new_fmls.reset(); } - TRACE("after_quasi_macros", display(tout);); + TRACE(after_quasi_macros, display(tout);); reduce_and_solve(); } @@ -452,10 +452,10 @@ void asserted_formulas::nnf_cnf() { unsigned i = m_qhead; unsigned sz = m_formulas.size(); - TRACE("nnf_bug", tout << "i: " << i << " sz: " << sz << "\n";); + TRACE(nnf_bug, tout << "i: " << i << " sz: " << sz << "\n";); for (; i < sz; i++) { expr * n = m_formulas[i].fml(); - TRACE("nnf_bug", tout << "processing:\n" << mk_pp(n, m) << "\n";); + TRACE(nnf_bug, tout << "processing:\n" << mk_pp(n, m) << "\n";); proof_ref pr(m_formulas[i].pr(), m); expr_ref r1(m); proof_ref pr1(m); @@ -510,7 +510,7 @@ void asserted_formulas::simplify_fmls::operator()() { return; } af.swap_asserted_formulas(new_fmls); - TRACE("asserted_formulas", af.display(tout);); + TRACE(asserted_formulas, af.display(tout);); post_op(); } @@ -546,7 +546,7 @@ void asserted_formulas::propagate_values() { while (!inconsistent() && sz/20 < delta_prop) { m_scoped_substitution.push(); unsigned prop = num_prop; - TRACE("propagate_values", display(tout << "before:\n");); + TRACE(propagate_values, display(tout << "before:\n");); unsigned i = m_qhead; for (; i < sz; i++) { prop += propagate_values(i); @@ -554,7 +554,7 @@ void asserted_formulas::propagate_values() { flush_cache(); m_scoped_substitution.pop(1); m_scoped_substitution.push(); - TRACE("propagate_values", tout << "middle:\n"; display(tout);); + TRACE(propagate_values, tout << "middle:\n"; display(tout);); i = sz; while (i > m_qhead) { --i; @@ -562,14 +562,14 @@ void asserted_formulas::propagate_values() { } m_scoped_substitution.pop(1); flush_cache(); - TRACE("propagate_values", tout << "after:\n"; display(tout);); + TRACE(propagate_values, tout << "after:\n"; display(tout);); delta_prop = prop - num_prop; num_prop = prop; if (sz <= m_formulas.size()) break; sz = m_formulas.size(); } - TRACE("asserted_formulas", tout << num_prop << "\n";); + TRACE(asserted_formulas, tout << num_prop << "\n";); if (num_prop > 0) m_reduce_asserted_formulas(); } @@ -597,17 +597,17 @@ bool asserted_formulas::update_substitution(expr* n, proof* pr) { proof_ref pr1(m); if (is_ground(n) && m.is_eq(n, lhs, rhs)) { if (is_gt(lhs, rhs)) { - TRACE("propagate_values", tout << "insert " << mk_pp(lhs, m) << " -> " << mk_pp(rhs, m) << "\n";); + TRACE(propagate_values, tout << "insert " << mk_pp(lhs, m) << " -> " << mk_pp(rhs, m) << "\n";); m_scoped_substitution.insert(lhs, rhs, pr); return true; } if (is_gt(rhs, lhs)) { - TRACE("propagate_values", tout << "insert " << mk_pp(rhs, m) << " -> " << mk_pp(lhs, m) << "\n";); + TRACE(propagate_values, tout << "insert " << mk_pp(rhs, m) << " -> " << mk_pp(lhs, m) << "\n";); pr1 = m.proofs_enabled() ? m.mk_symmetry(pr) : nullptr; m_scoped_substitution.insert(rhs, lhs, pr1); return true; } - TRACE("propagate_values", tout << "incompatible " << mk_pp(n, m) << "\n";); + TRACE(propagate_values, tout << "incompatible " << mk_pp(n, m) << "\n";); } if (m.is_not(n, n1)) { pr1 = m.proofs_enabled() ? m.mk_iff_false(pr) : nullptr; @@ -679,7 +679,7 @@ proof * asserted_formulas::get_inconsistency_proof() const { void asserted_formulas::refine_inj_axiom_fn::simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { expr* f = j.fml(); if (is_quantifier(f) && simplify_inj_axiom(m, to_quantifier(f), n)) { - TRACE("inj_axiom", tout << "simplifying...\n" << mk_pp(f, m) << "\n" << n << "\n";); + TRACE(inj_axiom, tout << "simplifying...\n" << mk_pp(f, m) << "\n" << n << "\n";); } else { n = j.fml(); diff --git a/src/solver/assertions/asserted_formulas.h b/src/solver/assertions/asserted_formulas.h index d0a748975..7c50ad1e1 100644 --- a/src/solver/assertions/asserted_formulas.h +++ b/src/solver/assertions/asserted_formulas.h @@ -124,7 +124,7 @@ class asserted_formulas { distribute_forall_fn(asserted_formulas& af): simplify_fmls(af, "distribute-forall"), m_functor(af.m) {} void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { m_functor(j.fml(), n); } bool should_apply() const override { return af.m_smt_params.m_distribute_forall && af.has_quantifiers(); } - void post_op() override { af.reduce_and_solve(); TRACE("asserted_formulas", af.display(tout);); } + void post_op() override { af.reduce_and_solve(); TRACE(asserted_formulas, af.display(tout);); } }; class pattern_inference_fn : public simplify_fmls { diff --git a/src/solver/check_logic.cpp b/src/solver/check_logic.cpp index 308ceae30..a03de7c4a 100644 --- a/src/solver/check_logic.cpp +++ b/src/solver/check_logic.cpp @@ -328,7 +328,7 @@ struct check_logic::imp { } void fail_non_diff(expr * t) { - TRACE("check_logic", tout << mk_pp(t, m) << "\n";); + TRACE(check_logic, tout << mk_pp(t, m) << "\n";); fail("logic only supports difference arithmetic"); } diff --git a/src/solver/combined_solver.cpp b/src/solver/combined_solver.cpp index 97ecc8e1c..e1c9931bb 100644 --- a/src/solver/combined_solver.cpp +++ b/src/solver/combined_solver.cpp @@ -126,7 +126,7 @@ public: } solver* translate(ast_manager& m, params_ref const& p) override { - TRACE("solver", tout << "translate\n";); + TRACE(solver, tout << "translate\n";); solver* s1 = m_solver1->translate(m, p); solver* s2 = m_solver2->translate(m, p); combined_solver* r = alloc(combined_solver, s1, s2, p); @@ -177,11 +177,11 @@ public: switch_inc_mode(); m_solver1->push(); m_solver2->push(); - TRACE("pop", tout << "push\n";); + TRACE(pop, tout << "push\n";); } void pop(unsigned n) override { - TRACE("pop", tout << n << "\n";); + TRACE(pop, tout << n << "\n";); switch_inc_mode(); m_solver1->pop(n); m_solver2->pop(n); diff --git a/src/solver/mus.cpp b/src/solver/mus.cpp index bfb1d25c3..154d72ab6 100644 --- a/src/solver/mus.cpp +++ b/src/solver/mus.cpp @@ -59,7 +59,7 @@ struct mus::imp { unsigned idx = m_lit2expr.size(); m_expr2lit.insert(lit, idx); m_lit2expr.push_back(lit); - TRACE("mus", tout << idx << ": " << mk_pp(lit, m) << "\n" << m_lit2expr << "\n";); + TRACE(mus, tout << idx << ": " << mk_pp(lit, m) << "\n" << m_lit2expr << "\n";); return idx; } @@ -80,10 +80,10 @@ struct mus::imp { lbool get_mus1(expr_ref_vector& mus) { ptr_vector unknown(m_lit2expr.size(), m_lit2expr.data()); expr_ref_vector core_exprs(m); - TRACE("mus", m_solver.display(tout);); + TRACE(mus, m_solver.display(tout);); while (!unknown.empty()) { IF_VERBOSE(12, verbose_stream() << "(mus reducing core: " << unknown.size() << " new core: " << mus.size() << ")\n";); - TRACE("mus", display_vec(tout << "core: ", unknown); display_vec(tout << "mus: ", mus);); + TRACE(mus, display_vec(tout << "core: ", unknown); display_vec(tout << "mus: ", mus);); expr* lit = unknown.back(); unknown.pop_back(); expr_ref not_lit(mk_not(m, lit), m); @@ -112,7 +112,7 @@ struct mus::imp { unknown.push_back(c); } } - TRACE("mus", tout << "core exprs:" << core_exprs << "\n"; + TRACE(mus, tout << "core exprs:" << core_exprs << "\n"; display_vec(tout << "core:", unknown); display_vec(tout << "mus:", mus); ); @@ -164,7 +164,7 @@ struct mus::imp { scoped_append assume_lit(*this, mus, lit); // current unknown literal switch (m_solver.check_sat(mus)) { case l_true: { - TRACE("mus", tout << "literal can be satisfied: " << mk_pp(lit, m) << "\n";); + TRACE(mus, tout << "literal can be satisfied: " << mk_pp(lit, m) << "\n";); mss.push_back(lit); m_solver.get_model(mdl); model_evaluator eval(*mdl.get()); @@ -183,7 +183,7 @@ struct mus::imp { break; } case l_false: - TRACE("mus", tout << "literal is in a core: " << mk_pp(lit, m) << "\n";); + TRACE(mus, tout << "literal is in a core: " << mk_pp(lit, m) << "\n";); nmcs.push_back(mk_not(m, lit)); nmcs_set.insert(nmcs.back()); get_core(core); diff --git a/src/solver/simplifier_solver.cpp b/src/solver/simplifier_solver.cpp index 23a802c49..961f6c9e7 100644 --- a/src/solver/simplifier_solver.cpp +++ b/src/solver/simplifier_solver.cpp @@ -138,7 +138,7 @@ class simplifier_solver : public solver { m_preprocess.reduce(); if (!m.inc()) return; - TRACE("solver", tout << "qhead " << qhead << "\n"; + TRACE(solver, tout << "qhead " << qhead << "\n"; m_preprocess_state.display(tout)); m_preprocess_state.advance_qhead(); } @@ -225,7 +225,7 @@ public: lbool check_sat_core(unsigned num_assumptions, expr* const* assumptions) override { expr_ref_vector _assumptions(m, num_assumptions, assumptions); flush(_assumptions); - TRACE("simplifier", tout << _assumptions); + TRACE(simplifier, tout << _assumptions); return s->check_sat_core(num_assumptions, _assumptions.data()); } @@ -236,7 +236,7 @@ public: model_ref m_cached_model; void get_model_core(model_ref& m) override { - CTRACE("simplifier", m_mc.get(), m_mc->display(tout)); + CTRACE(simplifier, m_mc.get(), m_mc->display(tout)); if (m_cached_model) { m = m_cached_model; return; diff --git a/src/solver/solver2tactic.cpp b/src/solver/solver2tactic.cpp index add55c628..516932a3f 100644 --- a/src/solver/solver2tactic.cpp +++ b/src/solver/solver2tactic.cpp @@ -107,7 +107,7 @@ public: extract_clauses_and_dependencies(in, clauses, assumptions, bool2dep, fmc); ref local_solver = m_solver->translate(m, m_params); local_solver->assert_expr(clauses); - TRACE("solver2tactic", tout << "clauses asserted\n";); + TRACE(solver2tactic, tout << "clauses asserted\n";); lbool r; try { r = local_solver->check_sat(assumptions.size(), assumptions.data()); @@ -116,7 +116,7 @@ public: local_solver->collect_statistics(m_st); throw; } - TRACE("solver2tactic", tout << "check sat result " << r << "\n";); + TRACE(solver2tactic, tout << "check sat result " << r << "\n";); proof* pr = local_solver->get_proof(); if (pr) in->set(proof2proof_converter(m, pr)); local_solver->collect_statistics(m_st); diff --git a/src/solver/solver_na2as.cpp b/src/solver/solver_na2as.cpp index 31c4ad9f3..e3e49ef01 100644 --- a/src/solver/solver_na2as.cpp +++ b/src/solver/solver_na2as.cpp @@ -35,7 +35,7 @@ void solver_na2as::assert_expr_core2(expr * t, expr * a) { else { SASSERT(is_uninterp_const(a)); SASSERT(m.is_bool(a)); - TRACE("solver_na2as", tout << "asserting\n" << mk_ismt2_pp(t, m) << "\n" << mk_ismt2_pp(a, m) << "\n";); + TRACE(solver_na2as, tout << "asserting\n" << mk_ismt2_pp(t, m) << "\n" << mk_ismt2_pp(a, m) << "\n";); m_assumptions.push_back(a); expr_ref new_t(m); new_t = m.mk_implies(a, t); @@ -61,7 +61,7 @@ struct append_assumptions { lbool solver_na2as::check_sat_core(unsigned num_assumptions, expr * const * assumptions) { append_assumptions app(m_assumptions, num_assumptions, assumptions); - TRACE("solver_na2as", display(tout);); + TRACE(solver_na2as, display(tout);); return check_sat_core2(m_assumptions.size(), m_assumptions.data()); } diff --git a/src/solver/solver_pool.cpp b/src/solver/solver_pool.cpp index 5fbe8fa11..27c6e305c 100644 --- a/src/solver/solver_pool.cpp +++ b/src/solver/solver_pool.cpp @@ -287,7 +287,7 @@ private: lbool last_status, double last_time) { std::string file_name = mk_file_name(); std::ofstream out(file_name); - STRACE("spacer.ind_gen", tout << "Dumping benchmark to " << file_name << "\n";); + STRACE(spacer_ind_gen, tout << "Dumping benchmark to " << file_name << "\n";); if (!out) { IF_VERBOSE(0, verbose_stream() << "could not open file " << file_name << " for output\n"); return; diff --git a/src/solver/tactic2solver.cpp b/src/solver/tactic2solver.cpp index bf849d830..4b8e28366 100644 --- a/src/solver/tactic2solver.cpp +++ b/src/solver/tactic2solver.cpp @@ -201,12 +201,12 @@ void tactic2solver::push_core() { m_last_assertions_valid = false; m_scopes.push_back(m_assertions.size()); m_result = nullptr; - TRACE("pop", tout << m_scopes.size() << "\n";); + TRACE(pop, tout << m_scopes.size() << "\n";); } void tactic2solver::pop_core(unsigned n) { m_last_assertions_valid = false; - TRACE("pop", tout << m_scopes.size() << " " << n << "\n";); + TRACE(pop, tout << m_scopes.size() << " " << n << "\n";); n = std::min(m_scopes.size(), n); unsigned new_lvl = m_scopes.size() - n; unsigned old_sz = m_scopes[new_lvl]; @@ -240,7 +240,7 @@ lbool tactic2solver::check_sat_core2(unsigned num_assumptions, expr * const * as expr_dependency_ref core(m); std::string reason_unknown = "unknown"; labels_vec labels; - TRACE("tactic", g->display(tout);); + TRACE(tactic, g->display(tout);); try { switch (::check_sat(*m_tactic, g, md, labels, pr, core, reason_unknown)) { case l_true: @@ -260,8 +260,8 @@ lbool tactic2solver::check_sat_core2(unsigned num_assumptions, expr * const * as } break; } - CTRACE("tactic", md.get(), tout << *md.get() << "\n";); - TRACE("tactic", + CTRACE(tactic, md.get(), tout << *md.get() << "\n";); + TRACE(tactic, if (m_mc) m_mc->display(tout << "mc:\n"); if (g->mc()) g->mc()->display(tout << "\ng:\n"); if (md) tout << "\nmodel:\n" << *md.get() << "\n"; @@ -270,12 +270,12 @@ lbool tactic2solver::check_sat_core2(unsigned num_assumptions, expr * const * as } catch (z3_error & ex) { - TRACE("tactic2solver", tout << "exception: " << ex.what() << "\n";); + TRACE(tactic2solver, tout << "exception: " << ex.what() << "\n";); m_result->m_proof = pr; throw ex; } catch (z3_exception & ex) { - TRACE("tactic2solver", tout << "exception: " << ex.what() << "\n";); + TRACE(tactic2solver, tout << "exception: " << ex.what() << "\n";); m_result->set_status(l_undef); m_result->m_unknown = ex.what(); m_result->m_proof = pr; diff --git a/src/tactic/aig/aig.cpp b/src/tactic/aig/aig.cpp index e59982969..fe66fcbfd 100644 --- a/src/tactic/aig/aig.cpp +++ b/src/tactic/aig/aig.cpp @@ -144,7 +144,7 @@ struct aig_manager::imp { } void delete_node(aig * n) { - TRACE("aig_lit_count", tout << "deleting: "; display_ref(tout, n); tout << "\n";); + TRACE(aig_lit_count, tout << "deleting: "; display_ref(tout, n); tout << "\n";); SASSERT(m_num_aigs > 0); m_num_aigs--; if (is_var(n)) { @@ -442,7 +442,7 @@ struct aig_manager::imp { } void cache_result(expr * t, aig_lit const & r) { - TRACE("expr2aig", tout << "caching:\n" << mk_bounded_pp(t, m.m()) << "\n---> "; m.display_ref(tout, r); tout << "\n";); + TRACE(expr2aig, tout << "caching:\n" << mk_bounded_pp(t, m.m()) << "\n---> "; m.display_ref(tout, r); tout << "\n";); SASSERT(!m_cache.contains(t)); m.inc_ref(r); m_cache.insert(t, r); @@ -774,7 +774,7 @@ struct aig_manager::imp { return n->m_id == 0 ? ast_mng.mk_true() : m.var2expr(n); } else { - CTRACE("aig2expr", !is_cached(n), tout << "invalid get_cached for "; m.display_ref(tout, n); tout << "\n";); + CTRACE(aig2expr, !is_cached(n), tout << "invalid get_cached for "; m.display_ref(tout, n); tout << "\n";); SASSERT(is_cached(n)); return m_cache.get(to_idx(n)); } @@ -867,7 +867,7 @@ struct aig_manager::imp { } expr * r = ast_mng.mk_not(ast_mng.mk_or(m_and_children.size(), m_and_children.data())); cache_result(n, r); - TRACE("aig2expr", tout << "caching AND "; m.display_ref(tout, n); tout << "\n";); + TRACE(aig2expr, tout << "caching AND "; m.display_ref(tout, n); tout << "\n";); } void mk_ite(aig * n) { @@ -885,7 +885,7 @@ struct aig_manager::imp { r = ast_mng.mk_ite(get_cached(c), get_cached(t), get_cached(e)); } cache_result(n, r); - TRACE("aig2expr", tout << "caching ITE/IFF "; m.display_ref(tout, n); tout << "\n";); + TRACE(aig2expr, tout << "caching ITE/IFF "; m.display_ref(tout, n); tout << "\n";); } /** @@ -935,7 +935,7 @@ struct aig_manager::imp { switch (fr.m_kind){ case AIG_AUX_AND: // do nothing - TRACE("aig2expr", tout << "skipping aux AND "; m.display_ref(tout, n); tout << "\n";); + TRACE(aig2expr, tout << "skipping aux AND "; m.display_ref(tout, n); tout << "\n";); break; case AIG_AND: mk_and(n); @@ -1136,7 +1136,7 @@ struct aig_manager::imp { aig_lit a = left(left(n)); aig_lit b = right(left(n)); aig_lit c = right(n); - TRACE("max_sharing", + TRACE(max_sharing, tout << "trying (and "; m.display_ref(tout, a); tout << " (and "; m.display_ref(tout, b); tout << " "; m.display_ref(tout, c); @@ -1149,12 +1149,12 @@ struct aig_manager::imp { r.invert(); save_result(o, r); m.dec_ref(bc); - TRACE("max_sharing", tout << "improved:\n"; m.display(tout, o); tout << "---->\n"; m.display(tout, r);); + TRACE(max_sharing, tout << "improved:\n"; m.display(tout, o); tout << "---->\n"; m.display(tout, r);); return true; } m.dec_ref(bc); - TRACE("max_sharing", + TRACE(max_sharing, tout << "trying (and "; m.display_ref(tout, a); tout << " (and "; m.display_ref(tout, c); tout << " "; m.display_ref(tout, b); @@ -1167,7 +1167,7 @@ struct aig_manager::imp { r.invert(); save_result(o, r); m.dec_ref(ac); - TRACE("max_sharing", tout << "improved:\n"; m.display(tout, o); tout << "---->\n"; m.display(tout, r);); + TRACE(max_sharing, tout << "improved:\n"; m.display(tout, o); tout << "---->\n"; m.display(tout, r);); return true; } m.dec_ref(ac); @@ -1181,7 +1181,7 @@ struct aig_manager::imp { aig_lit a = left(n); aig_lit b = left(right(n)); aig_lit c = right(right(n)); - TRACE("max_sharing", + TRACE(max_sharing, tout << "trying (and (and "; m.display_ref(tout, a); tout << " "; m.display_ref(tout, b); tout << ") "; m.display_ref(tout, c); @@ -1194,13 +1194,13 @@ struct aig_manager::imp { r.invert(); save_result(o, r); m.dec_ref(ab); - TRACE("max_sharing", tout << "improved:\n"; m.display(tout, o); tout << "---->\n"; m.display(tout, r);); + TRACE(max_sharing, tout << "improved:\n"; m.display(tout, o); tout << "---->\n"; m.display(tout, r);); return true; } m.dec_ref(ab); aig_lit ac = m.mk_and(a, c); - TRACE("max_sharing", + TRACE(max_sharing, tout << "trying (and (and "; m.display_ref(tout, a); tout << " "; m.display_ref(tout, c); tout << ") "; m.display_ref(tout, b); @@ -1212,7 +1212,7 @@ struct aig_manager::imp { r.invert(); save_result(o, r); m.dec_ref(ac); - TRACE("max_sharing", tout << "improved:\n"; m.display(tout, o); tout << "---->\n"; m.display(tout, r);); + TRACE(max_sharing, tout << "improved:\n"; m.display(tout, o); tout << "---->\n"; m.display(tout, r);); return true; } m.dec_ref(ac); @@ -1266,7 +1266,7 @@ struct aig_manager::imp { start: frame & fr = m_frame_stack.back(); aig * n = fr.m_node; - TRACE("max_sharing", tout << "processing "; m.display_ref(tout, n); tout << " idx: " << fr.m_idx << "\n";); + TRACE(max_sharing, tout << "processing "; m.display_ref(tout, n); tout << " idx: " << fr.m_idx << "\n";); switch (fr.m_idx) { case 0: fr.m_idx++; @@ -1289,7 +1289,7 @@ struct aig_manager::imp { process(p.ptr()); SASSERT(m_result_stack.size() == 1); aig_lit r = m_result_stack.back(); - TRACE("max_sharing", tout << "r.is_null(): " << r.is_null() << "\n";); + TRACE(max_sharing, tout << "r.is_null(): " << r.is_null() << "\n";); SASSERT(r.is_null() || ref_count(r) >= 1); reset_cache(); if (r.is_null()) { @@ -1300,7 +1300,7 @@ struct aig_manager::imp { r.invert(); } m_result_stack.pop_back(); - TRACE("max_sharing", tout << "result:\n"; m.display(tout, r);); + TRACE(max_sharing, tout << "result:\n"; m.display(tout, r);); m.dec_ref_result(r); return r; } @@ -1348,7 +1348,7 @@ public: aig_lit mk_and(aig_lit r1, aig_lit r2) { aig_lit r = mk_node(r1, r2); - TRACE("mk_and_bug", + TRACE(mk_and_bug, display(tout, r1); tout << "AND\n"; display(tout, r2); diff --git a/src/tactic/arith/add_bounds_tactic.cpp b/src/tactic/arith/add_bounds_tactic.cpp index 78235d647..4304c3f18 100644 --- a/src/tactic/arith/add_bounds_tactic.cpp +++ b/src/tactic/arith/add_bounds_tactic.cpp @@ -125,7 +125,7 @@ class add_bounds_tactic : public tactic { if (proc.m_num_bounds > 0) g->updt_prec(goal::UNDER); report_tactic_progress(":added-bounds", proc.m_num_bounds); - TRACE("add_bounds", g->display(tout);); + TRACE(add_bounds, g->display(tout);); } }; diff --git a/src/tactic/arith/arith_bounds_tactic.cpp b/src/tactic/arith/arith_bounds_tactic.cpp index 9a57b9eca..39d3d87b6 100644 --- a/src/tactic/arith/arith_bounds_tactic.cpp +++ b/src/tactic/arith/arith_bounds_tactic.cpp @@ -76,7 +76,7 @@ struct arith_bounds_tactic : public tactic { goal_ref s(g); // initialize result. obj_map lower, upper; expr* e1, *e2; - TRACE("arith_subsumption", s->display(tout); ); + TRACE(arith_subsumption, s->display(tout); ); for (unsigned i = 0; i < s->size(); ++i) { checkpoint(); expr* lemma = s->form(i); @@ -140,7 +140,7 @@ struct arith_bounds_tactic : public tactic { } s->elim_true(); result.push_back(s.get()); - TRACE("arith_subsumption", s->display(tout); ); + TRACE(arith_subsumption, s->display(tout); ); } void cleanup() override {} diff --git a/src/tactic/arith/bv2int_rewriter.cpp b/src/tactic/arith/bv2int_rewriter.cpp index 21d750d54..12ee3a754 100644 --- a/src/tactic/arith/bv2int_rewriter.cpp +++ b/src/tactic/arith/bv2int_rewriter.cpp @@ -84,7 +84,7 @@ void bv2int_rewriter_ctx::collect_power2(goal const& s) { expr* logx = m.mk_fresh_const("log2_v", bv.mk_sort(log2)); logx = bv.mk_zero_extend(num_bits - log2, logx); m_trail.push_back(logx); - TRACE("bv2int_rewriter", tout << mk_pp(v, m) << " |-> " << mk_pp(logx, m) << "\n";); + TRACE(bv2int_rewriter, tout << mk_pp(v, m) << " |-> " << mk_pp(logx, m) << "\n";); m_power2.insert(v, logx); } } @@ -237,7 +237,7 @@ br_status bv2int_rewriter::mk_mod(expr * s, expr * t, expr_ref & result) { if (is_ubv2int(s, s1) && is_ubv2int(t, t1)) { align_sizes(s1, t1, false); result = m_bv.mk_ubv2int(m_bv.mk_bv_urem(s1, t1)); - TRACE("bv2int_rewriter", tout << result << "\n";); + TRACE(bv2int_rewriter, tout << result << "\n";); return BR_DONE; } @@ -252,7 +252,7 @@ br_status bv2int_rewriter::mk_mod(expr * s, expr * t, expr_ref & result) { u1 = mk_bv_add(s1, u1, false); align_sizes(u1, t1, false); result = m_bv.mk_ubv2int(m_bv.mk_bv_urem(u1, t1)); - TRACE("bv2int_rewriter", tout << result << "\n";); + TRACE(bv2int_rewriter, tout << result << "\n";); return BR_DONE; } diff --git a/src/tactic/arith/bv2real_rewriter.cpp b/src/tactic/arith/bv2real_rewriter.cpp index 66616fb12..cf1cb5c79 100644 --- a/src/tactic/arith/bv2real_rewriter.cpp +++ b/src/tactic/arith/bv2real_rewriter.cpp @@ -315,7 +315,7 @@ bool bv2real_util::mk_is_divisible_by(expr_ref& s, rational const& _overflow) { SASSERT(overflow.is_int()); SASSERT(overflow.is_pos()); SASSERT(!overflow.is_one()); - TRACE("bv2real_rewriter", + TRACE(bv2real_rewriter, tout << mk_pp(s, m()) << " " << overflow << "\n";); unsigned power2 = 0; while ((overflow % rational(2)) == rational(0)) { @@ -336,7 +336,7 @@ bool bv2real_util::mk_is_divisible_by(expr_ref& s, rational const& _overflow) { } } - TRACE("bv2real_rewriter", + TRACE(bv2real_rewriter, tout << mk_pp(s, m()) << " " << overflow << "\n";); return overflow.is_one(); @@ -360,7 +360,7 @@ bv2real_rewriter::bv2real_rewriter(ast_manager& m, bv2real_util& util): br_status bv2real_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * const * args, expr_ref & result) { - TRACE("bv2real_rewriter", + TRACE(bv2real_rewriter, tout << mk_pp(f, m()) << " "; for (unsigned i = 0; i < num_args; ++i) { tout << mk_pp(args[i], m()) << " "; @@ -469,7 +469,7 @@ bool bv2real_rewriter::mk_le(expr* s, expr* t, bool is_pos, bool is_neg, expr_re u().add_side_condition(e4); } - TRACE("bv2real_rewriter", tout << "mk_le\n";); + TRACE(bv2real_rewriter, tout << "mk_le\n";); if (is_pos) { result = le_proxy; @@ -546,7 +546,7 @@ br_status bv2real_rewriter::mk_le(expr * s, expr * t, expr_ref & result) { expr* e2 = m().mk_or(m().mk_not(gz1), m().mk_not(lz2), ge); expr* e3 = m().mk_or(m().mk_not(gz2), m().mk_not(lz1), le); result = m().mk_and(e1, e2, e3); - TRACE("bv2real_rewriter", tout << "\n";); + TRACE(bv2real_rewriter, tout << "\n";); return BR_DONE; } return BR_FAILED; diff --git a/src/tactic/arith/degree_shift_tactic.cpp b/src/tactic/arith/degree_shift_tactic.cpp index 888503f6b..fd17b9f39 100644 --- a/src/tactic/arith/degree_shift_tactic.cpp +++ b/src/tactic/arith/degree_shift_tactic.cpp @@ -172,7 +172,7 @@ class degree_shift_tactic : public tactic { for (auto [f, d, p] : g) collect(f, visited); - TRACE("degree_shift", display_candidates(tout);); + TRACE(degree_shift, display_candidates(tout);); } void discard_non_candidates() { @@ -257,7 +257,7 @@ class degree_shift_tactic : public tactic { g->inc_depth(); g->add(mc.get()); result.push_back(g.get()); - TRACE("degree_shift", g->display(tout); if (mc) mc->display(tout);); + TRACE(degree_shift, g->display(tout); if (mc) mc->display(tout);); } }; diff --git a/src/tactic/arith/diff_neq_tactic.cpp b/src/tactic/arith/diff_neq_tactic.cpp index 59baace10..1e8943d13 100644 --- a/src/tactic/arith/diff_neq_tactic.cpp +++ b/src/tactic/arith/diff_neq_tactic.cpp @@ -168,7 +168,7 @@ class diff_neq_tactic : public tactic { unsigned sz = g.size(); for (unsigned i = 0; i < sz; i++) { expr * f = g.form(i); - TRACE("diff_neq_tactic", tout << "processing: " << mk_ismt2_pp(f, m) << "\n";); + TRACE(diff_neq_tactic, tout << "processing: " << mk_ismt2_pp(f, m) << "\n";); if (u.is_le(f, lhs, rhs)) process_le(lhs, rhs); else if (u.is_ge(f, lhs, rhs)) @@ -290,14 +290,14 @@ class diff_neq_tactic : public tactic { while (m_stack.size() < nvars) { if (!m.inc()) throw tactic_exception(m.limit().get_cancel_msg()); - TRACE("diff_neq_tactic", display_model(tout);); + TRACE(diff_neq_tactic, display_model(tout);); var x = m_stack.size(); if (extend_model(x)) continue; if (!resolve_conflict()) return false; } - TRACE("diff_neq_tactic", display_model(tout);); + TRACE(diff_neq_tactic, display_model(tout);); return true; } @@ -324,7 +324,7 @@ class diff_neq_tactic : public tactic { return; } compile(*g); - TRACE("diff_neq_tactic", g->display(tout); display(tout);); + TRACE(diff_neq_tactic, g->display(tout); display(tout);); bool r = search(); report_tactic_progress(":conflicts", m_num_conflicts); if (r) { diff --git a/src/tactic/arith/factor_tactic.cpp b/src/tactic/arith/factor_tactic.cpp index 1060a0d96..9438ccd09 100644 --- a/src/tactic/arith/factor_tactic.cpp +++ b/src/tactic/arith/factor_tactic.cpp @@ -173,7 +173,7 @@ class factor_tactic : public tactic { scoped_mpz d2(m_qm); m_expr2poly.to_polynomial(lhs, p1, d1); m_expr2poly.to_polynomial(rhs, p2, d2); - TRACE("factor_tactic_bug", + TRACE(factor_tactic_bug, tout << "lhs: " << mk_ismt2_pp(lhs, m) << "\n"; tout << "p1: " << p1 << "\n"; tout << "d1: " << d1 << "\n"; @@ -190,10 +190,10 @@ class factor_tactic : public tactic { if (is_const(p)) return BR_FAILED; polynomial::factors fs(m_pm); - TRACE("factor_tactic_bug", tout << "p: " << p << "\n";); + TRACE(factor_tactic_bug, tout << "p: " << p << "\n";); m_pm.factor(p, fs, m_fparams); SASSERT(fs.distinct_factors() > 0); - TRACE("factor_tactic_bug", tout << "factors:\n"; fs.display(tout); tout << "\n";); + TRACE(factor_tactic_bug, tout << "factors:\n"; fs.display(tout); tout << "\n";); if (fs.distinct_factors() == 1 && fs.get_degree(0) == 1) return BR_FAILED; if (m.is_eq(f)) { diff --git a/src/tactic/arith/fix_dl_var_tactic.cpp b/src/tactic/arith/fix_dl_var_tactic.cpp index 015108cc3..4b3ef96e0 100644 --- a/src/tactic/arith/fix_dl_var_tactic.cpp +++ b/src/tactic/arith/fix_dl_var_tactic.cpp @@ -46,7 +46,7 @@ class fix_dl_var_tactic : public tactic { } void throw_failed(expr * ctx1, expr * ctx2 = nullptr) { - TRACE("fix_dl_var", tout << mk_ismt2_pp(ctx1, m) << "\n"; if (ctx2) tout << mk_ismt2_pp(ctx2, m) << "\n";); + TRACE(fix_dl_var, tout << mk_ismt2_pp(ctx1, m) << "\n"; if (ctx2) tout << mk_ismt2_pp(ctx2, m) << "\n";); throw failed(); } @@ -104,7 +104,7 @@ class fix_dl_var_tactic : public tactic { visit(s, nested); } else { - CTRACE("fix_dl_var", m_util.is_add(lhs, t, ms), + CTRACE(fix_dl_var, m_util.is_add(lhs, t, ms), s = 0; tout << "is_times_minus_one: " << m_util.is_times_minus_one(ms, s) << "\n"; tout << "is_uninterp(t): " << is_uninterp(t) << "\n"; @@ -197,7 +197,7 @@ class fix_dl_var_tactic : public tactic { app * r1, * r2; r1 = most_occs(m_non_nested_occs, best1); r2 = most_occs(m_occs, best2); - TRACE("fix_dl_var", + TRACE(fix_dl_var, if (r1) { tout << "r1 occs: " << best1 << "\n"; tout << mk_ismt2_pp(r1, m) << "\n"; @@ -246,7 +246,7 @@ class fix_dl_var_tactic : public tactic { goal_ref_buffer & result) { tactic_report report("fix-dl-var", *g); m_produce_models = g->models_enabled(); - TRACE("fix_dl_var", g->display(tout);); + TRACE(fix_dl_var, g->display(tout);); app * var = is_target(u)(*g); if (var != nullptr) { diff --git a/src/tactic/arith/fm_tactic.cpp b/src/tactic/arith/fm_tactic.cpp index 1d3bc2770..ed2bcce8b 100644 --- a/src/tactic/arith/fm_tactic.cpp +++ b/src/tactic/arith/fm_tactic.cpp @@ -198,7 +198,7 @@ class fm_tactic : public tactic { void get_units(obj_map& units) override { units.reset(); } void operator()(model_ref & md) override { - TRACE("fm_mc", model_v2_pp(tout, *md); display(tout);); + TRACE(fm_mc, model_v2_pp(tout, *md); display(tout);); model::scoped_model_completion _sc(*md, true); //model_evaluator ev(*(md.get())); //ev.set_model_completion(true); @@ -218,23 +218,23 @@ class fm_tactic : public tactic { rational val; expr_ref val_e(m), val_upper_e(m), val_lower_e(m); bool has_lower = false, has_upper = false; - TRACE("fm_mc", tout << "processing " << x->get_name() << "\n";); + TRACE(fm_mc, tout << "processing " << x->get_name() << "\n";); for (expr* cl : m_clauses[i]) { if (!m.inc()) throw tactic_exception(m.limit().get_cancel_msg()); switch (process(x, cl, u, *md, val, val_e)) { case NONE: - TRACE("fm_mc", tout << "no bound for:\n" << mk_ismt2_pp(cl, m) << "\n";); + TRACE(fm_mc, tout << "no bound for:\n" << mk_ismt2_pp(cl, m) << "\n";); break; case LOWER: - TRACE("fm_mc", tout << "lower bound: " << val << " for:\n" << mk_ismt2_pp(cl, m) << "\n";); + TRACE(fm_mc, tout << "lower bound: " << val << " for:\n" << mk_ismt2_pp(cl, m) << "\n";); if (val_e) val_lower_e = val_lower_e != nullptr ? mk_max(val_lower_e, val_e) : val_e; else if (!has_lower || val > lower) lower = val, has_lower = true; break; case UPPER: - TRACE("fm_mc", tout << "upper bound: " << val << " for:\n" << mk_ismt2_pp(cl, m) << "\n";); + TRACE(fm_mc, tout << "upper bound: " << val << " for:\n" << mk_ismt2_pp(cl, m) << "\n";); if (val_e) val_upper_e = val_upper_e != nullptr ? mk_min(val_upper_e, val_e) : val_e; else if (!has_upper || val < upper) @@ -285,10 +285,10 @@ class fm_tactic : public tactic { else x_val = u.mk_numeral(rational(0), false); } - TRACE("fm_mc", tout << x->get_name() << " --> " << mk_ismt2_pp(x_val, m) << "\n";); + TRACE(fm_mc, tout << x->get_name() << " --> " << mk_ismt2_pp(x_val, m) << "\n";); md->register_decl(x, x_val); } - TRACE("fm_mc", model_v2_pp(tout, *md);); + TRACE(fm_mc, model_v2_pp(tout, *md);); } @@ -519,7 +519,7 @@ class fm_tactic : public tactic { bool is_linear_ineq(expr * t) const { m.is_not(t, t); expr * lhs, * rhs; - TRACE("is_occ_bug", tout << mk_pp(t, m) << "\n";); + TRACE(is_occ_bug, tout << mk_pp(t, m) << "\n";); if (m_util.is_le(t, lhs, rhs) || m_util.is_ge(t, lhs, rhs)) { if (!m_util.is_numeral(rhs)) return false; @@ -595,7 +595,7 @@ class fm_tactic : public tactic { cnstr->m_xs = reinterpret_cast(mem_xs); cnstr->m_as = reinterpret_cast(mem_as); for (unsigned i = 0; i < num_vars; i++) { - TRACE("mk_constraint_bug", tout << "xs[" << i << "]: " << xs[i] << "\n";); + TRACE(mk_constraint_bug, tout << "xs[" << i << "]: " << xs[i] << "\n";); cnstr->m_xs[i] = xs[i]; new (cnstr->m_as + i) rational(as[i]); } @@ -787,7 +787,7 @@ class fm_tactic : public tactic { if (c2->m_dead) continue; if (subsumes(c, *c2)) { - TRACE("fm_subsumption", display(tout, c); tout << "\nsubsumed:\n"; display(tout, *c2); tout << "\n";); + TRACE(fm_subsumption, display(tout, c); tout << "\nsubsumed:\n"; display(tout, *c2); tout << "\n";); c2->m_dead = true; continue; } @@ -858,7 +858,7 @@ class fm_tactic : public tactic { expr * f = g.form(i); if (is_occ(f)) continue; - TRACE("is_occ_bug", tout << "not OCC:\n" << mk_ismt2_pp(f, m) << "\n";); + TRACE(is_occ_bug, tout << "not OCC:\n" << mk_ismt2_pp(f, m) << "\n";); quick_for_each_expr(proc, visited, f); } } @@ -1009,7 +1009,7 @@ class fm_tactic : public tactic { x = mk_var(t); SASSERT(m_expr2var.contains(t)); SASSERT(m_var2expr.get(x) == t); - TRACE("to_var_bug", tout << mk_ismt2_pp(t, m) << " --> " << x << "\n";); + TRACE(to_var_bug, tout << mk_ismt2_pp(t, m) << " --> " << x << "\n";); return x; } @@ -1108,7 +1108,7 @@ class fm_tactic : public tactic { } } - TRACE("to_var_bug", tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); i++) tout << " " << xs[i]; tout << "\n";); + TRACE(to_var_bug, tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); i++) tout << " " << xs[i]; tout << "\n";); constraint * new_c = mk_constraint(lits.size(), lits.data(), @@ -1119,7 +1119,7 @@ class fm_tactic : public tactic { strict, dep); - TRACE("to_var_bug", tout << "add_constraint: "; display(tout, *new_c); tout << "\n";); + TRACE(to_var_bug, tout << "add_constraint: "; display(tout, *new_c); tout << "\n";); VERIFY(register_constraint(new_c)); } @@ -1132,7 +1132,7 @@ class fm_tactic : public tactic { if (is_false(*c)) { del_constraint(c); m_inconsistent = true; - TRACE("add_constraint_bug", tout << "is false "; display(tout, *c); tout << "\n";); + TRACE(add_constraint_bug, tout << "is false "; display(tout, *c); tout << "\n";); return false; } @@ -1155,7 +1155,7 @@ class fm_tactic : public tactic { return true; } else { - TRACE("add_constraint_bug", tout << "all variables are forbidden "; display(tout, *c); tout << "\n";); + TRACE(add_constraint_bug, tout << "all variables are forbidden "; display(tout, *c); tout << "\n";); m_new_goal->assert_expr(to_expr(*c), nullptr, c->m_dep); del_constraint(c); return false; @@ -1211,7 +1211,7 @@ class fm_tactic : public tactic { } // x_cost_lt is not a total order on variables std::stable_sort(x_cost_vector.begin(), x_cost_vector.end(), x_cost_lt(m_is_int)); - TRACE("fm", + TRACE(fm, for (auto const& [v,c] : x_cost_vector) tout << "(" << mk_ismt2_pp(m_var2expr.get(v), m) << " " << c << ") "; tout << "\n";); @@ -1390,7 +1390,7 @@ class fm_tactic : public tactic { if (new_xs.empty() && (new_c.is_pos() || (!new_strict && new_c.is_zero()))) { // literal is true - TRACE("fm", tout << "resolution " << x << " consequent literal is always true: \n"; + TRACE(fm, tout << "resolution " << x << " consequent literal is always true: \n"; display(tout, l); tout << "\n"; display(tout, u); tout << "\n";); @@ -1434,7 +1434,7 @@ class fm_tactic : public tactic { } if (tautology) { - TRACE("fm", tout << "resolution " << x << " tautology: \n"; + TRACE(fm, tout << "resolution " << x << " tautology: \n"; display(tout, l); tout << "\n"; display(tout, u); tout << "\n";); @@ -1444,7 +1444,7 @@ class fm_tactic : public tactic { expr_dependency * new_dep = m.mk_join(l.m_dep, u.m_dep); if (new_lits.empty() && new_xs.empty() && (new_c.is_neg() || (new_strict && new_c.is_zero()))) { - TRACE("fm", tout << "resolution " << x << " inconsistent: \n"; + TRACE(fm, tout << "resolution " << x << " inconsistent: \n"; display(tout, l); tout << "\n"; display(tout, u); tout << "\n";); @@ -1462,7 +1462,7 @@ class fm_tactic : public tactic { new_strict, new_dep); - TRACE("fm", tout << "resolution " << x << "\n"; + TRACE(fm, tout << "resolution " << x << "\n"; display(tout, l); tout << "\n"; display(tout, u); @@ -1485,7 +1485,7 @@ class fm_tactic : public tactic { if (l.empty() || u.empty()) { // easy case mark_constraints_dead(x); - TRACE("fm", tout << "variables was eliminated (trivial case)\n";); + TRACE(fm, tout << "variables was eliminated (trivial case)\n";); return true; } @@ -1503,7 +1503,7 @@ class fm_tactic : public tactic { m_counter += num_lowers * num_uppers; - TRACE("fm_bug", tout << "eliminating " << mk_ismt2_pp(m_var2expr.get(x), m) << "\nlowers:\n"; + TRACE(fm_bug, tout << "eliminating " << mk_ismt2_pp(m_var2expr.get(x), m) << "\nlowers:\n"; display_constraints(tout, l); tout << "uppers:\n"; display_constraints(tout, u);); unsigned num_old_cnstrs = num_uppers + num_lowers; @@ -1513,7 +1513,7 @@ class fm_tactic : public tactic { for (unsigned i = 0; i < num_lowers; i++) { for (unsigned j = 0; j < num_uppers; j++) { if (m_inconsistent || num_new_cnstrs > limit) { - TRACE("fm", tout << "too many new constraints: " << num_new_cnstrs << "\n";); + TRACE(fm, tout << "too many new constraints: " << num_new_cnstrs << "\n";); del_constraints(new_constraints.size(), new_constraints.data()); return false; } @@ -1538,7 +1538,7 @@ class fm_tactic : public tactic { backward_subsumption(*c); register_constraint(c); } - TRACE("fm", tout << "variables was eliminated old: " << num_old_cnstrs << " new_constraints: " << sz << "\n";); + TRACE(fm, tout << "variables was eliminated old: " << num_old_cnstrs << " new_constraints: " << sz << "\n";); return true; } @@ -1548,7 +1548,7 @@ class fm_tactic : public tactic { if (!c->m_dead) { c->m_dead = true; expr * new_f = to_expr(*c); - TRACE("fm_bug", tout << "asserting...\n" << mk_ismt2_pp(new_f, m) << "\nnew_dep: " << c->m_dep << "\n";); + TRACE(fm_bug, tout << "asserting...\n" << mk_ismt2_pp(new_f, m) << "\nnew_dep: " << c->m_dep << "\n";); m_new_goal->assert_expr(new_f, nullptr, c->m_dep); } } @@ -1589,7 +1589,7 @@ class fm_tactic : public tactic { m_new_goal->assert_expr(m.mk_false(), nullptr, m_inconsistent_core); } else { - TRACE("fm", display(tout);); + TRACE(fm, display(tout);); subsume(); var_vector candidates; @@ -1623,7 +1623,7 @@ class fm_tactic : public tactic { } reset_constraints(); result.push_back(m_new_goal.get()); - TRACE("fm", m_new_goal->display(tout);); + TRACE(fm, m_new_goal->display(tout);); } void display_constraints(std::ostream & out, constraints const & cs) const { diff --git a/src/tactic/arith/lia2card_tactic.cpp b/src/tactic/arith/lia2card_tactic.cpp index a5524d13a..d1133cccc 100644 --- a/src/tactic/arith/lia2card_tactic.cpp +++ b/src/tactic/arith/lia2card_tactic.cpp @@ -84,7 +84,7 @@ class lia2card_tactic : public tactic { else { return BR_FAILED; } - TRACE("pbsum", tout << expr_ref(m.mk_app(f, sz, es), m) << " ==>\n" << result << "\n";); + TRACE(pbsum, tout << expr_ref(m.mk_app(f, sz, es), m) << " ==>\n" << result << "\n";); return BR_DONE; } @@ -202,7 +202,7 @@ public: expr_ref b = mk_bounded(axioms, to_app(x), lo.get_unsigned(), hi.get_unsigned()); rep.insert(x, b); m_bounds.insert(x, bound(lo.get_unsigned(), hi.get_unsigned(), b)); - TRACE("pb", tout << "add bound " << lo << " " << hi << ": " << mk_pp(x, m) << "\n";); + TRACE(pb, tout << "add bound " << lo << " " << hi << ": " << mk_pp(x, m) << "\n";); } } for (unsigned i = 0; !g->inconsistent() && i < g->size(); i++) { @@ -330,7 +330,7 @@ public: conds.pop_back(); } else { - TRACE("pb", tout << "Can't handle " << mk_pp(x, m) << "\n";); + TRACE(pb, tout << "Can't handle " << mk_pp(x, m) << "\n";); ok = false; } return ok; diff --git a/src/tactic/arith/lia2pb_tactic.cpp b/src/tactic/arith/lia2pb_tactic.cpp index aa738ede0..b20e94ef4 100644 --- a/src/tactic/arith/lia2pb_tactic.cpp +++ b/src/tactic/arith/lia2pb_tactic.cpp @@ -94,7 +94,7 @@ class lia2pb_tactic : public tactic { visitor(imp & o):m_owner(o) {} void throw_failed(expr * n) { - TRACE("lia2pb", tout << "Failed at:\n" << mk_ismt2_pp(n, m_owner.m) << "\n";); + TRACE(lia2pb, tout << "Failed at:\n" << mk_ismt2_pp(n, m_owner.m) << "\n";); throw failed(); } @@ -200,7 +200,7 @@ class lia2pb_tactic : public tactic { for (unsigned i = 0; i < g->size(); ++i) m_bm(g->form(i), g->dep(i), g->pr(i)); - TRACE("lia2pb", m_bm.display(tout);); + TRACE(lia2pb, m_bm.display(tout);); // check if there is some variable to be converted if (!has_target()) { @@ -256,7 +256,7 @@ class lia2pb_tactic : public tactic { if (dep != nullptr) m_new_deps.push_back(dep); } - TRACE("lia2pb", tout << mk_ismt2_pp(x, m) << " -> " << dep << "\n";); + TRACE(lia2pb, tout << mk_ismt2_pp(x, m) << " -> " << dep << "\n";); subst.insert(x, def, nullptr, dep); if (m_produce_models) { gmc->add(x, def); diff --git a/src/tactic/arith/nla2bv_tactic.cpp b/src/tactic/arith/nla2bv_tactic.cpp index f47953655..789c544b1 100644 --- a/src/tactic/arith/nla2bv_tactic.cpp +++ b/src/tactic/arith/nla2bv_tactic.cpp @@ -82,7 +82,7 @@ class nla2bv_tactic : public tactic { void updt_params(params_ref const& p) {} void operator()(goal & g, model_converter_ref & mc) { - TRACE("nla2bv", g.display(tout); + TRACE(nla2bv, g.display(tout); tout << "Muls: " << count_mul(g) << "\n"; ); tactic_report report("nla->bv", g); @@ -99,10 +99,10 @@ class nla2bv_tactic : public tactic { return; } substitute_vars(g); - TRACE("nla2bv", g.display(tout << "substitute vars\n")); + TRACE(nla2bv, g.display(tout << "substitute vars\n")); reduce_bv2int(g); reduce_bv2real(g); - TRACE("nla2bv", g.display(tout << "after reduce\n")); + TRACE(nla2bv, g.display(tout << "after reduce\n")); mc = m_fmc.get(); for (unsigned i = 0; i < m_vars.size(); ++i) m_fmc->add(m_vars.get(i), m_defs.get(i)); @@ -110,8 +110,8 @@ class nla2bv_tactic : public tactic { m_fmc->hide(m_bv2real.get_aux_decl(i)); } IF_VERBOSE(TACTIC_VERBOSITY_LVL, verbose_stream() << "(nla->bv :sat-preserving " << m_is_sat_preserving << ")\n";); - TRACE("nla2bv_verbose", g.display(tout)); - TRACE("nla2bv", tout << "Muls: " << count_mul(g) << "\n"); + TRACE(nla2bv_verbose, g.display(tout)); + TRACE(nla2bv, tout << "Muls: " << count_mul(g) << "\n"); g.inc_depth(); if (!is_sat_preserving()) g.updt_prec(goal::UNDER); @@ -134,7 +134,7 @@ class nla2bv_tactic : public tactic { expr* w = m_bv.mk_ubv2int(m_bv.mk_bv_shl(m_bv.mk_numeral(1, num_bits), v)); m_trail.push_back(w); m_subst.insert(kv.m_key, w); - TRACE("nla2bv", tout << mk_ismt2_pp(kv.m_key, m_manager) << " " << mk_ismt2_pp(w, m_manager) << "\n";); + TRACE(nla2bv, tout << mk_ismt2_pp(kv.m_key, m_manager) << " " << mk_ismt2_pp(w, m_manager) << "\n";); } // eliminate the variables that are power of two. substitute_vars(g); @@ -174,7 +174,7 @@ class nla2bv_tactic : public tactic { g.assert_expr(conditions[i]); set_satisfiability_preserving(false); } - TRACE("nla2bv", + TRACE(nla2bv, for (unsigned i = 0; i < sz; ++i) { tout << mk_ismt2_pp(conditions[i], m_manager) << "\n"; }); @@ -229,7 +229,7 @@ class nla2bv_tactic : public tactic { num_bits = log2(abs(*up - *low)+numeral(1)); } else { - TRACE("nla2bv", tout << "no bounds for " << mk_ismt2_pp(n, m_manager) << "\n";); + TRACE(nla2bv, tout << "no bounds for " << mk_ismt2_pp(n, m_manager) << "\n";); set_satisfiability_preserving(false); } bv_sort = m_bv.mk_sort(num_bits); @@ -351,7 +351,7 @@ class nla2bv_tactic : public tactic { m_no_arith = false; } else if (n->get_family_id() != m.get_basic_family_id()) { - TRACE("nla2bv", tout << "Not supported: " << mk_ismt2_pp(n, m) << "\n";); + TRACE(nla2bv, tout << "Not supported: " << mk_ismt2_pp(n, m) << "\n";); m_in_supported_fragment = false; } m_imp.update_num_bits(n); diff --git a/src/tactic/arith/normalize_bounds_tactic.cpp b/src/tactic/arith/normalize_bounds_tactic.cpp index 8898ab613..d987417da 100644 --- a/src/tactic/arith/normalize_bounds_tactic.cpp +++ b/src/tactic/arith/normalize_bounds_tactic.cpp @@ -68,7 +68,7 @@ class normalize_bounds_tactic : public tactic { bool has_lowers() { for (auto* e : m_bm) { - TRACE("normalize_bounds_tactic", + TRACE(normalize_bounds_tactic, rational val; bool strict; tout << mk_ismt2_pp(e, m) << " has_lower: " << m_bm.has_lower(e, val, strict) << " val: " << val << "\n";); if (is_target(e)) @@ -129,7 +129,7 @@ class normalize_bounds_tactic : public tactic { } in->update(idx, new_curr, new_pr, in->dep(idx)); } - TRACE("normalize_bounds_tactic", in->display(tout);); + TRACE(normalize_bounds_tactic, in->display(tout);); in->inc_depth(); result.push_back(in.get()); } diff --git a/src/tactic/arith/pb2bv_model_converter.cpp b/src/tactic/arith/pb2bv_model_converter.cpp index 772680e6c..a8bf4a366 100644 --- a/src/tactic/arith/pb2bv_model_converter.cpp +++ b/src/tactic/arith/pb2bv_model_converter.cpp @@ -56,7 +56,7 @@ void pb2bv_model_converter::get_units(obj_map& units) { void pb2bv_model_converter::operator()(model_ref & md) { - TRACE("pb2bv", tout << "converting model:\n"; model_v2_pp(tout, *md); display(tout);); + TRACE(pb2bv, tout << "converting model:\n"; model_v2_pp(tout, *md); display(tout);); arith_util a_util(m); for (auto const& kv : m_c2bit) { diff --git a/src/tactic/arith/pb2bv_tactic.cpp b/src/tactic/arith/pb2bv_tactic.cpp index 5b1c4831f..de4eaea25 100644 --- a/src/tactic/arith/pb2bv_tactic.cpp +++ b/src/tactic/arith/pb2bv_tactic.cpp @@ -52,7 +52,7 @@ public: } void throw_non_pb(expr * n) { - TRACE("pb2bv", tout << "Not pseudo-Boolean: " << mk_ismt2_pp(n, m) << "\n";); + TRACE(pb2bv, tout << "Not pseudo-Boolean: " << mk_ismt2_pp(n, m) << "\n";); throw non_pb(n); } @@ -227,7 +227,7 @@ private: if (owner.is_constraint_core(s)) { owner.convert(to_app(s), m_saved_res, true, false); t = m_saved_res; - TRACE("pb2bv_convert", tout << mk_ismt2_pp(s, m) << "\n-->\n" << mk_ismt2_pp(t, m) << "\n";); + TRACE(pb2bv_convert, tout << mk_ismt2_pp(s, m) << "\n-->\n" << mk_ismt2_pp(t, m) << "\n";); return true; } return false; @@ -425,13 +425,13 @@ private: } } - TRACE("pb2bv_bv", tout << "BV Cardinality: " << mk_ismt2_pp(tmp.back(), m) << std::endl;); + TRACE(pb2bv_bv, tout << "BV Cardinality: " << mk_ismt2_pp(tmp.back(), m) << std::endl;); r = tmp.back(); return; } } - TRACE("pb2bv_bv_detail", tout << "encoding:\n"; display(tout, m_p, m_c);); + TRACE(pb2bv_bv_detail, tout << "encoding:\n"; display(tout, m_p, m_c);); // [Leo] improving number of bits needed. // using (sum-of-coeffs).get_num_bits() numeral sum; @@ -449,7 +449,7 @@ private: unsigned bits = sum.get_num_bits(); - TRACE("num_bits_bug", tout << "bits: " << bits << " sum: " << sum << " size: " << m_p.size() << "\n";); + TRACE(num_bits_bug, tout << "bits: " << bits << " sum: " << sum << " size: " << m_p.size() << "\n";); // [Leo]: The following assertion should hold, right? // I mean, the constraints are normalized, then mo.m_a <= m_c for every monomial in cnstr. @@ -511,7 +511,7 @@ private: } void mk_pbc(polynomial & m_p, numeral & m_c, expr_ref & r, bool enable_split) { - TRACE("mk_pbc", display(tout, m_p, m_c); ); + TRACE(mk_pbc, display(tout, m_p, m_c); ); if (m_c.is_nonpos()) { // constraint is equivalent to true. r = m.mk_true(); @@ -532,7 +532,7 @@ private: it->m_a /= a_gcd; m_c = ceil(m_c/a_gcd); } - TRACE("mk_pbc", tout << "GCD = " << a_gcd << "; Normalized: "; display(tout, m_p, m_c); tout << "\n"; ); + TRACE(mk_pbc, tout << "GCD = " << a_gcd << "; Normalized: "; display(tout, m_p, m_c); tout << "\n"; ); it = m_p.begin(); numeral a_sum; for (; it != end; ++it) { @@ -546,10 +546,10 @@ private: return; } polynomial clause; - TRACE("split_bug", display(tout, m_p, m_c);); + TRACE(split_bug, display(tout, m_p, m_c);); if (enable_split) split(m_p, m_c, clause); - TRACE("split_bug", display(tout, m_p, m_c); display(tout, clause, rational(1));); + TRACE(split_bug, display(tout, m_p, m_c); display(tout, clause, rational(1));); if (clause.empty()) { bitblast_pbc(m_p, m_c, r); } @@ -558,7 +558,7 @@ private: expr_ref r2(m); bitblast_pbc(m_p, m_c, r1); bitblast_pbc(clause, numeral(1), r2); - TRACE("split_bug", tout << mk_ismt2_pp(r1, m) << "\nAND\n" << mk_ismt2_pp(r2, m) << "\n";); + TRACE(split_bug, tout << mk_ismt2_pp(r1, m) << "\nAND\n" << mk_ismt2_pp(r2, m) << "\n";); m_b_rw.mk_and(r1, r2, r); } } @@ -582,7 +582,7 @@ private: } void throw_non_pb(expr * n) { - TRACE("pb2bv", tout << "Not pseudo-Boolean: " << mk_ismt2_pp(n, m) << "\n";); + TRACE(pb2bv, tout << "Not pseudo-Boolean: " << mk_ismt2_pp(n, m) << "\n";); throw non_pb(n); } @@ -590,7 +590,7 @@ private: // a_0*x_0 + a_0*~y_0 + ... + a_{n-1}*x_{n - 1} + a_{n - 1}*~y_{n - 1} = c // x_0 = y_0, ..., x_{n - 1} = y_{n - 1} bool is_eq_vector(polynomial const & p, numeral const & c) { - TRACE("is_eq_vector", display(tout, p, c);); + TRACE(is_eq_vector, display(tout, p, c);); unsigned sz = p.size(); if (sz % 2 == 1) return false; // size must be even @@ -653,7 +653,7 @@ private: else if ((c.is_zero() && k == LE) || (c.is_one() && k == GE)) { // redundant 0 <= x, 1 >= x - TRACE("pb2bv", tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";); + TRACE(pb2bv, tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";); SASSERT(pos); r = m.mk_true(); } @@ -678,7 +678,7 @@ private: add_bounds_dependencies(lhs); if (k == EQ) { - TRACE("pb2bv_bug", tout << "c: " << c << "\n";); + TRACE(pb2bv_bug, tout << "c: " << c << "\n";); if (!c.is_zero() && !c.is_one()) { // x = k --> true where k is not 0 or 1 r = pos ? m.mk_false() : m.mk_true(); @@ -696,7 +696,7 @@ private: if (k == LE) { // x <= c >= 1 if (c >= numeral(1)) { - TRACE("pb2bv", tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";); + TRACE(pb2bv, tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";); r = m.mk_true(); return; } @@ -709,7 +709,7 @@ private: } else if (k == GE) { if (c.is_nonpos()) { - TRACE("pb2bv", tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";); + TRACE(pb2bv, tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";); // x >= a <= 0 r = m.mk_true(); return; @@ -721,13 +721,13 @@ private: } SASSERT(c.is_one()); } - CTRACE("pb2bv", !(c.is_zero() || c.is_one()), + CTRACE(pb2bv, !(c.is_zero() || c.is_one()), tout << "BUG: " << mk_ismt2_pp(t, m) << "\nk: " << k << " " << c << "\n";); SASSERT(c.is_zero() || c.is_one()); SASSERT(!((c.is_zero() && k == GE) || (c.is_one() && k == LE))); - CTRACE("pb2bv_bug", !((c.is_zero() && k == LE) || (c.is_one() && k == GE)), + CTRACE(pb2bv_bug, !((c.is_zero() && k == LE) || (c.is_one() && k == GE)), tout << "c: " << c << ", k: " << k << "\n"; tout << "t: " << mk_ismt2_pp(t, m) << "\n";); SASSERT((c.is_zero() && k == LE) || @@ -801,7 +801,7 @@ private: SASSERT(k == EQ); if (is_eq_vector(m_p, m_c)) { - TRACE("is_eq_vector", tout << "found eq vector\n";); + TRACE(is_eq_vector, tout << "found eq vector\n";); unsigned sz = m_p.size(); expr_ref_vector eqs(m); for (unsigned i = 0; i < sz; i += 2) { @@ -829,7 +829,7 @@ private: expr_ref r2(m); mk_pbc(m_p, m_c, r1, false); mk_pbc(m_p2, m_c2, r2, false); - TRACE("pb2bv_convert", tout << mk_ismt2_pp(t, m) << "\n"; + TRACE(pb2bv_convert, tout << mk_ismt2_pp(t, m) << "\n"; display(tout, m_p, m_c); display(tout, m_p2, m_c2); tout << "--->\n" << mk_ismt2_pp(r1, m) << "\nAND\n" << mk_ismt2_pp(r2, m) << "\n";); @@ -900,7 +900,7 @@ private: void operator()(goal_ref const & g, goal_ref_buffer & result) { - TRACE("pb2bv", g->display(tout);); + TRACE(pb2bv, g->display(tout);); fail_if_proof_generation("pb2bv", g); m_produce_models = g->models_enabled(); m_produce_unsat_cores = g->unsat_core_enabled(); @@ -917,7 +917,7 @@ private: for (unsigned i = 0; i < size; i++) m_bm(g->form(i), g->dep(i), g->pr(i)); - TRACE("pb2bv", m_bm.display(tout);); + TRACE(pb2bv, m_bm.display(tout);); try { quick_pb_check(g); @@ -939,7 +939,7 @@ private: bool pos; if (is_constraint(curr, atom, pos)) { convert(to_app(atom), new_f, pos, true); - TRACE("pb2bv_convert", tout << "pos: " << pos << "\n" << mk_ismt2_pp(atom, m) << "\n--->\n" << mk_ismt2_pp(new_f, m) << "\n";); + TRACE(pb2bv_convert, tout << "pos: " << pos << "\n" << mk_ismt2_pp(atom, m) << "\n--->\n" << mk_ismt2_pp(new_f, m) << "\n";); } else { proof_ref pr(m); diff --git a/src/tactic/arith/probe_arith.cpp b/src/tactic/arith/probe_arith.cpp index 21498f08f..177f64890 100644 --- a/src/tactic/arith/probe_arith.cpp +++ b/src/tactic/arith/probe_arith.cpp @@ -136,7 +136,7 @@ struct has_nlmul { has_nlmul(ast_manager& m):m(m), a(m) {} void throw_found(expr* e) { - TRACE("probe", tout << expr_ref(e, m) << ": " << sort_ref(e->get_sort(), m) << "\n";); + TRACE(probe, tout << expr_ref(e, m) << ": " << sort_ref(e->get_sort(), m) << "\n";); throw found(); } @@ -438,7 +438,7 @@ struct is_non_nira_functor { is_non_nira_functor(ast_manager & _m, bool _int, bool _real, bool _quant, bool linear):m(_m), u(m), m_int(_int), m_real(_real), m_quant(_quant), m_linear(linear) {} void throw_found(expr* e) { - TRACE("probe", tout << expr_ref(e, m) << ": " << sort_ref(e->get_sort(), m) << "\n";); + TRACE(probe, tout << expr_ref(e, m) << ": " << sort_ref(e->get_sort(), m) << "\n";); throw found(); } @@ -615,13 +615,13 @@ struct is_non_qfufnra_functor { return; case OP_IDIV: case OP_DIV: case OP_REM: case OP_MOD: if (!u.is_numeral(n->get_arg(1))) { - TRACE("arith", tout << "non-linear " << expr_ref(n, m) << "\n";); + TRACE(arith, tout << "non-linear " << expr_ref(n, m) << "\n";); throw_found(); } return; case OP_POWER: if (!u.is_numeral(n->get_arg(1))) { - TRACE("arith", tout << "non-linear " << expr_ref(n, m) << "\n";); + TRACE(arith, tout << "non-linear " << expr_ref(n, m) << "\n";); throw_found(); } m_has_nonlinear = true; @@ -632,7 +632,7 @@ struct is_non_qfufnra_functor { throw_found(); return; default: - TRACE("arith", tout << "non-linear " << expr_ref(n, m) << "\n";); + TRACE(arith, tout << "non-linear " << expr_ref(n, m) << "\n";); throw_found(); } } diff --git a/src/tactic/arith/purify_arith_tactic.cpp b/src/tactic/arith/purify_arith_tactic.cpp index cc04dae93..86352510e 100644 --- a/src/tactic/arith/purify_arith_tactic.cpp +++ b/src/tactic/arith/purify_arith_tactic.cpp @@ -299,7 +299,7 @@ struct purify_arith_proc { void push_cnstr(expr * cnstr) { m_new_cnstrs.push_back(cnstr); - TRACE("purify_arith", tout << mk_pp(cnstr, m()) << "\n";); + TRACE(purify_arith, tout << mk_pp(cnstr, m()) << "\n";); } void cache_result(app * t, expr * r, proof * pr) { @@ -765,7 +765,7 @@ struct purify_arith_proc { expr_ref new_body(m()); proof_ref new_body_pr(m()); r(q->get_expr(), new_body, new_body_pr); - TRACE("purify_arith", + TRACE(purify_arith, tout << "body: " << mk_ismt2_pp(q->get_expr(), m()) << "\nnew_body: " << new_body << "\n";); result = m().update_quantifier(q, new_body); if (m_produce_proofs) { @@ -792,8 +792,8 @@ struct purify_arith_proc { // add constraints sz = r.cfg().m_new_cnstrs.size(); - TRACE("purify_arith", tout << r.cfg().m_new_cnstrs << "\n";); - TRACE("purify_arith", tout << r.cfg().m_new_cnstr_prs << "\n";); + TRACE(purify_arith, tout << r.cfg().m_new_cnstrs << "\n";); + TRACE(purify_arith, tout << r.cfg().m_new_cnstr_prs << "\n";); for (unsigned i = 0; i < sz; i++) { m_goal.assert_expr(r.cfg().m_new_cnstrs.get(i), m_produce_proofs ? r.cfg().m_new_cnstr_prs.get(i) : nullptr, nullptr); } @@ -923,7 +923,7 @@ public: goal_ref_buffer & result) override { try { tactic_report report("purify-arith", *g); - TRACE("goal", g->display(tout);); + TRACE(goal, g->display(tout);); bool produce_proofs = g->proofs_enabled(); bool produce_models = g->models_enabled(); bool elim_root_objs = m_params.get_bool("elim_root_objects", true); diff --git a/src/tactic/arith/recover_01_tactic.cpp b/src/tactic/arith/recover_01_tactic.cpp index 284aeeabe..7feea562c 100644 --- a/src/tactic/arith/recover_01_tactic.cpp +++ b/src/tactic/arith/recover_01_tactic.cpp @@ -300,7 +300,7 @@ class recover_01_tactic : public tactic { else x_def = m_util.mk_add(def_args); - TRACE("recover_01", tout << x->get_name() << " --> " << mk_ismt2_pp(x_def, m) << "\n";); + TRACE(recover_01, tout << x->get_name() << " --> " << mk_ismt2_pp(x_def, m) << "\n";); subst->insert(m.mk_const(x), x_def); if (m_produce_models) { gmc->add(x, x_def); @@ -373,7 +373,7 @@ class recover_01_tactic : public tactic { new_goal->update(idx, new_curr); } result.push_back(new_goal.get()); - TRACE("recover_01", new_goal->display(tout); if (new_goal->mc()) new_goal->mc()->display(tout);); + TRACE(recover_01, new_goal->display(tout); if (new_goal->mc()) new_goal->mc()->display(tout);); SASSERT(new_goal->is_well_formed()); } diff --git a/src/tactic/bv/bit_blaster_model_converter.cpp b/src/tactic/bv/bit_blaster_model_converter.cpp index ee48f48a1..4fbad22dc 100644 --- a/src/tactic/bv/bit_blaster_model_converter.cpp +++ b/src/tactic/bv/bit_blaster_model_converter.cpp @@ -66,7 +66,7 @@ struct bit_blaster_model_converter : public model_converter { bits.insert(to_app(bit)->get_decl()); } } - TRACE("model_converter", + TRACE(model_converter, tout << "bits that should not be included in the model:\n"; for (func_decl* f : bits) { tout << f->get_name() << " "; @@ -81,14 +81,14 @@ struct bit_blaster_model_converter : public model_converter { func_decl * f = old_model->get_constant(i); if (bits.contains(f)) continue; - TRACE("model_converter", tout << "non-bit: " << f->get_name() << "\n";); + TRACE(model_converter, tout << "non-bit: " << f->get_name() << "\n";); expr * fi = old_model->get_const_interp(f); new_model->register_decl(f, fi); } - TRACE("model_converter", tout << "after copy non bits:\n"; model_pp(tout, *new_model);); + TRACE(model_converter, tout << "after copy non bits:\n"; model_pp(tout, *new_model);); new_model->copy_func_interps(*old_model); new_model->copy_usort_interps(*old_model); - TRACE("model_converter", tout << "after copying functions and sorts:\n"; model_pp(tout, *new_model);); + TRACE(model_converter, tout << "after copying functions and sorts:\n"; model_pp(tout, *new_model);); } void mk_bvs(model * old_model, model * new_model) { diff --git a/src/tactic/bv/bit_blaster_tactic.cpp b/src/tactic/bv/bit_blaster_tactic.cpp index 0fd20313d..1937c9eb4 100644 --- a/src/tactic/bv/bit_blaster_tactic.cpp +++ b/src/tactic/bv/bit_blaster_tactic.cpp @@ -59,7 +59,7 @@ class bit_blaster_tactic : public tactic { tactic_report report("bit-blast", *g); - TRACE("before_bit_blaster", g->display(tout);); + TRACE(before_bit_blaster, g->display(tout);); m_num_steps = 0; m_rewriter->start_rewrite(); @@ -79,7 +79,7 @@ class bit_blaster_tactic : public tactic { } if (curr != new_curr) { change = true; - TRACE("bit_blaster", tout << mk_pp(curr, m()) << " -> " << new_curr << "\n";); + TRACE(bit_blaster, tout << mk_pp(curr, m()) << " -> " << new_curr << "\n";); g->update(idx, new_curr, new_pr, g->dep(idx)); } } @@ -92,7 +92,7 @@ class bit_blaster_tactic : public tactic { } g->inc_depth(); result.push_back(g.get()); - TRACE("after_bit_blaster", g->display(tout); if (g->mc()) g->mc()->display(tout); tout << "\n";); + TRACE(after_bit_blaster, g->display(tout); if (g->mc()) g->mc()->display(tout); tout << "\n";); m_rewriter->cleanup(); } diff --git a/src/tactic/bv/bv_bound_chk_tactic.cpp b/src/tactic/bv/bv_bound_chk_tactic.cpp index 93491f7b2..72c62c7ed 100644 --- a/src/tactic/bv/bv_bound_chk_tactic.cpp +++ b/src/tactic/bv/bv_bound_chk_tactic.cpp @@ -56,7 +56,7 @@ struct bv_bound_chk_rewriter_cfg : public default_rewriter_cfg { br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) { const br_status st = reduce_app_core(f, num, args, result, result_pr); - CTRACE("bv_bound_chk_step", st != BR_FAILED, + CTRACE(bv_bound_chk_step, st != BR_FAILED, tout << f->get_name() << "\n"; for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << "\n"; tout << "---------->\n" << mk_ismt2_pp(result, m()) << "\n";); diff --git a/src/tactic/bv/bv_size_reduction_tactic.cpp b/src/tactic/bv/bv_size_reduction_tactic.cpp index 286375b6a..335efcd68 100644 --- a/src/tactic/bv/bv_size_reduction_tactic.cpp +++ b/src/tactic/bv/bv_size_reduction_tactic.cpp @@ -145,7 +145,7 @@ public: if (m_util.is_bv_sle(f, lhs, rhs)) { bv_sz = m_util.get_bv_size(lhs); if (is_uninterp_const(lhs) && m_util.is_numeral(rhs, val, bv_sz)) { - TRACE("bv_size_reduction", tout << (negated?"not ":"") << mk_ismt2_pp(f, m) << std::endl; ); + TRACE(bv_size_reduction, tout << (negated?"not ":"") << mk_ismt2_pp(f, m) << std::endl; ); // v <= k val = m_util.norm(val, bv_sz, true); if (negated) { @@ -160,7 +160,7 @@ public: else update_signed_upper(to_app(lhs), val); } else if (is_uninterp_const(rhs) && m_util.is_numeral(lhs, val, bv_sz)) { - TRACE("bv_size_reduction", tout << (negated?"not ":"") << mk_ismt2_pp(f, m) << std::endl; ); + TRACE(bv_size_reduction, tout << (negated?"not ":"") << mk_ismt2_pp(f, m) << std::endl; ); // k <= v val = m_util.norm(val, bv_sz, true); if (negated) { @@ -178,7 +178,7 @@ public: #if 0 else if (m_util.is_bv_ule(f, lhs, rhs)) { if (is_uninterp_const(lhs) && m_util.is_numeral(rhs, val, bv_sz)) { - TRACE("bv_size_reduction", tout << (negated?"not ":"") << mk_ismt2_pp(f, m) << std::endl; ); + TRACE(bv_size_reduction, tout << (negated?"not ":"") << mk_ismt2_pp(f, m) << std::endl; ); // v <= k if (negated) update_unsigned_lower(to_app(lhs), val+numeral(1)); @@ -186,7 +186,7 @@ public: update_unsigned_upper(to_app(lhs), val); } else if (is_uninterp_const(rhs) && m_util.is_numeral(lhs, val, bv_sz)) { - TRACE("bv_size_reduction", tout << (negated?"not ":"") << mk_ismt2_pp(f, m) << std::endl; ); + TRACE(bv_size_reduction, tout << (negated?"not ":"") << mk_ismt2_pp(f, m) << std::endl; ); // k <= v if (negated) update_unsigned_upper(to_app(rhs), val-numeral(1)); @@ -212,7 +212,7 @@ public: void run(goal & g, model_converter_ref & mc) { if (g.inconsistent()) return; - TRACE("before_bv_size_reduction", g.display(tout);); + TRACE(before_bv_size_reduction, g.display(tout);); m_produce_models = g.models_enabled(); mc = nullptr; m_mc = nullptr; @@ -243,7 +243,7 @@ public: if (!(m_signed_lowers.empty() || m_signed_uppers.empty())) { - TRACE("bv_size_reduction", + TRACE(bv_size_reduction, tout << "m_signed_lowers: " << std::endl; for (auto const& [k, v] : m_signed_lowers) tout << mk_ismt2_pp(k, m) << " >= " << v.to_string() << std::endl; @@ -258,7 +258,7 @@ public: obj_map::obj_map_entry * entry = m_signed_uppers.find_core(k); if (entry != nullptr) { numeral u = m_util.norm(entry->get_data().m_value, bv_sz, true); - TRACE("bv_size_reduction", tout << l << " <= " << k->get_decl()->get_name() << " <= " << u << "\n";); + TRACE(bv_size_reduction, tout << l << " <= " << k->get_decl()->get_name() << " <= " << u << "\n";); expr * new_def = nullptr; app * new_const = nullptr; if (l > u) { @@ -278,7 +278,7 @@ public: { // l <= v <= u <= 0 unsigned i_nb = l_nb; - TRACE("bv_size_reduction", tout << " l <= " << k->get_decl()->get_name() << " <= u <= 0 " << " --> " << i_nb << " bits\n";); + TRACE(bv_size_reduction, tout << " l <= " << k->get_decl()->get_name() << " <= u <= 0 " << " --> " << i_nb << " bits\n";); if (i_nb < v_nb) { new_const = m.mk_fresh_const(nullptr, m_util.mk_sort(i_nb)); new_def = m_util.mk_concat(m_util.mk_numeral(numeral(-1), v_nb - i_nb), new_const); @@ -288,7 +288,7 @@ public: // l <= v <= 0 <= u unsigned u_nb = u.get_num_bits(); unsigned i_nb = ((l_nb > u_nb) ? l_nb : u_nb) + 1; - TRACE("bv_size_reduction", tout << " l <= " << k->get_decl()->get_name() << " <= 0 <= u " << " --> " << i_nb << " bits\n";); + TRACE(bv_size_reduction, tout << " l <= " << k->get_decl()->get_name() << " <= 0 <= u " << " --> " << i_nb << " bits\n";); if (i_nb < v_nb) { new_const = m.mk_fresh_const(nullptr, m_util.mk_sort(i_nb)); new_def = m_util.mk_sign_extend(v_nb - i_nb, new_const); @@ -299,7 +299,7 @@ public: // 0 <= l <= v <= u unsigned u_nb = u.get_num_bits(); unsigned v_nb = m_util.get_bv_size(k); - TRACE("bv_size_reduction", tout << l << " <= " << k->get_decl()->get_name() << " <= " << u << " --> " << u_nb << " bits\n";); + TRACE(bv_size_reduction, tout << l << " <= " << k->get_decl()->get_name() << " <= " << u << " --> " << u_nb << " bits\n";); if (u_nb < v_nb) { new_const = m.mk_fresh_const(nullptr, m_util.mk_sort(u_nb)); new_def = m_util.mk_concat(m_util.mk_numeral(numeral(0), v_nb - u_nb), new_const); @@ -325,7 +325,7 @@ public: #if 0 if (!(m_unsigned_lowers.empty() && m_unsigned_uppers.empty())) { - TRACE("bv_size_reduction", + TRACE(bv_size_reduction, tout << "m_unsigned_lowers: " << std::endl; for (obj_map::iterator it = m_unsigned_lowers.begin(); it != m_unsigned_lowers.end(); it++) tout << mk_ismt2_pp(it->m_key, m) << " >= " << it->m_value.to_string() << std::endl; @@ -352,7 +352,7 @@ public: if (lse != 0 && lse->get_data().m_value > l) l = lse->get_data().m_value; if (use != 0 && use->get_data().m_value < u) u = use->get_data().m_value; - TRACE("bv_size_reduction", tout << l << " <= " << v->get_decl()->get_name() << " <= " << u << "\n";); + TRACE(bv_size_reduction, tout << l << " <= " << v->get_decl()->get_name() << " <= " << u << "\n";); expr * new_def = 0; app * new_const = 0; if (l > u) { @@ -384,7 +384,7 @@ public: m_fmc->hide(new_const); } num_reduced++; - TRACE("bv_size_reduction", tout << "New definition = " << mk_ismt2_pp(new_def, m) << "\n";); + TRACE(bv_size_reduction, tout << "New definition = " << mk_ismt2_pp(new_def, m) << "\n";); } } } @@ -413,7 +413,7 @@ public: m_fmc = nullptr; } report_tactic_progress(":bv-reduced", num_reduced); - TRACE("after_bv_size_reduction", g.display(tout); if (m_mc) m_mc->display(tout);); + TRACE(after_bv_size_reduction, g.display(tout); if (m_mc) m_mc->display(tout);); } }; @@ -422,7 +422,7 @@ void bv_size_reduction_tactic::operator()(goal_ref const & g, goal_ref_buffer & result) { fail_if_proof_generation("bv-size-reduction", g); fail_if_unsat_core_generation("bv-size-reduction", g); - TRACE("goal", g->display(tout);); + TRACE(goal, g->display(tout);); result.reset(); model_converter_ref mc; run(*(g.get()), mc); diff --git a/src/tactic/bv/bvarray2uf_rewriter.cpp b/src/tactic/bv/bvarray2uf_rewriter.cpp index 7a065c44d..5d5797dfa 100644 --- a/src/tactic/bv/bvarray2uf_rewriter.cpp +++ b/src/tactic/bv/bvarray2uf_rewriter.cpp @@ -111,7 +111,7 @@ func_decl_ref bvarray2uf_rewriter_cfg::mk_uf_for_array(expr * e) { sort * domain = get_index_sort(e); sort * range = get_value_sort(e); bv_f = m_manager.mk_fresh_func_decl("f_t", "", 1, &domain, range); - TRACE("bvarray2uf_rw", tout << "for " << mk_ismt2_pp(e, m_manager) << " new func_decl is " << mk_ismt2_pp(bv_f, m_manager) << std::endl; ); + TRACE(bvarray2uf_rw, tout << "for " << mk_ismt2_pp(e, m_manager) << " new func_decl is " << mk_ismt2_pp(bv_f, m_manager) << std::endl; ); if (m_fmc) { m_fmc->hide(bv_f); if (is_uninterp_const(e)) @@ -122,7 +122,7 @@ func_decl_ref bvarray2uf_rewriter_cfg::mk_uf_for_array(expr * e) { m_manager.inc_ref(bv_f); } else { - TRACE("bvarray2uf_rw", tout << "for " << mk_ismt2_pp(e, m_manager) << " found " << mk_ismt2_pp(bv_f, m_manager) << std::endl; ); + TRACE(bvarray2uf_rw, tout << "for " << mk_ismt2_pp(e, m_manager) << " found " << mk_ismt2_pp(bv_f, m_manager) << std::endl; ); } return func_decl_ref(bv_f, m_manager); @@ -164,7 +164,7 @@ br_status bvarray2uf_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr func_decl_ref f_t(mk_uf_for_array(args[1]), m_manager); func_decl_ref f_f(mk_uf_for_array(args[2]), m_manager); - TRACE("bvarray2uf_rw", tout << "(ite " << c << ", " << f_t->get_name() + TRACE(bvarray2uf_rw, tout << "(ite " << c << ", " << f_t->get_name() << ", " << f_f->get_name() << ")" << std::endl;); sort * sorts[1] = { get_index_sort(args[1]->get_sort()) }; @@ -189,7 +189,7 @@ br_status bvarray2uf_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr result = m_array_util.mk_as_array(bv_f); - TRACE("bvarray2uf_rw", tout << "result: " << mk_ismt2_pp(result, m_manager) << ")" << std::endl;); + TRACE(bvarray2uf_rw, tout << "result: " << mk_ismt2_pp(result, m_manager) << ")" << std::endl;); res = BR_DONE; } @@ -197,7 +197,7 @@ br_status bvarray2uf_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr throw default_exception("not handled by bvarray2uf"); } else if (f->get_family_id() == null_family_id) { - TRACE("bvarray2uf_rw", tout << "UF APP: " << f->get_name() << std::endl; ); + TRACE(bvarray2uf_rw, tout << "UF APP: " << f->get_name() << std::endl; ); bool has_bv_arrays = false; func_decl_ref f_t(m_manager); @@ -225,13 +225,13 @@ br_status bvarray2uf_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr res = BR_FAILED; } else if (m_array_util.get_family_id() == f->get_family_id()) { - TRACE("bvarray2uf_rw", tout << "APP: " << f->get_name() << std::endl; ); + TRACE(bvarray2uf_rw, tout << "APP: " << f->get_name() << std::endl; ); if (m_array_util.is_select(f)) { SASSERT(num == 2); expr * t = args[0]; expr * i = args[1]; - TRACE("bvarray2uf_rw", tout << + TRACE(bvarray2uf_rw, tout << "select; array: " << mk_ismt2_pp(t, m()) << " index: " << mk_ismt2_pp(i, m()) << std::endl;); @@ -309,7 +309,7 @@ br_status bvarray2uf_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr expr * s = args[0]; expr * i = args[1]; expr * v = args[2]; - TRACE("bvarray2uf_rw", tout << + TRACE(bvarray2uf_rw, tout << "store; array: " << mk_ismt2_pp(s, m()) << " index: " << mk_ismt2_pp(i, m()) << " value: " << mk_ismt2_pp(v, m()) << std::endl;); @@ -340,7 +340,7 @@ br_status bvarray2uf_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr expr_ref ground_atom(m_manager); ground_atom = m_manager.mk_eq(m_manager.mk_app(f_t, i), v); extra_assertions.push_back(ground_atom); - TRACE("bvarray2uf_rw", tout << "ground atom: " << mk_ismt2_pp(ground_atom, m()) << std::endl; ); + TRACE(bvarray2uf_rw, tout << "ground atom: " << mk_ismt2_pp(ground_atom, m()) << std::endl; ); } } else { @@ -350,17 +350,17 @@ br_status bvarray2uf_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr } } - CTRACE("bvarray2uf_rw", res == BR_DONE, tout << "result: " << mk_ismt2_pp(result, m()) << std::endl; ); + CTRACE(bvarray2uf_rw, res == BR_DONE, tout << "result: " << mk_ismt2_pp(result, m()) << std::endl; ); return res; } bool bvarray2uf_rewriter_cfg::pre_visit(expr * t) { - TRACE("bvarray2uf_rw_q", tout << "pre_visit: " << mk_ismt2_pp(t, m()) << std::endl;); + TRACE(bvarray2uf_rw_q, tout << "pre_visit: " << mk_ismt2_pp(t, m()) << std::endl;); if (is_quantifier(t)) { quantifier * q = to_quantifier(t); - TRACE("bvarray2uf_rw_q", tout << "pre_visit quantifier [" << q->get_id() << "]: " << mk_ismt2_pp(q->get_expr(), m()) << std::endl;); + TRACE(bvarray2uf_rw_q, tout << "pre_visit quantifier [" << q->get_id() << "]: " << mk_ismt2_pp(q->get_expr(), m()) << std::endl;); sort_ref_vector new_bindings(m_manager); for (unsigned i = 0; i < q->get_num_decls(); i++) new_bindings.push_back(q->get_decl_sort(i)); diff --git a/src/tactic/bv/elim_small_bv_tactic.cpp b/src/tactic/bv/elim_small_bv_tactic.cpp index 43ff9090d..8bcdd7153 100644 --- a/src/tactic/bv/elim_small_bv_tactic.cpp +++ b/src/tactic/bv/elim_small_bv_tactic.cpp @@ -69,7 +69,7 @@ class elim_small_bv_tactic : public tactic { expr_ref replace_var(used_vars & uv, unsigned num_decls, unsigned max_var_idx_p1, unsigned idx, sort * s, expr * e, expr * replacement) { - TRACE("elim_small_bv", tout << "replace idx " << idx << " with " << mk_ismt2_pp(replacement, m) << + TRACE(elim_small_bv, tout << "replace idx " << idx << " with " << mk_ismt2_pp(replacement, m) << " in " << mk_ismt2_pp(e, m) << std::endl;); expr_ref res(m); ptr_vector substitution; @@ -88,7 +88,7 @@ class elim_small_bv_tactic : public tactic { // (VAR 0) should be in the last position of substitution. - TRACE("elim_small_bv", tout << "substitution: " << std::endl; + TRACE(elim_small_bv, tout << "substitution: " << std::endl; for (unsigned k = 0; k < substitution.size(); k++) { expr * se = substitution[k]; tout << k << " = "; @@ -103,13 +103,13 @@ class elim_small_bv_tactic : public tactic { proof_ref pr(m); m_simp(res, res, pr); - TRACE("elim_small_bv", tout << "replace done: " << mk_ismt2_pp(res, m) << std::endl;); + TRACE(elim_small_bv, tout << "replace done: " << mk_ismt2_pp(res, m) << std::endl;); return res; } br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) { - TRACE("elim_small_bv_app", expr_ref tmp(m.mk_app(f, num, args), m); tout << "reduce " << tmp << std::endl; ); + TRACE(elim_small_bv_app, expr_ref tmp(m.mk_app(f, num, args), m); tout << "reduce " << tmp << std::endl; ); return BR_FAILED; } @@ -123,7 +123,7 @@ class elim_small_bv_tactic : public tactic { if (is_lambda(q)) { return false; } - TRACE("elim_small_bv", tout << "reduce_quantifier " << mk_ismt2_pp(q, m) << std::endl; ); + TRACE(elim_small_bv, tout << "reduce_quantifier " << mk_ismt2_pp(q, m) << std::endl; ); unsigned long long num_steps = 0; unsigned curr_sz = m_bindings.size(); SASSERT(q->get_num_decls() <= curr_sz); @@ -141,7 +141,7 @@ class elim_small_bv_tactic : public tactic { expr_ref_vector new_bodies(m); if (is_small_bv(s) && !max_steps_exceeded(num_steps)) { unsigned bv_sz = m_util.get_bv_size(s); - TRACE("elim_small_bv", tout << "eliminating " << q->get_decl_name(i) << + TRACE(elim_small_bv, tout << "eliminating " << q->get_decl_name(i) << "; sort = " << mk_ismt2_pp(s, m) << "; body = " << mk_ismt2_pp(body, m) << std::endl;); @@ -169,7 +169,7 @@ class elim_small_bv_tactic : public tactic { return false; } - TRACE("elim_small_bv", tout << "new bodies: " << std::endl; + TRACE(elim_small_bv, tout << "new bodies: " << std::endl; for (unsigned k = 0; k < new_bodies.size(); k++) tout << mk_ismt2_pp(new_bodies[k].get(), m) << std::endl; ); @@ -187,7 +187,7 @@ class elim_small_bv_tactic : public tactic { unused_vars_eliminator el(m, m_params); result = el(new_q); - TRACE("elim_small_bv", tout << "elimination result: " << mk_ismt2_pp(result, m) << std::endl; ); + TRACE(elim_small_bv, tout << "elimination result: " << mk_ismt2_pp(result, m) << std::endl; ); result_pr = nullptr; // proofs NIY m_bindings.shrink(old_sz); @@ -195,10 +195,10 @@ class elim_small_bv_tactic : public tactic { } bool pre_visit(expr * t) { - TRACE("elim_small_bv_pre", tout << "pre_visit: " << mk_ismt2_pp(t, m) << std::endl;); + TRACE(elim_small_bv_pre, tout << "pre_visit: " << mk_ismt2_pp(t, m) << std::endl;); if (is_quantifier(t)) { quantifier * q = to_quantifier(t); - TRACE("elim_small_bv", tout << "pre_visit quantifier [" << q->get_id() << "]: " << mk_ismt2_pp(q->get_expr(), m) << std::endl;); + TRACE(elim_small_bv, tout << "pre_visit quantifier [" << q->get_id() << "]: " << mk_ismt2_pp(q->get_expr(), m) << std::endl;); sort_ref_vector new_bindings(m); for (unsigned i = 0; i < q->get_num_decls(); i++) new_bindings.push_back(q->get_decl_sort(i)); diff --git a/src/tactic/core/blast_term_ite_tactic.cpp b/src/tactic/core/blast_term_ite_tactic.cpp index 93c69af4a..45ea00045 100644 --- a/src/tactic/core/blast_term_ite_tactic.cpp +++ b/src/tactic/core/blast_term_ite_tactic.cpp @@ -74,7 +74,7 @@ class blast_term_ite_tactic : public tactic { for (unsigned i = 0; i < num_args; ++i) { expr* c, *t, *e; if (!m.is_bool(args[i]) && m.is_ite(args[i], c, t, e)) { - TRACE("blast_term_ite", result = m.mk_app(f, num_args, args); tout << result << "\n";); + TRACE(blast_term_ite, result = m.mk_app(f, num_args, args); tout << result << "\n";); expr_ref e1(m), e2(m); ptr_vector args1(num_args, args); args1[i] = t; diff --git a/src/tactic/core/cofactor_elim_term_ite.cpp b/src/tactic/core/cofactor_elim_term_ite.cpp index 2da133409..aa6f25dd9 100644 --- a/src/tactic/core/cofactor_elim_term_ite.cpp +++ b/src/tactic/core/cofactor_elim_term_ite.cpp @@ -107,7 +107,7 @@ struct cofactor_elim_term_ite::imp { frame & fr = m_frame_stack.back(); expr * t = fr.m_t; bool form_ctx = fr.m_form_ctx; - TRACE("cofactor", tout << "processing, form_ctx: " << form_ctx << "\n" << mk_bounded_pp(t, m) << "\n";); + TRACE(cofactor, tout << "processing, form_ctx: " << form_ctx << "\n" << mk_bounded_pp(t, m) << "\n";); m_owner.checkpoint(); @@ -140,7 +140,7 @@ struct cofactor_elim_term_ite::imp { for (expr* arg : *to_app(t)) { if (m_has_term_ite.is_marked(arg)) { m_has_term_ite.mark(t); - TRACE("cofactor", tout << "saving candidate: " << form_ctx << "\n" << mk_bounded_pp(t, m) << "\n";); + TRACE(cofactor, tout << "saving candidate: " << form_ctx << "\n" << mk_bounded_pp(t, m) << "\n";); save_candidate(t, form_ctx); break; } @@ -159,7 +159,7 @@ struct cofactor_elim_term_ite::imp { }; expr * get_first(expr * t) { - TRACE("cofactor", tout << mk_ismt2_pp(t, m) << "\n";); + TRACE(cofactor, tout << mk_ismt2_pp(t, m) << "\n";); typedef std::pair frame; expr_fast_mark1 visited; sbuffer stack; @@ -218,7 +218,7 @@ struct cofactor_elim_term_ite::imp { \brief Fuctor for selecting the term if-then-else condition with the most number of occurrences. */ expr * get_best(expr * t) { - TRACE("cofactor", tout << mk_ismt2_pp(t, m) << "\n";); + TRACE(cofactor, tout << mk_ismt2_pp(t, m) << "\n";); typedef std::pair frame; obj_map occs; expr_fast_mark1 visited; @@ -291,7 +291,7 @@ struct cofactor_elim_term_ite::imp { } } visited.reset(); - CTRACE("cofactor", best != 0, tout << "best num-occs: " << best_occs << "\n" << mk_ismt2_pp(best, m) << "\n";); + CTRACE(cofactor, best != 0, tout << "best num-occs: " << best_occs << "\n" << mk_ismt2_pp(best, m) << "\n";); return best; } @@ -352,12 +352,12 @@ struct cofactor_elim_term_ite::imp { if (m.is_unique_value(lhs)) { m_term = rhs; m_value = to_app(lhs); - TRACE("cofactor", tout << "term:\n" << mk_ismt2_pp(m_term, m) << "\nvalue: " << mk_ismt2_pp(m_value, m) << "\n";); + TRACE(cofactor, tout << "term:\n" << mk_ismt2_pp(m_term, m) << "\nvalue: " << mk_ismt2_pp(m_value, m) << "\n";); } else if (m.is_unique_value(rhs)) { m_term = lhs; m_value = to_app(rhs); - TRACE("cofactor", tout << "term:\n" << mk_ismt2_pp(m_term, m) << "\nvalue: " << mk_ismt2_pp(m_value, m) << "\n";); + TRACE(cofactor, tout << "term:\n" << mk_ismt2_pp(m_term, m) << "\nvalue: " << mk_ismt2_pp(m_value, m) << "\n";); } } // TODO: bounds @@ -438,7 +438,7 @@ struct cofactor_elim_term_ite::imp { if (m_cache.find(s, t)) return true; - TRACE("cofactor_ite", tout << "cofactor target:\n" << mk_ismt2_pp(s, m) << "\n";); + TRACE(cofactor_ite, tout << "cofactor target:\n" << mk_ismt2_pp(s, m) << "\n";); expr_ref curr(m); curr = s; while (true) { @@ -459,7 +459,7 @@ struct cofactor_elim_term_ite::imp { m_cofactor.set_cofactor_atom(neg_c); m_cofactor(curr, neg_cofactor); curr = m.mk_ite(c, pos_cofactor, neg_cofactor); - TRACE("cofactor", tout << "cofactor_ite step\n" << mk_ismt2_pp(curr, m) << "\n";); + TRACE(cofactor, tout << "cofactor_ite step\n" << mk_ismt2_pp(curr, m) << "\n";); } } return false; @@ -513,7 +513,7 @@ struct cofactor_elim_term_ite::imp { } void cofactor(expr * t, expr_ref & r) { - TRACE("cofactor", tout << "cofactor target:\n" << mk_ismt2_pp(t, m) << "\n";); + TRACE(cofactor, tout << "cofactor target:\n" << mk_ismt2_pp(t, m) << "\n";); expr_ref curr(m); curr = t; while (true) { @@ -543,7 +543,7 @@ struct cofactor_elim_term_ite::imp { else { curr = m.mk_ite(c, pos_cofactor, neg_cofactor); } - TRACE("cofactor", + TRACE(cofactor, tout << "cofactor_ite step\n"; tout << "cofactor: " << mk_ismt2_pp(c, m) << "\n"; tout << mk_ismt2_pp(curr, m) << "\n";); @@ -565,7 +565,7 @@ struct cofactor_elim_term_ite::imp { m_owner.checkpoint(); frame & fr = m_frames.back(); expr * t = fr.first; - TRACE("cofactor_bug", tout << "processing: " << t->get_id() << " :first " << fr.second << "\n";); + TRACE(cofactor_bug, tout << "processing: " << t->get_id() << " :first " << fr.second << "\n";); if (!is_app(t)) { m_cache.insert(t, t); m_frames.pop_back(); @@ -594,7 +594,7 @@ struct cofactor_elim_term_ite::imp { for (unsigned i = 0; i < num; i++) { expr * arg = to_app(t)->get_arg(i); expr * new_arg = nullptr; - TRACE("cofactor_bug", tout << "collecting child: " << arg->get_id() << "\n";); + TRACE(cofactor_bug, tout << "collecting child: " << arg->get_id() << "\n";); m_cache.find(arg, new_arg); SASSERT(new_arg != 0); if (new_arg != arg) @@ -622,7 +622,7 @@ struct cofactor_elim_term_ite::imp { if (has_term_ite) m_has_term_ite.insert(new_t); SASSERT(new_t.get() != 0); - TRACE("cofactor_bug", tout << "caching: " << t->get_id() << "\n";); + TRACE(cofactor_bug, tout << "caching: " << t->get_id() << "\n";); #if 0 counter ++; verbose_stream() << counter << "\n"; diff --git a/src/tactic/core/ctx_simplify_tactic.cpp b/src/tactic/core/ctx_simplify_tactic.cpp index ed9b277a8..f1f2f2162 100644 --- a/src/tactic/core/ctx_simplify_tactic.cpp +++ b/src/tactic/core/ctx_simplify_tactic.cpp @@ -82,7 +82,7 @@ void ctx_propagate_assertions::assert_eq_core(expr * t, app * val) { return; } - CTRACE("assert_eq_bug", m_assertions.contains(t), + CTRACE(assert_eq_bug, m_assertions.contains(t), tout << "t:\n" << mk_ismt2_pp(t, m) << "\nval:\n" << mk_ismt2_pp(val, m) << "\n"; expr * old_val = 0; m_assertions.find(t, old_val); @@ -180,7 +180,7 @@ struct ctx_simplify_tactic::imp { dealloc(m_simp); DEBUG_CODE({ for (unsigned i = 0; i < m_cache.size(); i++) { - CTRACE("ctx_simplify_tactic_bug", m_cache[i].m_from, + CTRACE(ctx_simplify_tactic_bug, m_cache[i].m_from, tout << "i: " << i << "\n" << mk_ismt2_pp(m_cache[i].m_from, m) << "\n"; tout << "m_result: " << m_cache[i].m_result << "\n"; if (m_cache[i].m_result) tout << "lvl: " << m_cache[i].m_result->m_lvl << "\n";); @@ -205,7 +205,7 @@ struct ctx_simplify_tactic::imp { } bool shared(expr * t) const { - TRACE("ctx_simplify_tactic_bug", tout << mk_pp(t, m) << "\n";); + TRACE(ctx_simplify_tactic_bug, tout << mk_pp(t, m) << "\n";); return t->get_ref_count() > 1 && m_occs.get_num_occs(t) > 1; } @@ -226,7 +226,7 @@ struct ctx_simplify_tactic::imp { void cache_core(expr * from, expr * to) { unsigned id = from->get_id(); - TRACE("ctx_simplify_tactic_cache", tout << "caching " << id << " @ " << scope_level() << "\n" << mk_ismt2_pp(from, m) << "\n--->\n" << mk_ismt2_pp(to, m) << "\n";); + TRACE(ctx_simplify_tactic_cache, tout << "caching " << id << " @ " << scope_level() << "\n" << mk_ismt2_pp(from, m) << "\n--->\n" << mk_ismt2_pp(to, m) << "\n";); m_cache.reserve(id+1); cache_cell & cell = m_cache[id]; void * mem = m_allocator.allocate(sizeof(cached_result)); @@ -271,7 +271,7 @@ struct ctx_simplify_tactic::imp { m.dec_ref(cell.m_result->m_to); cached_result * to_delete = cell.m_result; SASSERT(to_delete->m_lvl == lvl); - TRACE("ctx_simplify_tactic_cache", tout << "uncaching: " << to_delete->m_lvl << "\n" << + TRACE(ctx_simplify_tactic_cache, tout << "uncaching: " << to_delete->m_lvl << "\n" << mk_ismt2_pp(key, m) << "\n--->\n" << mk_ismt2_pp(to_delete->m_to, m) << "\nrestoring:\n"; if (to_delete->m_next) tout << mk_ismt2_pp(to_delete->m_next->m_to, m); else tout << ""; tout << "\n";); @@ -327,7 +327,7 @@ struct ctx_simplify_tactic::imp { return; } checkpoint(); - TRACE("ctx_simplify_tactic_detail", tout << "processing: " << mk_bounded_pp(t, m) << "\n";); + TRACE(ctx_simplify_tactic_detail, tout << "processing: " << mk_bounded_pp(t, m) << "\n";); if (is_cached(t, r) || m_simp->simplify(t, r)) { SASSERT(r.get() != 0); return; @@ -344,7 +344,7 @@ struct ctx_simplify_tactic::imp { simplify_app(to_app(t), r); m_depth--; SASSERT(r.get() != 0); - TRACE("ctx_simplify_tactic_detail", tout << "result:\n" << mk_bounded_pp(t, m) << "\n---->\n" << mk_bounded_pp(r, m) << "\n";); + TRACE(ctx_simplify_tactic_detail, tout << "result:\n" << mk_bounded_pp(t, m) << "\n---->\n" << mk_bounded_pp(r, m) << "\n";); } template @@ -462,7 +462,7 @@ struct ctx_simplify_tactic::imp { } else { expr * args[3] = { new_c.get(), new_t.get(), new_e.get() }; - TRACE("ctx_simplify_tactic_ite_bug", + TRACE(ctx_simplify_tactic_ite_bug, tout << "mk_ite\n" << mk_ismt2_pp(new_c.get(), m) << "\n" << mk_ismt2_pp(new_t.get(), m) << "\n" << mk_ismt2_pp(new_e.get(), m) << "\n";); m_mk_app(ite->get_decl(), 3, args, r); @@ -483,7 +483,7 @@ struct ctx_simplify_tactic::imp { expr * arg = t->get_arg(i); expr_ref new_arg(m); simplify(arg, new_arg); - CTRACE("ctx_simplify_tactic_bug", new_arg.get() == 0, tout << mk_ismt2_pp(arg, m) << "\n";); + CTRACE(ctx_simplify_tactic_bug, new_arg.get() == 0, tout << mk_ismt2_pp(arg, m) << "\n";); SASSERT(new_arg); if (new_arg != arg) modified = true; @@ -551,14 +551,14 @@ struct ctx_simplify_tactic::imp { } void process(expr * s, expr_ref & r) { - TRACE("ctx_simplify_tactic", tout << "simplifying:\n" << mk_ismt2_pp(s, m) << "\n";); + TRACE(ctx_simplify_tactic, tout << "simplifying:\n" << mk_ismt2_pp(s, m) << "\n";); SASSERT(scope_level() == 0); m_depth = 0; simplify(s, r); SASSERT(scope_level() == 0); SASSERT(m_depth == 0); SASSERT(r.get() != 0); - TRACE("ctx_simplify_tactic", tout << "result\n" << mk_ismt2_pp(r, m) << " :num-steps " << m_num_steps << "\n"; + TRACE(ctx_simplify_tactic, tout << "result\n" << mk_ismt2_pp(r, m) << " :num-steps " << m_num_steps << "\n"; tout << "old size: " << expr_size(s) << " new size: " << expr_size(r) << "\n";); if (m_bail_on_blowup && expr_size(s) < expr_size(r)) { r = s; diff --git a/src/tactic/core/elim_uncnstr_tactic.cpp b/src/tactic/core/elim_uncnstr_tactic.cpp index a372a1f8b..79cf8252f 100644 --- a/src/tactic/core/elim_uncnstr_tactic.cpp +++ b/src/tactic/core/elim_uncnstr_tactic.cpp @@ -99,8 +99,8 @@ class elim_uncnstr_tactic : public tactic { } v = m().mk_fresh_const(nullptr, t->get_sort()); - TRACE("elim_uncnstr_bug", tout << "eliminating:\n" << mk_ismt2_pp(t, m()) << "\n";); - TRACE("elim_uncnstr_bug_ll", tout << "eliminating:\n" << mk_bounded_pp(t, m()) << "\n";); + TRACE(elim_uncnstr_bug, tout << "eliminating:\n" << mk_ismt2_pp(t, m()) << "\n";); + TRACE(elim_uncnstr_bug_ll, tout << "eliminating:\n" << mk_bounded_pp(t, m()) << "\n";); m_fresh_vars.push_back(v); if (m_mc) m_mc->hide(v); m_cache_domain.push_back(t); @@ -908,7 +908,7 @@ class elim_uncnstr_tactic : public tactic { void run(goal_ref const & g, goal_ref_buffer & result) { bool produce_proofs = g->proofs_enabled(); - TRACE("goal", g->display(tout);); + TRACE(goal, g->display(tout);); statistics_report sreport([&](statistics& st) { collect_statistics(st); }); tactic_report report("elim-uncnstr", *g); m_vars.reset(); @@ -920,7 +920,7 @@ class elim_uncnstr_tactic : public tactic { return; } bool modified = true; - TRACE("elim_uncnstr", tout << "unconstrained variables...\n"; + TRACE(elim_uncnstr, tout << "unconstrained variables...\n"; for (expr * v : m_vars) tout << mk_ismt2_pp(v, m()) << " "; tout << "\n";); init_mc(g->models_enabled()); @@ -951,12 +951,12 @@ class elim_uncnstr_tactic : public tactic { m_num_elim_apps = m_rw->cfg().m_fresh_vars.size(); g->add(m_mc.get()); } - TRACE("elim_uncnstr", if (m_mc) m_mc->display(tout); else tout << "no mc\n";); + TRACE(elim_uncnstr, if (m_mc) m_mc->display(tout); else tout << "no mc\n";); m_mc = nullptr; m_rw = nullptr; result.push_back(g.get()); g->inc_depth(); - TRACE("goal", g->display(tout);); + TRACE(goal, g->display(tout);); return; } modified = false; diff --git a/src/tactic/core/injectivity_tactic.cpp b/src/tactic/core/injectivity_tactic.cpp index 640c41277..eb6470ace 100644 --- a/src/tactic/core/injectivity_tactic.cpp +++ b/src/tactic/core/injectivity_tactic.cpp @@ -144,7 +144,7 @@ class injectivity_tactic : public tactic { for (unsigned i = 0; i < goal->size(); ++i) { func_decl *f, *g; if (!is_axiom(goal->form(i), f, g)) continue; - TRACE("injectivity", tout << "Marking " << f->get_name() << " as injective" << std::endl;); + TRACE(injectivity, tout << "Marking " << f->get_name() << " as injective" << std::endl;); inj_map.insert(f, g); // TODO: Record that g is f's pseudoinverse } @@ -194,7 +194,7 @@ class injectivity_tactic : public tactic { return BR_FAILED; SASSERT(a->get_arg(0)->get_sort() == b->get_arg(0)->get_sort()); - TRACE("injectivity", tout << "Rewriting (= " << mk_ismt2_pp(args[0], m()) << + TRACE(injectivity, tout << "Rewriting (= " << mk_ismt2_pp(args[0], m()) << " " << mk_ismt2_pp(args[1], m()) << ")" << std::endl;); result = m().mk_eq(a->get_arg(0), b->get_arg(0)); result_pr = nullptr; @@ -223,7 +223,7 @@ public: injectivity_tactic(ast_manager & m, params_ref const & p): m_params(p), m_manager(m) { - TRACE("injectivity", tout << "constructed new tactic" << std::endl;); + TRACE(injectivity, tout << "constructed new tactic" << std::endl;); m_map = alloc(InjHelper, m); m_finder = alloc(finder, m, *m_map, p); m_eq = alloc(rewriter_eq, m, *m_map, p); diff --git a/src/tactic/core/nnf_tactic.cpp b/src/tactic/core/nnf_tactic.cpp index 3a5ce8d0a..89be52c07 100644 --- a/src/tactic/core/nnf_tactic.cpp +++ b/src/tactic/core/nnf_tactic.cpp @@ -40,7 +40,7 @@ public: nnf_tactic(params_ref const & p): m_params(p), m_nnf(nullptr) { - TRACE("nnf", tout << "nnf_tactic constructor: " << p << "\n";); + TRACE(nnf, tout << "nnf_tactic constructor: " << p << "\n";); } tactic * translate(ast_manager & m) override { @@ -54,7 +54,7 @@ public: void collect_param_descrs(param_descrs & r) override { nnf::get_param_descrs(r); } void operator()(goal_ref const & g, goal_ref_buffer & result) override { - TRACE("nnf", tout << "params: " << m_params << "\n"; g->display(tout);); + TRACE(nnf, tout << "params: " << m_params << "\n"; g->display(tout);); tactic_report report("nnf", *g); bool produce_proofs = g->proofs_enabled(); @@ -108,6 +108,6 @@ tactic * mk_snf_tactic(ast_manager & m, params_ref const & p) { tactic * mk_nnf_tactic(ast_manager & m, params_ref const & p) { params_ref new_p(p); new_p.set_sym("mode", symbol("full")); - TRACE("nnf", tout << "mk_nnf: " << new_p << "\n";); + TRACE(nnf, tout << "mk_nnf: " << new_p << "\n";); return using_params(mk_snf_tactic(m, p), new_p); } diff --git a/src/tactic/core/pb_preprocess_tactic.cpp b/src/tactic/core/pb_preprocess_tactic.cpp index 2d82a12a1..9a205bae2 100644 --- a/src/tactic/core/pb_preprocess_tactic.cpp +++ b/src/tactic/core/pb_preprocess_tactic.cpp @@ -139,7 +139,7 @@ public: while (it != m_vars.end()) { app * e = it->m_key; rec const& r = it->m_value; - TRACE("pb", tout << mk_pp(e, m) << " " << r.pos.size() << " " << r.neg.size() << "\n";); + TRACE(pb, tout << mk_pp(e, m) << " " << r.pos.size() << " " << r.neg.size() << "\n";); if (r.pos.empty()) { replace(r.neg, e, m.mk_false(), g); set_value(mc, e, false); @@ -280,11 +280,11 @@ private: fml1 = decompose_cut(a, start, end, cut_args, cut_coeffs); g->assert_expr(fml1, nullptr, g->dep(i)); start = end; - TRACE("pb", tout << fml1 << "\n";); + TRACE(pb, tout << fml1 << "\n";); } fml2 = pb.mk_ge(cut_args.size(), cut_coeffs.data(), cut_args.data(), pb.get_k(e)); g->update(i, fml2, nullptr, g->dep(i)); - TRACE("pb", tout << fml2 << "\n";); + TRACE(pb, tout << fml2 << "\n";); } } } @@ -465,7 +465,7 @@ private: expr_ref tmp1(m), tmp2(m); expr* fml1 = g->form(idx1); expr* fml2 = g->form(idx2); - TRACE("pb", tout << mk_pp(fml1, m) << " " << mk_pp(fml2, m) << "\n";); + TRACE(pb, tout << mk_pp(fml1, m) << " " << mk_pp(fml2, m) << "\n";); expr_ref_vector args1(m), args2(m); vector coeffs1, coeffs2; rational k1, k2; @@ -482,7 +482,7 @@ private: m.is_not(x, x); if (!is_app(x) || !m_vars.contains(to_app(x))) return; - TRACE("pb", tout << mk_pp(x, m) << "\n";); + TRACE(pb, tout << mk_pp(x, m) << "\n";); rec const& r = m_vars.find(to_app(x)); if (r.pos.size() != 1 || r.neg.size() != 1) return; @@ -527,7 +527,7 @@ private: verbose_stream() << "resolve: " << mk_pp(fml1, m) << "\n" << mk_pp(fml2, m) << "\n" << tmp1 << "\n"; verbose_stream() << "to\n" << mk_pp(fml2, m) << " -> " << tmp2 << "\n";); - TRACE("pb", + TRACE(pb, tout << "resolve: " << mk_pp(fml1, m) << "\n" << mk_pp(fml2, m) << "\n" << tmp1 << "\n"; tout << "to\n" << mk_pp(fml2, m) << " -> " << tmp2 << "\n";); @@ -595,7 +595,7 @@ private: if (!m.is_true(f)) { m_r(f, tmp, new_pr); if (tmp != f) { - TRACE("pb", tout << mk_pp(f, m) << " -> " << tmp + TRACE(pb, tout << mk_pp(f, m) << " -> " << tmp << " by " << mk_pp(e, m) << " |-> " << mk_pp(v, m) << "\n";); IF_VERBOSE(3, verbose_stream() << "replace " << mk_pp(f, m) << " -> " << tmp << "\n";); if (g->proofs_enabled()) { diff --git a/src/tactic/core/propagate_values_tactic.cpp b/src/tactic/core/propagate_values_tactic.cpp index 55615f3b6..aa7d94013 100644 --- a/src/tactic/core/propagate_values_tactic.cpp +++ b/src/tactic/core/propagate_values_tactic.cpp @@ -103,7 +103,7 @@ class propagate_values_tactic : public tactic { expr * lhs, * value; bool inverted = false; if (is_shared_eq(new_curr, lhs, value, inverted)) { - TRACE("shallow_context_simplifier_bug", tout << "found eq:\n" << mk_ismt2_pp(new_curr, m) << "\n" << mk_ismt2_pp(new_pr, m) << "\n";); + TRACE(shallow_context_simplifier_bug, tout << "found eq:\n" << mk_ismt2_pp(new_curr, m) << "\n" << mk_ismt2_pp(new_pr, m) << "\n";); if (inverted && new_pr) new_pr = m.mk_symmetry(new_pr); m_subst->insert(lhs, value, new_pr, new_d); } @@ -123,7 +123,7 @@ class propagate_values_tactic : public tactic { new_pr = m.mk_reflexivity(curr); } - TRACE("shallow_context_simplifier_bug", tout << mk_ismt2_pp(curr, m) << "\n---->\n" << new_curr << "\n" << new_pr << "\n";); + TRACE(shallow_context_simplifier_bug, tout << mk_ismt2_pp(curr, m) << "\n---->\n" << new_curr << "\n" << new_pr << "\n";); if (new_curr != curr) { m_modified = true; } @@ -157,7 +157,7 @@ class propagate_values_tactic : public tactic { m_occs(*m_goal); while (true) { - TRACE("propagate_values", tout << "while(true) loop\n"; m_goal->display_with_dependencies(tout);); + TRACE(propagate_values, tout << "while(true) loop\n"; m_goal->display_with_dependencies(tout);); if (forward) { for (; m_idx < size; m_idx++) { process_current(); @@ -193,15 +193,15 @@ class propagate_values_tactic : public tactic { if (round >= m_max_rounds) break; IF_VERBOSE(100, verbose_stream() << "starting new round, goal size: " << m_goal->num_exprs() << std::endl;); - TRACE("propagate_values", tout << "round finished\n"; m_goal->display(tout); tout << "\n";); + TRACE(propagate_values, tout << "round finished\n"; m_goal->display(tout); tout << "\n";); } end: m_goal->elim_redundancies(); m_goal->inc_depth(); result.push_back(m_goal); SASSERT(m_goal->is_well_formed()); - TRACE("propagate_values", tout << "end\n"; m_goal->display(tout);); - TRACE("propagate_values_core", m_goal->display_with_dependencies(tout);); + TRACE(propagate_values, tout << "end\n"; m_goal->display(tout);); + TRACE(propagate_values_core, m_goal->display_with_dependencies(tout);); m_goal = nullptr; } diff --git a/src/tactic/core/reduce_args_tactic.cpp b/src/tactic/core/reduce_args_tactic.cpp index dc3fe1acb..2c82e7bfb 100644 --- a/src/tactic/core/reduce_args_tactic.cpp +++ b/src/tactic/core/reduce_args_tactic.cpp @@ -151,7 +151,7 @@ class reduce_args_tactic : public tactic { quick_for_each_expr(proc, visited, g.form(i)); } - TRACE("reduce_args", tout << "non_candidates:\n"; + TRACE(reduce_args, tout << "non_candidates:\n"; for (func_decl* d : non_candidates) tout << d->get_name() << "\n"; ); @@ -230,7 +230,7 @@ class reduce_args_tactic : public tactic { for (func_decl* a : bad_decls) decl2args.erase(a); - TRACE("reduce_args", tout << "decl2args:" << std::endl; + TRACE(reduce_args, tout << "decl2args:" << std::endl; for (auto const& [k, v] : decl2args) { tout << k->get_name() << ": "; for (unsigned i = 0; i < v.size(); ++i) @@ -412,7 +412,7 @@ class reduce_args_tactic : public tactic { void operator()(goal & g) { if (g.inconsistent()) return; - TRACE("reduce_args", g.display(tout);); + TRACE(reduce_args, g.display(tout);); tactic_report report("reduce-args", g); obj_hashtable non_candidates; obj_map decl2args; @@ -439,7 +439,7 @@ class reduce_args_tactic : public tactic { if (g.models_enabled()) g.add(mk_mc(decl2args, ctx.m_decl2arg2funcs)); - TRACE("reduce_args", g.display(tout); if (g.mc()) g.mc()->display(tout);); + TRACE(reduce_args, g.display(tout); if (g.mc()) g.mc()->display(tout);); } public: diff --git a/src/tactic/core/simplify_tactic.cpp b/src/tactic/core/simplify_tactic.cpp index 27e859196..410e00db5 100644 --- a/src/tactic/core/simplify_tactic.cpp +++ b/src/tactic/core/simplify_tactic.cpp @@ -63,9 +63,9 @@ struct simplify_tactic::imp { } g.update(idx, new_curr, new_pr, g.dep(idx)); } - TRACE("simplifier", g.display(tout);); + TRACE(simplifier, g.display(tout);); g.elim_redundancies(); - TRACE("after_simplifier_detail", g.display_with_dependencies(tout);); + TRACE(after_simplifier_detail, g.display_with_dependencies(tout);); } unsigned get_num_steps() const { return m_num_steps; } diff --git a/src/tactic/core/special_relations_tactic.cpp b/src/tactic/core/special_relations_tactic.cpp index 0016e2fe0..ec63543f2 100644 --- a/src/tactic/core/special_relations_tactic.cpp +++ b/src/tactic/core/special_relations_tactic.cpp @@ -30,7 +30,7 @@ void special_relations_tactic::collect_feature(goal const& g, unsigned idx, unsigned index = 0; app_ref_vector patterns(m); bool is_match = m_pm.match_quantifier_index(to_quantifier(f), patterns, index); - TRACE("special_relations", tout << "check " << is_match << " " << mk_pp(f, m) << "\n"; + TRACE(special_relations, tout << "check " << is_match << " " << mk_pp(f, m) << "\n"; if (is_match) tout << patterns << " " << index << "\n";); if (is_match) { p = to_app(patterns.get(0)->get_arg(0))->get_decl(); @@ -113,7 +113,7 @@ void special_relations_tactic::initialize() { q = m.mk_forall(2, As, xyz, fml, 0, symbol::null, symbol::null, 1, pats); register_pattern(m_pm.initialize(q), sr_total); - TRACE("special_relations", m_pm.display(tout);); + TRACE(special_relations, m_pm.display(tout);); } void special_relations_tactic::register_pattern(unsigned index, sr_property p) { @@ -154,7 +154,7 @@ void special_relations_tactic::operator()(goal_ref const & g, goal_ref_buffer & to_delete.append(kv.m_value.m_goal_indices); break; default: - TRACE("special_relations", tout << "unprocessed feature " << feature << "\n";); + TRACE(special_relations, tout << "unprocessed feature " << feature << "\n";); break; } } diff --git a/src/tactic/core/split_clause_tactic.cpp b/src/tactic/core/split_clause_tactic.cpp index c29a2f3f2..bd9e2d183 100644 --- a/src/tactic/core/split_clause_tactic.cpp +++ b/src/tactic/core/split_clause_tactic.cpp @@ -100,7 +100,7 @@ public: void operator()(goal_ref const & in, goal_ref_buffer & result) override { tactic_report report("split-clause", *in); - TRACE("before_split_clause", in->display(tout);); + TRACE(before_split_clause, in->display(tout);); ast_manager & m = in->m(); unsigned cls_pos = select_clause(m, in); if (cls_pos == UINT_MAX) { diff --git a/src/tactic/core/symmetry_reduce_tactic.cpp b/src/tactic/core/symmetry_reduce_tactic.cpp index c5cba0b9a..ba0bb84c1 100644 --- a/src/tactic/core/symmetry_reduce_tactic.cpp +++ b/src/tactic/core/symmetry_reduce_tactic.cpp @@ -148,7 +148,7 @@ public: g.assert_expr(mem); num_sym_break_preds++; - TRACE("symmetry_reduce", tout << "member predicate: " << mem << "\n";); + TRACE(symmetry_reduce, tout << "member predicate: " << mem << "\n";); fml = m.mk_and(fml.get(), mem); normalize(fml); @@ -191,7 +191,7 @@ private: if (!is_const) continue; P.push_back(v); - TRACE("symmetry_reduce", for (app * a : v) tout << mk_pp(a, m) << " "; tout << "\n";); + TRACE(symmetry_reduce, for (app * a : v) tout << mk_pp(a, m) << " "; tout << "\n";); } } @@ -402,7 +402,7 @@ private: SASSERT(p.size() >= 2); bool result = check_swap(fml, p[0], p[1]) && check_cycle(fml, p); - TRACE("symmetry_reduce", + TRACE(symmetry_reduce, if (result) { tout << "Symmetric: "; } @@ -520,7 +520,7 @@ private: unsigned weight = 0, weight1 = 0; VERIFY(occs.find(t, weight)); unsigned cts_delta = compute_cts_delta(t, cts, consts); - TRACE("symmetry_reduce", tout << mk_pp(t, m) << " " << weight << " " << cts_delta << "\n";); + TRACE(symmetry_reduce, tout << mk_pp(t, m) << " " << weight << " " << cts_delta << "\n";); for (unsigned i = 1; i < T.size(); ++i) { app* t1 = T[i]; VERIFY(occs.find(t1, weight1)); @@ -528,7 +528,7 @@ private: continue; } unsigned cts_delta1 = compute_cts_delta(t1, cts, consts); - TRACE("symmetry_reduce", tout << mk_pp(t1, m) << " " << weight1 << " " << cts_delta1 << "\n";); + TRACE(symmetry_reduce, tout << mk_pp(t1, m) << " " << weight1 << " " << cts_delta1 << "\n";); if ((t->get_num_args() == t1->get_num_args() && (weight1 > weight || cts_delta1 < cts_delta)) || t->get_num_args() > t1->get_num_args()) { cts_delta = cts_delta1; @@ -556,7 +556,7 @@ private: void compute_used_in(app* t, term_set& cts, term_set const& consts) { member_of mem(consts, cts); for_each_expr(mem, t); - TRACE("symmetry_reduce", + TRACE(symmetry_reduce, tout << "Term: " << mk_pp(t, m) << "\n"; tout << "Support set: "; for (unsigned i = 0; i < consts.size(); ++i) { diff --git a/src/tactic/core/tseitin_cnf_tactic.cpp b/src/tactic/core/tseitin_cnf_tactic.cpp index 647bd18c5..5f8866ed3 100644 --- a/src/tactic/core/tseitin_cnf_tactic.cpp +++ b/src/tactic/core/tseitin_cnf_tactic.cpp @@ -159,7 +159,7 @@ class tseitin_cnf_tactic : public tactic { mk_lit(n, sign, r); return; default: - TRACE("tseitin_cnf_bug", tout << f->get_name() << "\n";); + TRACE(tseitin_cnf_bug, tout << f->get_name() << "\n";); UNREACHABLE(); return; } @@ -839,7 +839,7 @@ class tseitin_cnf_tactic : public tactic { m_produce_models = g->models_enabled(); m_produce_unsat_cores = g->unsat_core_enabled(); - TRACE("tseitin_cnf", g->display(tout);); + TRACE(tseitin_cnf, g->display(tout);); m_occs(*g); reset_cache(); diff --git a/src/tactic/fd_solver/bounded_int2bv_solver.cpp b/src/tactic/fd_solver/bounded_int2bv_solver.cpp index 67e726ddf..8ef39d0af 100644 --- a/src/tactic/fd_solver/bounded_int2bv_solver.cpp +++ b/src/tactic/fd_solver/bounded_int2bv_solver.cpp @@ -194,7 +194,7 @@ public: if (!offset.is_zero()) { value = m_arith.mk_add(value, m_arith.mk_numeral(offset, true)); } - TRACE("int2bv", tout << mk_pp(kv.m_key, m) << " " << value << "\n";); + TRACE(int2bv, tout << mk_pp(kv.m_key, m) << " " << value << "\n";); mc->add(kv.m_key, value); } return mc; @@ -297,11 +297,11 @@ private: if (!offset.is_zero()) { t = m_arith.mk_add(t, m_arith.mk_numeral(offset, true)); } - TRACE("pb", tout << lo << " <= " << hi << " offset: " << offset << "\n"; tout << mk_pp(e, m) << " |-> " << t << "\n";); + TRACE(pb, tout << lo << " <= " << hi << " offset: " << offset << "\n"; tout << mk_pp(e, m) << " |-> " << t << "\n";); sub.insert(e, t); } else { - TRACE("pb", + TRACE(pb, tout << "unprocessed entry: " << mk_pp(e, m) << "\n"; if (bm.has_lower(e, lo, s1)) { tout << "lower: " << lo << " " << s1 << "\n"; @@ -333,7 +333,7 @@ private: bound_manager& bm = *m_bounds.back(); for (expr* a : m_assertions) bm(a, nullptr, nullptr); - TRACE("int2bv", bm.display(tout);); + TRACE(int2bv, bm.display(tout);); expr_safe_replace sub(m); accumulate_sub(sub); proof_ref proof(m); @@ -350,7 +350,7 @@ private: return; } m_solver->assert_expr(fml2); - TRACE("int2bv", tout << fml2 << "\n";); + TRACE(int2bv, tout << fml2 << "\n";); } } m_assertions.reset(); diff --git a/src/tactic/fd_solver/smtfd_solver.cpp b/src/tactic/fd_solver/smtfd_solver.cpp index 46fb4054e..fda2f8688 100644 --- a/src/tactic/fd_solver/smtfd_solver.cpp +++ b/src/tactic/fd_solver/smtfd_solver.cpp @@ -404,7 +404,7 @@ namespace smtfd { smtfd_abs& get_abs() { return m_abs; } - void add(expr* f, char const* msg) { m_lemmas.push_back(f); TRACE("smtfd", tout << msg << " " << mk_bounded_pp(f, m, 2) << "\n";); } + void add(expr* f, char const* msg) { m_lemmas.push_back(f); TRACE(smtfd, tout << msg << " " << mk_bounded_pp(f, m, 2) << "\n";); } ast_manager& get_manager() { return m; } @@ -546,13 +546,13 @@ namespace smtfd { f_app f1 = mk_app(f, t, s); f_app const& f2 = insert(f1); if (f2.m_val_offset == f1.m_val_offset) { - TRACE("smtfd_verbose", tout << "fresh: " << mk_pp(f, m, 2) << "\n";); + TRACE(smtfd_verbose, tout << "fresh: " << mk_pp(f, m, 2) << "\n";); return; } bool eq = value_of(f1) == value_of(f2); m_values.shrink(f1.m_val_offset); if (eq) { - TRACE("smtfd_verbose", tout << "eq: " << " " << mk_bounded_pp(t, m, 2) << " " << mk_bounded_pp(f2.m_t, m, 2) << "\n";); + TRACE(smtfd_verbose, tout << "eq: " << " " << mk_bounded_pp(t, m, 2) << " " << mk_bounded_pp(f2.m_t, m, 2) << "\n";); return; } m_args.reset(); @@ -563,7 +563,7 @@ namespace smtfd { expr* e2 = f2.m_t->get_arg(i); if (e1 != e2) m_args.push_back(m.mk_eq(e1, e2)); } - TRACE("smtfd_verbose", tout << "diff: " << mk_bounded_pp(f1.m_t, m, 2) << " " << mk_bounded_pp(f2.m_t, m, 2) << "\n";); + TRACE(smtfd_verbose, tout << "diff: " << mk_bounded_pp(f1.m_t, m, 2) << " " << mk_bounded_pp(f2.m_t, m, 2) << "\n";); m_context.add(m.mk_implies(mk_and(m_args), m.mk_eq(f1.m_t, f2.m_t)), __FUNCTION__); } @@ -797,7 +797,7 @@ namespace smtfd { void check_term(expr* t, unsigned round) override { sort* s = t->get_sort(); if (round == 0 && is_uf(t)) { - TRACE("smtfd_verbose", tout << "check-term: " << mk_bounded_pp(t, m, 2) << "\n";); + TRACE(smtfd_verbose, tout << "check-term: " << mk_bounded_pp(t, m, 2) << "\n";); enforce_congruence(to_app(t)->get_decl(), to_app(t), s); } else if (round == 1 && sort_covered(s) && m.is_value(t)) { @@ -860,7 +860,7 @@ namespace smtfd { args.push_back(model_value(arg)); } expr_ref val = model_value(f.m_t); - TRACE("smtfd_verbose", tout << mk_bounded_pp(f.m_t, m, 2) << " := " << val << "\n";); + TRACE(smtfd_verbose, tout << mk_bounded_pp(f.m_t, m, 2) << " := " << val << "\n";); fi->insert_new_entry(args.data(), val); } mdl->register_decl(fn, fi); @@ -930,7 +930,7 @@ namespace smtfd { void check_select(app* t) { expr* a = t->get_arg(0); expr_ref vA = eval_abs(a); - TRACE("smtfd", tout << mk_bounded_pp(t, m, 2) << "\n";); + TRACE(smtfd, tout << mk_bounded_pp(t, m, 2) << "\n";); enforce_congruence(vA, t, a->get_sort()); } @@ -948,7 +948,7 @@ namespace smtfd { expr_ref val2 = eval_abs(stored_value); // A[i] = v if (val1 != val2) { - TRACE("smtfd", tout << "select/store: " << mk_bounded_pp(t, m, 2) << "\n";); + TRACE(smtfd, tout << "select/store: " << mk_bounded_pp(t, m, 2) << "\n";); m_context.add(m.mk_eq(sel, stored_value), __FUNCTION__); m_pinned.push_back(sel); insert_select(sel); @@ -993,7 +993,7 @@ namespace smtfd { app_ref sel(m_autil.mk_select(m_args), m); val2 = eval_abs(sel); if (val1 != val2 && !m.is_true(eqV)) { - TRACE("smtfd", tout << "select/store: " << mk_bounded_pp(t, m, 2) << "\n";); + TRACE(smtfd, tout << "select/store: " << mk_bounded_pp(t, m, 2) << "\n";); m_context.add(m.mk_or(m.mk_eq(sel, t), mk_and(eqs)), __FUNCTION__); m_pinned.push_back(sel); insert_select(sel); @@ -1063,7 +1063,7 @@ namespace smtfd { m_args.push_back(arg); } SASSERT(t->get_sort() == a->get_sort()); - TRACE("smtfd", tout << mk_bounded_pp(t, m, 2) << " " << mk_bounded_pp(f.m_t, m, 2) << "\n";); + TRACE(smtfd, tout << mk_bounded_pp(t, m, 2) << " " << mk_bounded_pp(f.m_t, m, 2) << "\n";); expr_ref eq = mk_eq_idxs(t, f.m_t); m_args[0] = t; expr_ref sel1(m_autil.mk_select(m_args), m); @@ -1159,7 +1159,7 @@ namespace smtfd { expr_ref b1(m_autil.mk_select(args), m); expr_ref ext(m.mk_iff(m.mk_eq(a1, b1), m.mk_eq(a, b)), m); if (!m.is_true(eval_abs(ext))) { - TRACE("smtfd", tout << mk_bounded_pp(a, m, 2) << " " << mk_bounded_pp(b, m, 2) << "\n";); + TRACE(smtfd, tout << mk_bounded_pp(a, m, 2) << " " << mk_bounded_pp(b, m, 2) << "\n";); m_context.add(ext, __FUNCTION__); } } @@ -1414,7 +1414,7 @@ namespace smtfd { if (is_exists(q) && m.is_false(tmp)) { return l_false; } - TRACE("smtfd", + TRACE(smtfd, tout << mk_pp(q, m) << "\n"; /*tout << *m_model << "\n"; */ tout << "eval: " << tmp << "\n";); @@ -1441,7 +1441,7 @@ namespace smtfd { m_solver->assert_expr(body); lbool r = m_solver->check_sat(0, nullptr); model_ref mdl; - TRACE("smtfd", tout << "check: " << r << "\n";); + TRACE(smtfd, tout << "check: " << r << "\n";); if (r == l_true) { expr_ref qq(q->get_expr(), m); @@ -1449,7 +1449,7 @@ namespace smtfd { init_term(t); } m_solver->get_model(mdl); - TRACE("smtfd", tout << *mdl << "\n";); + TRACE(smtfd, tout << *mdl << "\n";); for (unsigned i = 0; i < sz; ++i) { app* v = to_app(vars.get(i)); @@ -1473,7 +1473,7 @@ namespace smtfd { if (r == l_true) { body = subst(q->get_expr(), vals.size(), vals.data()); m_context.rewrite(body); - TRACE("smtfd", tout << "vals: " << vals << "\n" << body << "\n";); + TRACE(smtfd, tout << "vals: " << vals << "\n" << body << "\n";); if (is_forall(q)) { body = m.mk_implies(q, body); } @@ -1632,7 +1632,7 @@ namespace smtfd { m_assertions.pop_back(); expr* toggle = add_toggle(m.mk_fresh_const("toggle", m.mk_bool_sort())); m_assertions_qhead = m_assertions.size(); - TRACE("smtfd", tout << "flush: " << m_assertions_qhead << " " << mk_bounded_pp(fml, m, 3) << "\n";); + TRACE(smtfd, tout << "flush: " << m_assertions_qhead << " " << mk_bounded_pp(fml, m, 3) << "\n";); fml = abs(fml); m_fd_sat_solver->assert_expr(fml); fml = m.mk_not(m.mk_and(toggle, fml)); @@ -1644,12 +1644,12 @@ namespace smtfd { lbool check_abs(unsigned num_assumptions, expr * const * assumptions) { expr_ref_vector asms(m); init_assumptions(num_assumptions, assumptions, asms); - TRACE("smtfd", + TRACE(smtfd, for (unsigned i = 0; i < num_assumptions; ++i) { tout << mk_bounded_pp(assumptions[i], m, 3) << "\n"; } display(tout << asms << "\n");); - TRACE("smtfd_verbose", m_fd_sat_solver->display(tout);); + TRACE(smtfd_verbose, m_fd_sat_solver->display(tout);); lbool r = m_fd_sat_solver->check_sat(asms); update_reason_unknown(r, m_fd_sat_solver); @@ -1663,12 +1663,12 @@ namespace smtfd { m_fd_sat_solver->get_model(m_model); m_model->set_model_completion(true); init_model_assumptions(num_assumptions, assumptions, asms); - TRACE("smtfd", display(tout << asms << "\n" << *m_model << "\n");); + TRACE(smtfd, display(tout << asms << "\n" << *m_model << "\n");); lbool r = m_fd_core_solver->check_sat(asms); update_reason_unknown(r, m_fd_core_solver); if (r == l_false) { m_fd_core_solver->get_unsat_core(core); - TRACE("smtfd", display(tout << core << "\n");); + TRACE(smtfd, display(tout << core << "\n");); SASSERT(asms.contains(m_toggles.back())); SASSERT(core.contains(m_toggles.back())); core.erase(m_toggles.back()); @@ -1684,7 +1684,7 @@ namespace smtfd { for (unsigned round = 0; !m_context.at_max() && m_context.add_theory_axioms(terms, round); ++round) {} - TRACE("smtfd", m_context.display(tout);); + TRACE(smtfd, m_context.display(tout);); for (expr* f : m_context) { assert_fd(f); } @@ -1713,7 +1713,7 @@ namespace smtfd { } m_context.populate_model(m_model, terms); - TRACE("smtfd", + TRACE(smtfd, tout << "axioms: " << m_axioms << "\n"; for (expr* a : subterms::ground(terms)) { expr_ref val0 = (*m_model)(a); @@ -1885,7 +1885,7 @@ namespace smtfd { } void flush_atom_defs() { - CTRACE("smtfd", !m_abs.atom_defs().empty(), for (expr* f : m_abs.atom_defs()) tout << mk_bounded_pp(f, m, 4) << "\n";); + CTRACE(smtfd, !m_abs.atom_defs().empty(), for (expr* f : m_abs.atom_defs()) tout << mk_bounded_pp(f, m, 4) << "\n";); for (expr* f : m_abs.atom_defs()) { m_fd_sat_solver->assert_expr(f); m_fd_core_solver->assert_expr(f); @@ -1896,8 +1896,8 @@ namespace smtfd { void assert_fd(expr* fml) { expr_ref _fml(fml, m); - TRACE("smtfd", tout << mk_bounded_pp(fml, m, 3) << "\n";); - CTRACE("smtfd", m_axioms.contains(fml), + TRACE(smtfd, tout << mk_bounded_pp(fml, m, 3) << "\n";); + CTRACE(smtfd, m_axioms.contains(fml), tout << "formula:\n" << _fml << "\n"; tout << "axioms:\n" << m_axioms << "\n"; tout << "assertions:\n" << m_assertions << "\n";); @@ -1906,7 +1906,7 @@ namespace smtfd { SASSERT(!m_axioms.contains(fml)); m_axioms.push_back(fml); _fml = abs(fml); - TRACE("smtfd", tout << mk_bounded_pp(_fml, m, 3) << "\n";); + TRACE(smtfd, tout << mk_bounded_pp(_fml, m, 3) << "\n";); m_fd_sat_solver->assert_expr(_fml); m_fd_core_solver->assert_expr(_fml); flush_atom_defs(); @@ -1914,7 +1914,7 @@ namespace smtfd { void block_core(expr_ref_vector const& core) { expr_ref fml(m.mk_not(mk_and(core)), m); - TRACE("smtfd", tout << "block:\n" << mk_bounded_pp(fml, m, 3) << "\n" << mk_bounded_pp(abs(fml), m, 3) << "\n";); + TRACE(smtfd, tout << "block:\n" << mk_bounded_pp(fml, m, 3) << "\n" << mk_bounded_pp(abs(fml), m, 3) << "\n";); assert_fd(fml); } @@ -1982,7 +1982,7 @@ namespace smtfd { } IF_VERBOSE(1, indent(); verbose_stream() << "(smtfd-round :round " << round << " :lemmas " << m_context.size() << ")\n"); round = 0; - TRACE("smtfd_verbose", + TRACE(smtfd_verbose, for (expr* f : m_context) tout << "refine " << mk_bounded_pp(f, m, 3) << "\n"; m_context.display(tout);); for (expr* f : m_context) { diff --git a/src/tactic/fpa/fpa2bv_model_converter.cpp b/src/tactic/fpa/fpa2bv_model_converter.cpp index 67c427492..9852a427a 100644 --- a/src/tactic/fpa/fpa2bv_model_converter.cpp +++ b/src/tactic/fpa/fpa2bv_model_converter.cpp @@ -33,7 +33,7 @@ model_converter * fpa2bv_model_converter::translate(ast_translation & translator } void fpa2bv_model_converter::convert(model_core * mc, model * float_mdl) { - TRACE("fpa2bv_mc", tout << "BV Model: " << std::endl; + TRACE(fpa2bv_mc, tout << "BV Model: " << std::endl; for (unsigned i = 0; i < mc->get_num_constants(); i++) tout << mc->get_constant(i)->get_name() << " --> " << mk_ismt2_pp(mc->get_const_interp(mc->get_constant(i)), m) << std::endl; @@ -69,7 +69,7 @@ void fpa2bv_model_converter::convert(model_core * mc, model * float_mdl) { for (unsigned i = 0; i < sz; i++) { func_decl * f = mc->get_function(i); if (!seen.contains(f)) { - TRACE("fpa2bv_mc", tout << "Keeping: " << mk_ismt2_pp(f, m) << std::endl;); + TRACE(fpa2bv_mc, tout << "Keeping: " << mk_ismt2_pp(f, m) << std::endl;); func_interp * val = mc->get_func_interp(f)->copy(); float_mdl->register_decl(f, val); } diff --git a/src/tactic/fpa/fpa2bv_tactic.cpp b/src/tactic/fpa/fpa2bv_tactic.cpp index bc9825171..07bc41635 100644 --- a/src/tactic/fpa/fpa2bv_tactic.cpp +++ b/src/tactic/fpa/fpa2bv_tactic.cpp @@ -46,7 +46,7 @@ class fpa2bv_tactic : public tactic { tactic_report report("fpa2bv", *g); m_rw.reset(); - TRACE("fpa2bv", g->display(tout << "BEFORE: " << std::endl);); + TRACE(fpa2bv, g->display(tout << "BEFORE: " << std::endl);); if (g->inconsistent()) { result.push_back(g.get()); @@ -98,7 +98,7 @@ class fpa2bv_tactic : public tactic { result.back()->assert_expr(e, pr); } - TRACE("fpa2bv", g->display(tout << "AFTER:\n"); + TRACE(fpa2bv, g->display(tout << "AFTER:\n"); if (g->mc()) g->mc()->display(tout); tout << std::endl; ); } }; diff --git a/src/tactic/goal.cpp b/src/tactic/goal.cpp index 7c0bb9b59..f8af6a36e 100644 --- a/src/tactic/goal.cpp +++ b/src/tactic/goal.cpp @@ -254,7 +254,7 @@ void goal::assert_expr(expr * f, proof * pr, expr_dependency * d) { } SASSERT(!proofs_enabled() || pr); if (pr) { - CTRACE("goal", f != m().get_fact(pr), tout << mk_pp(f, m()) << "\n" << mk_pp(pr, m()) << "\n";); + CTRACE(goal, f != m().get_fact(pr), tout << mk_pp(f, m()) << "\n" << mk_pp(pr, m()) << "\n";); SASSERT(f == m().get_fact(pr)); slow_process(f, pr, d); } @@ -599,7 +599,7 @@ bool goal::is_well_formed() const { return false; #if 0 if (pr(i) && m().get_fact(pr(i)) != form(i)) { - TRACE("tactic", tout << mk_ismt2_pp(pr(i), m()) << "\n" << mk_ismt2_pp(form(i), m()) << "\n";); + TRACE(tactic, tout << mk_ismt2_pp(pr(i), m()) << "\n" << mk_ismt2_pp(form(i), m()) << "\n";); SASSERT(m().get_fact(pr(i)) == form(i)); return false; } diff --git a/src/tactic/portfolio/solver_subsumption_tactic.cpp b/src/tactic/portfolio/solver_subsumption_tactic.cpp index 96458c711..e28588f10 100644 --- a/src/tactic/portfolio/solver_subsumption_tactic.cpp +++ b/src/tactic/portfolio/solver_subsumption_tactic.cpp @@ -145,7 +145,7 @@ public: } void operator()(goal_ref const& g, goal_ref_buffer& result) override { - TRACE("tactic", tout << "params: " << m_params << "\n"; g->display(tout);); + TRACE(tactic, tout << "params: " << m_params << "\n"; g->display(tout);); tactic_report report("subsumption", *g); vector> fmls; diff --git a/src/tactic/sls/sls_tactic.cpp b/src/tactic/sls/sls_tactic.cpp index 2d9f18808..4467d6d85 100644 --- a/src/tactic/sls/sls_tactic.cpp +++ b/src/tactic/sls/sls_tactic.cpp @@ -93,7 +93,7 @@ public: if (g->models_enabled()) { model_ref mdl = m_sls->get_model(); mc = model2model_converter(mdl.get()); - TRACE("sls_model", mc->display(tout);); + TRACE(sls_model, mc->display(tout);); } g->reset(); } @@ -105,7 +105,7 @@ public: goal_ref_buffer& result) override { result.reset(); - TRACE("sls", g->display(tout);); + TRACE(sls, g->display(tout);); tactic_report report("sls", *g); model_converter_ref mc; @@ -186,7 +186,7 @@ public: if (g->models_enabled()) { model_ref mdl = m_engine->get_model(); mc = model2model_converter(mdl.get()); - TRACE("sls_model", mc->display(tout);); + TRACE(sls_model, mc->display(tout);); } g->reset(); } @@ -199,7 +199,7 @@ public: goal_ref_buffer & result) override { result.reset(); - TRACE("sls", g->display(tout);); + TRACE(sls, g->display(tout);); tactic_report report("sls", *g); model_converter_ref mc; diff --git a/src/tactic/smtlogics/qfufbv_tactic.cpp b/src/tactic/smtlogics/qfufbv_tactic.cpp index 6ba3e8cc9..160e56295 100644 --- a/src/tactic/smtlogics/qfufbv_tactic.cpp +++ b/src/tactic/smtlogics/qfufbv_tactic.cpp @@ -59,7 +59,7 @@ public: fail_if_unsat_core_generation("qfufbv_ackr", g); fail_if_proof_generation("qfufbv_ackr", g); - TRACE("goal", g->display(tout);); + TRACE(goal, g->display(tout);); // running implementation ptr_vector flas; const unsigned sz = g->size(); diff --git a/src/tactic/smtlogics/quant_tactics.cpp b/src/tactic/smtlogics/quant_tactics.cpp index 38cb1690b..77073484b 100644 --- a/src/tactic/smtlogics/quant_tactics.cpp +++ b/src/tactic/smtlogics/quant_tactics.cpp @@ -78,7 +78,7 @@ tactic * mk_uflra_tactic(ast_manager & m, params_ref const & p) { tactic * mk_auflia_tactic(ast_manager & m, params_ref const & p) { params_ref qi_p; qi_p.set_str("qi.cost", "0"); - TRACE("qi_cost", qi_p.display(tout); tout << "\n" << qi_p.get_str("qi.cost", "") << "\n";); + TRACE(qi_cost, qi_p.display(tout); tout << "\n" << qi_p.get_str("qi.cost", "") << "\n";); tactic * st = and_then(mk_no_solve_eq_preprocessor(m), or_else(and_then(fail_if(mk_gt(mk_num_exprs_probe(), mk_const_probe(static_cast(128)))), using_params(mk_smt_tactic(m), qi_p), diff --git a/src/tactic/tactic.cpp b/src/tactic/tactic.cpp index f31757127..be19325ca 100644 --- a/src/tactic/tactic.cpp +++ b/src/tactic/tactic.cpp @@ -34,14 +34,14 @@ struct tactic_report::imp { m_goal(g), m_start_memory(static_cast(memory::get_allocation_size())/static_cast(1024*1024)) { m_watch.start(); - TRACE("tactic", g.display_with_proofs(tout << id << "\n");); + TRACE(tactic, g.display_with_proofs(tout << id << "\n");); SASSERT(g.is_well_formed()); } ~imp() { m_watch.stop(); double end_memory = static_cast(memory::get_allocation_size())/static_cast(1024*1024); - TRACE("tactic", m_goal.display(tout << m_id << "\n"); + TRACE(tactic, m_goal.display(tout << m_id << "\n"); if (m_goal.mc()) m_goal.mc()->display(tout); ); IF_VERBOSE(0, @@ -227,13 +227,13 @@ lbool check_sat(tactic & t, goal_ref & g, model_ref & md, labels_vec & labels, p if (r.size() > 0) pr = r[0]->pr(0); return l_undef; } - TRACE("tactic", + TRACE(tactic, tout << "r.size(): " << r.size() << "\n"; for (unsigned i = 0; i < r.size(); i++) r[i]->display_with_dependencies(tout);); if (r.size() > 0) { pr = r[0]->pr(0); - CTRACE("tactic", pr, tout << pr << "\n";); + CTRACE(tactic, pr, tout << pr << "\n";); } if (is_decided_sat(r)) { diff --git a/src/tactic/tactical.cpp b/src/tactic/tactical.cpp index adb958888..764107520 100644 --- a/src/tactic/tactical.cpp +++ b/src/tactic/tactical.cpp @@ -288,7 +288,7 @@ public: } void updt_params(params_ref const & p) override { - TRACE("nary_tactical_updt_params", tout << "updt_params: " << p << "\n";); + TRACE(nary_tactical_updt_params, tout << "updt_params: " << p << "\n";); for (tactic* t : m_ts) t->updt_params(p); } @@ -1076,7 +1076,7 @@ public: char const* name() const override { return "using_params"; } void updt_params(params_ref const & p) override { - TRACE("using_params", + TRACE(using_params, tout << "before p: " << p << "\n"; tout << "m_params: " << m_params << "\n";); @@ -1084,7 +1084,7 @@ public: new_p.append(m_params); unary_tactical::updt_params(new_p); - TRACE("using_params", + TRACE(using_params, tout << "after p: " << p << "\n"; tout << "m_params: " << m_params << "\n"; tout << "new_p: " << new_p << "\n";); diff --git a/src/tactic/ufbv/macro_finder_tactic.cpp b/src/tactic/ufbv/macro_finder_tactic.cpp index 3f45feb37..9d508b718 100644 --- a/src/tactic/ufbv/macro_finder_tactic.cpp +++ b/src/tactic/ufbv/macro_finder_tactic.cpp @@ -41,7 +41,7 @@ class macro_finder_tactic : public tactic { void operator()(goal_ref const & g, goal_ref_buffer & result) { tactic_report report("macro-finder", *g); - TRACE("macro-finder", g->display(tout);); + TRACE(macro_finder, g->display(tout);); recfun::util rec(m()); if (!rec.get_rec_funs().empty()) { diff --git a/src/test/ast.cpp b/src/test/ast.cpp index 0826306f2..03407a4a5 100644 --- a/src/test/ast.cpp +++ b/src/test/ast.cpp @@ -44,9 +44,9 @@ static void tst1() { // ast_ref v3 (m.mk_var(1), m); // ENSURE(v1 != v2); // ENSURE(v1 == v3); -// TRACE("ast", tout << "resetting v1\n";); +// TRACE(ast, tout << "resetting v1\n";); // v1.reset(); -// TRACE("ast", tout << "overwriting v3\n";); +// TRACE(ast, tout << "overwriting v3\n";); // v3 = v2; // ast_ref t1(m.mk_type_decl(symbol("int"), 0), m); @@ -83,7 +83,7 @@ static void tst3() { // ast_manager m; // ast_ref<> n(m.mk_var(1), m); // n = m.mk_var(1); -// TRACE("ast", tout << n->get_id() << "\n";); +// TRACE(ast, tout << n->get_id() << "\n";); } static void tst4() { @@ -142,12 +142,12 @@ struct foo { }; void tst_ast() { - TRACE("ast", + TRACE(ast, tout << "sizeof(ast): " << sizeof(ast) << "\n"; tout << "sizeof(expr): " << sizeof(expr) << "\n"; tout << "sizeof(app): " << sizeof(app) << "\n"; ); - TRACE("ast", tout << "sizeof(foo): " << sizeof(foo) << "\n";); + TRACE(ast, tout << "sizeof(foo): " << sizeof(foo) << "\n";); tst1(); tst2(); tst3(); diff --git a/src/test/bit_blaster.cpp b/src/test/bit_blaster.cpp index fa623f767..07dcbd4f9 100644 --- a/src/test/bit_blaster.cpp +++ b/src/test/bit_blaster.cpp @@ -63,7 +63,7 @@ static unsigned to_int(model_core & mdl, expr_ref_vector & out) { #define ENSURE_INT(mdl, out, expected) \ do { \ unsigned actual = to_int(mdl, out); \ - TRACE("bit_blaster", \ + TRACE(bit_blaster, \ display(tout, out); \ tout << "expected=" << (expected) << ", actual=" << actual << "\n"; \ ); \ @@ -193,9 +193,9 @@ void tst_le(ast_manager & m, unsigned sz) { // bool t = true; // bit_blaster blaster(m, t); // blaster.mk_ule(sz, a.c_ptr(), b.c_ptr(), out); -// TRACE("bit_blaster", tout << mk_pp(out, m) << "\n";); +// TRACE(bit_blaster, tout << mk_pp(out, m) << "\n";); // blaster.mk_sle(sz, a.c_ptr(), b.c_ptr(), out); -// TRACE("bit_blaster", tout << mk_pp(out, m) << "\n";); +// TRACE(bit_blaster, tout << mk_pp(out, m) << "\n";); } void tst_eqs(ast_manager & m, unsigned sz) { @@ -206,7 +206,7 @@ void tst_eqs(ast_manager & m, unsigned sz) { // bool t = true; // bit_blaster blaster(m, t); // blaster.mk_eqs(sz, a.c_ptr(), b); -// TRACE("bit_blaster", display(tout, b, false);); +// TRACE(bit_blaster, display(tout, b, false);); } void tst_sh(ast_manager & m, unsigned sz) { @@ -218,13 +218,13 @@ void tst_sh(ast_manager & m, unsigned sz) { // bool t = true; // bit_blaster blaster(m, t); // blaster.mk_shl(sz, a.c_ptr(), b.c_ptr(), c); -// TRACE("bit_blaster", tout << "shl\n"; display(tout, c);); +// TRACE(bit_blaster, tout << "shl\n"; display(tout, c);); // c.reset(); // blaster.mk_lshr(sz, a.c_ptr(), b.c_ptr(), c); -// TRACE("bit_blaster", tout << "lshr\n"; display(tout, c);); +// TRACE(bit_blaster, tout << "lshr\n"; display(tout, c);); // c.reset(); // blaster.mk_ashr(sz, a.c_ptr(), b.c_ptr(), c); -// TRACE("bit_blaster", tout << "ashr " << c.size() << "\n"; display(tout, c, false);); +// TRACE(bit_blaster, tout << "ashr " << c.size() << "\n"; display(tout, c, false);); } void tst_bit_blaster() { diff --git a/src/test/chashtable.cpp b/src/test/chashtable.cpp index 773509aba..3bb08f835 100644 --- a/src/test/chashtable.cpp +++ b/src/test/chashtable.cpp @@ -121,13 +121,13 @@ static void tst4(unsigned num, unsigned N) { for (unsigned i = 0; i < num; i++) { int v = rand() % N; if (rand() % 3 == 2) { - TRACE("chashtable", tout << "erase " << v << "\n";); + TRACE(chashtable, tout << "erase " << v << "\n";); s.erase(v); t.erase(v); ENSURE(!t.contains(v)); } else { - TRACE("chashtable", tout << "insert " << v << "\n";); + TRACE(chashtable, tout << "insert " << v << "\n";); s.insert(v); t.insert(v); ENSURE(t.contains(v)); diff --git a/src/test/diff_logic.cpp b/src/test/diff_logic.cpp index 9a3403ad2..d8f1ee11c 100644 --- a/src/test/diff_logic.cpp +++ b/src/test/diff_logic.cpp @@ -85,7 +85,7 @@ static void tst2() { ENSURE(g.enable_edge(g.add_edge(3, 0, rational(2), l4))); ENSURE(!g.enable_edge(g.add_edge(0, 1, rational(-1), l5))); ENSURE(!g.is_feasible_dbg()); - TRACE("diff_logic", g.display(tout);); + TRACE(diff_logic, g.display(tout);); struct proc { bool_vector found; proc(): @@ -106,7 +106,7 @@ static void tst2() { ENSURE(p.found[6] == false); g.pop(1); ENSURE(g.is_feasible_dbg()); - TRACE("diff_logic", g.display(tout);); + TRACE(diff_logic, g.display(tout);); } static int add_edge(dlg& g, dl_var src, dl_var dst, int weight, unsigned lit) { @@ -138,7 +138,7 @@ static void tst3() { add_edge(g, 6, 10, 1, 610); add_edge(g, 8, 10, 1, 810); add_edge(g, 9, 10, 1, 910); - TRACE("diff_logic", g.display(tout);); + TRACE(diff_logic, g.display(tout);); int e38 = g.add_edge(3, 8, rational(3), smt::literal(38)); std::cout << "Edge: " << e38 << "\n"; diff --git a/src/test/doc.cpp b/src/test/doc.cpp index f1b5cf2ce..e05bc07f5 100644 --- a/src/test/doc.cpp +++ b/src/test/doc.cpp @@ -224,7 +224,7 @@ class test_doc_cls { void project(doc const& d, doc_manager& m2, const bit_vector& to_delete, doc_ref& result) { result = dm.project(m2, to_delete, d); - TRACE("doc", + TRACE(doc, for (unsigned i = 0; i < m_vars.size(); ++i) { tout << (to_delete.get(i)?"0":"1"); } @@ -250,7 +250,7 @@ class test_doc_cls { doc_manager m2(num_bits); doc_ref result(m2); project(*d, m2, to_delete, result); - TRACE("doc", + TRACE(doc, dm.display(tout, *d) << "\n"; m2.display(tout, *result) << "\n";); fml2 = to_formula(*result, m2); @@ -342,7 +342,7 @@ class test_doc_cls { solver.assert_expr(fml); lbool res = solver.check(); if (res != l_false) { - TRACE("doc", + TRACE(doc, tout << mk_pp(fml1, m) << "\n"; tout << mk_pp(fml2, m) << "\n"; ); @@ -459,11 +459,11 @@ public: mk_rand_udoc(3, 3, d2); fml1 = to_formula(d1, dm); fml2 = to_formula(d2, dm); - TRACE("doc", + TRACE(doc, d1.display(dm, tout) << "\n"; d2.display(dm, tout) << "\n";); d1.intersect(dm, d2); - TRACE("doc", d1.display(dm, tout) << "\n";); + TRACE(doc, d1.display(dm, tout) << "\n";); ENSURE(d1.well_formed(dm)); fml3 = to_formula(d1, dm); fml1 = m.mk_and(fml1, fml2); diff --git a/src/test/euf_arith_plugin.cpp b/src/test/euf_arith_plugin.cpp index 41d629ad5..d8ad15233 100644 --- a/src/test/euf_arith_plugin.cpp +++ b/src/test/euf_arith_plugin.cpp @@ -38,12 +38,12 @@ static void test1() { expr_ref y(m.mk_const("y", I), m); auto* nx = get_node(g, a, a.mk_add(a.mk_add(y, y), a.mk_add(x, x))); auto* ny = get_node(g, a, a.mk_add(a.mk_add(y, x), x)); - TRACE("plugin", tout << "before merge\n" << g << "\n"); + TRACE(plugin, tout << "before merge\n" << g << "\n"); g.merge(nx, ny, nullptr); - TRACE("plugin", tout << "before propagate\n" << g << "\n"); + TRACE(plugin, tout << "before propagate\n" << g << "\n"); g.propagate(); - TRACE("plugin", tout << "after propagate\n" << g << "\n"); + TRACE(plugin, tout << "after propagate\n" << g << "\n"); g.merge(get_node(g, a, a.mk_add(x, a.mk_add(y, y))), get_node(g, a, a.mk_add(y, x)), nullptr); g.propagate(); std::cout << g << "\n"; @@ -64,12 +64,12 @@ static void test2() { auto* nx = get_node(g, a, x); auto* ny = get_node(g, a, y); - TRACE("plugin", tout << "before merge\n" << g << "\n"); + TRACE(plugin, tout << "before merge\n" << g << "\n"); g.merge(nxy, nx, nullptr); g.merge(nyx, ny, nullptr); - TRACE("plugin", tout << "before propagate\n" << g << "\n"); + TRACE(plugin, tout << "before propagate\n" << g << "\n"); g.propagate(); - TRACE("plugin", tout << "after propagate\n" << g << "\n"); + TRACE(plugin, tout << "after propagate\n" << g << "\n"); SASSERT(nx->get_root() == ny->get_root()); g.merge(get_node(g, a, a.mk_add(x, a.mk_add(y, y))), get_node(g, a, a.mk_add(y, x)), nullptr); g.propagate(); @@ -92,9 +92,9 @@ static void test3() { auto* ny = get_node(g, a, y); g.merge(nxyy, nx, nullptr); g.merge(nyxx, ny, nullptr); - TRACE("plugin", tout << "before propagate\n" << g << "\n"); + TRACE(plugin, tout << "before propagate\n" << g << "\n"); g.propagate(); - TRACE("plugin", tout << "after propagate\n" << g << "\n"); + TRACE(plugin, tout << "after propagate\n" << g << "\n"); std::cout << g << "\n"; } diff --git a/src/test/euf_bv_plugin.cpp b/src/test/euf_bv_plugin.cpp index 501bd7b14..ea24ffa5d 100644 --- a/src/test/euf_bv_plugin.cpp +++ b/src/test/euf_bv_plugin.cpp @@ -45,11 +45,11 @@ static void test1() { expr_ref yy(bv.mk_concat(y1, bv.mk_concat(y2, y3)), m); auto* nx = get_node(g, bv, xx); auto* ny = get_node(g, bv, yy); - TRACE("bv", tout << "before merge\n" << g << "\n"); + TRACE(bv, tout << "before merge\n" << g << "\n"); g.merge(nx, ny, nullptr); - TRACE("bv", tout << "before propagate\n" << g << "\n"); + TRACE(bv, tout << "before propagate\n" << g << "\n"); g.propagate(); - TRACE("bv", tout << "after propagate\n" << g << "\n"); + TRACE(bv, tout << "after propagate\n" << g << "\n"); std::cout << g << "\n"; SASSERT(nx->get_root() == ny->get_root()); } @@ -120,7 +120,7 @@ static void test4() { g.merge(get_node(g, bv, bv.mk_concat(a, x2)), get_node(g, bv, y), nullptr); g.merge(get_node(g, bv, x1), get_node(g, bv, a), nullptr); g.propagate(); - TRACE("bv", tout << g << "\n"); + TRACE(bv, tout << g << "\n"); SASSERT(get_node(g, bv, bv.mk_extract(23, 8, x))->get_root() == get_node(g, bv, y)->get_root()); } @@ -138,11 +138,11 @@ static void test5() { expr_ref x2(bv.mk_extract(27, 0, x), m); auto* nx = get_node(g, bv, x1); auto* ny = get_node(g, bv, x2); - TRACE("bv", tout << "before merge\n" << g << "\n"); + TRACE(bv, tout << "before merge\n" << g << "\n"); g.merge(nx, ny, nullptr); - TRACE("bv", tout << "before propagate\n" << g << "\n"); + TRACE(bv, tout << "before propagate\n" << g << "\n"); g.propagate(); - TRACE("bv", tout << "after propagate\n" << g << "\n"); + TRACE(bv, tout << "after propagate\n" << g << "\n"); std::cout << g << "\n"; } @@ -160,11 +160,11 @@ static void test6() { expr_ref x2(bv.mk_extract(28, 0, x), m); auto* nx = get_node(g, bv, x1); auto* ny = get_node(g, bv, x2); - TRACE("bv", tout << "before merge\n" << g << "\n"); + TRACE(bv, tout << "before merge\n" << g << "\n"); g.merge(nx, ny, nullptr); - TRACE("bv", tout << "before propagate\n" << g << "\n"); + TRACE(bv, tout << "before propagate\n" << g << "\n"); g.propagate(); - TRACE("bv", tout << "after propagate\n" << g << "\n"); + TRACE(bv, tout << "after propagate\n" << g << "\n"); std::cout << g << "\n"; } diff --git a/src/test/heap.cpp b/src/test/heap.cpp index 25a509dc8..402db8934 100644 --- a/src/test/heap.cpp +++ b/src/test/heap.cpp @@ -95,18 +95,18 @@ static void tst2() { // insert int val = heap_rand() % N; if (!h.contains(val)) { - TRACE("heap", tout << "inserting: " << val << "\n";); + TRACE(heap, tout << "inserting: " << val << "\n";); h.insert(val); - TRACE("heap", dump_heap(h, tout);); + TRACE(heap, dump_heap(h, tout);); ENSURE(h.contains(val)); } } else if (cmd <= 6) { int val = heap_rand() % N; if (h.contains(val)) { - TRACE("heap", tout << "removing: " << val << "\n";); + TRACE(heap, tout << "removing: " << val << "\n";); h.erase(val); - TRACE("heap", dump_heap(h, tout);); + TRACE(heap, dump_heap(h, tout);); ENSURE(!h.contains(val)); } } @@ -118,11 +118,11 @@ static void tst2() { if (h.contains(val)) { g_value[val] = new_v; if (old_v < new_v) { - TRACE("heap", tout << "value of: " << val << " increased old: " << old_v << " new: " << new_v << "\n";); + TRACE(heap, tout << "value of: " << val << " increased old: " << old_v << " new: " << new_v << "\n";); h.increased(val); } else { - TRACE("heap", tout << "value of: " << val << " decreased old: " << old_v << " new: " << new_v << "\n";); + TRACE(heap, tout << "value of: " << val << " decreased old: " << old_v << " new: " << new_v << "\n";); h.decreased(val); } } diff --git a/src/test/inf_rational.cpp b/src/test/inf_rational.cpp index 634bae7c1..635d9a26e 100644 --- a/src/test/inf_rational.cpp +++ b/src/test/inf_rational.cpp @@ -22,7 +22,7 @@ Revision History: static void tst0() { inf_rational n(rational(0), false); - TRACE("inf_rational", tout << n << "\n";); + TRACE(inf_rational, tout << n << "\n";); ENSURE(n < inf_rational::zero()); ENSURE(!(n >= inf_rational::zero())); } diff --git a/src/test/list.cpp b/src/test/list.cpp index 956477237..adbceebb4 100644 --- a/src/test/list.cpp +++ b/src/test/list.cpp @@ -31,12 +31,12 @@ static void tst1() { ENSURE(append(r, l2, static_cast *>(nullptr)) == l2); ENSURE(append(r, static_cast *>(nullptr), l2) == l2); ENSURE(append(r, static_cast *>(nullptr), static_cast *>(nullptr)) == nullptr); - TRACE("list", display(tout, l2->begin(), l2->end()); tout << "\n";); + TRACE(list, display(tout, l2->begin(), l2->end()); tout << "\n";); list * l5 = append(r, l4, l2); - TRACE("list", display(tout, l5->begin(), l5->end()); tout << "\n";); + TRACE(list, display(tout, l5->begin(), l5->end()); tout << "\n";); list * l6 = append(r, l5, l5); (void) l6; - TRACE("list", display(tout, l6->begin(), l6->end()); tout << "\n";); + TRACE(list, display(tout, l6->begin(), l6->end()); tout << "\n";); } void tst_list() { diff --git a/src/test/lp/gomory_test.h b/src/test/lp/gomory_test.h index 04ec122ab..6d909b907 100644 --- a/src/test/lp/gomory_test.h +++ b/src/test/lp/gomory_test.h @@ -57,7 +57,7 @@ struct gomory_test { } void real_case_in_gomory_cut(const mpq & a, unsigned x_j, mpq & k, lar_term& pol, explanation & expl, const mpq& f_0, const mpq& one_minus_f_0) { - TRACE("gomory_cut_detail_real", tout << "real\n";); + TRACE(gomory_cut_detail_real, tout << "real\n";); mpq new_a; if (at_low(x_j)) { if (a.is_pos()) { @@ -83,7 +83,7 @@ struct gomory_test { k.addmul(new_a, upper_bound(x_j).x); // k += upper_bound(x_j).x * new_a; expl.add_pair(column_upper_bound_constraint(x_j), new_a); } - TRACE("gomory_cut_detail_real", tout << a << "*v" << x_j << " k: " << k << "\n";); + TRACE(gomory_cut_detail_real, tout << a << "*v" << x_j << " k: " << k << "\n";); pol.add_monomial(new_a, x_j); } @@ -92,7 +92,7 @@ struct gomory_test { SASSERT(!a.is_int()); SASSERT(f_0 > zero_of_type() && f_0 < one_of_type()); mpq f_j = fractional_part(a); - TRACE("gomory_cut_detail", + TRACE(gomory_cut_detail, tout << a << " x_j = " << x_j << ", k = " << k << "\n"; tout << "f_j: " << f_j << "\n"; tout << "f_0: " << f_0 << "\n"; @@ -123,7 +123,7 @@ struct gomory_test { k.addmul(new_a, upper_bound(x_j).x); expl.add_pair(column_upper_bound_constraint(x_j), new_a); } - TRACE("gomory_cut_detail", tout << "new_a: " << new_a << " k: " << k << "\n";); + TRACE(gomory_cut_detail, tout << "new_a: " << new_a << " k: " << k << "\n";); t.add_monomial(new_a, x_j); lcm_den = lcm(lcm_den, denominator(new_a)); } @@ -138,7 +138,7 @@ struct gomory_test { auto pol = t.coeffs_as_vector(); t.clear(); if (pol.size() == 1) { - TRACE("gomory_cut_detail", tout << "pol.size() is 1" << std::endl;); + TRACE(gomory_cut_detail, tout << "pol.size() is 1" << std::endl;); unsigned v = pol[0].second; SASSERT(is_integer(v)); const mpq& a = pol[0].first; @@ -155,9 +155,9 @@ struct gomory_test { t.add_monomial(mpq(1), v); } } else { - TRACE("gomory_cut_detail", tout << "pol.size() > 1" << std::endl;); + TRACE(gomory_cut_detail, tout << "pol.size() > 1" << std::endl;); lcm_den = lcm(lcm_den, denominator(k)); - TRACE("gomory_cut_detail", tout << "k: " << k << " lcm_den: " << lcm_den << "\n"; + TRACE(gomory_cut_detail, tout << "k: " << k << " lcm_den: " << lcm_den << "\n"; for (unsigned i = 0; i < pol.size(); i++) { tout << pol[i].first << " " << pol[i].second << "\n"; } @@ -171,7 +171,7 @@ struct gomory_test { } k *= lcm_den; } - TRACE("gomory_cut_detail", tout << "after *lcm\n"; + TRACE(gomory_cut_detail, tout << "after *lcm\n"; for (unsigned i = 0; i < pol.size(); i++) { tout << pol[i].first << " * v" << pol[i].second << "\n"; } @@ -182,7 +182,7 @@ struct gomory_test { t.add_monomial(-pi.first, pi.second); k.neg(); } - TRACE("gomory_cut_detail", tout << "k = " << k << std::endl;); + TRACE(gomory_cut_detail, tout << "k = " << k << std::endl;); SASSERT(k.is_int()); } @@ -197,7 +197,7 @@ struct gomory_test { enable_trace("gomory_cut"); enable_trace("gomory_cut_detail"); - TRACE("gomory_cut", + TRACE(gomory_cut, tout << "applying cut at:\n"; print_row(tout, row); tout << std::endl << "inf_col = " << inf_col << std::endl; ); @@ -231,7 +231,7 @@ struct gomory_test { if (some_int_columns) adjust_term_and_k_for_some_ints_case_gomory(t, k, lcm_den); - TRACE("gomory_cut", tout<<"new cut :"; print_term(t, tout); tout << " >= " << k << std::endl;); + TRACE(gomory_cut, tout<<"new cut :"; print_term(t, tout); tout << " >= " << k << std::endl;); } }; diff --git a/src/test/lp/lp.cpp b/src/test/lp/lp.cpp index 3de741d42..52c6a77cd 100644 --- a/src/test/lp/lp.cpp +++ b/src/test/lp/lp.cpp @@ -132,7 +132,7 @@ void test_basic_lemma_for_mon_neutral_from_factors_to_monomial(); void test_cn_on_expr(nex_sum *t, cross_nested &cn) { t = to_sum(cn.get_nex_creator().simplify(t)); - TRACE("nla_test", tout << "t=" << *t << '\n';); + TRACE(nla_test, tout << "t=" << *t << '\n';); cn.run(t); } @@ -183,7 +183,7 @@ void test_simplify() { nex_creator r; cross_nested cn( [](const nex *n) { - TRACE("nla_cn_test", tout << *n << "\n";); + TRACE(nla_cn_test, tout << *n << "\n";); return false; }, [](unsigned) { return false; }, []() { return 1; }, // for random @@ -203,7 +203,7 @@ void test_simplify() { auto a_plus_bc = r.mk_sum(a, bc); auto two_a_plus_bc = r.mk_mul(r.mk_scalar(rational(2)), a_plus_bc); auto simp_two_a_plus_bc = r.simplify(two_a_plus_bc); - TRACE("nla_test", tout << *simp_two_a_plus_bc << "\n";); + TRACE(nla_test, tout << *simp_two_a_plus_bc << "\n";); ENSURE(nex_creator::equal(simp_two_a_plus_bc, two_a_plus_bc)); auto simp_a_plus_bc = r.simplify(a_plus_bc); ENSURE(to_sum(simp_a_plus_bc)->size() > 1); @@ -211,46 +211,46 @@ void test_simplify() { auto three_ab = r.mk_mul(r.mk_scalar(rational(3)), a, b); auto three_ab_square = r.mk_mul(three_ab, three_ab, three_ab); - TRACE("nla_test", tout << "before simplify " << *three_ab_square << "\n";); + TRACE(nla_test, tout << "before simplify " << *three_ab_square << "\n";); three_ab_square = to_mul(r.simplify(three_ab_square)); - TRACE("nla_test", tout << *three_ab_square << "\n";); + TRACE(nla_test, tout << *three_ab_square << "\n";); const rational &s = three_ab_square->coeff(); ENSURE(s == rational(27)); auto m = r.mk_mul(a, a); - TRACE("nla_test_", tout << "m = " << *m << "\n";); + TRACE(nla_test_, tout << "m = " << *m << "\n";); /* auto n = r.mk_mul(b, b, b, b, b, b, b); n->add_child_in_power(b, 7); n->add_child(r.mk_scalar(rational(3))); n->add_child_in_power(r.mk_scalar(rational(2)), 2); n->add_child(r.mk_scalar(rational(1))); - TRACE("nla_test_", tout << "n = " << *n << "\n";); + TRACE(nla_test_, tout << "n = " << *n << "\n";); m->add_child_in_power(n, 3); n->add_child_in_power(r.mk_scalar(rational(1, 3)), 2); - TRACE("nla_test_", tout << "m = " << *m << "\n";); + TRACE(nla_test_, tout << "m = " << *m << "\n";); nex_sum * e = r.mk_sum(a, r.mk_sum(b, m)); - TRACE("nla_test", tout << "before simplify e = " << *e << "\n";); + TRACE(nla_test, tout << "before simplify e = " << *e << "\n";); e = to_sum(r.simplify(e)); - TRACE("nla_test", tout << "simplified e = " << *e << "\n";); + TRACE(nla_test, tout << "simplified e = " << *e << "\n";); ENSURE(e->children().size() > 2); nex_sum * e_m = r.mk_sum(); for (const nex* ex: to_sum(e)->children()) { nex* ce = r.mk_mul(r.clone(ex), r.mk_scalar(rational(3))); - TRACE("nla_test", tout << "before simpl ce = " << *ce << "\n";); + TRACE(nla_test, tout << "before simpl ce = " << *ce << "\n";); ce = r.simplify(ce); - TRACE("nla_test", tout << "simplified ce = " << *ce << "\n";); + TRACE(nla_test, tout << "simplified ce = " << *ce << "\n";); e_m->add_child(ce); } e->add_child(e_m); - TRACE("nla_test", tout << "before simplify sum e = " << *e << "\n";); + TRACE(nla_test, tout << "before simplify sum e = " << *e << "\n";); e = to_sum(r.simplify(e)); - TRACE("nla_test", tout << "simplified sum e = " << *e << "\n";); + TRACE(nla_test, tout << "simplified sum e = " << *e << "\n";); nex * pr = r.mk_mul(a, b, b); - TRACE("nla_test", tout << "before simplify pr = " << *pr << "\n";); + TRACE(nla_test, tout << "before simplify pr = " << *pr << "\n";); r.simplify(pr); - TRACE("nla_test", tout << "simplified sum e = " << *pr << "\n";); + TRACE(nla_test, tout << "simplified sum e = " << *pr << "\n";); */ #endif } @@ -260,7 +260,7 @@ void test_cn_shorter() { // nex_creator cr; // cross_nested cn( // [](const nex* n) { - // TRACE("nla_test", tout <<"cn form = " << *n << "\n"; + // TRACE(nla_test, tout <<"cn form = " << *n << "\n"; // ); // return false; @@ -295,7 +295,7 @@ void test_cn_shorter() { // rational(3); nex* _6aad = cr.mk_mul(cr.mk_scalar(rational(6)), a, a, // d); clone = to_sum(cr.clone(cr.mk_sum(_6aad, abcd, eae, three_eac))); // clone = to_sum(cr.simplify(clone)); - // TRACE("nla_test", tout << "clone = " << *clone << "\n";); + // TRACE(nla_test, tout << "clone = " << *clone << "\n";); // // test_cn_on_expr(cr.mk_sum(aad, abcd, aaccd, add, eae, eac, ed), // cn); test_cn_on_expr(clone, cn); // */ @@ -307,7 +307,7 @@ void test_cn() { // nex_creator cr; // cross_nested cn( // [](const nex* n) { - // TRACE("nla_test", tout <<"cn form = " << *n << "\n";); + // TRACE(nla_test, tout <<"cn form = " << *n << "\n";); // return false; // } , // [](unsigned) { return false; }, @@ -352,14 +352,14 @@ void test_cn() { // nex* _6aad = cr.mk_mul(cr.mk_scalar(rational(6)), a, a, d); // nex * clone = cr.clone(cr.mk_sum(_6aad, abcd, aaccd, add, eae, eac, // ed)); clone = cr.simplify(clone); ENSURE(cr.is_simplified(clone)); - // TRACE("nla_test", tout << "clone = " << *clone << "\n";); + // TRACE(nla_test, tout << "clone = " << *clone << "\n";); // // test_cn_on_expr(cr.mk_sum(aad, abcd, aaccd, add, eae, eac, ed), - // cn); test_cn_on_expr(to_sum(clone), cn); TRACE("nla_test", tout << + // cn); test_cn_on_expr(to_sum(clone), cn); TRACE(nla_test, tout << // "done\n";); test_cn_on_expr(cr.mk_sum(abd, abc, cbd, acd), cn); - // TRACE("nla_test", tout << "done\n";);*/ + // TRACE(nla_test, tout << "done\n";);*/ // #endif // // test_cn_on_expr(a*b*b*d*d + a*b*b*c*d + c*b*b*d); - // // TRACE("nla_test", tout << "done\n";); + // // TRACE(nla_test, tout << "done\n";); // // test_cn_on_expr(a*b*d + a*b*c + c*b*d); } diff --git a/src/test/lp/nla_solver_test.cpp b/src/test/lp/nla_solver_test.cpp index fa5a29e99..ab66bfb7b 100644 --- a/src/test/lp/nla_solver_test.cpp +++ b/src/test/lp/nla_solver_test.cpp @@ -154,7 +154,7 @@ void create_abcde(solver & nla, void test_basic_lemma_for_mon_neutral_from_factors_to_monomial_0() { std::cout << "test_basic_lemma_for_mon_neutral_from_factors_to_monomial_0\n"; enable_trace("nla_solver"); - TRACE("nla_solver",); + TRACE(nla_solver,); lp::lar_solver s; unsigned a = 0, b = 1, c = 2, d = 3, e = 4, abcde = 5, ac = 6, bde = 7; @@ -233,7 +233,7 @@ void s_set_column_value_test(lp::lar_solver&s, lpvar j, const lp::impq & v) { void test_basic_lemma_for_mon_neutral_from_factors_to_monomial_1() { std::cout << "test_basic_lemma_for_mon_neutral_from_factors_to_monomial_1\n"; - TRACE("nla_solver",); + TRACE(nla_solver,); lp::lar_solver s; unsigned a = 0, b = 1, c = 2, d = 3, e = 4, bde = 7; diff --git a/src/test/mpff.cpp b/src/test/mpff.cpp index 75b23be3d..3dba5d90c 100644 --- a/src/test/mpff.cpp +++ b/src/test/mpff.cpp @@ -115,12 +115,12 @@ static void tst7() { m.display_smt2(std::cout, a); std::cout << "\n"; } -// if (!qm.le(qa, qt)) { TRACE("mpff_bug", tout << fa << "\n" << qa << "\n" << qt << "\n";); UNREACHABLE(); } +// if (!qm.le(qa, qt)) { TRACE(mpff_bug, tout << fa << "\n" << qa << "\n" << qt << "\n";); UNREACHABLE(); } #define MK_BIN_OP(OP) \ static void tst_ ## OP ## _core(int64_t n1, uint64_t d1, int64_t n2, uint64_t d2, unsigned precision = 2, unsigned exp = 0) { \ - TRACE("mpff_bug", tout << n1 << "/" << d1 << ", " << n2 << "/" << d2 << "\n";); \ + TRACE(mpff_bug, tout << n1 << "/" << d1 << ", " << n2 << "/" << d2 << "\n";); \ unsynch_mpq_manager qm; \ scoped_mpq qa(qm), qb(qm), qc(qm), qt(qm); \ \ diff --git a/src/test/mpz.cpp b/src/test/mpz.cpp index 2c76b3a66..f628b884c 100644 --- a/src/test/mpz.cpp +++ b/src/test/mpz.cpp @@ -149,7 +149,7 @@ void tst_div2k(synch_mpz_manager & m, mpz const & v, unsigned k) { m.machine_div(v, pw, y); bool is_eq = m.eq(x, y); (void)is_eq; - CTRACE("mpz_2k", !is_eq, tout << "div: " << m.to_string(v) << ", k: " << k << " r: " << m.to_string(x) << ", expected: " << m.to_string(y) << "\n";); + CTRACE(mpz_2k, !is_eq, tout << "div: " << m.to_string(v) << ", k: " << k << " r: " << m.to_string(x) << ", expected: " << m.to_string(y) << "\n";); ENSURE(is_eq); m.del(x); m.del(y); @@ -177,7 +177,7 @@ void tst_mul2k(synch_mpz_manager & m, mpz const & v, unsigned k) { m.mul(v, pw, y); bool is_eq = m.eq(x, y); (void)is_eq; - CTRACE("mpz_2k", !is_eq, tout << "mul: " << m.to_string(v) << ", k: " << k << " r: " << m.to_string(x) << ", expected: " << m.to_string(y) << "\n";); + CTRACE(mpz_2k, !is_eq, tout << "mul: " << m.to_string(v) << ", k: " << k << " r: " << m.to_string(x) << ", expected: " << m.to_string(y) << "\n";); ENSURE(is_eq); m.del(x); m.del(y); diff --git a/src/test/no_overflow.cpp b/src/test/no_overflow.cpp index c7124a5ce..5ee8b6844 100644 --- a/src/test/no_overflow.cpp +++ b/src/test/no_overflow.cpp @@ -93,7 +93,7 @@ Z3_ast mk_max(Z3_context ctx, Z3_sort bv, bool is_signed) { void test_add(unsigned bvsize, bool is_signed) { - TRACE("no_overflow", tout << "test_add: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";); + TRACE(no_overflow, tout << "test_add: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";); Z3_config cfg = Z3_mk_config(); Z3_context ctx = Z3_mk_context(cfg); @@ -178,7 +178,7 @@ void test_add(unsigned bvsize, bool is_signed) { void test_sub(unsigned bvsize, bool is_signed) { - TRACE("no_overflow", tout << "test_sub: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";); + TRACE(no_overflow, tout << "test_sub: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";); Z3_config cfg = Z3_mk_config(); Z3_context ctx = Z3_mk_context(cfg); @@ -292,7 +292,7 @@ void test_sub(unsigned bvsize, bool is_signed) { void test_neg(unsigned bvsize) { - TRACE("no_overflow", tout << "test_neg: bvsize = " << bvsize << "\n";); + TRACE(no_overflow, tout << "test_neg: bvsize = " << bvsize << "\n";); Z3_config cfg = Z3_mk_config(); Z3_context ctx = Z3_mk_context(cfg); @@ -340,7 +340,7 @@ void test_neg(unsigned bvsize) { void test_mul(unsigned bvsize, bool is_signed) { - TRACE("no_overflow", tout << "test_mul: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";); + TRACE(no_overflow, tout << "test_mul: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";); Z3_config cfg = Z3_mk_config(); Z3_context ctx = Z3_mk_context(cfg); @@ -446,7 +446,7 @@ void test_mul(unsigned bvsize, bool is_signed) { void test_div(unsigned bvsize) { - TRACE("no_overflow", tout << "test_div: bvsize = " << bvsize << "\n";); + TRACE(no_overflow, tout << "test_div: bvsize = " << bvsize << "\n";); Z3_config cfg = Z3_mk_config(); Z3_context ctx = Z3_mk_context(cfg); @@ -571,7 +571,7 @@ Z3_ast Z3_API Z3_mk_bvmul_no_underflow_wrapper(Z3_context ctx, Z3_ast t1, Z3_ast void test_equiv(Equivalence_params params, unsigned bvsize, bool is_signed) { - TRACE("no_overflow", tout << "test_" << params.name << "_equiv: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";); + TRACE(no_overflow, tout << "test_" << params.name << "_equiv: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";); Z3_config cfg = Z3_mk_config(); Z3_context ctx = Z3_mk_context(cfg); diff --git a/src/test/object_allocator.cpp b/src/test/object_allocator.cpp index ce2ae124c..2ef3c4718 100644 --- a/src/test/object_allocator.cpp +++ b/src/test/object_allocator.cpp @@ -92,7 +92,7 @@ static void tst2() { if (!object_coeff_pairs.empty()) { unsigned idx = rand() % object_coeff_pairs.size(); cell * c = object_coeff_pairs[idx].first; - CTRACE("object_allocator", c->m_coeff != rational(object_coeff_pairs[idx].second), tout << c->m_coeff << " != " << rational(object_coeff_pairs[idx].second) << "\n";); + CTRACE(object_allocator, c->m_coeff != rational(object_coeff_pairs[idx].second), tout << c->m_coeff << " != " << rational(object_coeff_pairs[idx].second) << "\n";); ENSURE(c->m_coeff == rational(object_coeff_pairs[idx].second)); if (idx < 5) m1.recycle(c); @@ -110,13 +110,13 @@ static void tst2() { num_resets++; } } - TRACE("object_allocator", tout << "num. resets: " << num_resets << "\n";); + TRACE(object_allocator, tout << "num. resets: " << num_resets << "\n";); } void tst_object_allocator() { tst1(); tst2(); - TRACE("object_allocator", tout << "num. allocated cells: " << cell::g_num_allocated_cells << "\nnum. deallocated cells: " << cell::g_num_deallocated_cells << + TRACE(object_allocator, tout << "num. allocated cells: " << cell::g_num_allocated_cells << "\nnum. deallocated cells: " << cell::g_num_deallocated_cells << "\nnum. recycled cells: " << cell::g_num_recycled_cells << "\n";); ENSURE(cell::g_num_allocated_cells == cell::g_num_deallocated_cells); } diff --git a/src/test/optional.cpp b/src/test/optional.cpp index d698f7289..1f342a16f 100644 --- a/src/test/optional.cpp +++ b/src/test/optional.cpp @@ -28,7 +28,7 @@ static void tst1() { v = 10; ENSURE(v); ENSURE(*v == 10); - TRACE("optional", tout << sizeof(v) << "\n";); + TRACE(optional, tout << sizeof(v) << "\n";); } struct OptFoo { @@ -36,11 +36,11 @@ struct OptFoo { int m_y; OptFoo(int x, int y):m_x(x), m_y(y) { - TRACE("optional", tout << "OptFoo created: " << m_x << " : " << m_y << "\n";); + TRACE(optional, tout << "OptFoo created: " << m_x << " : " << m_y << "\n";); } ~OptFoo() { - TRACE("optional", tout << "OptFoo deleted: " << m_x << " : " << m_y << "\n";); + TRACE(optional, tout << "OptFoo deleted: " << m_x << " : " << m_y << "\n";); } }; @@ -53,7 +53,7 @@ static void tst2() { v = OptFoo(200, 300); ENSURE(v->m_x == 200); ENSURE(v->m_y == 300); - TRACE("optional", tout << sizeof(v) << "\n";); + TRACE(optional, tout << sizeof(v) << "\n";); } static void tst3() { @@ -63,7 +63,7 @@ static void tst3() { v = &x; ENSURE(v); ENSURE(*v == &x); - TRACE("optional", tout << sizeof(v) << "\n";); + TRACE(optional, tout << sizeof(v) << "\n";); ENSURE(*(*v) == 10); } diff --git a/src/test/parray.cpp b/src/test/parray.cpp index 7e6b78cd8..eca94cef7 100644 --- a/src/test/parray.cpp +++ b/src/test/parray.cpp @@ -49,14 +49,14 @@ static void tst1() { m.mk(a1); ENSURE(m.size(a1) == 0); m.push_back(a1, 10, a2); - TRACE("parray", + TRACE(parray, m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n";); ENSURE(m.size(a1) == 0); ENSURE(m.size(a2) == 1); m.push_back(a1, 20, a1); m.push_back(a1, 30, a1); - TRACE("parray", + TRACE(parray, m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n";); ENSURE(m.get(a1, 0) == 20); @@ -69,7 +69,7 @@ static void tst1() { ENSURE(m.size(a3) == 2); ENSURE(m.get(a3, 0) == 10); ENSURE(m.get(a3, 1) == 100); - TRACE("parray", + TRACE(parray, m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n"; m.display_info(tout, a3); tout << "\n";); @@ -77,7 +77,7 @@ static void tst1() { ENSURE(m.get(a2, 0) == 10); ENSURE(m.get(a2, 1) == 50); ENSURE(m.size(a2) == 2); - TRACE("parray", + TRACE(parray, m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n"; m.display_info(tout, a3); tout << "\n";); @@ -91,7 +91,7 @@ static void tst2() { typedef parray_manager > int_parray_manager; typedef typename int_parray_manager::ref int_array; - TRACE("parray", tout << "tst2\n";); + TRACE(parray, tout << "tst2\n";); dummy_value_manager vm; small_object_allocator a; int_parray_manager m(vm, a); @@ -105,11 +105,11 @@ static void tst2() { m.push_back(a1, 100, a2); for (unsigned i = 0; i < 10; i++) m.push_back(a2, i+101); - TRACE("parray", + TRACE(parray, m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n";); ENSURE(m.get(a1, 0) == 0); - TRACE("parray", + TRACE(parray, m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n";); for (unsigned i = 0; i < m.size(a1); i++) { @@ -118,11 +118,11 @@ static void tst2() { for (unsigned i = 0; i < m.size(a2); i++) { ENSURE(static_cast(m.get(a2, i)) == i); } - TRACE("parray", + TRACE(parray, m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n";); m.unshare(a1); - TRACE("parray", + TRACE(parray, m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n";); m.del(a1); @@ -134,7 +134,7 @@ static void tst3() { typedef parray_manager > int_parray_manager; typedef typename int_parray_manager::ref int_array; - TRACE("parray", tout << "tst3\n";); + TRACE(parray, tout << "tst3\n";); dummy_value_manager vm; small_object_allocator a; int_parray_manager m(vm, a); @@ -164,14 +164,14 @@ static void tst3() { for (unsigned i = 0; i < 20; i++) { ENSURE(static_cast(m.get(a2, i)) == i+1); } - TRACE("parray", + TRACE(parray, m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n"; m.display_info(tout, a3); tout << "\n"; m.display_info(tout, a4); tout << "\n"; ); ENSURE(m.get(a1, 10) == 10); - TRACE("parray", + TRACE(parray, tout << "after rerooting...\n"; m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n"; @@ -191,7 +191,7 @@ static void tst3() { } ENSURE(m.get(a4, 18) == 30); ENSURE(m.get(a3, 18) == 40); - TRACE("parray", + TRACE(parray, tout << "after many gets...\n"; m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n"; @@ -199,7 +199,7 @@ static void tst3() { m.display_info(tout, a4); tout << "\n"; ); m.unshare(a1); - TRACE("parray", + TRACE(parray, tout << "after unshare...\n"; m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n"; @@ -207,7 +207,7 @@ static void tst3() { m.display_info(tout, a4); tout << "\n"; ); m.reroot(a4); - TRACE("parray", + TRACE(parray, tout << "after reroot...\n"; m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n"; @@ -215,7 +215,7 @@ static void tst3() { m.display_info(tout, a4); tout << "\n"; ); m.unshare(a2); - TRACE("parray", + TRACE(parray, tout << "after second unshare...\n"; m.display_info(tout, a1); tout << "\n"; m.display_info(tout, a2); tout << "\n"; @@ -244,7 +244,7 @@ typedef parray_manager expr_array_manager; typedef expr_array_manager::ref expr_array; static void tst4() { - TRACE("parray", tout << "tst4\n";); + TRACE(parray, tout << "tst4\n";); ast_manager m; expr_array_manager m2(m, m.get_allocator()); @@ -262,12 +262,12 @@ static void tst4() { m2.push_back(a1, v3); m2.push_back(a2, v2); m2.pop_back(a1); - TRACE("parray", + TRACE(parray, m2.display_info(tout, a1); tout << "\n"; m2.display_info(tout, a2); tout << "\n"; ); m2.reroot(a1); - TRACE("parray", + TRACE(parray, m2.display_info(tout, a1); tout << "\n"; m2.display_info(tout, a2); tout << "\n"; ); diff --git a/src/test/polynomial.cpp b/src/test/polynomial.cpp index f259c4234..c8a545fc6 100644 --- a/src/test/polynomial.cpp +++ b/src/test/polynomial.cpp @@ -255,9 +255,9 @@ static void tst9() { q = x2 - (((x0^3) - 1)*(x1^2) - 1); std::cout << "q: " << q << "\n"; polynomial_ref r2(m); - TRACE("polynomial", tout << "QUASI_RESULTANT: q, sqrt2.....\n";); + TRACE(polynomial, tout << "QUASI_RESULTANT: q, sqrt2.....\n";); r2 = quasi_resultant(q, sqrt2, 0); - // TRACE("polynomial", tout << "QUASI_RESULTANT: sqrt2, q.....\n";); + // TRACE(polynomial, tout << "QUASI_RESULTANT: sqrt2, q.....\n";); // std::cout << "r2: " << r2 << "\n"; // r2 = quasi_resultant(sqrt2, q, 0); // std::cout << "r2: " << r2 << "\n"; @@ -1340,7 +1340,7 @@ static void tst_mm() { static void tst_eval(polynomial_ref const & p, polynomial::var x0, rational v0, polynomial::var x1, rational v1, polynomial::var x2, rational v2, rational expected) { - TRACE("eval_bug", tout << "tst_eval, " << p << "\n";); + TRACE(eval_bug, tout << "tst_eval, " << p << "\n";); std::cout << "p: " << p << "\nx" << x0 << " -> " << v0 << "\nx" << x1 << " -> " << v1 << "\nx" << x2 << " -> " << v2 << "\n"; unsynch_mpq_manager qm; polynomial::simple_var2value x2v(qm); diff --git a/src/test/polynorm.cpp b/src/test/polynorm.cpp index 80ff74904..ab93b4b99 100644 --- a/src/test/polynorm.cpp +++ b/src/test/polynorm.cpp @@ -135,7 +135,7 @@ private: #endif } - TRACE("polynorm", + TRACE(polynorm, tout << mk_pp(coefficient, m) << "\n"; for (unsigned i = 0; i < factors.size(); ++i) { tout << mk_pp(factors[i].get(), m) << " * " << mk_pp(coefficients[i].get(), m) << "\n"; diff --git a/src/test/random.cpp b/src/test/random.cpp index 89d5a24cf..a1b7c35fa 100644 --- a/src/test/random.cpp +++ b/src/test/random.cpp @@ -22,7 +22,7 @@ Revision History: static void tst1() { random_gen r(0); - TRACE("random", + TRACE(random, for (unsigned i = 0; i < 1000; i++) { tout << r() << "\n"; }); diff --git a/src/test/rational.cpp b/src/test/rational.cpp index 8fe565c62..c44daf8c6 100644 --- a/src/test/rational.cpp +++ b/src/test/rational.cpp @@ -93,11 +93,11 @@ static void tst1() { ENSURE(rational(3,4) >= rational(3,4)); ENSURE(rational(3,4) > rational(2,8)); ENSURE(rational(3,4) < rational(7,8)); - TRACE("rational", tout << rational(3,4) << "\n";); - TRACE("rational", tout << rational(7,9) << "\n";); - TRACE("rational", tout << rational(-3,7) << "\n";); - TRACE("rational", tout << rational(5,8) << "\n";); - TRACE("rational", tout << rational(4,2) << "\n";); + TRACE(rational, tout << rational(3,4) << "\n";); + TRACE(rational, tout << rational(7,9) << "\n";); + TRACE(rational, tout << rational(-3,7) << "\n";); + TRACE(rational, tout << rational(5,8) << "\n";); + TRACE(rational, tout << rational(4,2) << "\n";); ENSURE(rational(3) + rational(2) == rational(5)); ENSURE(rational(3) - rational(2) == rational(1)); ENSURE(rational(3) * rational(2) == rational(6)); @@ -112,9 +112,9 @@ static void tst2() { rational r1("10000000000000000000000000000000000"); rational r2("10000000000000000000000000000000000/3"); rational r3("20000000000000000000000000000000000/6"); - TRACE("rational", tout << r1 << std::endl;); - TRACE("rational", tout << r2 << std::endl;); - TRACE("rational", tout << r3 << std::endl;); + TRACE(rational, tout << r1 << std::endl;); + TRACE(rational, tout << r2 << std::endl;); + TRACE(rational, tout << r3 << std::endl;); ENSURE(r2 == r3); ENSURE(r1 != r2); @@ -207,16 +207,16 @@ static void tst2() { void tst3() { rational n1 = power(rational(2), 32); - TRACE("rational", tout << "n1: " << n1 << "\n";); + TRACE(rational, tout << "n1: " << n1 << "\n";); rational n2 = div(n1, rational(2)); rational n3 = div(rational(2), n2); - TRACE("rational", + TRACE(rational, tout << "n1: " << n1 << "\n"; tout << "n2: " << n2 << "\n"; tout << "n3: " << n3 << "\n";); rational n4 = n1 - rational(3); rational n5 = div(n4, rational(2)); - TRACE("rational", + TRACE(rational, tout << "n4: " << n4 << "\n"; tout << "n5: " << n5 << "\n";); ENSURE(n5 == rational("2147483646")); @@ -224,7 +224,7 @@ void tst3() { void tst4() { rational n1("4294967293"); - TRACE("rational", tout << "n1: " << n1 << "\n";); + TRACE(rational, tout << "n1: " << n1 << "\n";); rational n2 = div(n1, rational(2)); } @@ -233,9 +233,9 @@ void tst5() { n1.neg(); rational n2("4294967295"); n1 /= n2; - TRACE("rational", tout << n1 << " " << n2 << " " << n1.is_big() << " " << n2.is_big() << "\n";); + TRACE(rational, tout << n1 << " " << n2 << " " << n1.is_big() << " " << n2.is_big() << "\n";); n1 *= n2; - TRACE("rational", tout << "after: " << n1 << " " << n2 << "\n";); + TRACE(rational, tout << "after: " << n1 << " " << n2 << "\n";); ENSURE(n1.is_minus_one()); } @@ -305,7 +305,7 @@ static void tst7() { rational y; rational gcd; extended_gcd(n, p, gcd, x, y); - TRACE("gcd", tout << n << " " << p << ": " << gcd << " " << x << " " << y << "\n";); + TRACE(gcd, tout << n << " " << p << ": " << gcd << " " << x << " " << y << "\n";); ENSURE(!mod(n, rational(2)).is_one() || mod(n * x, p).is_one()); } } @@ -490,7 +490,7 @@ static void tst13() { void tst_rational() { - TRACE("rational", tout << "starting rational test...\n";); + TRACE(rational, tout << "starting rational test...\n";); std::cout << "sizeof(rational): " << sizeof(rational) << "\n"; rational r1("10000000000000000000000000000000001"); r1.hash(); diff --git a/src/test/simple_parser.cpp b/src/test/simple_parser.cpp index bdfb86fb8..64dff3cdb 100644 --- a/src/test/simple_parser.cpp +++ b/src/test/simple_parser.cpp @@ -36,28 +36,28 @@ void tst_simple_parser() { p.add_var("y"); expr_ref r(m); p.parse_string("(+ x (* y x))", r); - TRACE("simple_parser", tout << mk_pp(r, m) << "\n";); + TRACE(simple_parser, tout << mk_pp(r, m) << "\n";); p.parse_string("(+ x (* y x) x)", r); float vals[2] = { 2.0f, 3.0f }; (void)vals; - TRACE("simple_parser", + TRACE(simple_parser, tout << mk_pp(r, m) << "\n"; tout << "val: " << eval(r, 2, vals) << "\n";); p.parse_string("(+ x (* y x) x", r); // << error p.parse_string("(x)", r); // << error p.parse_string("(+ x))", r); // <<< this is accepted - TRACE("simple_parser", tout << mk_pp(r, m) << "\n";); + TRACE(simple_parser, tout << mk_pp(r, m) << "\n";); p.parse_string(")x)", r); // error p.parse_string("(+ x (* 10 y) 2)", r); - TRACE("simple_parser", + TRACE(simple_parser, tout << mk_pp(r, m) << "\n"; tout << "val: " << eval(r, 2, vals) << "\n";); p.parse_string("(ite (and (> x 3) (<= y 4)) 2 10)", r); - TRACE("simple_parser", + TRACE(simple_parser, tout << mk_pp(r, m) << "\n"; tout << "val: " << eval(r, 2, vals) << "\n";); p.parse_string("(ite (or (> x 3) (<= y 4)) 2 10)", r); - TRACE("simple_parser", + TRACE(simple_parser, tout << mk_pp(r, m) << "\n"; tout << "val: " << eval(r, 2, vals) << "\n";); } diff --git a/src/test/simplifier.cpp b/src/test/simplifier.cpp index 7bfa72db8..f3a5ba8b2 100644 --- a/src/test/simplifier.cpp +++ b/src/test/simplifier.cpp @@ -13,7 +13,7 @@ Copyright (c) 2015 Microsoft Corporation static void ev_const(Z3_context ctx, Z3_ast e) { Z3_ast r = Z3_simplify(ctx, e); - TRACE("simplifier", + TRACE(simplifier, tout << Z3_ast_to_string(ctx, e) << " -> "; tout << Z3_ast_to_string(ctx, r) << "\n";); Z3_ast_kind k = Z3_get_ast_kind(ctx, r); @@ -34,7 +34,7 @@ static void test_bv() { Z3_ast e = Z3_mk_eq(ctx, bit3_2, Z3_mk_sign_ext(ctx, 1, bit1_1)); ENSURE(Z3_simplify(ctx, e) == Z3_mk_true(ctx)); - TRACE("simplifier", tout << Z3_ast_to_string(ctx, e) << "\n";); + TRACE(simplifier, tout << Z3_ast_to_string(ctx, e) << "\n";); Z3_ast b12 = Z3_mk_numeral(ctx, "12", bv72); Z3_ast b13 = Z3_mk_numeral(ctx, "13", bv72); @@ -149,8 +149,8 @@ static void test_bool() { Z3_ast b = Z3_simplify(ctx, Z3_mk_not(ctx, Z3_mk_iff(ctx, Z3_mk_false(ctx), Z3_mk_true(ctx)))); ENSURE(Z3_mk_true(ctx) == a); ENSURE(Z3_mk_true(ctx) == b); - TRACE("simplifier", tout << Z3_ast_to_string(ctx, a) << "\n";); - TRACE("simplifier", tout << Z3_ast_to_string(ctx, b) << "\n";); + TRACE(simplifier, tout << Z3_ast_to_string(ctx, a) << "\n";); + TRACE(simplifier, tout << Z3_ast_to_string(ctx, b) << "\n";); Z3_del_config(cfg); Z3_del_context(ctx); @@ -179,8 +179,8 @@ static void test_array() { Z3_ast rxy = Z3_simplify(ctx, exy); (void)rxy; - TRACE("simplifier", tout << Z3_ast_to_string(ctx, rxy) << "\n";); - TRACE("simplifier", tout << Z3_ast_to_string(ctx, Z3_simplify(ctx, Z3_mk_eq(ctx, x2, x3))) << "\n";); + TRACE(simplifier, tout << Z3_ast_to_string(ctx, rxy) << "\n";); + TRACE(simplifier, tout << Z3_ast_to_string(ctx, Z3_simplify(ctx, Z3_mk_eq(ctx, x2, x3))) << "\n";); // ENSURE(rxy == Z3_mk_true(ctx)); // ENSURE(Z3_simplify(ctx, Z3_mk_eq(ctx, x2, x3)) == Z3_mk_false(ctx)); @@ -189,7 +189,7 @@ static void test_array() { exy = Z3_mk_eq(ctx, xs[i], xs[j]); rxy = Z3_simplify(ctx, exy); - TRACE("simplifier", + TRACE(simplifier, tout << Z3_ast_to_string(ctx, exy); tout << " -> " << Z3_ast_to_string(ctx, rxy) << "\n"; ); @@ -201,7 +201,7 @@ static void test_array() { (void)sel1; (void)sel2; - TRACE("simplifier", + TRACE(simplifier, tout << Z3_ast_to_string(ctx, Z3_simplify(ctx, sel1)) << "\n"; tout << Z3_ast_to_string(ctx, Z3_simplify(ctx, sel2)) << "\n"; ); diff --git a/src/test/small_object_allocator.cpp b/src/test/small_object_allocator.cpp index 2f08d553e..624c8c524 100644 --- a/src/test/small_object_allocator.cpp +++ b/src/test/small_object_allocator.cpp @@ -15,20 +15,20 @@ void tst_small_object_allocator() { char * p1 = new (soa) char[13]; char * q1 = new (soa) char[14]; char * p2 = new (soa) char[13]; - TRACE("small_object_allocator", + TRACE(small_object_allocator, tout << "p1: " << (void*)p1 << " q1: " << (void*)q1 << " p2: " << (void*)p2 << "\n";); soa.deallocate(13,p1); soa.deallocate(14,q1); soa.deallocate(13,p2); char * p3 = new (soa) char[13]; - TRACE("small_object_allocator", tout << "p3: " << (void*)p3 << "\n";); + TRACE(small_object_allocator, tout << "p3: " << (void*)p3 << "\n";); soa.deallocate(13,p3); char * r1 = new (soa) char[1]; char * r2 = new (soa) char[1]; char * r3 = new (soa) char[1]; char * r4 = new (soa) char[1]; - TRACE("small_object_allocator", + TRACE(small_object_allocator, tout << "r1: " << (void*)r1 << " r2: " << (void*)r2 << " r3: " << (void*)r3 << " r4: " << (void*)r4 << "\n";); soa.deallocate(1,r1); @@ -37,7 +37,7 @@ void tst_small_object_allocator() { soa.deallocate(1,r4); r4 = new (soa) char[1]; r3 = new (soa) char[1]; - TRACE("small_object_allocator", + TRACE(small_object_allocator, tout << "r1: " << (void*)r1 << " r2: " << (void*)r2 << " r3: " << (void*)r3 << " r4: " << (void*)r4 << "\n";); soa.deallocate(1,r1); soa.deallocate(1,r2); diff --git a/src/test/sorting_network.cpp b/src/test/sorting_network.cpp index cd22ac9ae..f67e76a04 100644 --- a/src/test/sorting_network.cpp +++ b/src/test/sorting_network.cpp @@ -219,7 +219,7 @@ static void test_eq1(unsigned n, sorting_network_encoding enc) { model_ref model; solver.get_model(model); model_smt2_pp(std::cout, m, *model, 0); - TRACE("pb", model_smt2_pp(tout, m, *model, 0);); + TRACE(pb, model_smt2_pp(tout, m, *model, 0);); } ENSURE(l_false == res); ext.m_clauses.reset(); @@ -267,7 +267,7 @@ static void test_sorting_eq(unsigned n, unsigned k, sorting_network_encoding enc solver.assert_expr(in[k].get()); res = solver.check(); if (res == l_true) { - TRACE("pb", + TRACE(pb, unsigned sz = solver.size(); for (unsigned i = 0; i < sz; ++i) { tout << mk_pp(solver.get_formula(i), m) << "\n"; @@ -275,7 +275,7 @@ static void test_sorting_eq(unsigned n, unsigned k, sorting_network_encoding enc model_ref model; solver.get_model(model); model_smt2_pp(std::cout, m, *model, 0); - TRACE("pb", model_smt2_pp(tout, m, *model, 0);); + TRACE(pb, model_smt2_pp(tout, m, *model, 0);); } ENSURE(res == l_false); solver.pop(1); @@ -324,7 +324,7 @@ static void test_sorting_le(unsigned n, unsigned k, sorting_network_encoding enc solver.assert_expr(in[k].get()); res = solver.check(); if (res == l_true) { - TRACE("pb", + TRACE(pb, unsigned sz = solver.size(); for (unsigned i = 0; i < sz; ++i) { tout << mk_pp(solver.get_formula(i), m) << "\n"; @@ -332,7 +332,7 @@ static void test_sorting_le(unsigned n, unsigned k, sorting_network_encoding enc model_ref model; solver.get_model(model); model_smt2_pp(std::cout, m, *model, 0); - TRACE("pb", model_smt2_pp(tout, m, *model, 0);); + TRACE(pb, model_smt2_pp(tout, m, *model, 0);); } ENSURE(res == l_false); solver.pop(1); @@ -373,7 +373,7 @@ void test_sorting_ge(unsigned n, unsigned k, sorting_network_encoding enc) { solver.assert_expr(m.mk_not(in[n - k].get())); res = solver.check(); if (res == l_true) { - TRACE("pb", + TRACE(pb, unsigned sz = solver.size(); for (unsigned i = 0; i < sz; ++i) { tout << mk_pp(solver.get_formula(i), m) << "\n"; @@ -381,7 +381,7 @@ void test_sorting_ge(unsigned n, unsigned k, sorting_network_encoding enc) { model_ref model; solver.get_model(model); model_smt2_pp(std::cout, m, *model, 0); - TRACE("pb", model_smt2_pp(tout, m, *model, 0);); + TRACE(pb, model_smt2_pp(tout, m, *model, 0);); } ENSURE(res == l_false); solver.pop(1); diff --git a/src/test/string_buffer.cpp b/src/test/string_buffer.cpp index b3e3ce79d..26fff29a2 100644 --- a/src/test/string_buffer.cpp +++ b/src/test/string_buffer.cpp @@ -33,7 +33,7 @@ static void tst2() { int r = rand() % 10; b << r; } - TRACE("string_buffer", tout << b.c_str() << "\n";); + TRACE(string_buffer, tout << b.c_str() << "\n";); ENSURE(strlen(b.c_str()) == 10000); } diff --git a/src/test/substitution.cpp b/src/test/substitution.cpp index 77087c84c..848223613 100644 --- a/src/test/substitution.cpp +++ b/src/test/substitution.cpp @@ -41,11 +41,11 @@ void tst_substitution() expr_ref res(m); - TRACE("substitution", subst.display(tout);); - TRACE("substitution", tout << ok1 << " " << ok2 << "\n";); + TRACE(substitution, subst.display(tout);); + TRACE(substitution, tout << ok1 << " " << ok2 << "\n";); subst.display(std::cout); subst.apply(v1.get(), res); - TRACE("substitution", tout << mk_pp(res, m) << "\n";); + TRACE(substitution, tout << mk_pp(res, m) << "\n";); expr_ref q(m), body(m); sort_ref_vector sorts(m); @@ -55,6 +55,6 @@ void tst_substitution() body = m.mk_and(m.mk_eq(v1,v2), m.mk_eq(v3,v4)); q = m.mk_forall(sorts.size(), sorts.data(), names.data(), body); subst.apply(q, res); - TRACE("substitution", tout << mk_pp(q, m) << "\n->\n" << mk_pp(res, m) << "\n";); + TRACE(substitution, tout << mk_pp(q, m) << "\n->\n" << mk_pp(res, m) << "\n";); } diff --git a/src/test/theory_pb.cpp b/src/test/theory_pb.cpp index 72a48fa2a..224578003 100644 --- a/src/test/theory_pb.cpp +++ b/src/test/theory_pb.cpp @@ -138,7 +138,7 @@ void tst_theory_pb() { unsigned k = populate_literals(i, lits); std::cout << "k:" << k << " " << N << "\n"; std::cout.flush(); - TRACE("pb", tout << "k " << k << ": " << lits << "\n";); + TRACE(pb, tout << "k " << k << ": " << lits << "\n";); { smt::context ctx(m, params); @@ -146,7 +146,7 @@ void tst_theory_pb() { smt::literal l = smt::theory_pb::assert_ge(ctx, k+1, lits.size(), lits.data()); if (l != smt::false_literal) { ctx.assign(l, nullptr, false); - TRACE("pb", tout << "assign: " << l << "\n"; + TRACE(pb, tout << "assign: " << l << "\n"; ctx.display(tout);); VERIFY(l_false == ctx.check()); } @@ -158,7 +158,7 @@ void tst_theory_pb() { smt::literal l = smt::theory_pb::assert_ge(ctx, k, lits.size(), lits.data()); ENSURE(l != smt::false_literal); ctx.assign(l, nullptr, false); - TRACE("pb", ctx.display(tout);); + TRACE(pb, ctx.display(tout);); VERIFY(l_true == ctx.check()); ctx.pop(1); } diff --git a/src/test/trigo.cpp b/src/test/trigo.cpp index f03d5b3da..380b66d81 100644 --- a/src/test/trigo.cpp +++ b/src/test/trigo.cpp @@ -110,7 +110,7 @@ static void tst_float_sine(std::ostream & out, unsigned N, unsigned k) { for (unsigned i = 0; i < N; i++) { unsigned n = 4 * (rand() % PREC); unsigned d = PREC; - TRACE("sine", tout << "next-val : " << n << "/" << d << "\n";); + TRACE(sine, tout << "next-val : " << n << "/" << d << "\n";); fm.set(a, EBITS, SBITS, MPF_ROUND_TOWARD_POSITIVE, n, d); if (rand() % 2 == 0) fm.neg(a); diff --git a/src/test/upolynomial.cpp b/src/test/upolynomial.cpp index aee3086ae..df7154b42 100644 --- a/src/test/upolynomial.cpp +++ b/src/test/upolynomial.cpp @@ -123,7 +123,7 @@ static void tst_isolate_roots(polynomial_ref const & p, unsigned prec, mpbq_mana um.eval_sign_at(q.size(), q.data(), uppers[i]) == 0 || um.sign_variations_at(sseq, lowers[i]) - um.sign_variations_at(sseq, uppers[i]) == 1); // Fourier sequence may also be used to check if the interval is isolating - TRACE("upolynomial", + TRACE(upolynomial, tout << "lowers[i]: " << bqm.to_string(lowers[i]) << "\n"; tout << "uppers[i]: " << bqm.to_string(uppers[i]) << "\n"; tout << "fourier lower: " << um.sign_variations_at(fseq, lowers[i]) << "\n"; @@ -140,7 +140,7 @@ static void tst_isolate_roots(polynomial_ref const & p, unsigned prec, mpbq_mana // Double checking using Descartes bounds for the interval // Must use square free component. unsigned dab = um.descartes_bound_a_b(q_sqf.size(), q_sqf.data(), bqm, lowers[i], uppers[i]); - TRACE("upolynomial", tout << "Descartes bound: " << dab << "\n";); + TRACE(upolynomial, tout << "Descartes bound: " << dab << "\n";); VERIFY(dab == 1); } } @@ -896,7 +896,7 @@ static void tst_fact(polynomial_ref const & p, unsigned num_distinct_factors, up ENSURE(fs.distinct_factors() == num_distinct_factors); upolynomial::scoped_numeral_vector _r(um); fs.multiply(_r); - TRACE("upolynomial", tout << "_r: "; um.display(tout, _r); tout << "\n_p: "; um.display(tout, _p); tout << "\n";); + TRACE(upolynomial, tout << "_r: "; um.display(tout, _r); tout << "\n_p: "; um.display(tout, _p); tout << "\n";); ENSURE(um.eq(_p, _r)); } diff --git a/src/test/var_subst.cpp b/src/test/var_subst.cpp index a39c0e7f1..90bc95056 100644 --- a/src/test/var_subst.cpp +++ b/src/test/var_subst.cpp @@ -52,7 +52,7 @@ void tst_instantiate(ast_manager & m, expr * f) { for (unsigned i = 0; i < q->get_num_decls(); i++) cnsts.push_back(m.mk_fresh_const("a", q->get_decl_sort(i))); expr_ref r = instantiate(m, q, cnsts.data()); - TRACE("var_subst", tout << "quantifier:\n" << mk_pp(q, m) << "\nresult:\n" << mk_pp(r, m) << "\n";); + TRACE(var_subst, tout << "quantifier:\n" << mk_pp(q, m) << "\nresult:\n" << mk_pp(r, m) << "\n";); } } diff --git a/src/util/bit_vector.cpp b/src/util/bit_vector.cpp index 78b7f15aa..831700dbb 100644 --- a/src/util/bit_vector.cpp +++ b/src/util/bit_vector.cpp @@ -40,7 +40,7 @@ void bit_vector::resize(unsigned new_size, bool val) { return; } - TRACE("bit_vector", tout << "expanding: " << new_size << " capacity: " << m_capacity << " num words: " + TRACE(bit_vector, tout << "expanding: " << new_size << " capacity: " << m_capacity << " num words: " << num_words(new_size) << "\n";); if (num_words(new_size) > m_capacity) { @@ -64,7 +64,7 @@ void bit_vector::resize(unsigned new_size, bool val) { cval = 0; } - TRACE("bit_vector", + TRACE(bit_vector, tout << "num_bits: " << m_num_bits << "\n"; tout << "bwidx: " << bwidx << "\n"; tout << "ewidx: " << ewidx << "\n"; diff --git a/src/util/chashtable.h b/src/util/chashtable.h index f245a047c..4e11619f7 100644 --- a/src/util/chashtable.h +++ b/src/util/chashtable.h @@ -89,7 +89,7 @@ protected: cell * copy_table(cell * source, unsigned source_slots, unsigned source_capacity, cell * target, unsigned target_slots, unsigned target_capacity, unsigned & used_slots) { - TRACE("chashtable", tout << "copy_table...\n";); + TRACE(chashtable, tout << "copy_table...\n";); SASSERT(target_slots >= source_slots); SASSERT(target_capacity >= source_capacity); unsigned target_mask = target_slots - 1; @@ -129,7 +129,7 @@ protected: } } #if 0 - TRACE("chashtable", + TRACE(chashtable, for (unsigned i = 0; i < source_capacity; i++) { tout << i << ":["; if (source[i].m_next == 0) diff --git a/src/util/gparams.cpp b/src/util/gparams.cpp index c73d222fb..d2adc9f9f 100644 --- a/src/util/gparams.cpp +++ b/src/util/gparams.cpp @@ -612,7 +612,7 @@ void gparams::reset() { } void gparams::set(char const * name, char const * value) { - TRACE("gparams", tout << "setting [" << name << "] <- '" << value << "'\n";); + TRACE(gparams, tout << "setting [" << name << "] <- '" << value << "'\n";); SASSERT(g_imp); g_imp->set(name, value); } @@ -654,7 +654,7 @@ params_ref gparams::get_module(char const * module_name) { params_ref const& gparams::get_ref() { - TRACE("gparams", tout << "gparams::get_ref()\n";); + TRACE(gparams, tout << "gparams::get_ref()\n";); SASSERT(g_imp); return g_imp->get_ref(); } @@ -689,13 +689,13 @@ void gparams::display_parameter(std::ostream & out, char const * name) { } void gparams::init() { - TRACE("gparams", tout << "gparams::init()\n";); + TRACE(gparams, tout << "gparams::init()\n";); ALLOC_MUTEX(gparams_mux); g_imp = alloc(imp); } void gparams::finalize() { - TRACE("gparams", tout << "gparams::finalize()\n";); + TRACE(gparams, tout << "gparams::finalize()\n";); dealloc(g_imp); DEALLOC_MUTEX(gparams_mux); } diff --git a/src/util/hwf.cpp b/src/util/hwf.cpp index e48934b5b..52ba28094 100644 --- a/src/util/hwf.cpp +++ b/src/util/hwf.cpp @@ -126,7 +126,7 @@ void hwf_manager::set(hwf & o, mpf_rounding_mode rm, char const * value) { f = (e_pos != std::string::npos) ? v.substr(0, e_pos) : v; e = (e_pos != std::string::npos) ? v.substr(e_pos+1) : "0"; - TRACE("mpf_dbg", tout << " f = " << f << " e = " << e << std::endl;); + TRACE(mpf_dbg, tout << " f = " << f << " e = " << e << std::endl;); mpq q; m_mpq_manager.set(q, f.c_str()); @@ -136,7 +136,7 @@ void hwf_manager::set(hwf & o, mpf_rounding_mode rm, char const * value) { set(o, rm, q, ex); - TRACE("mpf_dbg", tout << "set: res = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "set: res = " << to_string(o) << std::endl;); } void hwf_manager::set(hwf & o, mpf_rounding_mode rm, mpq const & significand, mpz const & exponent) { diff --git a/src/util/memory_manager.cpp b/src/util/memory_manager.cpp index 8c6bfc7e7..eddadb989 100644 --- a/src/util/memory_manager.cpp +++ b/src/util/memory_manager.cpp @@ -223,12 +223,12 @@ void memory::display_i_max_usage(std::ostream & os) { #if Z3DEBUG void memory::deallocate(char const * file, int line, void * p) { deallocate(p); - TRACE_CODE(if (!g_finalizing) TRACE("memory", tout << "dealloc " << std::hex << p << std::dec << " " << file << ":" << line << "\n";);); + TRACE_CODE(if (!g_finalizing) TRACE(memory, tout << "dealloc " << std::hex << p << std::dec << " " << file << ":" << line << "\n";);); } void * memory::allocate(char const* file, int line, char const* obj, size_t s) { void * r = allocate(s); - TRACE("memory", tout << "alloc " << std::hex << r << std::dec << " " << file << ":" << line << " " << obj << " " << s << "\n";); + TRACE(memory, tout << "alloc " << std::hex << r << std::dec << " " << file << ":" << line << " " << obj << " " << s << "\n";); return r; } #endif diff --git a/src/util/min_cut.cpp b/src/util/min_cut.cpp index b7c30f546..a21b7d4af 100644 --- a/src/util/min_cut.cpp +++ b/src/util/min_cut.cpp @@ -32,7 +32,7 @@ unsigned min_cut::new_node() { void min_cut::add_edge(unsigned int i, unsigned int j, unsigned capacity) { m_edges.reserve(i + 1); m_edges[i].push_back(edge(j, capacity)); - TRACE("spacer.mincut", tout << "adding edge (" << i << "," << j << ")\n";); + TRACE(spacer_mincut, tout << "adding edge (" << i << "," << j << ")\n";); } void min_cut::compute_min_cut(unsigned_vector& cut_nodes) { diff --git a/src/util/mpbq.cpp b/src/util/mpbq.cpp index 74b8deb49..2622dd140 100644 --- a/src/util/mpbq.cpp +++ b/src/util/mpbq.cpp @@ -163,7 +163,7 @@ void mpbq_manager::add(mpbq const & a, mpz const & b, mpbq & r) { normalize(r); #ifdef MPBQ_DEBUG rational _r = to_rational(r); - TRACE("mpbq_bug", tout << "add a: " << _a << ", b: " << _b << ", r: " << _r << ", expected: " << (_a + _b) << "\n";); + TRACE(mpbq_bug, tout << "add a: " << _a << ", b: " << _b << ", r: " << _r << ", expected: " << (_a + _b) << "\n";); SASSERT(_a + _b == _r); #endif } @@ -191,7 +191,7 @@ void mpbq_manager::sub(mpbq const & a, mpbq const & b, mpbq & r) { normalize(r); #ifdef MPBQ_DEBUG rational _r = to_rational(r); - TRACE("mpbq_bug", tout << "sub a: " << _a << ", b: " << _b << ", r: " << _r << ", expected: " << (_a - _b) << "\n";); + TRACE(mpbq_bug, tout << "sub a: " << _a << ", b: " << _b << ", r: " << _r << ", expected: " << (_a - _b) << "\n";); SASSERT(_a - _b == _r); #endif } @@ -750,7 +750,7 @@ bool mpbq_manager::select_small(mpbq const & lower, mpbq const & upper, mpbq & r void mpbq_manager::select_small_core(unsynch_mpq_manager & qm, mpq const & lower, mpbq const & upper, mpbq & r) { - TRACE("select_small", tout << "lower (q): " << qm.to_string(lower) << ", upper (bq): " << to_string(upper) << "\n";); + TRACE(select_small, tout << "lower (q): " << qm.to_string(lower) << ", upper (bq): " << to_string(upper) << "\n";); SASSERT(gt(upper, lower)); mpz & aux = m_select_small_tmp; if (select_integer(qm, lower, upper, aux)) { diff --git a/src/util/mpf.cpp b/src/util/mpf.cpp index da0e10571..0071843f4 100644 --- a/src/util/mpf.cpp +++ b/src/util/mpf.cpp @@ -68,7 +68,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, int value) { o.ebits = ebits; o.sbits = sbits; - TRACE("mpf_dbg", tout << "set: value = " << value << std::endl;); + TRACE(mpf_dbg, tout << "set: value = " << value << std::endl;); if (value == 0) { mk_pzero(ebits, sbits, o); } @@ -97,7 +97,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, int value) { m_mpz_manager.machine_div2k(o.significand, 32-sbits); } - TRACE("mpf_dbg", tout << "set: res = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "set: res = " << to_string(o) << std::endl;); } void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, int n, int d) { @@ -116,7 +116,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, double value) { int64_t e = ((raw & 0x7FF0000000000000ull) >> 52) - 1023; uint64_t s = raw & 0x000FFFFFFFFFFFFFull; - TRACE("mpf_dbg", tout << "set: " << value << " is: raw=" << raw << " (double)" << + TRACE(mpf_dbg, tout << "set: " << value << " is: raw=" << raw << " (double)" << " sign=" << sign << " s=" << s << " e=" << e << std::endl;); SASSERT(-1023 <= e && e <= +1024); @@ -139,7 +139,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, double value) { else if (sbits > 53) m_mpz_manager.mul2k(o.significand, sbits-53); - TRACE("mpf_dbg", tout << "set: res = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "set: res = " << to_string(o) << std::endl;); } void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, float value) { @@ -152,7 +152,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, float value) { signed int e = ((raw & 0x7F800000) >> 23) - 127; unsigned int s = raw & 0x007FFFFF; - TRACE("mpf_dbg", tout << "set: " << value << " is: raw=" << raw << " (float)" << + TRACE(mpf_dbg, tout << "set: " << value << " is: raw=" << raw << " (float)" << " sign=" << sign << " s=" << s << " e=" << e << std::endl;); SASSERT(-127 <= e && e <= +128); @@ -175,19 +175,19 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, float value) { else if (sbits > 24) m_mpz_manager.mul2k(o.significand, sbits-24); - TRACE("mpf_dbg", tout << "set: res = " << to_string_raw(o) << std::endl;); + TRACE(mpf_dbg, tout << "set: res = " << to_string_raw(o) << std::endl;); } void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, mpq const & value) { - TRACE("mpf_dbg", tout << "set: " << m_mpq_manager.to_string(value) << " [" << ebits << "/" << sbits << "]"<< std::endl;); + TRACE(mpf_dbg, tout << "set: " << m_mpq_manager.to_string(value) << " [" << ebits << "/" << sbits << "]"<< std::endl;); scoped_mpz exp(m_mpz_manager); m_mpz_manager.set(exp, 0); set(o, ebits, sbits, rm, exp, value); - TRACE("mpf_dbg", tout << "set: res = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "set: res = " << to_string(o) << std::endl;); } void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, char const * value) { - TRACE("mpf_dbg", tout << "set: " << value << " [" << ebits << "/" << sbits << "]"<< std::endl;); + TRACE(mpf_dbg, tout << "set: " << value << " [" << ebits << "/" << sbits << "]"<< std::endl;); o.ebits = ebits; o.sbits = sbits; @@ -209,7 +209,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode auto f = (e_pos != std::string_view::npos) ? std::string(v.substr(0, e_pos)) : std::string(v); auto e = (e_pos != std::string_view::npos) ? std::string(v.substr(e_pos+1)) : "0"; - TRACE("mpf_dbg", tout << "sgn = " << sgn << " f = " << f << " e = " << e << std::endl;); + TRACE(mpf_dbg, tout << "sgn = " << sgn << " f = " << f << " e = " << e << std::endl;); scoped_mpq q(m_mpq_manager); m_mpq_manager.set(q, f.c_str()); @@ -220,12 +220,12 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode set(o, ebits, sbits, rm, ex, q); o.sign = sgn; - TRACE("mpf_dbg", tout << "set: res = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "set: res = " << to_string(o) << std::endl;); } void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, mpz const & exponent, mpq const & significand) { // Assumption: this represents significand * 2^exponent. - TRACE("mpf_dbg", tout << "set: sig = " << m_mpq_manager.to_string(significand) << " exp = " << m_mpz_manager.to_string(exponent) << std::endl;); + TRACE(mpf_dbg, tout << "set: sig = " << m_mpq_manager.to_string(significand) << " exp = " << m_mpz_manager.to_string(exponent) << std::endl;); o.ebits = ebits; o.sbits = sbits; @@ -260,7 +260,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode m_mpz_manager.add(exp, mpz(pp), exp); } - TRACE("mpf_dbg", tout << "Normalized: sig = " << m_mpq_manager.to_string(sig) << + TRACE(mpf_dbg, tout << "Normalized: sig = " << m_mpq_manager.to_string(sig) << " exp = " << m_mpz_manager.to_string(exp) << std::endl;); // Check that 1.0 <= sig < 2.0 @@ -279,7 +279,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode if (!m_mpq_manager.is_zero(sig) && m_mpz_manager.is_even(o.significand)) m_mpz_manager.inc(o.significand); - TRACE("mpf_dbg", tout << "sig = " << m_mpz_manager.to_string(o.significand) << + TRACE(mpf_dbg, tout << "sig = " << m_mpz_manager.to_string(o.significand) << " exp = " << o.exponent << std::endl;); if (m_mpz_manager.is_small(exp)) { @@ -290,7 +290,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode mk_inf(ebits, sbits, o.sign, o); } - TRACE("mpf_dbg", tout << "set: res = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "set: res = " << to_string(o) << std::endl;); } void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, bool sign, mpf_exp_t exponent, uint64_t significand) { @@ -529,9 +529,9 @@ void mpf_manager::add_sub(mpf_rounding_mode rm, mpf const & x, mpf const & y, mp if (exp_delta > x.sbits+2) exp_delta = x.sbits+2; - TRACE("mpf_dbg", tout << "A = " << to_string(a) << std::endl;); - TRACE("mpf_dbg", tout << "B = " << to_string(b) << std::endl;); - TRACE("mpf_dbg", tout << "d = " << exp_delta << std::endl;); + TRACE(mpf_dbg, tout << "A = " << to_string(a) << std::endl;); + TRACE(mpf_dbg, tout << "B = " << to_string(b) << std::endl;); + TRACE(mpf_dbg, tout << "d = " << exp_delta << std::endl;); // Introduce 3 extra bits into both numbers. m_mpz_manager.mul2k(a.significand(), 3, a.significand()); @@ -542,32 +542,32 @@ void mpf_manager::add_sub(mpf_rounding_mode rm, mpf const & x, mpf const & y, mp scoped_mpz sticky_rem(m_mpz_manager); m_mpz_manager.machine_div_rem(b.significand(), m_powers2((int)exp_delta), b.significand(), sticky_rem); - TRACE("mpf_dbg", tout << "A' = " << m_mpz_manager.to_string(a.significand()) << std::endl;); - TRACE("mpf_dbg", tout << "B' = " << m_mpz_manager.to_string(b.significand()) << std::endl;); + TRACE(mpf_dbg, tout << "A' = " << m_mpz_manager.to_string(a.significand()) << std::endl;); + TRACE(mpf_dbg, tout << "B' = " << m_mpz_manager.to_string(b.significand()) << std::endl;); // Significand addition if (sgn(a) != sgn(b)) { - TRACE("mpf_dbg", tout << "SUBTRACTING" << std::endl;); + TRACE(mpf_dbg, tout << "SUBTRACTING" << std::endl;); m_mpz_manager.sub(a.significand(), b.significand(), o.significand); if (!sticky_rem.is_zero() && m_mpz_manager.is_even(o.significand)) m_mpz_manager.dec(o.significand); } else { - TRACE("mpf_dbg", tout << "ADDING" << std::endl;); + TRACE(mpf_dbg, tout << "ADDING" << std::endl;); m_mpz_manager.add(a.significand(), b.significand(), o.significand); if (!sticky_rem.is_zero() && m_mpz_manager.is_even(o.significand)) m_mpz_manager.inc(o.significand); } - TRACE("mpf_dbg", tout << "sum[-2:sbits+2] = " << m_mpz_manager.to_string(o.significand) << std::endl;); + TRACE(mpf_dbg, tout << "sum[-2:sbits+2] = " << m_mpz_manager.to_string(o.significand) << std::endl;); if (m_mpz_manager.is_zero(o.significand)) mk_zero(o.ebits, o.sbits, rm == MPF_ROUND_TOWARD_NEGATIVE, o); else { bool neg = m_mpz_manager.is_neg(o.significand); - TRACE("mpf_dbg", tout << "NEG=" << neg << std::endl;); + TRACE(mpf_dbg, tout << "NEG=" << neg << std::endl;); m_mpz_manager.abs(o.significand); - TRACE("mpf_dbg", tout << "fs[-1:sbits+2] = " << m_mpz_manager.to_string(o.significand) << std::endl;); + TRACE(mpf_dbg, tout << "fs[-1:sbits+2] = " << m_mpz_manager.to_string(o.significand) << std::endl;); o.sign = ((!a.sign() && b.sign() && neg) || ( a.sign() && !b.sign() && !neg) || ( a.sign() && b.sign())); @@ -578,13 +578,13 @@ void mpf_manager::add_sub(mpf_rounding_mode rm, mpf const & x, mpf const & y, mp } void mpf_manager::mul(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o) { - TRACE("mpf_mul_bug", tout << "rm: " << rm << "\n"; + TRACE(mpf_mul_bug, tout << "rm: " << rm << "\n"; tout << "X: " << to_string(x) << "\n"; tout << "Y: " << to_string(y) << "\n";); SASSERT(x.sbits == y.sbits && x.ebits == y.ebits); - TRACE("mpf_dbg", tout << "X = " << to_string(x) << std::endl;); - TRACE("mpf_dbg", tout << "Y = " << to_string(y) << std::endl;); + TRACE(mpf_dbg, tout << "X = " << to_string(x) << std::endl;); + TRACE(mpf_dbg, tout << "Y = " << to_string(y) << std::endl;); if (is_nan(x)) mk_nan(x.ebits, x.sbits, o); @@ -628,17 +628,17 @@ void mpf_manager::mul(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & unpack(a, true); unpack(b, true); - TRACE("mpf_dbg", tout << "A = " << to_string(a) << std::endl;); - TRACE("mpf_dbg", tout << "B = " << to_string(b) << std::endl;); + TRACE(mpf_dbg, tout << "A = " << to_string(a) << std::endl;); + TRACE(mpf_dbg, tout << "B = " << to_string(b) << std::endl;); o.exponent = a.exponent() + b.exponent(); - TRACE("mpf_dbg", tout << "A' = " << m_mpz_manager.to_string(a.significand()) << std::endl;); - TRACE("mpf_dbg", tout << "B' = " << m_mpz_manager.to_string(b.significand()) << std::endl;); + TRACE(mpf_dbg, tout << "A' = " << m_mpz_manager.to_string(a.significand()) << std::endl;); + TRACE(mpf_dbg, tout << "B' = " << m_mpz_manager.to_string(b.significand()) << std::endl;); m_mpz_manager.mul(a.significand(), b.significand(), o.significand); - TRACE("mpf_dbg", tout << "PRODUCT = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "PRODUCT = " << to_string(o) << std::endl;); // Remove the extra bits, keeping a sticky bit. scoped_mpz sticky_rem(m_mpz_manager); @@ -652,14 +652,14 @@ void mpf_manager::mul(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & round(rm, o); } - TRACE("mpf_mul_bug", tout << "result: " << to_string(o) << "\n";); + TRACE(mpf_mul_bug, tout << "result: " << to_string(o) << "\n";); } void mpf_manager::div(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o) { SASSERT(x.sbits == y.sbits && x.ebits == y.ebits); - TRACE("mpf_dbg", tout << "X = " << to_string(x) << std::endl;); - TRACE("mpf_dbg", tout << "Y = " << to_string(y) << std::endl;); + TRACE(mpf_dbg, tout << "X = " << to_string(x) << std::endl;); + TRACE(mpf_dbg, tout << "Y = " << to_string(y) << std::endl;); if (is_nan(x)) mk_nan(x.ebits, x.sbits, o); @@ -710,19 +710,19 @@ void mpf_manager::div(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & unpack(a, true); unpack(b, true); - TRACE("mpf_dbg", tout << "A = " << to_string(a) << std::endl;); - TRACE("mpf_dbg", tout << "B = " << to_string(b) << std::endl;); + TRACE(mpf_dbg, tout << "A = " << to_string(a) << std::endl;); + TRACE(mpf_dbg, tout << "B = " << to_string(b) << std::endl;); o.exponent = a.exponent() - b.exponent(); - TRACE("mpf_dbg", tout << "A' = " << m_mpz_manager.to_string(a.significand()) << std::endl;); - TRACE("mpf_dbg", tout << "B' = " << m_mpz_manager.to_string(b.significand()) << std::endl;); + TRACE(mpf_dbg, tout << "A' = " << m_mpz_manager.to_string(a.significand()) << std::endl;); + TRACE(mpf_dbg, tout << "B' = " << m_mpz_manager.to_string(b.significand()) << std::endl;); unsigned extra_bits = x.sbits + 2; m_mpz_manager.mul2k(a.significand(), x.sbits + extra_bits); m_mpz_manager.machine_div(a.significand(), b.significand(), o.significand); - TRACE("mpf_dbg", tout << "QUOTIENT = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "QUOTIENT = " << to_string(o) << std::endl;); // Remove the extra bits, keeping a sticky bit. scoped_mpz sticky_rem(m_mpz_manager); @@ -730,7 +730,7 @@ void mpf_manager::div(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & if (!m_mpz_manager.is_zero(sticky_rem) && m_mpz_manager.is_even(o.significand)) m_mpz_manager.inc(o.significand); - TRACE("mpf_dbg", tout << "QUOTIENT' = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "QUOTIENT' = " << to_string(o) << std::endl;); round(rm, o); } @@ -740,9 +740,9 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co SASSERT(x.sbits == y.sbits && x.ebits == y.ebits && x.sbits == z.sbits && x.ebits == z.ebits); - TRACE("mpf_dbg", tout << "X = " << to_string(x) << std::endl;); - TRACE("mpf_dbg", tout << "Y = " << to_string(y) << std::endl;); - TRACE("mpf_dbg", tout << "Z = " << to_string(z) << std::endl;); + TRACE(mpf_dbg, tout << "X = " << to_string(x) << std::endl;); + TRACE(mpf_dbg, tout << "Y = " << to_string(y) << std::endl;); + TRACE(mpf_dbg, tout << "Z = " << to_string(z) << std::endl;); if (is_nan(x) || is_nan(y) || is_nan(z)) mk_nan(x.ebits, x.sbits, o); @@ -801,7 +801,7 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co unpack(b, true); unpack(c, true); - TRACE("mpf_dbg", tout << "A = " << to_string(a) << std::endl; + TRACE(mpf_dbg, tout << "A = " << to_string(a) << std::endl; tout << "B = " << to_string(b) << std::endl; tout << "C = " << to_string(c) << std::endl; tout << "A = " << to_string_binary(a, 1, 0) << std::endl; @@ -818,7 +818,7 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co mr.set(x.ebits+2, 2*x.sbits-1, a.sign() != b.sign(), a.exponent() + b.exponent()); m_mpz_manager.mul(a.significand(), b.significand(), mr.significand()); - TRACE("mpf_dbg", tout << "M = " << to_string(mr) << std::endl; + TRACE(mpf_dbg, tout << "M = " << to_string(mr) << std::endl; tout << "M = " << to_string_binary(mr, 1, 0) << std::endl;); // mul_res is [-1][0].[2*sbits - 2], i.e., >= 2^(2*sbits-2) and < 2^(2*sbits). @@ -832,7 +832,7 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co mr.set(x.ebits + 2, 2 * x.sbits - 1 + 3, mr.sign(), mr.exponent(), mr.significand()); m_mpz_manager.mul2k(mr.significand(), 3); - TRACE("mpf_dbg", tout << "C_= " << to_string(c) << std::endl; + TRACE(mpf_dbg, tout << "C_= " << to_string(c) << std::endl; tout << "C_= " << to_string_binary(c, 1, 0) << std::endl;); SASSERT(m_mpz_manager.lt(c.significand(), m_powers2(2*x.sbits + 3))); @@ -840,7 +840,7 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co m_mpz_manager.ge(c.significand(), m_powers2(2*x.sbits - 2 + 3))); if (exp(c) > exp(mr)) { - TRACE("mpf_dbg", tout << "Swap!" << std::endl;); + TRACE(mpf_dbg, tout << "Swap!" << std::endl;); mr.swap(c); } @@ -855,20 +855,20 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co scoped_mpz sticky_rem(m_mpz_manager); m_mpz_manager.machine_div_rem(c.significand(), m_powers2(exp_delta), c.significand(), sticky_rem); - TRACE("mpf_dbg", tout << "alignment shift by delta=" << exp_delta << " -> sig = " << m_mpz_manager.to_string(c.significand()) << + TRACE(mpf_dbg, tout << "alignment shift by delta=" << exp_delta << " -> sig = " << m_mpz_manager.to_string(c.significand()) << " sticky_rem = " << m_mpz_manager.to_string(sticky_rem) << std::endl;); bool alignment_sticky = !m_mpz_manager.is_zero(sticky_rem); - TRACE("mpf_dbg", tout << "M'= " << m_mpz_manager.to_string(mr.significand()) << std::endl; + TRACE(mpf_dbg, tout << "M'= " << m_mpz_manager.to_string(mr.significand()) << std::endl; tout << "M'= " << to_string_binary(mr, 1, 0) << std::endl; ); - TRACE("mpf_dbg", tout << "C'= " << m_mpz_manager.to_string(c.significand()) << std::endl; + TRACE(mpf_dbg, tout << "C'= " << m_mpz_manager.to_string(c.significand()) << std::endl; tout << "C'= " << to_string_binary(c, 1, 0) << std::endl; ); // Significand addition scoped_mpf res(mr); if (sgn(mr) != sgn(c)) { - TRACE("mpf_dbg", tout << "SUBTRACTING" << std::endl;); + TRACE(mpf_dbg, tout << "SUBTRACTING" << std::endl;); m_mpz_manager.sub(mr.significand(), c.significand(), res.significand()); if (alignment_sticky && m_mpz_manager.is_even(res.significand())) @@ -880,14 +880,14 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co } } else { - TRACE("mpf_dbg", tout << "ADDING" << std::endl;); + TRACE(mpf_dbg, tout << "ADDING" << std::endl;); m_mpz_manager.add(mr.significand(), c.significand(), res.significand()); if (alignment_sticky && m_mpz_manager.is_even(res.significand())) m_mpz_manager.inc(res.get().significand); } - TRACE("mpf_dbg", tout << "S'= " << m_mpz_manager.to_string(res.significand()) << std::endl; + TRACE(mpf_dbg, tout << "S'= " << m_mpz_manager.to_string(res.significand()) << std::endl; tout << "S'= " << to_string_binary(res, 1, 0) << std::endl; ); // Renormalize @@ -899,7 +899,7 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co res.get().exponent++; renorm_sticky = !m_mpz_manager.is_even(res.significand()); m_mpz_manager.machine_div2k(res.significand(), 1); - TRACE("mpf_dbg", tout << "Add/Sub overflew into 4.xxx!" << std::endl; + TRACE(mpf_dbg, tout << "Add/Sub overflew into 4.xxx!" << std::endl; tout << "S*= " << to_string_binary(res, 2, 0) << std::endl;); } @@ -911,7 +911,7 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co res.get().exponent -= renorm_delta; m_mpz_manager.mul2k(res.significand(), renorm_delta); - TRACE("mpf_dbg", tout << "R*= " << to_string_binary(res, 2, 0) << " (renormalized, delta=" << renorm_delta << ")" << std::endl;); + TRACE(mpf_dbg, tout << "R*= " << to_string_binary(res, 2, 0) << " (renormalized, delta=" << renorm_delta << ")" << std::endl;); set(o, x.ebits, x.sbits, res.sign(), res.exponent(), mpz(0)); @@ -927,7 +927,7 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co if (renorm_sticky && m_mpz_manager.is_even(o.significand)) m_mpz_manager.inc(o.significand); - TRACE("mpf_dbg", tout << "sum[-1:sbits+2] = " << m_mpz_manager.to_string(o.significand) << std::endl; + TRACE(mpf_dbg, tout << "sum[-1:sbits+2] = " << m_mpz_manager.to_string(o.significand) << std::endl; tout << "R = " << to_string_binary(o, 1, 3) << std::endl;); unsigned max_size = o.sbits+4; @@ -944,7 +944,7 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co round(rm, o); } - TRACE("mpf_dbg", tout << "FMA = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "FMA = " << to_string(o) << std::endl;); } void my_mpz_sqrt(unsynch_mpz_manager & m, unsigned sbits, bool odd_exp, mpz & in, mpz & o) { @@ -965,18 +965,18 @@ void my_mpz_sqrt(unsynch_mpz_manager & m, unsigned sbits, bool odd_exp, mpz & in m.set(o, lower); while (m.neq(lower, upper)) { - STRACE("mpf_dbg", tout << "SIG = " << m.to_string(in) << + STRACE(mpf_dbg, tout << "SIG = " << m.to_string(in) << " LOWER = " << m.to_string(lower) << " UPPER = " << m.to_string(upper) << std::endl;); m.sub(upper, lower, diff); if (m.is_one(diff)) { m.mul(lower, lower, product); if (m.eq(product, in)) { - STRACE("mpf_dbg", tout << "choosing lower" << std::endl;); + STRACE(mpf_dbg, tout << "choosing lower" << std::endl;); m.set(o, lower); } else { - STRACE("mpf_dbg", tout << "choosing upper" << std::endl;); + STRACE(mpf_dbg, tout << "choosing upper" << std::endl;); m.set(o, upper); // choosing upper is like a sticky bit here. } break; @@ -986,7 +986,7 @@ void my_mpz_sqrt(unsynch_mpz_manager & m, unsigned sbits, bool odd_exp, mpz & in m.machine_div2k(mid, 1); m.mul(mid, mid, product); - STRACE("mpf_dbg", tout << "MID = " << m.to_string(mid) << + STRACE(mpf_dbg, tout << "MID = " << m.to_string(mid) << " PROD = " << m.to_string(product) << std::endl;); if (m.lt(product, in)) @@ -1004,7 +1004,7 @@ void my_mpz_sqrt(unsynch_mpz_manager & m, unsigned sbits, bool odd_exp, mpz & in void mpf_manager::sqrt(mpf_rounding_mode rm, mpf const & x, mpf & o) { SASSERT(x.ebits > 0 && x.sbits > 0); - TRACE("mpf_dbg", tout << "X = " << to_string(x) << std::endl;); + TRACE(mpf_dbg, tout << "X = " << to_string(x) << std::endl;); if (is_nan(x)) mk_nan(x.ebits, x.sbits, o); @@ -1023,7 +1023,7 @@ void mpf_manager::sqrt(mpf_rounding_mode rm, mpf const & x, mpf & o) { set(a, x); unpack(a, true); - TRACE("mpf_dbg", tout << "A = " << to_string(a) << std::endl;); + TRACE(mpf_dbg, tout << "A = " << to_string(a) << std::endl;); m_mpz_manager.mul2k(a.significand(), x.sbits + ((a.exponent() % 2)?6:7)); if (!m_mpz_manager.root(a.significand(), 2, o.significand)) @@ -1032,7 +1032,7 @@ void mpf_manager::sqrt(mpf_rounding_mode rm, mpf const & x, mpf & o) { // We need a sticky bit in the last position here, so we fix that. if (m_mpz_manager.is_even(o.significand)) m_mpz_manager.dec(o.significand); - TRACE("mpf_dbg", tout << "dec'ed " << m_mpz_manager.to_string(o.significand) << std::endl;); + TRACE(mpf_dbg, tout << "dec'ed " << m_mpz_manager.to_string(o.significand) << std::endl;); } o.exponent = a.exponent() >> 1; if (a.exponent() % 2 == 0) o.exponent--; @@ -1040,13 +1040,13 @@ void mpf_manager::sqrt(mpf_rounding_mode rm, mpf const & x, mpf & o) { round(rm, o); } - TRACE("mpf_dbg", tout << "SQRT = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "SQRT = " << to_string(o) << std::endl;); } void mpf_manager::round_to_integral(mpf_rounding_mode rm, mpf const & x, mpf & o) { SASSERT(x.ebits > 0 && x.sbits > 0); - TRACE("mpf_dbg", tout << "X = " << to_string(x) << std::endl;); + TRACE(mpf_dbg, tout << "X = " << to_string(x) << std::endl;); if (is_nan(x)) mk_nan(x.ebits, x.sbits, o); @@ -1072,7 +1072,7 @@ void mpf_manager::round_to_integral(mpf_rounding_mode rm, mpf const & x, mpf & o else { SASSERT(rm == MPF_ROUND_NEAREST_TEVEN || rm == MPF_ROUND_NEAREST_TAWAY); bool tie = m_mpz_manager.is_zero(x.significand) && x.exponent == -1; - TRACE("mpf_dbg", tout << "tie = " << tie << std::endl;); + TRACE(mpf_dbg, tout << "tie = " << tie << std::endl;); if (tie && rm == MPF_ROUND_NEAREST_TEVEN) mk_zero(x.ebits, x.sbits, x.sign, o); else if (tie && rm == MPF_ROUND_NEAREST_TAWAY) @@ -1096,7 +1096,7 @@ void mpf_manager::round_to_integral(mpf_rounding_mode rm, mpf const & x, mpf & o set(a, x); unpack(a, true); // A includes hidden bit - TRACE("mpf_dbg", tout << "A = " << to_string_raw(a) << std::endl;); + TRACE(mpf_dbg, tout << "A = " << to_string_raw(a) << std::endl;); SASSERT(m_mpz_manager.lt(a.significand(), m_powers2(x.sbits))); SASSERT(m_mpz_manager.ge(a.significand(), m_powers2(x.sbits - 1))); @@ -1107,12 +1107,12 @@ void mpf_manager::round_to_integral(mpf_rounding_mode rm, mpf const & x, mpf & o unsigned shift = (o.sbits - 1) - ((unsigned)o.exponent); const mpz & shift_p = m_powers2(shift); const mpz & shiftm1_p = m_powers2(shift-1); - TRACE("mpf_dbg", tout << "shift=" << shift << std::endl;); - TRACE("mpf_dbg", tout << "shiftm1_p=" << m_mpz_manager.to_string(shiftm1_p) << std::endl;); + TRACE(mpf_dbg, tout << "shift=" << shift << std::endl;); + TRACE(mpf_dbg, tout << "shiftm1_p=" << m_mpz_manager.to_string(shiftm1_p) << std::endl;); scoped_mpz div(m_mpz_manager), rem(m_mpz_manager); m_mpz_manager.machine_div_rem(o.significand, shift_p, div, rem); - TRACE("mpf_dbg", tout << "div=" << m_mpz_manager.to_string(div) << " rem=" << m_mpz_manager.to_string(rem) << std::endl;); + TRACE(mpf_dbg, tout << "div=" << m_mpz_manager.to_string(div) << " rem=" << m_mpz_manager.to_string(rem) << std::endl;); switch (rm) { case MPF_ROUND_NEAREST_TEVEN: @@ -1121,11 +1121,11 @@ void mpf_manager::round_to_integral(mpf_rounding_mode rm, mpf const & x, mpf & o bool less_than_tie = m_mpz_manager.lt(rem, shiftm1_p); bool more_than_tie = m_mpz_manager.gt(rem, shiftm1_p); (void)less_than_tie; - TRACE("mpf_dbg", tout << "tie= " << tie << "; tie = " << more_than_tie << std::endl;); + TRACE(mpf_dbg, tout << "tie= " << tie << "; tie = " << more_than_tie << std::endl;); if (tie) { if ((rm == MPF_ROUND_NEAREST_TEVEN && m_mpz_manager.is_odd(div)) || (rm == MPF_ROUND_NEAREST_TAWAY)) { - TRACE("mpf_dbg", tout << "div++ (1)" << std::endl;); + TRACE(mpf_dbg, tout << "div++ (1)" << std::endl;); m_mpz_manager.inc(div); } } @@ -1133,7 +1133,7 @@ void mpf_manager::round_to_integral(mpf_rounding_mode rm, mpf const & x, mpf & o SASSERT(less_than_tie || more_than_tie); if (more_than_tie) { m_mpz_manager.inc(div); - TRACE("mpf_dbg", tout << "div++ (2)" << std::endl;); + TRACE(mpf_dbg, tout << "div++ (2)" << std::endl;); } } break; @@ -1163,7 +1163,7 @@ void mpf_manager::round_to_integral(mpf_rounding_mode rm, mpf const & x, mpf & o m_mpz_manager.sub(o.significand, m_powers2(o.sbits - 1), o.significand); // strip hidden bit } - TRACE("mpf_dbg", tout << "INTEGRAL = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "INTEGRAL = " << to_string(o) << std::endl;); } void mpf_manager::to_mpz(mpf const & x, unsynch_mpz_manager & zm, mpz & o) { @@ -1213,7 +1213,7 @@ void mpf_manager::to_sbv_mpq(mpf_rounding_mode rm, const mpf & x, scoped_mpq & o default: UNREACHABLE(); } if (inc) m_mpz_manager.inc(z); - TRACE("mpf_dbg_sbv", + TRACE(mpf_dbg_sbv, tout << "SBV: (" << to_string(x) << ") == " << m_mpq_manager.to_string(z) << std::endl; tout << "sign=" << t.sign() << " last=" << last << " round=" << round << " sticky=" << sticky << " inc=" << inc << std::endl; ); @@ -1224,7 +1224,7 @@ void mpf_manager::to_sbv_mpq(mpf_rounding_mode rm, const mpf & x, scoped_mpq & o m_mpq_manager.set(o, z); if (x.sign) m_mpq_manager.neg(o); - TRACE("mpf_dbg", tout << "SBV = " << m_mpq_manager.to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "SBV = " << m_mpq_manager.to_string(o) << std::endl;); } void mpf_manager::to_ieee_bv_mpz(const mpf & x, scoped_mpz & o) { @@ -1251,7 +1251,7 @@ void mpf_manager::to_ieee_bv_mpz(const mpf & x, scoped_mpz & o) { m_mpz_manager.add(o, sig(x), o); } - TRACE("mpf_dbg", tout << "IEEE_BV = " << m_mpz_manager.to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "IEEE_BV = " << m_mpz_manager.to_string(o) << std::endl;); } void mpf_manager::renormalize(unsigned ebits, unsigned sbits, mpf_exp_t & exp, mpz & sig) { @@ -1281,7 +1281,7 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex signed int D = (signed int)(exp_diff); mpf_exp_t N = sbits-1; - TRACE("mpf_dbg_rem", tout << "x=" << to_string(x) << std::endl; + TRACE(mpf_dbg_rem, tout << "x=" << to_string(x) << std::endl; tout << "y=" << to_string(y) << std::endl; tout << "d=" << D << std::endl; tout << "partial=" << partial << std::endl;); @@ -1300,7 +1300,7 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex m_mpz_manager.machine_div_rem(x_sig_shifted, y.significand, x_div_y_sig_lrg, x_div_y_rem); // rem useful? // x/y is in x_diuv_y_sig_lrg and has sbits+3 extra bits. - TRACE("mpf_dbg_rem", tout << "X/Y_exp=" << x_div_y_exp << std::endl; + TRACE(mpf_dbg_rem, tout << "X/Y_exp=" << x_div_y_exp << std::endl; tout << "X/Y_sig_lrg=" << m_mpz_manager.to_string(x_div_y_sig_lrg) << std::endl; tout << "X/Y_rem=" << m_mpz_manager.to_string(x_div_y_rem) << std::endl; tout << "X/Y~=" << to_string_hexfloat(x_div_y_sgn, x_div_y_exp, x_div_y_sig_lrg, ebits, sbits, sbits+3) << std::endl;); @@ -1321,7 +1321,7 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex const mpz & shiftm1_p = m_powers2(Q_shft-1); bool tie = m_mpz_manager.eq(Q_rem, shiftm1_p); bool more_than_tie = m_mpz_manager.gt(Q_rem, shiftm1_p); - TRACE("mpf_dbg_rem", tout << "tie= " << tie << "; >tie= " << more_than_tie << std::endl;); + TRACE(mpf_dbg_rem, tout << "tie= " << tie << "; >tie= " << more_than_tie << std::endl;); if ((tie && m_mpz_manager.is_odd(Q_sig)) || more_than_tie) m_mpz_manager.inc(Q_sig); } @@ -1330,7 +1330,7 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex renormalize(ebits, sbits, Q_exp, Q_sig); (void)Q_sgn; - TRACE("mpf_dbg_rem", tout << "Q_exp=" << Q_exp << std::endl; + TRACE(mpf_dbg_rem, tout << "Q_exp=" << Q_exp << std::endl; tout << "Q_sig=" << m_mpz_manager.to_string(Q_sig) << std::endl; tout << "Q=" << to_string_hexfloat(Q_sgn, Q_exp, Q_sig, ebits, sbits, 0) << std::endl;); @@ -1351,7 +1351,7 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex renormalize(ebits, 2*sbits-1, YQ_exp, YQ_sig); // YQ_sig has `sbits-1' extra bits. (void)YQ_sgn; - TRACE("mpf_dbg_rem", tout << "YQ_sgn=" << YQ_sgn << std::endl; + TRACE(mpf_dbg_rem, tout << "YQ_sgn=" << YQ_sgn << std::endl; tout << "YQ_exp=" << YQ_exp << std::endl; tout << "YQ_sig=" << m_mpz_manager.to_string(YQ_sig) << std::endl; tout << "YQ=" << to_string_hexfloat(YQ_sgn, YQ_exp, YQ_sig, ebits, sbits, sbits-1) << std::endl;); @@ -1364,7 +1364,7 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex mpf_exp_t X_YQ_exp = x.exponent; scoped_mpz X_YQ_sig(m_mpz_manager); mpf_exp_t exp_delta = exp(x) - YQ_exp; - TRACE("mpf_dbg_rem", tout << "exp_delta=" << exp_delta << std::endl;); + TRACE(mpf_dbg_rem, tout << "exp_delta=" << exp_delta << std::endl;); SASSERT(INT_MIN < exp_delta && exp_delta <= INT_MAX); scoped_mpz minuend(m_mpz_manager), subtrahend(m_mpz_manager); @@ -1393,11 +1393,11 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex } if (!m_mpz_manager.is_zero(sticky_rem) && m_mpz_manager.is_even(subtrahend)) m_mpz_manager.inc(subtrahend); - TRACE("mpf_dbg_rem", tout << "aligned subtrahend=" << m_mpz_manager.to_string(subtrahend) << std::endl;); + TRACE(mpf_dbg_rem, tout << "aligned subtrahend=" << m_mpz_manager.to_string(subtrahend) << std::endl;); } m_mpz_manager.sub(minuend, subtrahend, X_YQ_sig); - TRACE("mpf_dbg_rem", tout << "X_YQ_sig'=" << m_mpz_manager.to_string(X_YQ_sig) << std::endl;); + TRACE(mpf_dbg_rem, tout << "X_YQ_sig'=" << m_mpz_manager.to_string(X_YQ_sig) << std::endl;); bool neg = m_mpz_manager.is_neg(X_YQ_sig); if (neg) m_mpz_manager.neg(X_YQ_sig); @@ -1409,7 +1409,7 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex else { renormalize(ebits, 2*sbits-1, X_YQ_exp, X_YQ_sig); - TRACE("mpf_dbg_rem", tout << "minuend=" << m_mpz_manager.to_string(minuend) << std::endl; + TRACE(mpf_dbg_rem, tout << "minuend=" << m_mpz_manager.to_string(minuend) << std::endl; tout << "subtrahend=" << m_mpz_manager.to_string(subtrahend) << std::endl; tout << "X_YQ_sgn=" << X_YQ_sgn << std::endl; tout << "X_YQ_exp=" << X_YQ_exp << std::endl; @@ -1420,7 +1420,7 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex SASSERT(m_mpz_manager.lt(X_YQ_sig, m_powers2(2*sbits-1))); scoped_mpz rnd_bits(m_mpz_manager); m_mpz_manager.machine_div_rem(X_YQ_sig, m_powers2(sbits-1), X_YQ_sig, rnd_bits); - TRACE("mpf_dbg_rem", tout << "final sticky=" << m_mpz_manager.to_string(rnd_bits) << std::endl; ); + TRACE(mpf_dbg_rem, tout << "final sticky=" << m_mpz_manager.to_string(rnd_bits) << std::endl; ); // Round to nearest, ties to even. if (m_mpz_manager.eq(rnd_bits, mpz(32))) { // tie. @@ -1434,13 +1434,13 @@ void mpf_manager::partial_remainder(mpf & x, mpf const & y, mpf_exp_t const & ex set(x, ebits, sbits, X_YQ_sgn, X_YQ_exp, X_YQ_sig); } - TRACE("mpf_dbg_rem", tout << "partial remainder = " << to_string_hexfloat(x) << std::endl;); + TRACE(mpf_dbg_rem, tout << "partial remainder = " << to_string_hexfloat(x) << std::endl;); } void mpf_manager::rem(mpf const & x, mpf const & y, mpf & o) { SASSERT(x.sbits == y.sbits && x.ebits == y.ebits); - TRACE("mpf_dbg_rem", tout << "X = " << to_string(x) << "=" << to_string_hexfloat(x) << std::endl; + TRACE(mpf_dbg_rem, tout << "X = " << to_string(x) << "=" << to_string_hexfloat(x) << std::endl; tout << "Y = " << to_string(y) << "=" << to_string_hexfloat(y) << std::endl;); if (is_nan(x) || is_nan(y)) @@ -1482,8 +1482,8 @@ void mpf_manager::rem(mpf const & x, mpf const & y, mpf & o) { round(MPF_ROUND_NEAREST_TEVEN, o); } - TRACE("mpf_dbg_rem", tout << "R = " << to_string(o) << "=" << to_string_hexfloat(o) << std::endl; ); - TRACE("mpf_dbg", tout << "REMAINDER = " << to_string(o) << std::endl;); + TRACE(mpf_dbg_rem, tout << "R = " << to_string(o) << "=" << to_string_hexfloat(o) << std::endl; ); + TRACE(mpf_dbg, tout << "REMAINDER = " << to_string(o) << std::endl;); } void mpf_manager::maximum(mpf const & x, mpf const & y, mpf & o) { @@ -1546,10 +1546,10 @@ std::string mpf_manager::to_string(mpf const & x) { m_mpz_manager.add(num, sig(x), num); m_mpz_manager.mul2k(denom, x.sbits-1, denom); - //TRACE("mpf_dbg", tout << "SIG=" << m_mpq_manager.to_string(sig(x)) << std::endl; ); - //TRACE("mpf_dbg", tout << "NUM=" << m_mpq_manager.to_string(num) << std::endl;); - //TRACE("mpf_dbg", tout << "DEN=" << m_mpq_manager.to_string(denom) << std::endl;); - //TRACE("mpf_dbg", tout << "EXP=" << exponent << std::endl;); + //TRACE(mpf_dbg, tout << "SIG=" << m_mpq_manager.to_string(sig(x)) << std::endl; ); + //TRACE(mpf_dbg, tout << "NUM=" << m_mpq_manager.to_string(num) << std::endl;); + //TRACE(mpf_dbg, tout << "DEN=" << m_mpq_manager.to_string(denom) << std::endl;); + //TRACE(mpf_dbg, tout << "EXP=" << exponent << std::endl;); scoped_mpq r(m_mpq_manager); m_mpq_manager.set(r, num); @@ -1918,7 +1918,7 @@ void mpf_manager::mk_ninf(unsigned ebits, unsigned sbits, mpf & o) { } void mpf_manager::unpack(mpf & o, bool normalize) { - TRACE("mpf_dbg", tout << "unpack " << to_string(o) << ": ebits=" << + TRACE(mpf_dbg, tout << "unpack " << to_string(o) << ": ebits=" << o.ebits << " sbits=" << o.sbits << " normalize=" << normalize << " has_top_exp=" << has_top_exp(o) << " (" << mk_top_exp(o.ebits) << ")" << @@ -1962,7 +1962,7 @@ void mpf_manager::round(mpf_rounding_mode rm, mpf & o) { // Assumptions: o.significand is of the form f[-1:0] . f[1:sbits-1] [round,extra,sticky], // i.e., it has 2 + (sbits-1) + 3 = sbits + 4 bits. - TRACE("mpf_dbg", tout << "RND: " << to_string(o) << std::endl; + TRACE(mpf_dbg, tout << "RND: " << to_string(o) << std::endl; tout << to_string_binary(o, 1, 3) << std::endl;); DEBUG_CODE({ @@ -1995,7 +1995,7 @@ void mpf_manager::round(mpf_rounding_mode rm, mpf & o) { if (m_mpz_manager.lt(sigma, sigma_cap)) m_mpz_manager.set(sigma, sigma_cap); - TRACE("mpf_dbg", tout << "e_min_norm = " << e_min << std::endl; + TRACE(mpf_dbg, tout << "e_min_norm = " << e_min << std::endl; tout << "e_max_norm = " << e_max << std::endl; tout << "beta = " << beta << ", (beta < e_min) = " << (beta < e_min) << std::endl; tout << "LZ = " << lz << std::endl; @@ -2004,7 +2004,7 @@ void mpf_manager::round(mpf_rounding_mode rm, mpf & o) { // Normalization shift - TRACE("mpf_dbg", tout << "Shift distance: " << m_mpz_manager.to_string(sigma) << " " << ((m_mpz_manager.is_nonneg(sigma))?"(LEFT)":"(RIGHT)") << std::endl;); + TRACE(mpf_dbg, tout << "Shift distance: " << m_mpz_manager.to_string(sigma) << " " << ((m_mpz_manager.is_nonneg(sigma))?"(LEFT)":"(RIGHT)") << std::endl;); if (m_mpz_manager.le(sigma, -1)) { // Right shift @@ -2021,7 +2021,7 @@ void mpf_manager::round(mpf_rounding_mode rm, mpf & o) { m_mpz_manager.mul2k(o.significand, sigma_uint, o.significand); } - TRACE("mpf_dbg", tout << "Shifted: " << to_string(o) << std::endl; + TRACE(mpf_dbg, tout << "Shifted: " << to_string(o) << std::endl; tout << to_string_binary(o, 1, 3) << std::endl;); // Significand rounding (sigrd) @@ -2035,8 +2035,8 @@ void mpf_manager::round(mpf_rounding_mode rm, mpf & o) { bool last = !m_mpz_manager.is_even(o.significand); - TRACE("mpf_dbg", tout << "sign=" << o.sign << " last=" << last << " round=" << round << " sticky=" << sticky << std::endl;); - TRACE("mpf_dbg", tout << "before rounding decision: " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "sign=" << o.sign << " last=" << last << " round=" << round << " sticky=" << sticky << std::endl;); + TRACE(mpf_dbg, tout << "before rounding decision: " << to_string(o) << std::endl;); // The significand has the right size now, but we might have to increment it // depending on the sign, the last/round/sticky bits, and the rounding mode. @@ -2050,11 +2050,11 @@ void mpf_manager::round(mpf_rounding_mode rm, mpf & o) { default: UNREACHABLE(); } - TRACE("mpf_dbg", tout << "Rounding increment -> significand +" << (int)inc << std::endl;); + TRACE(mpf_dbg, tout << "Rounding increment -> significand +" << (int)inc << std::endl;); if (inc) m_mpz_manager.inc(o.significand); - TRACE("mpf_dbg", tout << "Rounded significand: " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "Rounded significand: " << to_string(o) << std::endl;); // Post normalization (post) @@ -2065,16 +2065,16 @@ void mpf_manager::round(mpf_rounding_mode rm, mpf & o) { } bool SIGovf = o.exponent > e_max; - TRACE("mpf_dbg", tout << "Post-normalized: " << to_string(o) << std::endl;); - TRACE("mpf_dbg", tout << "SIGovf = " << SIGovf << std::endl;); + TRACE(mpf_dbg, tout << "Post-normalized: " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "SIGovf = " << SIGovf << std::endl;); // Exponent rounding (exprd) bool o_has_max_exp = (o.exponent > e_max); bool OVF2 = SIGovf && o_has_max_exp; - TRACE("mpf_dbg", tout << "OVF2 = " << OVF2 << std::endl;); - TRACE("mpf_dbg", tout << "o_has_max_exp = " << o_has_max_exp << std::endl;); + TRACE(mpf_dbg, tout << "OVF2 = " << OVF2 << std::endl;); + TRACE(mpf_dbg, tout << "o_has_max_exp = " << o_has_max_exp << std::endl;); if (OVF2) mk_round_inf(rm, o); @@ -2082,21 +2082,21 @@ void mpf_manager::round(mpf_rounding_mode rm, mpf & o) { const mpz & p = m_powers2(o.sbits-1); if (m_mpz_manager.ge(o.significand, p)) { - TRACE("mpf_dbg", tout << "NORMAL: " << m_mpz_manager.to_string(o.significand) << std::endl;); + TRACE(mpf_dbg, tout << "NORMAL: " << m_mpz_manager.to_string(o.significand) << std::endl;); m_mpz_manager.sub(o.significand, p, o.significand); // Strips the hidden bit. } else { - TRACE("mpf_dbg", tout << "DENORMAL: " << m_mpz_manager.to_string(o.significand) << std::endl;); + TRACE(mpf_dbg, tout << "DENORMAL: " << m_mpz_manager.to_string(o.significand) << std::endl;); o.exponent = mk_bot_exp(o.ebits); } } - TRACE("mpf_dbg", tout << "ROUNDED = " << to_string(o) << std::endl; + TRACE(mpf_dbg, tout << "ROUNDED = " << to_string(o) << std::endl; tout << to_string_binary(o, -1, 0) << " (hidden bit, unbiased exp)." << std::endl;); } void mpf_manager::round_sqrt(mpf_rounding_mode rm, mpf & o) { - TRACE("mpf_dbg", tout << "RND-SQRT: " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "RND-SQRT: " << to_string(o) << std::endl;); bool sticky = !m_mpz_manager.is_even(o.significand); m_mpz_manager.machine_div2k(o.significand, 1); @@ -2118,14 +2118,14 @@ void mpf_manager::round_sqrt(mpf_rounding_mode rm, mpf & o) { default: UNREACHABLE(); } - TRACE("mpf_dbg", tout << "last=" << last << " round=" << round << " sticky=" << sticky << " --> inc=" << inc << std::endl;); + TRACE(mpf_dbg, tout << "last=" << last << " round=" << round << " sticky=" << sticky << " --> inc=" << inc << std::endl;); if (inc) m_mpz_manager.inc(o.significand); m_mpz_manager.sub(o.significand, m_powers2(o.sbits-1), o.significand); - TRACE("mpf_dbg", tout << "ROUNDED = " << to_string(o) << std::endl;); + TRACE(mpf_dbg, tout << "ROUNDED = " << to_string(o) << std::endl;); } unsigned mpf_manager::prev_power_of_two(mpf const & a) { diff --git a/src/util/mpff.cpp b/src/util/mpff.cpp index 41dee21ab..c55e69c19 100644 --- a/src/util/mpff.cpp +++ b/src/util/mpff.cpp @@ -326,13 +326,13 @@ void mpff_manager::set(mpff & n, mpff const & v) { template void mpff_manager::set_core(mpff & n, mpz_manager & m, mpz const & v) { - TRACE("mpff", tout << "mpz->mpff\n"; m.display(tout, v); tout << "\n";); + TRACE(mpff, tout << "mpz->mpff\n"; m.display(tout, v); tout << "\n";); if (m.is_int64(v)) { - TRACE("mpff", tout << "is_int64 " << m.get_int64(v) << "\n";); + TRACE(mpff, tout << "is_int64 " << m.get_int64(v) << "\n";); set(n, m.get_int64(v)); } else if (m.is_uint64(v)) { - TRACE("mpff", tout << "is_uint64\n";); + TRACE(mpff, tout << "is_uint64\n";); set(n, m.get_uint64(v)); } else { @@ -342,7 +342,7 @@ void mpff_manager::set_core(mpff & n, mpz_manager & m, mpz const & v) { while (w.size() < m_precision) { w.push_back(0); } - TRACE("mpff", tout << "w words: "; for (unsigned i = 0; i < w.size(); i++) tout << w[i] << " "; tout << "\n";); + TRACE(mpff, tout << "w words: "; for (unsigned i = 0; i < w.size(); i++) tout << w[i] << " "; tout << "\n";); unsigned w_sz = w.size(); SASSERT(w_sz >= m_precision); unsigned num_leading_zeros = nlz(w_sz, w.data()); @@ -368,7 +368,7 @@ void mpff_manager::set_core(mpff & n, mpz_manager & m, mpz const & v) { // it is precise } } - TRACE("mpff", tout << "mpz->mpff result:\n"; display_raw(tout, n); tout << "\n";); + TRACE(mpff, tout << "mpz->mpff result:\n"; display_raw(tout, n); tout << "\n";); SASSERT(check(n)); } @@ -422,14 +422,14 @@ bool mpff_manager::eq(mpff const & a, mpff const & b) const { } bool mpff_manager::lt(mpff const & a, mpff const & b) const { - STRACE("mpff_trace", tout << "[mpff] ("; display(tout, a); tout << " < "; display(tout, b); tout << ") == ";); + STRACE(mpff_trace, tout << "[mpff] ("; display(tout, a); tout << " < "; display(tout, b); tout << ") == ";); if (is_zero(a)) { if (is_zero(b) || is_neg(b)) { - STRACE("mpff_trace", tout << "(1 == 0)\n";); + STRACE(mpff_trace, tout << "(1 == 0)\n";); return false; } else { - STRACE("mpff_trace", tout << "(1 == 1)\n";); + STRACE(mpff_trace, tout << "(1 == 1)\n";); SASSERT(is_pos(b)); return true; } @@ -437,12 +437,12 @@ bool mpff_manager::lt(mpff const & a, mpff const & b) const { if (is_zero(b)) { SASSERT(!is_zero(a)); if (is_neg(a)) { - STRACE("mpff_trace", tout << "(1 == 1)\n";); + STRACE(mpff_trace, tout << "(1 == 1)\n";); return true; } else { SASSERT(is_pos(a)); - STRACE("mpff_trace", tout << "(1 == 0)\n";); + STRACE(mpff_trace, tout << "(1 == 0)\n";); return false; } } @@ -450,26 +450,26 @@ bool mpff_manager::lt(mpff const & a, mpff const & b) const { SASSERT(!is_zero(b)); if (a.m_sign == 1) { if (b.m_sign == 0) { - STRACE("mpff_trace", tout << "(1 == 1)\n";); + STRACE(mpff_trace, tout << "(1 == 1)\n";); return true; // neg < pos } // case: neg neg bool r = b.m_exponent < a.m_exponent || (a.m_exponent == b.m_exponent && ::lt(m_precision, sig(b), sig(a))); - STRACE("mpff_trace", tout << "(" << r << " == 1)\n";); + STRACE(mpff_trace, tout << "(" << r << " == 1)\n";); return r; } else { if (b.m_sign == 1) { - STRACE("mpff_trace", tout << "(1 == 0)\n";); + STRACE(mpff_trace, tout << "(1 == 0)\n";); return false; // pos < neg } // case: pos pos bool r = a.m_exponent < b.m_exponent || (a.m_exponent == b.m_exponent && ::lt(m_precision, sig(a), sig(b))); - STRACE("mpff_trace", tout << "(" << r << " == 1)\n";); + STRACE(mpff_trace, tout << "(" << r << " == 1)\n";); return r; } } @@ -647,7 +647,7 @@ void mpff_manager::add_sub(bool is_sub, mpff const & a, mpff const & b, mpff & c return; } - TRACE("mpff", tout << (is_sub ? "sub" : "add") << "("; display(tout, a); tout << ", "; display(tout, b); tout << ")\n";); + TRACE(mpff, tout << (is_sub ? "sub" : "add") << "("; display(tout, a); tout << ", "; display(tout, b); tout << ")\n";); // Remark: any result returned by sig(...) may be invalid after a call to allocate_if_needed() // So, we must invoke allocate_if_needed(c) before we invoke sig(a) and sig(b). @@ -766,30 +766,30 @@ void mpff_manager::add_sub(bool is_sub, mpff const & a, mpff const & b, mpff & c c.m_exponent = exp_a; } } - TRACE("mpff", tout << "result: "; display(tout, c); tout << "\n";); + TRACE(mpff, tout << "result: "; display(tout, c); tout << "\n";); SASSERT(check(c)); } void mpff_manager::add(mpff const & a, mpff const & b, mpff & c) { - STRACE("mpff_trace", tout << "[mpff] "; display(tout, a); tout << " + "; display(tout, b); tout << " " << (m_to_plus_inf ? "<=" : ">=") << " ";); + STRACE(mpff_trace, tout << "[mpff] "; display(tout, a); tout << " + "; display(tout, b); tout << " " << (m_to_plus_inf ? "<=" : ">=") << " ";); add_sub(false, a, b, c); - STRACE("mpff_trace", display(tout, c); tout << "\n";); + STRACE(mpff_trace, display(tout, c); tout << "\n";); } void mpff_manager::sub(mpff const & a, mpff const & b, mpff & c) { - STRACE("mpff_trace", tout << "[mpff] "; display(tout, a); tout << " - "; display(tout, b); tout << " " << (m_to_plus_inf ? "<=" : ">=") << " ";); + STRACE(mpff_trace, tout << "[mpff] "; display(tout, a); tout << " - "; display(tout, b); tout << " " << (m_to_plus_inf ? "<=" : ">=") << " ";); add_sub(true, a, b, c); - STRACE("mpff_trace", display(tout, c); tout << "\n";); + STRACE(mpff_trace, display(tout, c); tout << "\n";); } void mpff_manager::mul(mpff const & a, mpff const & b, mpff & c) { - STRACE("mpff_trace", tout << "[mpff] ("; display(tout, a); tout << ") * ("; display(tout, b); tout << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); + STRACE(mpff_trace, tout << "[mpff] ("; display(tout, a); tout << ") * ("; display(tout, b); tout << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); if (is_zero(a) || is_zero(b)) { reset(c); } else { allocate_if_needed(c); - TRACE("mpff", tout << "mul("; display(tout, a); tout << ", "; display(tout, b); tout << ")\n";); + TRACE(mpff, tout << "mul("; display(tout, a); tout << ", "; display(tout, b); tout << ")\n";); c.m_sign = a.m_sign ^ b.m_sign; // use int64_t to make sure we do not have overflows int64_t exp_a = a.m_exponent; @@ -801,7 +801,7 @@ void mpff_manager::mul(mpff const & a, mpff const & b, mpff & c) { // r has 2*m_precision_bits bits unsigned num_leading_zeros = nlz(m_precision*2, r); SASSERT(num_leading_zeros <= m_precision_bits); - TRACE("mpff", tout << "num_leading_zeros: " << num_leading_zeros << "\n";); + TRACE(mpff, tout << "num_leading_zeros: " << num_leading_zeros << "\n";); // We must shift right (m_precision_bits - num_leading_zeros) // If r does not have a 1 bit in the first (m_precision_bits - num_leading_zeros), then the result is precise. unsigned shift = m_precision_bits - num_leading_zeros; @@ -812,7 +812,7 @@ void mpff_manager::mul(mpff const & a, mpff const & b, mpff & c) { // 1) !c.m_sign && m_to_plus_inf // 2) c.m_sign && !m_to_plus_inf bool _inc_significand = ((c.m_sign == 1) != m_to_plus_inf) && has_one_at_first_k_bits(m_precision*2, r, shift); - TRACE("mpff", + TRACE(mpff, tout << "c.m_sign: " << c.m_sign << ", m_to_plus_inf: " << m_to_plus_inf << "\nhas_one_at_first_k_bits: " << has_one_at_first_k_bits(m_precision*2, r, shift) << "\n"; tout << "_inc_significand: " << _inc_significand << "\n";); @@ -822,16 +822,16 @@ void mpff_manager::mul(mpff const & a, mpff const & b, mpff & c) { if (_inc_significand) inc_significand(s_c, exp_c); set_exponent(c, exp_c); - TRACE("mpff", tout << "result: "; display(tout, c); tout << "\n";); + TRACE(mpff, tout << "result: "; display(tout, c); tout << "\n";); SASSERT(check(c)); } - STRACE("mpff_trace", display(tout, c); tout << "\n";); + STRACE(mpff_trace, display(tout, c); tout << "\n";); } void mpff_manager::div(mpff const & a, mpff const & b, mpff & c) { if (is_zero(b)) throw div0_exception(); - STRACE("mpff_trace", tout << "[mpff] ("; display(tout, a); tout << ") / ("; display(tout, b); tout << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); + STRACE(mpff_trace, tout << "[mpff] ("; display(tout, a); tout << ") / ("; display(tout, b); tout << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); if (is_zero(a)) { reset(c); } @@ -872,7 +872,7 @@ void mpff_manager::div(mpff const & a, mpff const & b, mpff & c) { sig(b), m_precision, q, r); - TRACE("mpff_div", + TRACE(mpff_div, unsigned j = q_sz; while (j > 0) { --j; tout << std::hex << std::setfill('0') << std::setw(2*sizeof(unsigned)) << q[j]; tout << " "; } tout << std::dec << "\n";); @@ -915,13 +915,13 @@ void mpff_manager::div(mpff const & a, mpff const & b, mpff & c) { set_exponent(c, exp_c); SASSERT(check(c)); } - STRACE("mpff_trace", display(tout, c); tout << "\n";); + STRACE(mpff_trace, display(tout, c); tout << "\n";); } void mpff_manager::floor(mpff & n) { if (n.m_exponent >= 0) return; - STRACE("mpff_trace", tout << "[mpff] Floor["; display(tout, n); tout << "] == ";); + STRACE(mpff_trace, tout << "[mpff] Floor["; display(tout, n); tout << "] == ";); if (n.m_exponent <= -static_cast(m_precision_bits)) { // number is between (-1, 1) if (n.m_sign == 0) @@ -951,13 +951,13 @@ void mpff_manager::floor(mpff & n) { } } SASSERT(check(n)); - STRACE("mpff_trace", display(tout, n); tout << "\n";); + STRACE(mpff_trace, display(tout, n); tout << "\n";); } void mpff_manager::ceil(mpff & n) { if (n.m_exponent >= 0) return; - STRACE("mpff_trace", tout << "[mpff] Ceiling["; display(tout, n); tout << "] == ";); + STRACE(mpff_trace, tout << "[mpff] Ceiling["; display(tout, n); tout << "] == ";); if (n.m_exponent <= -static_cast(m_precision_bits)) { // number is between (-1, 1) if (n.m_sign == 0) @@ -987,7 +987,7 @@ void mpff_manager::ceil(mpff & n) { } } SASSERT(check(n)); - STRACE("mpff_trace", display(tout, n); tout << "\n";); + STRACE(mpff_trace, display(tout, n); tout << "\n";); } void mpff_manager::power(mpff const & a, unsigned p, mpff & b) { @@ -1053,8 +1053,8 @@ void mpff_manager::power(mpff const & a, unsigned p, mpff & b) { } } } - STRACE("mpff_trace", tout << "[mpff] ("; display(tout, _a); tout << ") ^ " << _p << (m_to_plus_inf ? "<=" : ">="); display(tout, b); tout << "\n";); - TRACE("mpff_power", display_raw(tout, b); tout << "\n";); + STRACE(mpff_trace, tout << "[mpff] ("; display(tout, _a); tout << ") ^ " << _p << (m_to_plus_inf ? "<=" : ">="); display(tout, b); tout << "\n";); + TRACE(mpff_power, display_raw(tout, b); tout << "\n";); SASSERT(check(b)); } @@ -1124,7 +1124,7 @@ void mpff_manager::to_mpz(mpff const & n, synch_mpz_manager & m, mpz & t) { template void mpff_manager::to_mpq_core(mpff const & n, mpq_manager & m, mpq & t) { int exp = n.m_exponent; - TRACE("mpff_to_mpq", tout << "to_mpq: "; display(tout, n); tout << "\nexp: " << exp << "\n";); + TRACE(mpff_to_mpq, tout << "to_mpq: "; display(tout, n); tout << "\nexp: " << exp << "\n";); if (exp < 0 && exp > -static_cast(m_precision_bits) && !has_one_at_first_k_bits(m_precision, sig(n), -n.m_exponent)) { to_buffer(0, n); unsigned * b = m_buffers[0].data(); diff --git a/src/util/mpfx.cpp b/src/util/mpfx.cpp index ff6db740a..b25aa4b0c 100644 --- a/src/util/mpfx.cpp +++ b/src/util/mpfx.cpp @@ -334,7 +334,7 @@ bool mpfx_manager::eq(mpfx const & a, mpfx const & b) const { } bool mpfx_manager::lt(mpfx const & a, mpfx const & b) const { - STRACE("mpfx_trace", tout << "[mpfx] ("; display(tout, a); tout << " < "; display(tout, b); tout << ") == ";); + STRACE(mpfx_trace, tout << "[mpfx] ("; display(tout, a); tout << " < "; display(tout, b); tout << ") == ";); bool r; if (is_zero(a)) { r = !is_zero(b) && !is_neg(b); @@ -353,7 +353,7 @@ bool mpfx_manager::lt(mpfx const & a, mpfx const & b) const { r = is_pos(b) && ::lt(m_total_sz, words(a), words(b)); } } - STRACE("mpfx_trace", tout << "(" << r << " == 1)\n";); + STRACE(mpfx_trace, tout << "(" << r << " == 1)\n";); return r; } @@ -370,7 +370,7 @@ void mpfx_manager::add_sub(bool is_sub, mpfx const & a, mpfx const & b, mpfx & c return; } - TRACE("mpfx", tout << (is_sub ? "sub" : "add") << "("; display(tout, a); tout << ", "; display(tout, b); tout << ")\n";); + TRACE(mpfx, tout << (is_sub ? "sub" : "add") << "("; display(tout, a); tout << ", "; display(tout, b); tout << ")\n";); allocate_if_needed(c); @@ -405,24 +405,24 @@ void mpfx_manager::add_sub(bool is_sub, mpfx const & a, mpfx const & b, mpfx & c } SASSERT(borrow == 0); } - TRACE("mpfx", tout << "result: "; display(tout, c); tout << "\n";); + TRACE(mpfx, tout << "result: "; display(tout, c); tout << "\n";); SASSERT(check(c)); } void mpfx_manager::add(mpfx const & a, mpfx const & b, mpfx & c) { - STRACE("mpfx_trace", tout << "[mpfx] "; display(tout, a); tout << " + "; display(tout, b); tout << " == ";); + STRACE(mpfx_trace, tout << "[mpfx] "; display(tout, a); tout << " + "; display(tout, b); tout << " == ";); add_sub(false, a, b, c); - STRACE("mpfx_trace", display(tout, c); tout << "\n";); + STRACE(mpfx_trace, display(tout, c); tout << "\n";); } void mpfx_manager::sub(mpfx const & a, mpfx const & b, mpfx & c) { - STRACE("mpfx_trace", tout << "[mpfx] "; display(tout, a); tout << " - "; display(tout, b); tout << " == ";); + STRACE(mpfx_trace, tout << "[mpfx] "; display(tout, a); tout << " - "; display(tout, b); tout << " == ";); add_sub(true, a, b, c); - STRACE("mpfx_trace", display(tout, c); tout << "\n";); + STRACE(mpfx_trace, display(tout, c); tout << "\n";); } void mpfx_manager::mul(mpfx const & a, mpfx const & b, mpfx & c) { - STRACE("mpfx_trace", tout << "[mpfx] ("; display(tout, a); tout << ") * ("; display(tout, b); tout << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); + STRACE(mpfx_trace, tout << "[mpfx] ("; display(tout, a); tout << ") * ("; display(tout, b); tout << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); if (is_zero(a) || is_zero(b)) { reset(c); } @@ -445,14 +445,14 @@ void mpfx_manager::mul(mpfx const & a, mpfx const & b, mpfx & c) { for (unsigned i = 0; i < m_total_sz; i++) w_c[i] = _r[i]; } - STRACE("mpfx_trace", display(tout, c); tout << "\n";); + STRACE(mpfx_trace, display(tout, c); tout << "\n";); SASSERT(check(c)); } void mpfx_manager::div(mpfx const & a, mpfx const & b, mpfx & c) { if (is_zero(b)) throw div0_exception(); - STRACE("mpfx_trace", tout << "[mpfx] ("; display(tout, a); tout << ") / ("; display(tout, b); tout << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); + STRACE(mpfx_trace, tout << "[mpfx] ("; display(tout, a); tout << ") / ("; display(tout, b); tout << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); if (is_zero(a)) { reset(c); } @@ -519,12 +519,12 @@ void mpfx_manager::div(mpfx const & a, mpfx const & b, mpfx & c) { } } } - STRACE("mpfx_trace", display(tout, c); tout << "\n";); + STRACE(mpfx_trace, display(tout, c); tout << "\n";); SASSERT(check(c)); } void mpfx_manager::div2k(mpfx & a, unsigned k) { - STRACE("mpfx_trace", tout << "[mpfx] ("; display(tout, a); tout << ") / (2^" << k << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); + STRACE(mpfx_trace, tout << "[mpfx] ("; display(tout, a); tout << ") / (2^" << k << ") " << (m_to_plus_inf ? "<=" : ">=") << " ";); if (!is_zero(a) && k > 0) { unsigned * w = words(a); bool _inc = ((a.m_sign == 1) != m_to_plus_inf) && has_one_at_first_k_bits(m_total_sz, w, k); @@ -537,7 +537,7 @@ void mpfx_manager::div2k(mpfx & a, unsigned k) { reset(a); } } - STRACE("mpfx_trace", display(tout, a); tout << "\n";); + STRACE(mpfx_trace, display(tout, a); tout << "\n";); SASSERT(check(a)); } @@ -561,7 +561,7 @@ void mpfx_manager::set_plus_epsilon(mpfx & n) { } void mpfx_manager::floor(mpfx & n) { - STRACE("mpfx_trace", tout << "[mpfx] Floor["; display(tout, n); tout << "] == ";); + STRACE(mpfx_trace, tout << "[mpfx] Floor["; display(tout, n); tout << "] == ";); unsigned * w = words(n); if (is_neg(n)) { bool is_int = true; @@ -581,11 +581,11 @@ void mpfx_manager::floor(mpfx & n) { if (::is_zero(m_int_part_sz, w + m_frac_part_sz)) reset(n); SASSERT(check(n)); - STRACE("mpfx_trace", display(tout, n); tout << "\n";); + STRACE(mpfx_trace, display(tout, n); tout << "\n";); } void mpfx_manager::ceil(mpfx & n) { - STRACE("mpfx_trace", tout << "[mpfx] Ceiling["; display(tout, n); tout << "] == ";); + STRACE(mpfx_trace, tout << "[mpfx] Ceiling["; display(tout, n); tout << "] == ";); unsigned * w = words(n); if (is_pos(n)) { bool is_int = true; @@ -605,7 +605,7 @@ void mpfx_manager::ceil(mpfx & n) { if (::is_zero(m_int_part_sz, w + m_frac_part_sz)) reset(n); SASSERT(check(n)); - STRACE("mpfx_trace", display(tout, n); tout << "\n";); + STRACE(mpfx_trace, display(tout, n); tout << "\n";); } void mpfx_manager::power(mpfx const & a, unsigned p, mpfx & b) { @@ -649,8 +649,8 @@ void mpfx_manager::power(mpfx const & a, unsigned p, mpfx & b) { mask = mask << 1; } } - STRACE("mpfx_trace", tout << "[mpfx] ("; display(tout, _a); tout << ") ^ " << _p << (m_to_plus_inf ? "<=" : ">="); display(tout, b); tout << "\n";); - TRACE("mpfx_power", display_raw(tout, b); tout << "\n";); + STRACE(mpfx_trace, tout << "[mpfx] ("; display(tout, _a); tout << ") ^ " << _p << (m_to_plus_inf ? "<=" : ">="); display(tout, b); tout << "\n";); + TRACE(mpfx_power, display_raw(tout, b); tout << "\n";); SASSERT(check(b)); } diff --git a/src/util/mpn.cpp b/src/util/mpn.cpp index e84c15d5e..4e38e2d83 100644 --- a/src/util/mpn.cpp +++ b/src/util/mpn.cpp @@ -40,7 +40,7 @@ int mpn_manager::compare(mpn_digit const * a, unsigned lnga, res = -1; } - TRACE("mpn", tout << ((res == 1) ? " > " : (res == -1) ? " < " : " == "); ); + TRACE(mpn, tout << ((res == 1) ? " > " : (res == -1) ? " < " : " == "); ); trace_nl(b, lngb); return res; @@ -173,7 +173,7 @@ bool mpn_manager::div(mpn_digit const * numer, unsigned lnum, div_unnormalize(u, v, d, rem); } - // TRACE("mpn_dbg", display_raw(tout, quot, lnum - lden + 1); tout << ", "; + // TRACE(mpn_dbg, display_raw(tout, quot, lnum - lden + 1); tout << ", "; // display_raw(tout, rem, lden); tout << std::endl; ); trace_nl(quot, lnum-lden+1); @@ -189,7 +189,7 @@ bool mpn_manager::div(mpn_digit const * numer, unsigned lnum, for (unsigned i = 0; i < lnum && ok; i++) if (temp[i] != numer[i]) ok = false; if (temp[lnum] != 0) ok = false; - CTRACE("mpn_dbg", !ok, tout << "DIV BUG: quot * denom + rem = "; display_raw(tout, temp.data(), lnum+1); tout << std::endl; ); + CTRACE(mpn_dbg, !ok, tout << "DIV BUG: quot * denom + rem = "; display_raw(tout, temp.data(), lnum+1); tout << std::endl; ); SASSERT(ok); #endif @@ -230,7 +230,7 @@ unsigned mpn_manager::div_normalize(mpn_digit const * numer, unsigned lnum, d = 0; } - TRACE("mpn_norm", tout << "Normalized: n_numer="; display_raw(tout, n_numer.data(), n_numer.size()); + TRACE(mpn_norm, tout << "Normalized: n_numer="; display_raw(tout, n_numer.data(), n_numer.size()); tout << " n_denom="; display_raw(tout, n_denom.data(), n_denom.size()); tout << std::endl; ); return d; } @@ -269,7 +269,7 @@ bool mpn_manager::div_1(mpn_sbuffer & numer, mpn_digit const denom, quot[j-1]--; numer[j] = numer[j-1] + denom; } - TRACE("mpn_div1", + TRACE(mpn_div1, mpn_double_digit r_hat = temp % (mpn_double_digit) denom; tout << "j=" << j << " q_hat=" << q_hat << " r_hat=" << r_hat; tout << " ms=" << ms; @@ -323,7 +323,7 @@ bool mpn_manager::div_n(mpn_sbuffer & numer, mpn_sbuffer const & denom, for (unsigned i = 0; i < n+1; i++) numer[j+i] = ab[i]; } - TRACE("mpn_div", tout << "q_hat=" << q_hat << " r_hat=" << r_hat; + TRACE(mpn_div, tout << "q_hat=" << q_hat << " r_hat=" << r_hat; tout << " ms="; display_raw(tout, ms.data(), n); tout << " new numer="; display_raw(tout, numer.data(), m+n+1); tout << " borrow=" << borrow; @@ -335,7 +335,7 @@ bool mpn_manager::div_n(mpn_sbuffer & numer, mpn_sbuffer const & denom, char * mpn_manager::to_string(mpn_digit const * a, unsigned lng, char * buf, unsigned lbuf) const { SASSERT(buf && lbuf > 0); - TRACE("mpn_to_string", tout << "[mpn] to_string "; display_raw(tout, a, lng); tout << " == "; ); + TRACE(mpn_to_string, tout << "[mpn] to_string "; display_raw(tout, a, lng); tout << " == "; ); if (lng == 1) { #ifdef _WINDOWS @@ -368,7 +368,7 @@ char * mpn_manager::to_string(mpn_digit const * a, unsigned lng, char * buf, uns std::swap(buf[i], buf[j-i]); } - TRACE("mpn_to_string", tout << buf << std::endl; ); + TRACE(mpn_to_string, tout << buf << std::endl; ); return buf; } @@ -384,7 +384,7 @@ void mpn_manager::trace(mpn_digit const * a, unsigned lnga, const char * op) const { #ifdef Z3DEBUG char char_buf[4096]; - TRACE("mpn", tout << "[mpn] " << to_string(a, lnga, char_buf, sizeof(char_buf)); + TRACE(mpn, tout << "[mpn] " << to_string(a, lnga, char_buf, sizeof(char_buf)); tout << " " << op << " " << to_string(b, lngb, char_buf, sizeof(char_buf)); tout << " == "; ); #endif @@ -393,13 +393,13 @@ void mpn_manager::trace(mpn_digit const * a, unsigned lnga, void mpn_manager::trace(mpn_digit const * a, unsigned lnga) const { #ifdef Z3DEBUG char char_buf[4096]; - TRACE("mpn", tout << to_string(a, lnga, char_buf, sizeof(char_buf)); ); + TRACE(mpn, tout << to_string(a, lnga, char_buf, sizeof(char_buf)); ); #endif } void mpn_manager::trace_nl(mpn_digit const * a, unsigned lnga) const { #ifdef Z3DEBUG char char_buf[4096]; - TRACE("mpn", tout << to_string(a, lnga, char_buf, sizeof(char_buf)) << std::endl; ); + TRACE(mpn, tout << to_string(a, lnga, char_buf, sizeof(char_buf)) << std::endl; ); #endif } diff --git a/src/util/mpq.cpp b/src/util/mpq.cpp index f90843e36..40defcb6b 100644 --- a/src/util/mpq.cpp +++ b/src/util/mpq.cpp @@ -197,7 +197,7 @@ void mpq_manager::set(mpq & a, char const * val) { } ++str; } - TRACE("mpq_set", tout << "[before] a: " << to_string(a) << "\n";); + TRACE(mpq_set, tout << "[before] a: " << to_string(a) << "\n";); if (str[0] == '/' || str[0] == '.' || str[0] == 'e' || str[0] == 'E') { bool is_rat = str[0] == '/'; _scoped_numeral > tmp2(*this); @@ -239,7 +239,7 @@ void mpq_manager::set(mpq & a, char const * val) { else if ('/' == str[0]) { throw default_exception("mixing rational/scientific notation"); } - TRACE("mpq_set", tout << "[exp]: " << exp << ", str[0]: " << (str[0] - '0') << std::endl;); + TRACE(mpq_set, tout << "[exp]: " << exp << ", str[0]: " << (str[0] - '0') << std::endl;); ++str; } } @@ -258,7 +258,7 @@ void mpq_manager::set(mpq & a, char const * val) { _scoped_numeral> _qten(*this); _qten = 10; power(_qten, static_cast(exp), _exp); - TRACE("mpq_set", tout << "a: " << to_string(a) << ", exp_sign:" << exp_sign << ", exp: " << exp << " " << to_string(_exp) << std::endl;); + TRACE(mpq_set, tout << "a: " << to_string(a) << ", exp_sign:" << exp_sign << ", exp: " << exp << " " << to_string(_exp) << std::endl;); if (exp_sign) div(a, _exp, a); else @@ -371,17 +371,17 @@ void mpq_manager::rat_mul(mpq const & a, mpq const & b, mpq & c, mpz& g1, template void mpq_manager::rat_mul(mpz const & a, mpq const & b, mpq & c) { - STRACE("rat_mpq", tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";); + STRACE(rat_mpq, tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";); mul(a, b.m_num, c.m_num); set(c.m_den, b.m_den); normalize(c); - STRACE("rat_mpq", tout << to_string(c) << "\n";); + STRACE(rat_mpq, tout << to_string(c) << "\n";); } template void mpq_manager::rat_mul(mpq const & a, mpq const & b, mpq & c) { - STRACE("rat_mpq", tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";); + STRACE(rat_mpq, tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";); if (SYNCH) { mpz g1, g2, tmp1, tmp2; rat_mul(a, b, c, g1, g2, tmp1, tmp2); @@ -393,12 +393,12 @@ void mpq_manager::rat_mul(mpq const & a, mpq const & b, mpq & c) { else { rat_mul(a, b, c, m_tmp1, m_tmp2, m_tmp3, m_tmp4); } - STRACE("rat_mpq", tout << to_string(c) << "\n";); + STRACE(rat_mpq, tout << to_string(c) << "\n";); } template void mpq_manager::rat_add(mpq const & a, mpq const & b, mpq & c) { - STRACE("rat_mpq", tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";); + STRACE(rat_mpq, tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";); if (SYNCH) { mpz_stack tmp1, tmp2, tmp3, g; lin_arith_op(a, b, c, g, tmp1, tmp2, tmp3); @@ -410,12 +410,12 @@ void mpq_manager::rat_add(mpq const & a, mpq const & b, mpq & c) { else { lin_arith_op(a, b, c, m_tmp1, m_tmp2, m_tmp3, m_tmp4); } - STRACE("rat_mpq", tout << to_string(c) << "\n";); + STRACE(rat_mpq, tout << to_string(c) << "\n";); } template void mpq_manager::rat_sub(mpq const & a, mpq const & b, mpq & c) { - STRACE("rat_mpq", tout << "[mpq] " << to_string(a) << " - " << to_string(b) << " == ";); + STRACE(rat_mpq, tout << "[mpq] " << to_string(a) << " - " << to_string(b) << " == ";); if (SYNCH) { mpz tmp1, tmp2, tmp3, g; lin_arith_op(a, b, c, g, tmp1, tmp2, tmp3); @@ -427,7 +427,7 @@ void mpq_manager::rat_sub(mpq const & a, mpq const & b, mpq & c) { else { lin_arith_op(a, b, c, m_tmp1, m_tmp2, m_tmp3, m_tmp4); } - STRACE("rat_mpq", tout << to_string(c) << "\n";); + STRACE(rat_mpq, tout << to_string(c) << "\n";); } diff --git a/src/util/mpq.h b/src/util/mpq.h index 87ee5e17d..212fa1c97 100644 --- a/src/util/mpq.h +++ b/src/util/mpq.h @@ -74,7 +74,7 @@ class mpq_manager : public mpz_manager { void rat_add(mpq const & a, mpq const & b, mpq & c); void rat_add(mpq const & a, mpz const & b, mpq & c) { - STRACE("rat_mpq", tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";); + STRACE(rat_mpq, tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";); if (SYNCH) { mpz tmp1; mul(b, a.m_den, tmp1); @@ -89,7 +89,7 @@ class mpq_manager : public mpz_manager { add(a.m_num, m_tmp1, c.m_num); normalize(c); } - STRACE("rat_mpq", tout << to_string(c) << "\n";); + STRACE(rat_mpq, tout << to_string(c) << "\n";); } void rat_sub(mpq const & a, mpq const & b, mpq & c); @@ -228,7 +228,7 @@ public: void add(mpz const & a, mpz const & b, mpz & c) { mpz_manager::add(a, b, c); } void add(mpq const & a, mpq const & b, mpq & c) { - STRACE("mpq", tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";); + STRACE(mpq, tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";); if (is_zero(b)) { set(c, a); } @@ -242,11 +242,11 @@ public: else { rat_add(a, b, c); } - STRACE("mpq", tout << to_string(c) << "\n";); + STRACE(mpq, tout << to_string(c) << "\n";); } void add(mpq const & a, mpz const & b, mpq & c) { - STRACE("mpq", tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";); + STRACE(mpq, tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";); if (is_zero(b)) { set(c, a); } @@ -260,20 +260,20 @@ public: else { rat_add(a, b, c); } - STRACE("mpq", tout << to_string(c) << "\n";); + STRACE(mpq, tout << to_string(c) << "\n";); } void sub(mpz const & a, mpz const & b, mpz & c) { mpz_manager::sub(a, b, c); } void sub(mpq const & a, mpq const & b, mpq & c) { - STRACE("mpq", tout << "[mpq] " << to_string(a) << " - " << to_string(b) << " == ";); + STRACE(mpq, tout << "[mpq] " << to_string(a) << " - " << to_string(b) << " == ";); if (is_int(a) && is_int(b)) { mpz_manager::sub(a.m_num, b.m_num, c.m_num); reset_denominator(c); } else rat_sub(a, b, c); - STRACE("mpq", tout << to_string(c) << "\n";); + STRACE(mpq, tout << to_string(c) << "\n";); } void inc(mpz & a) { mpz_manager::inc(a); } @@ -292,25 +292,25 @@ public: } void mul(mpq const & a, mpq const & b, mpq & c) { - STRACE("mpq", tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";); + STRACE(mpq, tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";); if (is_int(a) && is_int(b)) { mpz_manager::mul(a.m_num, b.m_num, c.m_num); reset_denominator(c); } else rat_mul(a, b, c); - STRACE("mpq", tout << to_string(c) << "\n";); + STRACE(mpq, tout << to_string(c) << "\n";); } void mul(mpz const & a, mpq const & b, mpq & c) { - STRACE("mpq", tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";); + STRACE(mpq, tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";); if (is_int(b)) { mpz_manager::mul(a, b.m_num, c.m_num); reset_denominator(c); } else rat_mul(a, b, c); - STRACE("mpq", tout << to_string(c) << "\n";); + STRACE(mpq, tout << to_string(c) << "\n";); } void addmul(mpz const & a, mpz const & b, mpz const & c, mpz & d) { @@ -431,7 +431,7 @@ public: } void div(mpq const & a, mpq const & b, mpq & c) { - STRACE("mpq", tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";); + STRACE(mpq, tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";); if (is_zero(a) || is_one(b)) { set(c, a); return; @@ -453,11 +453,11 @@ public: neg(c.m_den); } normalize(c); - STRACE("mpq", tout << to_string(c) << "\n";); + STRACE(mpq, tout << to_string(c) << "\n";); } void div(mpq const & a, mpz const & b, mpq & c) { - STRACE("mpq", tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";); + STRACE(mpq, tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";); if (is_zero(a) || is_one(b)) { set(c, a); return; @@ -469,18 +469,18 @@ public: neg(c.m_den); } normalize(c); - STRACE("mpq", tout << to_string(c) << "\n";); + STRACE(mpq, tout << to_string(c) << "\n";); } void acc_div(mpq & a, mpz const & b) { - STRACE("mpq", tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";); + STRACE(mpq, tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";); mul(a.m_den, b, a.m_den); if (mpz_manager::is_neg(b)) { neg(a.m_num); neg(a.m_den); } normalize(a); - STRACE("mpq", tout << to_string(a) << "\n";); + STRACE(mpq, tout << to_string(a) << "\n";); } void machine_div(mpz const & a, mpz const & b, mpz & c) { mpz_manager::machine_div(a, b, c); } diff --git a/src/util/mpz.cpp b/src/util/mpz.cpp index 7b9719b36..277777ce6 100644 --- a/src/util/mpz.cpp +++ b/src/util/mpz.cpp @@ -251,26 +251,26 @@ void mpz_manager::del(mpz_manager* m, mpz & a) { template void mpz_manager::add(mpz const & a, mpz const & b, mpz & c) { - STRACE("mpz", tout << "[mpz] " << to_string(a) << " + " << to_string(b) << " == ";); + STRACE(mpz, tout << "[mpz] " << to_string(a) << " + " << to_string(b) << " == ";); if (is_small(a) && is_small(b)) { set_i64(c, i64(a) + i64(b)); } else { big_add(a, b, c); } - STRACE("mpz", tout << to_string(c) << "\n";); + STRACE(mpz, tout << to_string(c) << "\n";); } template void mpz_manager::sub(mpz const & a, mpz const & b, mpz & c) { - STRACE("mpz", tout << "[mpz] " << to_string(a) << " - " << to_string(b) << " == ";); + STRACE(mpz, tout << "[mpz] " << to_string(a) << " - " << to_string(b) << " == ";); if (is_small(a) && is_small(b)) { set_i64(c, i64(a) - i64(b)); } else { big_sub(a, b, c); } - STRACE("mpz", tout << to_string(c) << "\n";); + STRACE(mpz, tout << to_string(c) << "\n";); } template @@ -507,14 +507,14 @@ void mpz_manager::set_digits(mpz & target, unsigned sz, digit_t const * d template void mpz_manager::mul(mpz const & a, mpz const & b, mpz & c) { - STRACE("mpz", tout << "[mpz] " << to_string(a) << " * " << to_string(b) << " == ";); + STRACE(mpz, tout << "[mpz] " << to_string(a) << " * " << to_string(b) << " == ";); if (is_small(a) && is_small(b)) { set_i64(c, i64(a) * i64(b)); } else { big_mul(a, b, c); } - STRACE("mpz", tout << to_string(c) << "\n";); + STRACE(mpz, tout << to_string(c) << "\n";); } // d <- a + b*c @@ -555,7 +555,7 @@ void mpz_manager::submul(mpz const & a, mpz const & b, mpz const & c, mpz template void mpz_manager::machine_div_rem(mpz const & a, mpz const & b, mpz & q, mpz & r) { - STRACE("mpz", tout << "[mpz-ext] divrem(" << to_string(a) << ", " << to_string(b) << ") == ";); + STRACE(mpz, tout << "[mpz-ext] divrem(" << to_string(a) << ", " << to_string(b) << ") == ";); if (is_small(a) && is_small(b)) { int64_t _a = i64(a); int64_t _b = i64(b); @@ -565,12 +565,12 @@ void mpz_manager::machine_div_rem(mpz const & a, mpz const & b, mpz & q, else { big_div_rem(a, b, q, r); } - STRACE("mpz", tout << "(" << to_string(q) << ", " << to_string(r) << ")\n";); + STRACE(mpz, tout << "(" << to_string(q) << ", " << to_string(r) << ")\n";); } template void mpz_manager::machine_div(mpz const & a, mpz const & b, mpz & c) { - STRACE("mpz", tout << "[mpz-ext] machine-div(" << to_string(a) << ", " << to_string(b) << ") == ";); + STRACE(mpz, tout << "[mpz-ext] machine-div(" << to_string(a) << ", " << to_string(b) << ") == ";); if (is_small(b) && i64(b) == 0) throw default_exception("division by 0"); @@ -578,7 +578,7 @@ void mpz_manager::machine_div(mpz const & a, mpz const & b, mpz & c) { set_i64(c, i64(a) / i64(b)); else big_div(a, b, c); - STRACE("mpz", tout << to_string(c) << "\n";); + STRACE(mpz, tout << to_string(c) << "\n";); } template @@ -589,32 +589,32 @@ void mpz_manager::reset(mpz & a) { template void mpz_manager::rem(mpz const & a, mpz const & b, mpz & c) { - STRACE("mpz", tout << "[mpz-ext] rem(" << to_string(a) << ", " << to_string(b) << ") == ";); + STRACE(mpz, tout << "[mpz-ext] rem(" << to_string(a) << ", " << to_string(b) << ") == ";); if (is_small(a) && is_small(b)) { set_i64(c, i64(a) % i64(b)); } else { big_rem(a, b, c); } - STRACE("mpz", tout << to_string(c) << "\n";); + STRACE(mpz, tout << to_string(c) << "\n";); } template void mpz_manager::div_gcd(mpz const& a, mpz const& b, mpz & c) { - STRACE("mpz", tout << "[mpz-ext] div(" << to_string(a) << ", " << to_string(b) << ") == ";); + STRACE(mpz, tout << "[mpz-ext] div(" << to_string(a) << ", " << to_string(b) << ") == ";); if (is_one(b)) { set(c, a); } else { machine_div(a, b, c); } - STRACE("mpz", tout << to_string(c) << "\n";); + STRACE(mpz, tout << to_string(c) << "\n";); } template void mpz_manager::div(mpz const & a, mpz const & b, mpz & c) { - STRACE("mpz", tout << "[mpz-ext] div(" << to_string(a) << ", " << to_string(b) << ") == ";); + STRACE(mpz, tout << "[mpz-ext] div(" << to_string(a) << ", " << to_string(b) << ") == ";); SASSERT(!is_zero(b)); if (is_one(b)) { set(c, a); @@ -633,12 +633,12 @@ void mpz_manager::div(mpz const & a, mpz const & b, mpz & c) { else { machine_div(a, b, c); } - STRACE("mpz", tout << to_string(c) << "\n";); + STRACE(mpz, tout << to_string(c) << "\n";); } template void mpz_manager::mod(mpz const & a, mpz const & b, mpz & c) { - STRACE("mpz", tout << "[mpz-ext] mod(" << to_string(a) << ", " << to_string(b) << ") == ";); + STRACE(mpz, tout << "[mpz-ext] mod(" << to_string(a) << ", " << to_string(b) << ") == ";); rem(a, b, c); if (is_neg(c)) { if (is_pos(b)) @@ -646,12 +646,12 @@ void mpz_manager::mod(mpz const & a, mpz const & b, mpz & c) { else sub(c, b, c); } - STRACE("mpz", tout << to_string(c) << "\n";); + STRACE(mpz, tout << to_string(c) << "\n";); } template void mpz_manager::neg(mpz & a) { - STRACE("mpz", tout << "[mpz] 0 - " << to_string(a) << " == ";); + STRACE(mpz, tout << "[mpz] 0 - " << to_string(a) << " == ";); if (is_small(a) && a.m_val == INT_MIN) { // neg(INT_MIN) is not a small int set_big_i64(a, - static_cast(INT_MIN)); @@ -667,7 +667,7 @@ void mpz_manager::neg(mpz & a) { mpz_neg(*a.m_ptr, *a.m_ptr); } #endif - STRACE("mpz", tout << to_string(a) << "\n";); + STRACE(mpz, tout << to_string(a) << "\n";); } template @@ -1198,7 +1198,7 @@ void mpz_manager::gcd(unsigned sz, mpz const * as, mpz & g) { p.push_back(i); sz_lt lt(*this, as); std::sort(p.begin(), p.end(), lt); - TRACE("mpz_gcd", for (unsigned i = 0; i < sz; i++) tout << p[i] << ":" << size_info(as[p[i]]) << " "; tout << "\n";); + TRACE(mpz_gcd, for (unsigned i = 0; i < sz; i++) tout << p[i] << ":" << size_info(as[p[i]]) << " "; tout << "\n";); gcd(as[p[0]], as[p[1]], g); for (i = 2; i < sz; i++) { if (is_one(g)) @@ -1311,30 +1311,30 @@ template void mpz_manager::lcm(mpz const & a, mpz const & b, mpz & c) { if (is_one(b)) { set(c, a); - TRACE("lcm_bug", tout << "1. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); + TRACE(lcm_bug, tout << "1. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); } else if (is_one(a) || eq(a, b)) { set(c, b); - TRACE("lcm_bug", tout << "2. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); + TRACE(lcm_bug, tout << "2. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); } else { mpz r; gcd(a, b, r); - TRACE("lcm_bug", tout << "gcd(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(r) << "\n";); + TRACE(lcm_bug, tout << "gcd(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(r) << "\n";); if (eq(r, a)) { set(c, b); - TRACE("lcm_bug", tout << "3. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); + TRACE(lcm_bug, tout << "3. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); } else if (eq(r, b)) { set(c, a); - TRACE("lcm_bug", tout << "4. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); + TRACE(lcm_bug, tout << "4. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); } else { // c contains gcd(a, b) // so c divides a, and machine_div(a, c) is equal to div(a, c) machine_div(a, r, r); mul(r, b, c); - TRACE("lcm_bug", tout << "5. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); + TRACE(lcm_bug, tout << "5. lcm(" << to_string(a) << ", " << to_string(b) << ") = " << to_string(c) << "\n";); } del(r); } @@ -1344,7 +1344,7 @@ template void mpz_manager::bitwise_or(mpz const & a, mpz const & b, mpz & c) { SASSERT(is_nonneg(a)); SASSERT(is_nonneg(b)); - TRACE("mpz", tout << "is_small(a): " << is_small(a) << ", is_small(b): " << is_small(b) << "\n";); + TRACE(mpz, tout << "is_small(a): " << is_small(a) << ", is_small(b): " << is_small(b) << "\n";); if (is_small(a) && is_small(b)) { c.m_val = a.m_val | b.m_val; c.m_kind = mpz_small; @@ -1357,12 +1357,12 @@ void mpz_manager::bitwise_or(mpz const & a, mpz const & b, mpz & c) { set(m, 1); set(c, 0); while (!is_zero(a1) && !is_zero(b1)) { - TRACE("mpz", tout << "a1: " << to_string(a1) << ", b1: " << to_string(b1) << "\n";); + TRACE(mpz, tout << "a1: " << to_string(a1) << ", b1: " << to_string(b1) << "\n";); mod(a1, m_two64, a2); mod(b1, m_two64, b2); - TRACE("mpz", tout << "a2: " << to_string(a2) << ", b2: " << to_string(b2) << "\n";); + TRACE(mpz, tout << "a2: " << to_string(a2) << ", b2: " << to_string(b2) << "\n";); uint64_t v = get_uint64(a2) | get_uint64(b2); - TRACE("mpz", tout << "uint(a2): " << get_uint64(a2) << ", uint(b2): " << get_uint64(b2) << "\n";); + TRACE(mpz, tout << "uint(a2): " << get_uint64(a2) << ", uint(b2): " << get_uint64(b2) << "\n";); set(tmp, v); mul(tmp, m, tmp); add(c, tmp, c); // c += m * v @@ -1487,7 +1487,7 @@ void mpz_manager::bitwise_not(unsigned sz, mpz const & a, mpz & c) { uint64_t mask = (1ull << static_cast(sz)) - 1ull; v = mask & v; } - TRACE("bitwise_not", tout << "sz: " << sz << ", v: " << v << ", n: " << n << "\n";); + TRACE(bitwise_not, tout << "sz: " << sz << ", v: " << v << ", n: " << n << "\n";); set(tmp, v); SASSERT(get_uint64(tmp) == v); mul(tmp, m, tmp); @@ -1497,7 +1497,7 @@ void mpz_manager::bitwise_not(unsigned sz, mpz const & a, mpz & c) { sz -= (sz<64) ? sz : 64; } del(a1); del(a2); del(m); del(tmp); - TRACE("bitwise_not", tout << "sz: " << sz << " a: " << to_string(a) << " c: " << to_string(c) << "\n";); + TRACE(bitwise_not, tout << "sz: " << sz << " a: " << to_string(a) << " c: " << to_string(c) << "\n";); } } @@ -2072,7 +2072,7 @@ void mpz_manager::machine_div2k(mpz & a, unsigned k) { unsigned new_sz = sz - digit_shift; SASSERT(new_sz >= 1); digit_t * ds = c->m_digits; - TRACE("mpz_2k", tout << "bit_shift: " << bit_shift << ", comp_shift: " << comp_shift << ", new_sz: " << new_sz << ", sz: " << sz << "\n";); + TRACE(mpz_2k, tout << "bit_shift: " << bit_shift << ", comp_shift: " << comp_shift << ", new_sz: " << new_sz << ", sz: " << sz << "\n";); if (new_sz < sz) { unsigned i = 0; unsigned j = digit_shift; @@ -2123,13 +2123,13 @@ void mpz_manager::mul2k(mpz & a, unsigned k) { return; } #ifndef _MP_GMP - TRACE("mpz_mul2k", tout << "mul2k\na: " << to_string(a) << "\nk: " << k << "\n";); + TRACE(mpz_mul2k, tout << "mul2k\na: " << to_string(a) << "\nk: " << k << "\n";); unsigned word_shift = k / (8 * sizeof(digit_t)); unsigned bit_shift = k % (8 * sizeof(digit_t)); unsigned old_sz = is_small(a) ? 1 : a.m_ptr->m_size; unsigned new_sz = old_sz + word_shift + 1; ensure_capacity(a, new_sz); - TRACE("mpz_mul2k", tout << "word_shift: " << word_shift << "\nbit_shift: " << bit_shift << "\nold_sz: " << old_sz << "\nnew_sz: " << new_sz + TRACE(mpz_mul2k, tout << "word_shift: " << word_shift << "\nbit_shift: " << bit_shift << "\nold_sz: " << old_sz << "\nnew_sz: " << new_sz << "\na after ensure capacity:\n" << to_string(a) << "\n"; tout << a.m_kind << "\n";); SASSERT(!is_small(a)); @@ -2168,7 +2168,7 @@ void mpz_manager::mul2k(mpz & a, unsigned k) { } } normalize(a); - TRACE("mpz_mul2k", tout << "mul2k result:\n" << to_string(a) << "\n";); + TRACE(mpz_mul2k, tout << "mul2k result:\n" << to_string(a) << "\n";); #else ensure_mpz_t a1(a); mk_big(a); @@ -2425,7 +2425,7 @@ bool mpz_manager::root(mpz & a, unsigned n) { while (true) { add(upper, lower, mid); machine_div2k(mid, 1); - TRACE("mpz", tout << "upper: "; display(tout, upper); tout << "\nlower: "; display(tout, lower); tout << "\nmid: "; display(tout, mid); tout << "\n";); + TRACE(mpz, tout << "upper: "; display(tout, upper); tout << "\nlower: "; display(tout, lower); tout << "\nmid: "; display(tout, mid); tout << "\n";); power(mid, n, mid_n); if (eq(mid_n, a)) { swap(a, mid); @@ -2534,8 +2534,8 @@ bool mpz_manager::divides(mpz const & a, mpz const & b) { rem(b, a, tmp); r = is_zero(tmp); } - STRACE("divides", tout << "[mpz] Divisible["; display(tout, b); tout << ", "; display(tout, a); tout << "] == " << (r?"True":"False") << "\n";); - TRACE("divides_bug", tout << "tmp: "; display(tout, tmp); tout << "\n";); + STRACE(divides, tout << "[mpz] Divisible["; display(tout, b); tout << ", "; display(tout, a); tout << "] == " << (r?"True":"False") << "\n";); + TRACE(divides_bug, tout << "tmp: "; display(tout, tmp); tout << "\n";); return r; } diff --git a/src/util/mpzzp.h b/src/util/mpzzp.h index 24fb64ea3..cdb581678 100644 --- a/src/util/mpzzp.h +++ b/src/util/mpzzp.h @@ -51,7 +51,7 @@ class mpzzp_manager { if (even) { m().inc(m_lower); } - TRACE("mpzzp", tout << "lower: " << m_manager.to_string(m_lower) << ", upper: " << m_manager.to_string(m_upper) << "\n";); + TRACE(mpzzp, tout << "lower: " << m_manager.to_string(m_lower) << ", upper: " << m_manager.to_string(m_upper) << "\n";); } void p_normalize_core(mpz & x) { @@ -171,11 +171,11 @@ public: SASSERT(!is_zero(a)); // eulers theorem a^(p - 2), but gcd could be more efficient // a*t1 + p*t2 = 1 => a*t1 = 1 (mod p) => t1 is the inverse (t3 == 1) - TRACE("mpzp_inv_bug", tout << "a: " << m().to_string(a) << ", p: " << m().to_string(m_p) << "\n";); + TRACE(mpzp_inv_bug, tout << "a: " << m().to_string(a) << ", p: " << m().to_string(m_p) << "\n";); p_normalize(a); - TRACE("mpzp_inv_bug", tout << "after normalization a: " << m().to_string(a) << "\n";); + TRACE(mpzp_inv_bug, tout << "after normalization a: " << m().to_string(a) << "\n";); m().gcd(a, m_p, m_inv_tmp1, m_inv_tmp2, m_inv_tmp3); - TRACE("mpzp_inv_bug", tout << "tmp1: " << m().to_string(m_inv_tmp1) << "\ntmp2: " << m().to_string(m_inv_tmp2) + TRACE(mpzp_inv_bug, tout << "tmp1: " << m().to_string(m_inv_tmp1) << "\ntmp2: " << m().to_string(m_inv_tmp2) << "\ntmp3: " << m().to_string(m_inv_tmp3) << "\n";); p_normalize(m_inv_tmp1); m().swap(a, m_inv_tmp1); diff --git a/src/util/parray.h b/src/util/parray.h index b00f1328d..2678b3834 100644 --- a/src/util/parray.h +++ b/src/util/parray.h @@ -38,7 +38,7 @@ private: ++mem; value * r = reinterpret_cast(mem); SASSERT(capacity(r) == c); - TRACE("parray_mem", tout << "allocated values[" << c << "]: " << r << "\n";); + TRACE(parray_mem, tout << "allocated values[" << c << "]: " << r << "\n";); return r; } @@ -46,7 +46,7 @@ private: if (vs == nullptr) return; size_t c = capacity(vs); - TRACE("parray_mem", tout << "deallocated values[" << c << "]: " << vs << "\n";); + TRACE(parray_mem, tout << "deallocated values[" << c << "]: " << vs << "\n";); size_t * mem = reinterpret_cast(vs); --mem; m_allocator.deallocate(sizeof(value)*c + sizeof(size_t), mem); @@ -98,7 +98,7 @@ private: cell * mk(ckind k) { cell * r = new (m_allocator.allocate(sizeof(cell))) cell(k); - TRACE("parray_mem", tout << "allocated cell: " << r << "\n";); + TRACE(parray_mem, tout << "allocated cell: " << r << "\n";); return r; } @@ -119,7 +119,7 @@ private: deallocate_values(c->m_values); break; } - TRACE("parray_mem", tout << "deallocated cell: " << c << "\n";); + TRACE(parray_mem, tout << "deallocated cell: " << c << "\n";); c->~cell(); m_allocator.deallocate(sizeof(cell), c); if (next == nullptr) @@ -139,7 +139,7 @@ private: void dec_ref(cell * c) { if (!c) return; - TRACE("parray_mem", tout << "dec_ref(" << c << "), ref_count: " << c->m_ref_count << "\n";); + TRACE(parray_mem, tout << "dec_ref(" << c << "), ref_count: " << c->m_ref_count << "\n";); SASSERT(c->m_ref_count > 0); c->m_ref_count--; if (c->m_ref_count == 0) diff --git a/src/util/sorting_network.h b/src/util/sorting_network.h index d159104f6..e77757aea 100644 --- a/src/util/sorting_network.h +++ b/src/util/sorting_network.h @@ -694,7 +694,7 @@ Notes: } literal mk_exactly_1(bool full, unsigned n, literal const* xs) { - TRACE("pb", tout << "exactly 1 with " << n << " arguments " << (full?"full":"not full") << "\n";); + TRACE(pb, tout << "exactly 1 with " << n << " arguments " << (full?"full":"not full") << "\n";); literal_vector ors; literal r1; switch (m_cfg.m_encoding) { @@ -724,7 +724,7 @@ Notes: } literal mk_at_most_1(bool full, unsigned n, literal const* xs, literal_vector& ors, bool use_ors) { - TRACE("pb_verbose", tout << (full?"full":"partial") << " "; + TRACE(pb_verbose, tout << (full?"full":"partial") << " "; for (unsigned i = 0; i < n; ++i) tout << xs[i] << " "; tout << "\n";); literal_vector in(n, xs); @@ -948,7 +948,7 @@ Notes: for (unsigned i = 0; i < N; ++i) { in.push_back(mk_not(xs[i])); } - TRACE("pb_verbose", + TRACE(pb_verbose, //pp(tout << N << ": ", in); tout << " ~ " << k << "\n";); return true; @@ -1034,23 +1034,23 @@ Notes: } void card(unsigned k, unsigned n, literal const* xs, literal_vector& out) { - TRACE("pb_verbose", tout << "card k: " << k << " n: " << n << "\n";); + TRACE(pb_verbose, tout << "card k: " << k << " n: " << n << "\n";); if (n <= k) { psort_nw::sorting(n, xs, out); } else if (use_dcard(k, n)) { - TRACE("pb_verbose", tout << "use dcard\n";); + TRACE(pb_verbose, tout << "use dcard\n";); dsorting(k, n, xs, out); } else { - TRACE("pb_verbose", tout << "use merge\n";); + TRACE(pb_verbose, tout << "use merge\n";); literal_vector out1, out2; unsigned half = n/2; // TBD card(k, half, xs, out1); card(k, n-half, xs + half, out2); smerge(k, out1.size(), out1.data(), out2.size(), out2.data(), out); } - TRACE("pb_verbose", tout << "card k: " << k << " n: " << n << "\n"; + TRACE(pb_verbose, tout << "card k: " << k << " n: " << n << "\n"; //pp(tout << "in:", n, xs) << "\n"; //pp(tout << "out:", out) << "\n"; ); @@ -1115,7 +1115,7 @@ Notes: odd_b.size(), odd_b.data(), out2); interleave(out1, out2, out); } - TRACE("pb_verbose", tout << "merge a: " << a << " b: " << b << " "; + TRACE(pb_verbose, tout << "merge a: " << a << " b: " << b << " "; tout << "num clauses " << m_stats.m_num_compiled_clauses - nc << "\n"; vc_dsmerge(a, b, a + b).pp(tout << "vc_dsmerge ") << "\n"; vc_smerge_rec(a, b, a + b).pp(tout << "vc_smerge_rec ") << "\n"; @@ -1178,7 +1178,7 @@ Notes: out.push_back(as[sz+1]); } SASSERT(out.size() == as.size() + bs.size()); - TRACE("pb_verbose", tout << "interleave: " << as.size() << " " << bs.size() << " "; + TRACE(pb_verbose, tout << "interleave: " << as.size() << " " << bs.size() << " "; tout << "num clauses " << m_stats.m_num_compiled_clauses - nc << "\n"; //pp(tout << "a: ", as) << "\n"; //pp(tout << "b: ", bs) << "\n"; @@ -1192,7 +1192,7 @@ Notes: public: void sorting(unsigned n, literal const* xs, literal_vector& out) { - TRACE("pb_verbose", tout << "sorting: " << n << "\n";); + TRACE(pb_verbose, tout << "sorting: " << n << "\n";); switch(n) { case 0: break; @@ -1204,11 +1204,11 @@ Notes: break; default: if (use_dsorting(n)) { - TRACE("pb_verbose", tout << "use dsorting: " << n << "\n";); + TRACE(pb_verbose, tout << "use dsorting: " << n << "\n";); dsorting(n, n, xs, out); } else { - TRACE("pb_verbose", tout << "use merge: " << n << "\n";); + TRACE(pb_verbose, tout << "use merge: " << n << "\n";); literal_vector out1, out2; unsigned half = n/2; // TBD sorting(half, xs, out1); @@ -1219,7 +1219,7 @@ Notes: } break; } - TRACE("pb_verbose", tout << "sorting: " << n << "\n"; + TRACE(pb_verbose, tout << "sorting: " << n << "\n"; //pp(tout << "in:", n, xs) << "\n"; //pp(tout << "out:", out) << "\n"; ); @@ -1331,7 +1331,7 @@ Notes: out.push_back(y); } } - TRACE("pb_verbose", tout << "smerge: c:" << c << " a:" << a << " b:" << b << " "; + TRACE(pb_verbose, tout << "smerge: c:" << c << " a:" << a << " b:" << b << " "; tout << "num clauses " << m_stats.m_num_compiled_clauses - nc << "\n"; //pp(tout << "a:", a, as) << "\n"; //pp(tout << "b:", b, bs) << "\n"; @@ -1421,7 +1421,7 @@ Notes: } } } - TRACE("pb_verbose", tout << "dsmerge: c:" << c << " a:" << a << " b:" << b << " "; + TRACE(pb_verbose, tout << "dsmerge: c:" << c << " a:" << a << " b:" << b << " "; tout << "num clauses: " << m_stats.m_num_compiled_clauses - nc << "\n"; vc_dsmerge(a, b, c).pp(tout << "vc_dsmerge ") << "\n"; vc_smerge_rec(a, b, c).pp(tout << "vc_smerge_rec ") << "\n"; @@ -1463,7 +1463,7 @@ Notes: lits.pop_back(); } } - TRACE("pb_verbose", + TRACE(pb_verbose, tout << "dsorting m: " << m << " n: " << n << " "; tout << "num clauses: " << m_stats.m_num_compiled_clauses - nc << "\n";); } @@ -1482,7 +1482,7 @@ Notes: void add_subset(bool polarity, unsigned k, unsigned offset, literal_vector& lits, unsigned n, literal const* xs) { - TRACE("pb_verbose", tout << "k:" << k << " offset: " << offset << " n: " << n << " "; + TRACE(pb_verbose, tout << "k:" << k << " offset: " << offset << " n: " << n << " "; //pp(tout, lits) << "\n"; ); SASSERT(k + offset <= n); diff --git a/src/util/state_graph.cpp b/src/util/state_graph.cpp index 55de6d515..9d26b4c99 100644 --- a/src/util/state_graph.cpp +++ b/src/util/state_graph.cpp @@ -20,7 +20,7 @@ Author: #include void state_graph::add_state_core(state s) { - STRACE("state_graph", tout << "add(" << s << ") ";); + STRACE(state_graph, tout << "add(" << s << ") ";); SASSERT(!m_seen.contains(s)); // Ensure corresponding var in union find structure while (s >= m_state_ufind.get_num_vars()) { @@ -38,7 +38,7 @@ void state_graph::remove_state_core(state s) { // added again later. // The state should be unknown, and all edges to or from the state // should already have been renamed. - STRACE("state_graph", tout << "del(" << s << ") ";); + STRACE(state_graph, tout << "del(" << s << ") ";); SASSERT(m_seen.contains(s)); SASSERT(!m_state_ufind.is_root(s)); SASSERT(m_unknown.contains(s)); @@ -49,21 +49,21 @@ void state_graph::remove_state_core(state s) { } void state_graph::mark_unknown_core(state s) { - STRACE("state_graph", tout << "unk(" << s << ") ";); + STRACE(state_graph, tout << "unk(" << s << ") ";); SASSERT(m_state_ufind.is_root(s)); SASSERT(m_unexplored.contains(s)); m_unexplored.remove(s); m_unknown.insert(s); } void state_graph::mark_live_core(state s) { - STRACE("state_graph", tout << "live(" << s << ") ";); + STRACE(state_graph, tout << "live(" << s << ") ";); SASSERT(m_state_ufind.is_root(s)); SASSERT(m_unknown.contains(s)); m_unknown.remove(s); m_live.insert(s); } void state_graph::mark_dead_core(state s) { - STRACE("state_graph", tout << "dead(" << s << ") ";); + STRACE(state_graph, tout << "dead(" << s << ") ";); SASSERT(m_state_ufind.is_root(s)); SASSERT(m_unknown.contains(s)); m_unknown.remove(s); @@ -78,7 +78,7 @@ void state_graph::mark_dead_core(state s) { maybecycle = true. */ void state_graph::add_edge_core(state s1, state s2, bool maybecycle) { - STRACE("state_graph", tout << "add(" << s1 << "," << s2 << "," + STRACE(state_graph, tout << "add(" << s1 << "," << s2 << "," << (maybecycle ? "y" : "n") << ") ";); SASSERT(m_state_ufind.is_root(s1)); SASSERT(m_state_ufind.is_root(s2)); @@ -95,7 +95,7 @@ void state_graph::add_edge_core(state s1, state s2, bool maybecycle) { } } void state_graph::remove_edge_core(state s1, state s2) { - STRACE("state_graph", tout << "del(" << s1 << "," << s2 << ") ";); + STRACE(state_graph, tout << "del(" << s1 << "," << s2 << ") ";); SASSERT(m_targets[s1].contains(s2)); SASSERT(m_sources[s2].contains(s1)); m_targets[s1].remove(s2); @@ -127,7 +127,7 @@ auto state_graph::merge_states(state s1, state s2) -> state { SASSERT(m_state_ufind.is_root(s2)); SASSERT(m_unknown.contains(s1)); SASSERT(m_unknown.contains(s2)); - STRACE("state_graph", tout << "merge(" << s1 << "," << s2 << ") ";); + STRACE(state_graph, tout << "merge(" << s1 << "," << s2 << ") ";); m_state_ufind.merge(s1, s2); if (m_state_ufind.is_root(s2)) std::swap(s1, s2); // rename s2 to s1 in edges @@ -262,15 +262,15 @@ auto state_graph::merge_all_cycles(state s) -> state { void state_graph::add_state(state s) { if (m_seen.contains(s)) return; - STRACE("state_graph", tout << "[state_graph] adding state " << s << ": ";); + STRACE(state_graph, tout << "[state_graph] adding state " << s << ": ";); add_state_core(s); CASSERT("state_graph", write_dgml()); CASSERT("state_graph", write_dot()); CASSERT("state_graph", check_invariant()); - STRACE("state_graph", tout << std::endl;); + STRACE(state_graph, tout << std::endl;); } void state_graph::mark_live(state s) { - STRACE("state_graph", tout << "[state_graph] marking live " << s << ": ";); + STRACE(state_graph, tout << "[state_graph] marking live " << s << ": ";); SASSERT(m_unexplored.contains(s) || m_live.contains(s)); SASSERT(m_state_ufind.is_root(s)); if (m_unexplored.contains(s)) mark_unknown_core(s); @@ -278,10 +278,10 @@ void state_graph::mark_live(state s) { CASSERT("state_graph", write_dgml()); CASSERT("state_graph", write_dot()); CASSERT("state_graph", check_invariant()); - STRACE("state_graph", tout << std::endl;); + STRACE(state_graph, tout << std::endl;); } void state_graph::add_edge(state s1, state s2, bool maybecycle) { - STRACE("state_graph", tout << "[state_graph] adding edge " + STRACE(state_graph, tout << "[state_graph] adding edge " << s1 << "->" << s2 << ": ";); SASSERT(m_unexplored.contains(s1) || m_live.contains(s1)); SASSERT(m_state_ufind.is_root(s1)); @@ -292,20 +292,20 @@ void state_graph::add_edge(state s1, state s2, bool maybecycle) { CASSERT("state_graph", write_dgml()); CASSERT("state_graph", write_dot()); CASSERT("state_graph", check_invariant()); - STRACE("state_graph", tout << std::endl;); + STRACE(state_graph, tout << std::endl;); } void state_graph::mark_done(state s) { SASSERT(m_unexplored.contains(s) || m_live.contains(s)); SASSERT(m_state_ufind.is_root(s)); if (m_live.contains(s)) return; - STRACE("state_graph", tout << "[state_graph] marking done " << s << ": ";); + STRACE(state_graph, tout << "[state_graph] marking done " << s << ": ";); if (m_unexplored.contains(s)) mark_unknown_core(s); s = merge_all_cycles(s); mark_dead_recursive(s); // check if dead CASSERT("state_graph", write_dgml()); CASSERT("state_graph", write_dot()); CASSERT("state_graph", check_invariant()); - STRACE("state_graph", tout << std::endl;); + STRACE(state_graph, tout << std::endl;); } unsigned state_graph::get_size() const { @@ -413,7 +413,7 @@ bool state_graph::check_invariant() const { !(m_unknown.contains(s1) && m_unknown.contains(s2) && m_sources_maybecycle[s2].contains(s1))); - STRACE("state_graph", tout << "(invariant passed) ";); + STRACE(state_graph, tout << "(invariant passed) ";); return true; } diff --git a/src/util/tbv.cpp b/src/util/tbv.cpp index 5048267ad..3b99fdec5 100644 --- a/src/util/tbv.cpp +++ b/src/util/tbv.cpp @@ -31,7 +31,7 @@ void tbv_manager::debug_alloc() { tbv_manager::~tbv_manager() { DEBUG_CODE( for (auto t : allocated_tbvs) - TRACE("doc", tout << "dangling: " << t << "\n";);); + TRACE(doc, tout << "dangling: " << t << "\n";);); } void tbv_manager::reset() { @@ -42,7 +42,7 @@ tbv* tbv_manager::allocate() { m.reset(*r); DEBUG_CODE( if (s_debug_alloc) { - TRACE("doc", tout << allocated_tbvs.size() << " " << r << "\n";); + TRACE(doc, tout << allocated_tbvs.size() << " " << r << "\n";); } allocated_tbvs.insert(r); ); @@ -174,7 +174,7 @@ void tbv_manager::deallocate(tbv* bv) { UNREACHABLE(); } if (s_debug_alloc) { - TRACE("doc", tout << "deallocate: " << bv << "\n";); + TRACE(doc, tout << "deallocate: " << bv << "\n";); } allocated_tbvs.erase(bv);); #endif diff --git a/src/util/total_order.h b/src/util/total_order.h index 07e409717..5aac3f82b 100644 --- a/src/util/total_order.h +++ b/src/util/total_order.h @@ -87,7 +87,7 @@ class total_order { uint64_t vbn_a = vbn(a); SASSERT(vb_a < vbn_a); if (vbn_a < 2 || (vb_a > vbn_a - 2)) { - TRACE("total_order", tout << "relabeling...\n"; tout << "\n";); + TRACE(total_order, tout << "relabeling...\n"; tout << "\n";); uint64_t v0 = v(a); unsigned sz = size(); uint64_t ideal_gap = UINT64_MAX / sz; @@ -100,7 +100,7 @@ class total_order { c = c->m_next; curr_gap = (v(c) - v0) / j; } - TRACE("total_order", tout << "j: " << j << " curr_gap: " << curr_gap << " sz: " << sz << "\n";); + TRACE(total_order, tout << "j: " << j << " curr_gap: " << curr_gap << " sz: " << sz << "\n";); if (j == sz) curr_gap = ideal_gap; c = a->m_next; diff --git a/src/util/trace.cpp b/src/util/trace.cpp index d6e6323fc..bb4812e00 100644 --- a/src/util/trace.cpp +++ b/src/util/trace.cpp @@ -59,6 +59,20 @@ void finalize_trace() { void enable_trace(const char * tag) { get_enabled_trace_tags().insert(tag); + + // TODO(#7663): Implement tag_class activation of all associated tags + // int count = 0; + // TraceTag tag_str = find_trace_tag_by_string(tag); + // if(tag_str == TraceTag::Count) { + // return; + // } + // const TraceTag* tags = get_tags_by_class(tag_str, count); + // for (int i = 0; i < count; ++i) { + // const char* tag_str = tracetag_to_string(tags[i]); + // if (!get_enabled_trace_tags().contains(tag_str)) { + // get_enabled_trace_tags().insert(tag_str); + // } + // } } void enable_all_trace(bool flag) { @@ -69,9 +83,9 @@ void disable_trace(const char * tag) { get_enabled_trace_tags().erase(tag); } -bool is_trace_enabled(const char * tag) { +bool is_trace_enabled(TraceTag tag) { return g_enable_all_trace_tags || - (g_enabled_trace_tags && get_enabled_trace_tags().contains(tag)); + (g_enabled_trace_tags && get_enabled_trace_tags().contains(tracetag_to_string(tag))); } void close_trace() { diff --git a/src/util/trace.h b/src/util/trace.h index 2a63bfaf9..afa5dd48c 100644 --- a/src/util/trace.h +++ b/src/util/trace.h @@ -20,6 +20,7 @@ Revision History: #pragma once #include +#include "trace_tags.h" #ifdef SINGLE_THREAD # define is_threaded() false @@ -55,7 +56,7 @@ extern std::ofstream tout; void enable_trace(const char * tag); void enable_all_trace(bool flag); void disable_trace(const char * tag); -bool is_trace_enabled(const char * tag); +bool is_trace_enabled(TraceTag tag); void close_trace(); void open_trace(); void finalize_trace(); @@ -69,21 +70,18 @@ void finalize_trace(); static inline void enable_trace(const char * tag) {} static inline void enable_all_trace(bool flag) {} static inline void disable_trace(const char * tag) {} -static inline bool is_trace_enabled(const char * tag) { return false; } +static inline bool is_trace_enabled(TraceTag tag) { return false; } static inline void close_trace() {} static inline void open_trace() {} static inline void finalize_trace() {} #endif -#define TRACEH(TAG) tout << "-------- [" << TAG << "] " << __FUNCTION__ << " " << __FILE__ << ":" << __LINE__ << " ---------\n" +#define TRACEH(TAG) tout << "-------- [" << tracetag_to_string(TraceTag::TAG) << "] " << __FUNCTION__ << " " << __FILE__ << ":" << __LINE__ << " ---------\n" #define TRACEEND tout << "------------------------------------------------\n" #define TRACEBODY(TAG, CODE) TRACEH(TAG); CODE; TRACEEND; tout.flush() #define STRACEBODY(CODE) CODE; tout.flush() -#define TRACE(TAG, CODE) TRACE_CODE(if (is_trace_enabled(TAG)) { THREAD_LOCK(TRACEBODY(TAG, CODE)); }) - -#define STRACE(TAG, CODE) TRACE_CODE(if (is_trace_enabled(TAG)) { THREAD_LOCK(STRACEBODY(CODE)); }) - -#define SCTRACE(TAG, COND, CODE) TRACE_CODE(if (is_trace_enabled(TAG) && (COND)) { THREAD_LOCK(STRACEBODY(CODE)); }) - -#define CTRACE(TAG, COND, CODE) TRACE_CODE(if (is_trace_enabled(TAG) && (COND)) { THREAD_LOCK(TRACEBODY(TAG, CODE)); }) +#define TRACE(TAG, CODE) TRACE_CODE(if (is_trace_enabled(TraceTag::TAG)) { THREAD_LOCK(TRACEBODY(TAG, CODE)); }) +#define STRACE(TAG, CODE) TRACE_CODE(if (is_trace_enabled(TraceTag::TAG)) { THREAD_LOCK(STRACEBODY(CODE)); }) +#define SCTRACE(TAG, COND, CODE) TRACE_CODE(if (is_trace_enabled(TraceTag::TAG) && (COND)) { THREAD_LOCK(STRACEBODY(CODE)); }) +#define CTRACE(TAG, COND, CODE) TRACE_CODE(if (is_trace_enabled(TraceTag::TAG) && (COND)) { THREAD_LOCK(TRACEBODY(TAG, CODE)); }) diff --git a/src/util/trace_tags.def b/src/util/trace_tags.def new file mode 100644 index 000000000..7f8b6988a --- /dev/null +++ b/src/util/trace_tags.def @@ -0,0 +1,1248 @@ +// CLASS or STRUCT +X(Global, Global, "Unknown Class") + +X(arith_bounds_tactic, arith_bounds_tactic, "arith bounds tactic") +X(add_bounds_tactic, add_bounds_tactic, "add bounds tactic") +X(parser, parser, "parser") +X(ctx_propagate_assertions, ctx_propagate_assertions, "ctx propagate assertions") +X(bv_size_reduction_tactic, bv_size_reduction_tactic, "bv size reduction tactic") +X(lar_solver, lar_solver, "lar solver") +X(imp, imp, "imp") +X(auf_solver, auf_solver, "auf solver") +X(split_clause_tactic, split_clause_tactic, "split clause tactic") +X(check_sat_using_tactic_cmd, check_sat_using_tactic_cmd, "check sat using tactic command") +X(rw_cfg, rw_cfg, "rw cfg") +X(bv_bound_chk_rewriter_cfg, bv_bound_chk_rewriter_cfg, "bv bound chk rewriter cfg") +X(eq_der, eq_der, "eq der") +X(elim_uncnstr_tactic, elim_uncnstr_tactic, "elim uncnstr tactic") +X(fm_model_converter, fm_model_converter, "fm model converter") +X(get_implied_equalities_impl, get_implied_equalities_impl, "get implied equalities impl") +X(ackermannize_bv_tactic, ackermannize_bv_tactic, "ackermannize bv tactic") +X(inc_sat_solver, inc_sat_solver, "inc sat solver") +X(create_cut, create_cut, "create cut") +X(mam_impl, mam_impl, "mam impl") +X(lemma_inductive_generalizer, lemma_inductive_generalizer, "lemma inductive generalizer") +X(injectivity_tactic, injectivity_tactic, "injectivity tactic") +X(bounded_int2bv_solver, bounded_int2bv_solver, "bounded int2bv solver") +X(quantifier_analyzer, quantifier_analyzer, "quantifier analyzer") +X(ite_term_relevancy_eh, ite_term_relevancy_eh, "ite term relevancy eh") +X(smt2_printer, smt2_printer, "smt2 printer") +X(combined_solver, combined_solver, "combined solver") +X(lia_rewriter_cfg, lia_rewriter_cfg, "lia rewriter cfg") +X(relevancy_propagator_imp, relevancy_propagator_imp, "relevancy propagator imp") +X(is_non_nira_functor, is_non_nira_functor, "is non nira functor") +X(push_instantiations_up_cl, push_instantiations_up_cl, "push instantiations up cl") +X(nlarith_plugin, nlarith_plugin, "nlarith plugin") +X(tangent_imp, tangent_imp, "tangent imp") +X(th_rewriter_cfg, th_rewriter_cfg, "th rewriter cfg") +X(purify_arith_proc, purify_arith_proc, "purify arith proc") +X(qsat, qsat, "qsat") +X(lex_lt2, lex_lt2, "lex lt2") +X(trace_tactic, trace_tactic, "trace tactic") +X(compiler, compiler, "compiler") +X(interpreter, interpreter, "interpreter") +X(default_qm_plugin, default_qm_plugin, "default qm plugin") +X(name_nested_formulas, name_nested_formulas, "name nested formulas") +X(monomial_manager, monomial_manager, "monomial manager") +X(nary_tactical, nary_tactical, "nary tactical") +X(propagate_values_tactic, propagate_values_tactic, "propagate values tactic") +X(expr_substitution_simplifier, expr_substitution_simplifier, "expr substitution simplifier") +X(kernel, kernel, "kernel") +X(ast_pp_dot_st, ast_pp_dot_st, "ast pp dot st") +X(sls_tactic, sls_tactic, "sls tactic") +X(reduce_args_simplifier, reduce_args_simplifier, "reduce args simplifier") +X(join_planner, join_planner, "join planner") +X(well_sorted_proc, well_sorted_proc, "well sorted proc") +X(using_params_tactical, using_params_tactical, "using params tactical") +X(theory_aware_branching_queue, theory_aware_branching_queue, "theory aware branching queue") +X(pool_solver, pool_solver, "pool solver") +X(conv_rewriter_cfg, conv_rewriter_cfg, "conv rewriter cfg") +X(simplifier_solver, simplifier_solver, "simplifier solver") +X(bool_plugin, bool_plugin, "bool plugin") +X(get_uninterp_proc, get_uninterp_proc, "get uninterp proc") +X(berlekamp_matrix, berlekamp_matrix, "berlekamp matrix") +X(pob, pob, "pob") +X(theory_str, theory_str, "theory str") + +// TAG +X(t_str_dump_assign, theory_str, "dump assign") +X(t_str_dump_assign_on_scope_change, theory_str, "dump assign on scope change") +X(qe_def, eq_der, "qe def") +X(spacer_timeit, pob, "spacer timeit") +X(polynomial_factorization__bughunt, berlekamp_matrix, "polynomial factorization bug hunt") +X(qe_debug, Global, "qe debug") +X(old_interval, Global, "old interval") +X(CRA, Global, "CRA") +X(Lazard, Global, "Lazard") +X(QF_AUFLIA, Global, "QF AUFLIA") +X(TAG, Global, "TAG") +X(ac_sharing_detail, Global, "ac sharing detail") +X(ack, Global, "ack") +X(ackermannize, Global, "ackermannize") +X(activity_profile, Global, "activity profile") +X(add_bound, Global, "add bound") +X(add_bounds, add_bounds_tactic, "add bounds") +X(add_bug, Global, "add bug") +X(add_constraint_bug, imp, "add constraint bug") +X(add_diseq, Global, "add diseq") +X(add_diseq_inconsistent, Global, "add diseq inconsistent") +X(add_eq, Global, "add eq") +X(add_eq_bug, Global, "add eq bug") +X(add_eq_detail, Global, "add eq detail") +X(add_eq_parents, Global, "add eq parents") +X(add_var, lar_solver, "add var") +X(add_watch_literal_bug, Global, "add watch literal bug") +X(after_bit_blaster, imp, "after bit blaster") +X(after_bv_size_reduction, bv_size_reduction_tactic, "after bv size reduction") +X(after_cleanup, Global, "after cleanup") +X(after_first_propagate, Global, "after first propagate") +X(after_init_search, Global, "after init search") +X(after_internalization, Global, "after internalization") +X(after_internalize_assertions, Global, "after internalize assertions") +X(after_pop, parser, "after pop") +X(after_quasi_macros, Global, "after quasi macros") +X(after_reduce, Global, "after reduce") +X(after_reduce_ll, Global, "after reduce ll") +X(after_search, Global, "after search") +X(after_simplifier, Global, "after simplifier") +X(after_simplifier_detail, Global, "after simplifier detail") +X(aig2expr, Global, "aig2expr") +X(aig_lit_count, Global, "aig lit count") +X(aig_simplifier, Global, "aig simplifier") +X(algebraic, Global, "algebraic") +X(algebraic2expr, Global, "algebraic2expr") +X(algebraic_bug, Global, "algebraic bug") +X(algebraic_select, Global, "algebraic select") +X(anf_simplifier, Global, "anf simplifier") +X(anum_detail, Global, "anum detail") +X(anum_eval_sign, Global, "anum eval sign") +X(anum_mk_binary, Global, "anum mk binary") +X(app_ground, Global, "app ground") +X(are_distinct_bug, Global, "are distinct bug") +X(arith, Global, "arith") +X(arith_adaptive, Global, "arith adaptive") +X(arith_bound, Global, "arith bound") +X(arith_bug, Global, "arith bug") +X(arith_conflict, Global, "arith conflict") +X(arith_eq, Global, "arith eq") +X(arith_eq_adapter, Global, "arith eq adapter") +X(arith_eq_adapter_bug, Global, "arith eq adapter bug") +X(arith_eq_adapter_detail, Global, "arith eq adapter detail") +X(arith_eq_adapter_info, Global, "arith eq adapter info") +X(arith_eq_adapter_mk_axioms, Global, "arith eq adapter mk axioms") +X(arith_eq_adapter_perf, Global, "arith eq adapter perf") +X(arith_eq_adapter_profile, Global, "arith eq adapter profile") +X(arith_eq_adapter_profile_detail, Global, "arith eq adapter profile detail") +X(arith_eq_adapter_relevancy, Global, "arith eq adapter relevancy") +X(arith_eq_solver, Global, "arith eq solver") +X(arith_eq_verbose, Global, "arith eq verbose") +X(arith_final, Global, "arith final") +X(arith_imply_bound, Global, "arith imply bound") +X(arith_init_search, Global, "arith init search") +X(arith_int, Global, "arith int") +X(arith_int_detail, Global, "arith int detail") +X(arith_int_fracs_min_max, Global, "arith int fracs min max") +X(arith_int_freedom, Global, "arith int freedom") +X(arith_int_incomp, Global, "arith int incomp") +X(arith_int_inf, Global, "arith int inf") +X(arith_int_rows, Global, "arith int rows") +X(arith_internalize, Global, "arith internalize") +X(arith_internalize_detail, Global, "arith internalize detail") +X(arith_make_feasible, Global, "arith make feasible") +X(arith_make_feasible_detail, Global, "arith make feasible detail") +X(arith_mk_polynomial, Global, "arith mk polynomial") +X(arith_mod, Global, "arith mod") +X(arith_new_diseq_eh, Global, "arith new diseq eh") +X(arith_new_eq_eh, Global, "arith new eq eh") +X(arith_pivot, Global, "arith pivot") +X(arith_pivoting, Global, "arith pivoting") +X(arith_pop_scope_bug, Global, "arith pop scope bug") +X(arith_proof, Global, "arith proof") +X(arith_prop, Global, "arith prop") +X(arith_rand, Global, "arith rand") +X(arith_relevant_eh, Global, "arith relevant eh") +X(arith_rewriter, Global, "arith rewriter") +X(arith_rewriter_gcd, Global, "arith rewriter gcd") +X(arith_subsumption, arith_bounds_tactic, "arith subsumption") +X(arith_value, Global, "arith value") +X(arith_verbose, Global, "arith verbose") +X(array, Global, "array") +X(array_axiom, Global, "array axiom") +X(array_axiom2b, Global, "array axiom2b") +X(array_bug, Global, "array bug") +X(array_decl_plugin_bug, Global, "array decl plugin bug") +X(array_ext, Global, "array ext") +X(array_factory, Global, "array factory") +X(array_factory_bug, Global, "array factory bug") +X(array_map_bug, Global, "array map bug") +X(array_rewriter, Global, "array rewriter") +X(artih, Global, "artih") +X(assert_bound, Global, "assert bound") +X(assert_distinct, Global, "assert distinct") +X(assert_eq_bug, ctx_propagate_assertions, "assert eq bug") +X(assert_expr_bug, Global, "assert expr bug") +X(assert_k_diseq_exceptions, auf_solver, "assert k diseq exceptions") +X(asserted_formulas, Global, "asserted formulas") +X(asserted_formulas_bug, Global, "asserted formulas bug") +X(asserted_formulas_scopes, Global, "asserted formulas scopes") +X(assign_bit_bug, Global, "assign bit bug") +X(assign_core, Global, "assign core") +X(assign_profile, Global, "assign profile") +X(assign_quantifier_bug, Global, "assign quantifier bug") +X(assigned_literals_per_lvl, Global, "assigned literals per lvl") +X(assume_eq, Global, "assume eq") +X(assume_eq_int, Global, "assume eq int") +X(assume_eqs, Global, "assume eqs") +X(assumption, Global, "assumption") +X(assumptions, Global, "assumptions") +X(ast, Global, "ast") +X(ast_delete_node, Global, "ast delete node") +X(ast_translation, Global, "ast translation") +X(asymm_branch, Global, "asymm branch") +X(asymm_branch_detail, Global, "asymm branch detail") +X(ba, Global, "ba") +X(ba_verbose, Global, "ba verbose") +X(bcd, Global, "bcd") +X(bcp_bug, Global, "bcp bug") +X(bdd, Global, "bdd") +X(before_bit_blaster, imp, "before bit blaster") +X(before_bv_size_reduction, bv_size_reduction_tactic, "before bv size reduction") +X(before_check_sat, Global, "before check sat") +X(before_quasi_macros, Global, "before quasi macros") +X(before_reduce, Global, "before reduce") +X(before_sat_solver, imp, "before sat solver") +X(before_search, Global, "before search") +X(before_split_clause, split_clause_tactic, "before split clause") +X(begin_assert_expr, Global, "begin assert expr") +X(begin_assert_expr_ll, Global, "begin assert expr ll") +X(bin_clause_bug, Global, "bin clause bug") +X(bindings, Global, "bindings") +X(bit2int, Global, "bit2int") +X(bit2int_verbose, Global, "bit2int verbose") +X(bit_blaster, Global, "bit blaster") +X(bit_vector, Global, "bit vector") +X(bitwise_not, Global, "bitwise not") +X(blands_rule, Global, "blands rule") +X(blast_eq_value, Global, "blast eq value") +X(blast_term_ite, rw_cfg, "blast term ite") +X(blocked_clause, Global, "blocked clause") +X(blocked_clause_bug, Global, "blocked clause bug") +X(bmc, Global, "bmc") +X(bound_analyzer, Global, "bound analyzer") +X(bound_bug, Global, "bound bug") +X(bound_manager, Global, "bound manager") +X(bound_propagator, Global, "bound propagator") +X(bound_propagator_derived, Global, "bound propagator derived") +X(bound_propagator_detail, Global, "bound propagator detail") +X(bound_propagator_step, Global, "bound propagator step") +X(bound_propagator_step_detail, Global, "bound propagator step detail") +X(bound_relation, Global, "bound relation") +X(bounded_search, Global, "bounded search") +X(bv, Global, "bv") +X(bv2fpa, Global, "bv2fpa") +X(bv2fpa_rebuild, Global, "bv2fpa rebuild") +X(bv2int_bug, Global, "bv2int bug") +X(bv2int_rewriter, Global, "bv2int rewriter") +X(bv2real_rewriter, Global, "bv2real rewriter") +X(bv_are_distinct, Global, "bv are distinct") +X(bv_bit_prop, Global, "bv bit prop") +X(bv_bound_chk_step, bv_bound_chk_rewriter_cfg, "bv bound chk step") +X(bv_bounds, Global, "bv bounds") +X(bv_bug, Global, "bv bug") +X(bv_diseq_axiom, Global, "bv diseq axiom") +X(bv_eq, Global, "bv eq") +X(bv_ite, Global, "bv ite") +X(bv_op, Global, "bv op") +X(bv_size_reduction, bv_size_reduction_tactic, "bv size reduction") +X(bv_udiv, Global, "bv udiv") +X(bv_verbose, Global, "bv verbose") +X(bvarray2uf_rw, Global, "bvarray2uf rw") +X(bvarray2uf_rw_q, Global, "bvarray2uf rw q") +X(cached_generation, Global, "cached generation") +X(card, Global, "card") +X(card2bv, Global, "card2bv") +X(carry, Global, "carry") +X(carry_sorted, Global, "carry sorted") +X(case_split, Global, "case split") +X(causality, Global, "causality") +X(cg, Global, "cg") +X(cg_table, Global, "cg table") +X(chainable, Global, "chainable") +X(change_x_del, Global, "change x del") +X(chashtable, Global, "chashtable") +X(check_enode, Global, "check enode") +X(check_explanation, Global, "check explanation") +X(check_logic, Global, "check logic") +X(check_main_int, Global, "check main int") +X(check_relevancy, Global, "check relevancy") +X(check_sat_using, check_sat_using_tactic_cmd, "check sat using") +X(check_th_diseq_propagation, Global, "check th diseq propagation") +X(checker, Global, "checker") +X(clause_proof, Global, "clause proof") +X(clause_use_list_bug, Global, "clause use list bug") +X(cleanup_bug, Global, "cleanup bug") +X(cluster_stats, Global, "cluster stats") +X(cluster_stats_verb, Global, "cluster stats verb") +X(cmd_context, Global, "cmd context") +X(cmd_context_detail, Global, "cmd context detail") +X(coeff_bug, Global, "coeff bug") +X(cofactor, Global, "cofactor") +X(cofactor_bug, Global, "cofactor bug") +X(cofactor_ite, Global, "cofactor ite") +X(collect, Global, "collect") +X(collect_info, Global, "collect info") +X(collector, Global, "collector") +X(comm_proof_bug, Global, "comm proof bug") +X(concretize, Global, "concretize") +X(conflict, Global, "conflict") +X(conflict_, Global, "conflict ") +X(conflict_bug, Global, "conflict bug") +X(conflict_detail, Global, "conflict detail") +X(conflict_detail_verbose, Global, "conflict detail verbose") +X(conflict_smt2, Global, "conflict smt2") +X(conflict_verbose, Global, "conflict verbose") +X(consume_attributes, parser, "consume attributes") +X(content_bug, Global, "content bug") +X(context, Global, "context") +X(context_lemma, Global, "context lemma") +X(context_proof, Global, "context proof") +X(context_proof_hack, Global, "context proof hack") +X(convert_bug, Global, "convert bug") +X(copy_families_plugins, Global, "copy families plugins") +X(core_array_eq, Global, "core array eq") +X(core_eq, Global, "core eq") +X(cosine, Global, "cosine") +X(cross_nested, Global, "cross nested") +X(cross_nested_bug, Global, "cross nested bug") +X(ctx_simplify_tactic, Global, "ctx simplify tactic") +X(ctx_simplify_tactic_bug, Global, "ctx simplify tactic bug") +X(ctx_simplify_tactic_cache, Global, "ctx simplify tactic cache") +X(ctx_simplify_tactic_detail, Global, "ctx simplify tactic detail") +X(ctx_simplify_tactic_ite_bug, Global, "ctx simplify tactic ite bug") +X(ctx_solver_simplify_tactic, ctx_solver_simplify_tactic, "ctx solver simplify tactic") +X(cube, lar_solver, "cube") +X(current_solution_is_inf_on_cut, Global, "current solution is inf on cut") +X(cut_simplifier, Global, "cut simplifier") +X(cvx_dbg, Global, "cvx dbg") +X(cvx_dbg_verb, Global, "cvx dbg verb") +X(d_undo, Global, "d undo") +X(datatype, Global, "datatype") +X(datatype_bug, Global, "datatype bug") +X(datatype_conflict, Global, "datatype conflict") +X(datatype_detail, Global, "datatype detail") +X(datatype_parser_bug, parser, "datatype parser bug") +X(datatype_verbose, Global, "datatype verbose") +X(dd_solver, Global, "dd.solver") +X(dd_solver_d, Global, "dd.solver d") +X(ddl, Global, "ddl") +X(ddl_detail, Global, "ddl detail") +X(ddl_model, Global, "ddl model") +X(decide, Global, "decide") +X(decide_detail, Global, "decide detail") +X(declare_const, parser, "declare const") +X(declare_datatypes, parser, "declare datatypes") +X(deep_internalize, Global, "deep internalize") +X(degree_shift, imp, "degree shift") +X(del_atoms, Global, "del atoms") +X(del_inactive_lemmas, Global, "del inactive lemmas") +X(del_quantifier, Global, "del quantifier") +X(delete_node_bug, Global, "delete node bug") +X(demodulator, Global, "demodulator") +X(demodulator_bug, Global, "demodulator bug") +X(demodulator_fwd, Global, "demodulator fwd") +X(demodulator_stack, Global, "demodulator stack") +X(dep_intervals, Global, "dep intervals") +X(der, Global, "der") +X(der_bug, eq_der, "der bug") +X(derived_bound, Global, "derived bound") +X(diff_atom, Global, "diff atom") +X(diff_logic, Global, "diff logic") +X(diff_logic_traverse, Global, "diff logic traverse") +X(diff_logic_vars, Global, "diff logic vars") +X(diff_neq_tactic, imp, "diff neq tactic") +X(diff_term, Global, "diff term") +X(dio, Global, "dio") +X(dio_br, Global, "dio br") +X(dio_entry, Global, "dio entry") +X(dio_reg, Global, "dio reg") +X(dio_remove_fresh, Global, "dio remove fresh") +X(dio_s, Global, "dio s") +X(dioph_eq_deb, Global, "dioph eq deb") +X(diseq_bug, Global, "diseq bug") +X(distinct, Global, "distinct") +X(distribute_forall, Global, "distribute forall") +X(div_axiom_bug, Global, "div axiom bug") +X(div_bug, Global, "div bug") +X(divides, Global, "divides") +X(divides_bug, Global, "divides bug") +X(dl, Global, "dl") +X(dl_activity, Global, "dl activity") +X(dl_bfs, Global, "dl bfs") +X(dl_bug, Global, "dl bug") +X(dl_compiler, Global, "dl compiler") +X(dl_decl_plugin, Global, "dl decl plugin") +X(dl_eq_bug, Global, "dl eq bug") +X(dl_interp_tail_simplifier_propagation, Global, "dl interp tail simplifier propagation") +X(dl_interp_tail_simplifier_propagation_pre, Global, "dl interp tail simplifier propagation pre") +X(dl_relation, Global, "dl relation") +X(dl_rule, Global, "dl rule") +X(dl_rule_transf, Global, "dl rule transf") +X(dl_rule_unbound_fix, Global, "dl rule unbound fix") +X(dl_rule_unbound_fix_pre_qe, Global, "dl rule unbound fix pre qe") +X(dl_table_relation, Global, "dl table relation") +X(dl_verbose, Global, "dl verbose") +X(doc, Global, "doc") +X(dt, Global, "dt") +X(dt_is_value, Global, "dt is value") +X(dt_verbose, Global, "dt verbose") +X(dummy, Global, "dummy") +X(dump_terms, lar_solver, "dump terms") +X(dyn_ack, Global, "dyn ack") +X(dyn_ack_clause, Global, "dyn ack clause") +X(dyn_ack_inst, Global, "dyn ack inst") +X(dyn_ack_target, Global, "dyn ack target") +X(elim_bounds, Global, "elim bounds") +X(elim_eqs, Global, "elim eqs") +X(elim_eqs_bug, Global, "elim eqs bug") +X(elim_lit, Global, "elim lit") +X(elim_predicates, Global, "elim predicates") +X(elim_rem, Global, "elim rem") +X(elim_small_bv, rw_cfg, "elim small bv") +X(elim_small_bv_app, rw_cfg, "elim small bv app") +X(elim_small_bv_pre, rw_cfg, "elim small bv pre") +X(elim_term_ite_bug, Global, "elim term ite bug") +X(elim_to_real, Global, "elim to real") +X(elim_uncnstr, elim_uncnstr_tactic, "elim uncnstr") +X(elim_uncnstr_bug, rw_cfg, "elim uncnstr bug") +X(elim_uncnstr_bug_ll, rw_cfg, "elim uncnstr bug ll") +X(elim_unconstrained, Global, "elim unconstrained") +X(elim_unused_vars, Global, "elim unused vars") +X(eliminate, Global, "eliminate") +X(empty_pol, Global, "empty pol") +X(end_assert_expr_ll, Global, "end assert expr ll") +X(epsilon_bug, Global, "epsilon bug") +X(eq, Global, "eq") +X(eq_scc, Global, "eq scc") +X(eq_to_bug, Global, "eq to bug") +X(eqc_bool, Global, "eqc bool") +X(equiv, Global, "equiv") +X(euf, Global, "euf") +X(euf_completion, Global, "euf completion") +X(euf_verbose, Global, "euf verbose") +X(eval_bug, Global, "eval bug") +X(expand_bnd, Global, "expand bnd") +X(expand_bnd_verb, Global, "expand bnd verb") +X(expr2aig, Global, "expr2aig") +X(expr2polynomial, Global, "expr2polynomial") +X(expr2var, Global, "expr2var") +X(expr_abstract, Global, "expr abstract") +X(expr_context_simplifier, Global, "expr context simplifier") +X(expr_pattern_match, Global, "expr pattern match") +X(ext, Global, "ext") +X(ext_gcd_test, Global, "ext gcd test") +X(extract_prop, Global, "extract prop") +X(fact_bug, Global, "fact bug") +X(factor, Global, "factor") +X(factor_bug, Global, "factor bug") +X(factor_rewriter, Global, "factor rewriter") +X(factor_tactic_bug, rw_cfg, "factor tactic bug") +X(farkas_learner2, Global, "farkas learner2") +X(feas_bug, Global, "feas bug") +X(final_check, Global, "final check") +X(final_check_result, Global, "final check result") +X(final_check_stats, Global, "final check stats") +X(final_check_step, Global, "final check step") +X(find_feas_stats, Global, "find feas stats") +X(find_infeasible_int_base_var, Global, "find infeasible int base var") +X(find_ite_bounds, Global, "find ite bounds") +X(find_ite_bounds_bug, Global, "find ite bounds bug") +X(find_wpos, Global, "find wpos") +X(fingerprint_bug, Global, "fingerprint bug") +X(fits, Global, "fits") +X(fix_dl_var, imp, "fix dl var") +X(fix_missing_refs, Global, "fix missing refs") +X(fixed_var_eh, Global, "fixed var eh") +X(flush, Global, "flush") +X(fm, imp, "fm") +X(fm_bug, imp, "fm bug") +X(fm_mc, fm_model_converter, "fm mc") +X(fm_subsumption, imp, "fm subsumption") +X(for_each_ast, Global, "for each ast") +X(for_each_relevant_expr, Global, "for each relevant expr") +X(forget_phase, Global, "forget phase") +X(fp, Global, "fp") +X(fp_rewriter, Global, "fp rewriter") +X(fpa2bv, Global, "fpa2bv") +X(fpa2bv_add, Global, "fpa2bv add") +X(fpa2bv_add_core, Global, "fpa2bv add core") +X(fpa2bv_dbg, Global, "fpa2bv dbg") +X(fpa2bv_div, Global, "fpa2bv div") +X(fpa2bv_float_eq, Global, "fpa2bv float eq") +X(fpa2bv_fma_, Global, "fpa2bv fma ") +X(fpa2bv_is_negative, Global, "fpa2bv is negative") +X(fpa2bv_mc, Global, "fpa2bv mc") +X(fpa2bv_mk_fp, Global, "fpa2bv mk fp") +X(fpa2bv_mul, Global, "fpa2bv mul") +X(fpa2bv_rem, Global, "fpa2bv rem") +X(fpa2bv_round, Global, "fpa2bv round") +X(fpa2bv_round_to_integral, Global, "fpa2bv round to integral") +X(fpa2bv_rw, Global, "fpa2bv rw") +X(fpa2bv_to_bv, Global, "fpa2bv to bv") +X(fpa2bv_to_bv_unspecified, Global, "fpa2bv to bv unspecified") +X(fpa2bv_to_fp, Global, "fpa2bv to fp") +X(fpa2bv_to_fp_real, Global, "fpa2bv to fp real") +X(fpa2bv_to_fp_signed, Global, "fpa2bv to fp signed") +X(fpa2bv_to_fp_unsigned, Global, "fpa2bv to fp unsigned") +X(fpa2bv_to_ieee_bv, Global, "fpa2bv to ieee bv") +X(fpa2bv_to_ieee_bv_unspecified, Global, "fpa2bv to ieee bv unspecified") +X(fpa2bv_to_real, Global, "fpa2bv to real") +X(fpa2bv_to_sbv, Global, "fpa2bv to sbv") +X(fpa2bv_to_ubv, Global, "fpa2bv to ubv") +X(fpa2bv_unpack, Global, "fpa2bv unpack") +X(fpa_util, Global, "fpa util") +X(freedom_interval, Global, "freedom interval") +X(func_decl_alias, Global, "func decl alias") +X(func_decls, Global, "func decls") +X(func_interp, Global, "func interp") +X(func_interp_bug, Global, "func interp bug") +X(gate_clause, Global, "gate clause") +X(gb_bug, Global, "gb bug") +X(gcd, Global, "gcd") +X(gcd_calls, Global, "gcd calls") +X(gcd_test, Global, "gcd test") +X(gcd_test_bug, Global, "gcd test bug") +X(generation, Global, "generation") +X(get_assignment_bug, Global, "get assignment bug") +X(get_implied_equalities, get_implied_equalities_impl, "get implied equalities") +X(get_macro, Global, "get macro") +X(get_model, Global, "get model") +X(get_proof, Global, "get proof") +X(get_proof_bug, Global, "get proof bug") +X(get_proof_bug_after, Global, "get proof bug after") +X(gg, Global, "gg") +X(global, Global, "global") +X(global_verbose, Global, "global verbose") +X(goal, ackermannize_bv_tactic, "goal") +X(goal2nlsat, Global, "goal2nlsat") +X(goal2nlsat_bug, Global, "goal2nlsat bug") +X(goal2sat, inc_sat_solver, "goal2sat") +X(goal2sat_bug, Global, "goal2sat bug") +X(goal2sat_not_handled, Global, "goal2sat not handled") +X(gomory_cut, Global, "gomory cut") +X(gomory_cut_detail, create_cut, "gomory cut detail") +X(gomory_cut_detail_real, create_cut, "gomory cut detail real") +X(gparams, Global, "gparams") +X(grobner, Global, "grobner") +X(grobner_bug, Global, "grobner bug") +X(grobner_d, Global, "grobner d") +X(grobner_d_, Global, "grobner d ") +X(grobner_stats_d, Global, "grobner stats d") +X(guessed_literals, Global, "guessed literals") +X(heap, Global, "heap") +X(hilbert_basis, Global, "hilbert basis") +X(hilbert_basis_verbose, Global, "hilbert basis verbose") +X(hnf, Global, "hnf") +X(hnf_calc, Global, "hnf calc") +X(hnf_cut, Global, "hnf cut") +X(horn, imp, "horn") +X(horner_bug, Global, "horner bug") +X(hyper_res, Global, "hyper res") +X(imply_eq, Global, "imply eq") +X(in_monovariate_monomials, Global, "in monovariate monomials") +X(incompleteness_bug, Global, "incompleteness bug") +X(incremental_matcher, mam_impl, "incremental matcher") +X(indgen, lemma_inductive_generalizer, "indgen") +X(inf_rational, Global, "inf rational") +X(inherit_bug, Global, "inherit bug") +X(init_bits, Global, "init bits") +X(init_row_bug, Global, "init row bug") +X(inj_axiom, Global, "inj axiom") +X(injectivity, injectivity_tactic, "injectivity") +X(insert_macro, Global, "insert macro") +X(instance, Global, "instance") +X(instantiate_bug, Global, "instantiate bug") +X(int2bv, bounded_int2bv_solver, "int2bv") +X(int_solver, Global, "int solver") +X(interface_eq, Global, "interface eq") +X(internalize, Global, "internalize") +X(internalize_add_bug, Global, "internalize add bug") +X(internalize_assertion, Global, "internalize assertion") +X(internalize_assertion_ll, Global, "internalize assertion ll") +X(internalize_assertions, Global, "internalize assertions") +X(internalize_bug, Global, "internalize bug") +X(internalize_ite_term_bug, Global, "internalize ite term bug") +X(internalize_mul_core, Global, "internalize mul core") +X(internalize_quantifier, Global, "internalize quantifier") +X(internalize_quantifier_zero, Global, "internalize quantifier zero") +X(internalize_theory_atom, Global, "internalize theory atom") +X(interpolator, Global, "interpolator") +X(interval, Global, "interval") +X(interval_bug, Global, "interval bug") +X(interval_nth_root, Global, "interval nth root") +X(interval_relation, Global, "interval relation") +X(interval_xn_eq_y, Global, "interval xn eq y") +X(interval_zero_bug, Global, "interval zero bug") +X(inv_algebraic, Global, "inv algebraic") +X(invalid_ptr, Global, "invalid ptr") +X(is_allone, Global, "is allone") +X(is_bv_num, parser, "is bv num") +X(is_diseq, Global, "is diseq") +X(is_diseq_bug, Global, "is diseq bug") +X(is_eq_vector, imp, "is eq vector") +X(is_ext_diseq, Global, "is ext diseq") +X(is_inconsistent, Global, "is inconsistent") +X(is_occ_bug, imp, "is occ bug") +X(is_row_useful, Global, "is row useful") +X(is_shared, Global, "is shared") +X(is_var_and_ground, quantifier_analyzer, "is var and ground") +X(is_var_plus_ground, quantifier_analyzer, "is var plus ground") +X(is_x_gle_t, quantifier_analyzer, "is x gle t") +X(isolate_roots, Global, "isolate roots") +X(isolate_roots_bug, Global, "isolate roots bug") +X(ite_bug, Global, "ite bug") +X(ite_term_relevancy, ite_term_relevancy_eh, "ite term relevancy") +X(lar_solver_details, lar_solver, "lar solver details") +X(lar_solver_feas, Global, "lar solver feas") +X(lar_solver_improve_bounds, lar_solver, "lar solver improve bounds") +X(lar_solver_inf_heap, Global, "lar solver inf heap") +X(lar_solver_model, lar_solver, "lar solver model") +X(lar_solver_rand, lar_solver, "lar solver rand") +X(lar_solver_terms, lar_solver, "lar solver terms") +X(lar_solver_validate, lar_solver, "lar solver validate") +X(lcm_bug, Global, "lcm bug") +X(le_bug, Global, "le bug") +X(le_extra, Global, "le extra") +X(lemma, Global, "lemma") +X(let_frame, parser, "let frame") +X(lex_bug, lex_lt2, "lex bug") +X(lia2pb, imp, "lia2pb") +X(linear_eq_solver, Global, "linear eq solver") +X(linear_equation_bug, Global, "linear equation bug") +X(linear_equation_mk, Global, "linear equation mk") +X(list, Global, "list") +X(literal_occ, Global, "literal occ") +X(lp_core, Global, "lp core") +X(m_tag, trace_tactic, "m tag") +X(macro_bug, Global, "macro bug") +X(macro_finder, Global, "macro finder") +X(macro_insert, Global, "macro insert") +X(macro_manager, Global, "macro manager") +X(macro_manager_bug, Global, "macro manager bug") +X(macro_util, Global, "macro util") +X(macros, Global, "macros") +X(make_var_feasible, Global, "make var feasible") +X(mam, mam_impl, "mam") +X(mam_bug, mam_impl, "mam bug") +X(mam_candidate, mam_impl, "mam candidate") +X(mam_compiler, compiler, "mam compiler") +X(mam_compiler_bug, compiler, "mam compiler bug") +X(mam_compiler_detail, compiler, "mam compiler detail") +X(mam_execute_core, interpreter, "mam execute core") +X(mam_inc_bug, mam_impl, "mam inc bug") +X(mam_inc_bug_detail, mam_impl, "mam inc bug detail") +X(mam_info, mam_impl, "mam info") +X(mam_int, interpreter, "mam int") +X(mam_lbl_bug, compiler, "mam lbl bug") +X(mam_new_pat, mam_impl, "mam new pat") +X(mam_pat, mam_impl, "mam pat") +X(mam_path_tree, mam_impl, "mam path tree") +X(mam_path_tree_updt, mam_impl, "mam path tree updt") +X(mam_stats, default_qm_plugin, "mam stats") +X(mask_bug, Global, "mask bug") +X(max_sharing, Global, "max sharing") +X(may_propagate_bug, Global, "may propagate bug") +X(mbc, Global, "mbc") +X(mbi, Global, "mbi") +X(mbp_tg, Global, "mbp tg") +X(mbp_tg_verbose, Global, "mbp tg verbose") +X(mbqi_bug, Global, "mbqi bug") +X(mbqi_bug_detail, Global, "mbqi bug detail") +X(mbqi_project, Global, "mbqi project") +X(mbqi_project_verbose, Global, "mbqi project verbose") +X(mc, Global, "mc") +X(memory, Global, "memory") +X(merge_theory_vars, Global, "merge theory vars") +X(mf_simp_bug, auf_solver, "mf simp bug") +X(mg_top_sort, Global, "mg top sort") +X(mgcd, Global, "mgcd") +X(mgcd_bug, Global, "mgcd bug") +X(mgcd_call, Global, "mgcd call") +X(mgcd_detail, Global, "mgcd detail") +X(missing_instance, mam_impl, "missing instance") +X(missing_instance_detail, Global, "missing instance detail") +X(missing_propagation, Global, "missing propagation") +X(mk_and_bug, Global, "mk and bug") +X(mk_and_cnstr, Global, "mk and cnstr") +X(mk_and_elim, Global, "mk and elim") +X(mk_arith_var, Global, "mk arith var") +X(mk_asserted_bug, Global, "mk asserted bug") +X(mk_axioms_bug, Global, "mk axioms bug") +X(mk_bool_var, Global, "mk bool var") +X(mk_bound_axioms, Global, "mk bound axioms") +X(mk_clause, Global, "mk clause") +X(mk_clause_result, Global, "mk clause result") +X(mk_conflict_proof, Global, "mk conflict proof") +X(mk_constraint_bug, imp, "mk constraint bug") +X(mk_definition_bug, Global, "mk definition bug") +X(mk_enode, Global, "mk enode") +X(mk_enode_detail, Global, "mk enode detail") +X(mk_filter_rules, Global, "mk filter rules") +X(mk_iff_cnstr, Global, "mk iff cnstr") +X(mk_le_bug, Global, "mk le bug") +X(mk_lemma, Global, "mk lemma") +X(mk_modus_ponens, Global, "mk modus ponens") +X(mk_mul_eq, Global, "mk mul eq") +X(mk_pbc, imp, "mk pbc") +X(mk_proof, Global, "mk proof") +X(mk_quantifier, parser, "mk quantifier") +X(mk_th_axiom, Global, "mk th axiom") +X(mk_th_lemma, Global, "mk th lemma") +X(mk_transitivity, Global, "mk transitivity") +X(mk_unit_resolution_bug, Global, "mk unit resolution bug") +X(mk_var_bug, Global, "mk var bug") +X(mod_bug, Global, "mod bug") +X(model, Global, "model") +X(model_bug, Global, "model bug") +X(model_checker, Global, "model checker") +X(model_checker_bug_detail, Global, "model checker bug detail") +X(model_constructor, Global, "model constructor") +X(model_converter, Global, "model converter") +X(model_evaluator, Global, "model evaluator") +X(model_finder, Global, "model finder") +X(model_finder_bug, quantifier_analyzer, "model finder bug") +X(model_finder_bug_detail, Global, "model finder bug detail") +X(model_finder_hint, Global, "model finder hint") +X(model_fresh_bug, Global, "model fresh bug") +X(model_generator_bug, Global, "model generator bug") +X(model_smt2_pp, Global, "model smt2 pp") +X(model_validate, Global, "model validate") +X(model_verbose, Global, "model verbose") +X(monomial_mul_bug, monomial_manager, "monomial mul bug") +X(move_unconstrained_to_base, Global, "move unconstrained to base") +X(mp_iff_justification, Global, "mp iff justification") +X(mpbq_bug, Global, "mpbq bug") +X(mpf_dbg, Global, "mpf dbg") +X(mpf_dbg_rem, Global, "mpf dbg rem") +X(mpf_dbg_sbv, Global, "mpf dbg sbv") +X(mpf_mul_bug, Global, "mpf mul bug") +X(mpff, Global, "mpff") +X(mpff_bug, Global, "mpff bug") +X(mpff_div, Global, "mpff div") +X(mpff_power, Global, "mpff power") +X(mpff_to_mpq, Global, "mpff to mpq") +X(mpff_trace, Global, "mpff trace") +X(mpfx, Global, "mpfx") +X(mpfx_power, Global, "mpfx power") +X(mpfx_trace, Global, "mpfx trace") +X(mpn, Global, "mpn") +X(mpn_dbg, Global, "mpn dbg") +X(mpn_div, Global, "mpn div") +X(mpn_div1, Global, "mpn div1") +X(mpn_norm, Global, "mpn norm") +X(mpn_to_string, Global, "mpn to string") +X(mpq, Global, "mpq") +X(mpq_set, Global, "mpq set") +X(mpz, Global, "mpz") +X(mpz_2k, Global, "mpz 2k") +X(mpz_gcd, Global, "mpz gcd") +X(mpz_matrix, Global, "mpz matrix") +X(mpz_mul2k, Global, "mpz mul2k") +X(mpzp_inv_bug, Global, "mpzp inv bug") +X(mpzzp, Global, "mpzzp") +X(mul_bug, Global, "mul bug") +X(mus, Global, "mus") +X(name_expr, parser, "name expr") +X(name_exprs, name_nested_formulas, "name exprs") +X(nary_tactical_updt_params, nary_tactical, "nary tactical updt params") +X(network_flow, Global, "network flow") +X(new_bound, Global, "new bound") +X(new_dt_eh, Global, "new dt eh") +X(new_entries_bug, Global, "new entries bug") +X(newton, Global, "newton") +X(nex_details, Global, "nex details") +X(nex_gt, Global, "nex gt") +X(nl_arith_bug, Global, "nl arith bug") +X(nl_branching, Global, "nl branching") +X(nl_evaluate, Global, "nl evaluate") +X(nl_info, Global, "nl info") +X(nl_value, Global, "nl value") +X(nla, Global, "nla") +X(nla2bv, get_uninterp_proc, "nla2bv") +X(nla2bv_verbose, imp, "nla2bv verbose") +X(nla_cn, Global, "nla cn") +X(nla_cn_, Global, "nla cn ") +X(nla_cn_common_factor, Global, "nla cn common factor") +X(nla_cn_details, Global, "nla cn details") +X(nla_cn_test, Global, "nla cn test") +X(nla_grobner, Global, "nla grobner") +X(nla_horner, Global, "nla horner") +X(nla_intervals, Global, "nla intervals") +X(nla_intervals_details, Global, "nla intervals details") +X(nla_solver, Global, "nla solver") +X(nla_solver_bl, Global, "nla solver bl") +X(nla_solver_check_monic, Global, "nla solver check monic") +X(nla_solver_details, Global, "nla solver details") +X(nla_solver_div, Global, "nla solver div") +X(nla_solver_eq, Global, "nla solver eq") +X(nla_solver_mons, Global, "nla solver mons") +X(nla_solver_tp, tangent_imp, "nla solver tp") +X(nla_solver_verbose, Global, "nla solver verbose") +X(nla_test, Global, "nla test") +X(nla_test_, Global, "nla test ") +X(nlarith, nlarith_plugin, "nlarith") +X(nlarith_verbose, Global, "nlarith verbose") +X(nlsat, imp, "nlsat") +X(nlsat_assign, Global, "nlsat assign") +X(nlsat_bool_assignment, Global, "nlsat bool assignment") +X(nlsat_bool_assignment_bug, Global, "nlsat bool assignment bug") +X(nlsat_bug, Global, "nlsat bug") +X(nlsat_evaluator, Global, "nlsat evaluator") +X(nlsat_evaluator_bug, Global, "nlsat evaluator bug") +X(nlsat_explain, Global, "nlsat explain") +X(nlsat_factor, Global, "nlsat factor") +X(nlsat_fd, Global, "nlsat fd") +X(nlsat_inf_set, Global, "nlsat inf set") +X(nlsat_interval, Global, "nlsat interval") +X(nlsat_lazy, Global, "nlsat lazy") +X(nlsat_mathematica, Global, "nlsat mathematica") +X(nlsat_minimize, Global, "nlsat minimize") +X(nlsat_model, Global, "nlsat model") +X(nlsat_proof, Global, "nlsat proof") +X(nlsat_proof_sk, Global, "nlsat proof sk") +X(nlsat_reorder, Global, "nlsat reorder") +X(nlsat_reorder_clauses, Global, "nlsat reorder clauses") +X(nlsat_resolve, Global, "nlsat resolve") +X(nlsat_resolve_done, Global, "nlsat resolve done") +X(nlsat_root, Global, "nlsat root") +X(nlsat_simpilfy_core, Global, "nlsat simpilfy core") +X(nlsat_simplify_core, Global, "nlsat simplify core") +X(nlsat_smt2, Global, "nlsat smt2") +X(nlsat_solver, Global, "nlsat solver") +X(nlsat_sort, Global, "nlsat sort") +X(nlsat_table_bug, Global, "nlsat table bug") +X(nlsat_verbose, Global, "nlsat verbose") +X(nnf, nnf, "nnf") +X(nnf_bug, Global, "nnf bug") +X(nnf_result, Global, "nnf result") +X(no_overflow, Global, "no overflow") +X(non_diff_logic, Global, "non diff logic") +X(non_linear, Global, "non linear") +X(non_linear_bug, Global, "non linear bug") +X(non_linear_gb, Global, "non linear gb") +X(non_linear_verbose, Global, "non linear verbose") +X(nondet_bug, Global, "nondet bug") +X(norm_eq_proof, Global, "norm eq proof") +X(norm_eq_proof_bug, Global, "norm eq proof bug") +X(normalize_bounds_tactic, imp, "normalize bounds tactic") +X(normalize_fraction_bug, Global, "normalize fraction bug") +X(nra, Global, "nra") +X(nth_root, Global, "nth root") +X(nth_root_bug, Global, "nth root bug") +X(nth_root_trace, Global, "nth root trace") +X(num_bits_bug, imp, "num bits bug") +X(object_allocator, Global, "object allocator") +X(old_spacer, Global, "old spacer") +X(opt, Global, "opt") +X(opt1, Global, "opt1") +X(opt_verbose, Global, "opt verbose") +X(optional, Global, "optional") +X(p2expr_bug, Global, "p2expr bug") +X(parent_bug, Global, "parent bug") +X(parray, Global, "parray") +X(parray_mem, Global, "parray mem") +X(parse_bv_numeral, parser, "parse bv numeral") +X(parse_expr, parser, "parse expr") +X(parse_numeral, parser, "parse numeral") +X(parse_qualified_name, parser, "parse qualified name") +X(parse_quantifier, parser, "parse quantifier") +X(parse_sorted_vars, parser, "parse sorted vars") +X(parser_error, parser, "parser error") +X(patch_int, Global, "patch int") +X(pattern_inference, Global, "pattern inference") +X(pattern_inference_skolem, Global, "pattern inference skolem") +X(pb, Global, "pb") +X(pb2bv, imp, "pb2bv") +X(pb2bv_bug, imp, "pb2bv bug") +X(pb2bv_bv, imp, "pb2bv bv") +X(pb2bv_bv_detail, imp, "pb2bv bv detail") +X(pb2bv_convert, imp, "pb2bv convert") +X(pb_validate, Global, "pb validate") +X(pb_verbose, Global, "pb verbose") +X(pbsum, lia_rewriter_cfg, "pbsum") +X(pconstructor_decl, Global, "pconstructor decl") +X(pcs, Global, "pcs") +X(pdecl_manager, Global, "pdecl manager") +X(pdr, Global, "pdr") +X(pdr_verbose, Global, "pdr verbose") +X(phase_selection, Global, "phase selection") +X(pi_failed, Global, "pi failed") +X(pivot_bignums, Global, "pivot bignums") +X(pivot_bug, Global, "pivot bug") +X(pivot_shape, Global, "pivot shape") +X(pivot_stats, Global, "pivot stats") +X(plugin, Global, "plugin") +X(pob_queue, Global, "pob queue") +X(poly_bug, polynomial, "poly bug") +X(poly_rewriter, Global, "poly rewriter") +X(polynomial, Global, "polynomial") +X(polynomial_factorization, Global, "polynomial::factorization") +X(polynomial_factorization_bughunt, Global, "polynomial::factorization::bughunt") +X(polynomial_gcd, Global, "polynomial gcd") +X(polynomial_gcd_detail, Global, "polynomial gcd detail") +X(polynorm, polynorm, "polynorm") +X(pop, combined_solver, "pop") +X(pop_app_frame, parser, "pop app frame") +X(pop_scope, Global, "pop scope") +X(pop_scope_detail, Global, "pop scope detail") +X(pp_ast_dot_step, ast_pp_dot_st, "pp ast dot step") +X(pp_let, smt2_printer, "pp let") +X(pp_scope, smt2_printer, "pp scope") +X(pr_lemma_bug, Global, "pr lemma bug") +X(pr_unit_bug, Global, "pr unit bug") +X(probe, is_non_nira_functor, "probe") +X(probing, Global, "probing") +X(process_non_linear, Global, "process non linear") +X(proof_checker, Global, "proof checker") +X(proof_converter, Global, "proof converter") +X(proof_gen_bug, Global, "proof gen bug") +X(proof_utils, push_instantiations_up_cl, "proof utils") +X(propagate, Global, "propagate") +X(propagate_ineqs, Global, "propagate-ineqs") +X(propagate_atoms, Global, "propagate atoms") +X(propagate_bool_var_enode_bug, Global, "propagate bool var enode bug") +X(propagate_bounds, Global, "propagate bounds") +X(propagate_bounds_bug, Global, "propagate bounds bug") +X(propagate_bounds_detail, Global, "propagate bounds detail") +X(propagate_bug, Global, "propagate bug") +X(propagate_clause, Global, "propagate clause") +X(propagate_clause_bug, Global, "propagate clause bug") +X(propagate_monomial, Global, "propagate monomial") +X(propagate_nl_bound, Global, "propagate nl bound") +X(propagate_polynomial, Global, "propagate polynomial") +X(propagate_polynomial_bug, Global, "propagate polynomial bug") +X(propagate_polynomial_detail, Global, "propagate polynomial detail") +X(propagate_relevancy, Global, "propagate relevancy") +X(propagate_relevancy_to_args, relevancy_propagator_imp, "propagate relevancy to args") +X(propagate_relevant_ite, relevancy_propagator_imp, "propagate relevant ite") +X(propagate_values, expr_substitution_simplifier, "propagate values") +X(propagate_values_core, propagate_values_tactic, "propagate values core") +X(proto_model, Global, "proto model") +X(psc, Global, "psc") +X(psc_chain_classic, Global, "psc chain classic") +X(pseudo_remainder, Global, "pseudo remainder") +X(psolve, Global, "psolve") +X(psolve_verbose, Global, "psolve verbose") +X(pull_quant, Global, "pull quant") +X(purify_arith, purify_arith_proc, "purify arith") +X(push_app_ite, Global, "push app ite") +X(push_expr_frame, parser, "push expr frame") +X(push_ite, th_rewriter_cfg, "push ite") +X(push_new_th_diseqs, Global, "push new th diseqs") +X(q, mam_impl, "q") +X(q_detail, Global, "q detail") +X(qe, Global, "qe") +X(qe_assumptions, Global, "qe assumptions") +X(qe_block, qsat, "qe block") +X(qe_core, kernel, "qe core") +X(qe_lite, Global, "qe lite") +X(qe_verbose, Global, "qe verbose") +X(qi_cost, Global, "qi cost") +X(qi_queue, Global, "qi queue") +X(qi_queue_bug, Global, "qi queue bug") +X(qi_queue_detail, Global, "qi queue detail") +X(qi_queue_min_cost, Global, "qi queue min cost") +X(qi_queue_profile, Global, "qi queue profile") +X(qi_queue_profile_detail, Global, "qi queue profile detail") +X(qi_unsat, Global, "qi unsat") +X(quant_elim, bool_plugin, "quant elim") +X(quantifier, default_qm_plugin, "quantifier") +X(quasi_base_bug_detail, Global, "quasi base bug detail") +X(quasi_base_row2base_row, Global, "quasi base row2base row") +X(quasi_macros, Global, "quasi macros") +X(quick_checker, Global, "quick checker") +X(quick_checker_candidates, Global, "quick checker candidates") +X(quick_checker_canonizer, Global, "quick checker canonizer") +X(quick_checker_sizes, Global, "quick checker sizes") +X(random, Global, "random") +X(random_split, Global, "random split") +X(random_update, Global, "random update") +X(rat_mpq, Global, "rat mpq") +X(rational, Global, "rational") +X(rcf_TaQ, Global, "rcf TaQ") +X(rcf_algebraic, Global, "rcf algebraic") +X(rcf_algebraic_sign, Global, "rcf algebraic sign") +X(rcf_arith, Global, "rcf arith") +X(rcf_clean, Global, "rcf clean") +X(rcf_clean_bug, Global, "rcf clean bug") +X(rcf_count_signs, Global, "rcf count signs") +X(rcf_determine_sign_bug, Global, "rcf determine sign bug") +X(rcf_gcd, Global, "rcf gcd") +X(rcf_isolate, Global, "rcf isolate") +X(rcf_isolate_bug, Global, "rcf isolate bug") +X(rcf_prem, Global, "rcf prem") +X(rcf_rem, Global, "rcf rem") +X(rcf_sign_det, Global, "rcf sign det") +X(rcf_sturm_seq, Global, "rcf sturm seq") +X(rcf_transcendental, Global, "rcf transcendental") +X(rdl_bug, Global, "rdl bug") +X(re_info, Global, "re info") +X(reassert_units, Global, "reassert units") +X(recfun, Global, "recfun") +X(recognizer_conflict, Global, "recognizer conflict") +X(recover_01, imp, "recover 01") +X(reduce_app, Global, "reduce app") +X(reduce_args, reduce_args_simplifier, "reduce args") +X(reduce_quantifier, th_rewriter_cfg, "reduce quantifier") +X(reduce_quantifier_bug, Global, "reduce quantifier bug") +X(reduce_step_ll, Global, "reduce step ll") +X(ref, Global, "ref") +X(refine_epsilon, Global, "refine epsilon") +X(reinit_clauses, Global, "reinit clauses") +X(reinit_clauses_bug, Global, "reinit clauses bug") +X(relevancy, Global, "relevancy") +X(relevancy_bug, Global, "relevancy bug") +X(rem_bug, Global, "rem bug") +X(rename, Global, "rename") +X(reorder, Global, "reorder") +X(report_costs, join_planner, "report costs") +X(resolve_bug, Global, "resolve bug") +X(resolve_conflict_bug, Global, "resolve conflict bug") +X(resolve_conflict_crash, Global, "resolve conflict crash") +X(restore_assignment_bug, Global, "restore assignment bug") +X(resultant, Global, "resultant") +X(rewriter, Global, "rewriter") +X(rewriter_bug, Global, "rewriter bug") +X(rewriter_cache_result, Global, "rewriter cache result") +X(rewriter_const, Global, "rewriter const") +X(rewriter_reuse, Global, "rewriter reuse") +X(rewriter_step, Global, "rewriter step") +X(rewriter_subst, Global, "rewriter subst") +X(rewriter_visit, Global, "rewriter visit") +X(root_core, Global, "root core") +X(row_bug, Global, "row bug") +X(sat, inc_sat_solver, "sat") +X(sat_assign, Global, "sat assign") +X(sat_assign_core, Global, "sat assign core") +X(sat_bug, Global, "sat bug") +X(sat_clause, Global, "sat clause") +X(sat_cleaner_bug, Global, "sat cleaner bug") +X(sat_cleaner_frozen, Global, "sat cleaner frozen") +X(sat_conflict, Global, "sat conflict") +X(sat_conflict_detail, Global, "sat conflict detail") +X(sat_decide, Global, "sat decide") +X(sat_dimacs, imp, "sat dimacs") +X(sat_drat, Global, "sat drat") +X(sat_frozen, Global, "sat frozen") +X(sat_gc, Global, "sat gc") +X(sat_lemma, Global, "sat lemma") +X(sat_mc, Global, "sat mc") +X(sat_mc_bug, Global, "sat mc bug") +X(sat_missed_prop, Global, "sat missed prop") +X(sat_mk_clause, Global, "sat mk clause") +X(sat_model_bug, Global, "sat model bug") +X(sat_model_converter, Global, "sat model converter") +X(sat_propagate, Global, "sat propagate") +X(sat_reinit, Global, "sat reinit") +X(sat_simplifier, Global, "sat simplifier") +X(sat_stats, sat_tactic, "sat stats") +X(sat_tactic, imp, "sat tactic") +X(sat_verbose, Global, "sat verbose") +X(sat_watched_bug, Global, "sat watched bug") +X(sat_xor, Global, "sat xor") +X(sats, Global, "sats") +X(save_elim, Global, "save elim") +X(save_value, Global, "save value") +X(scanner, Global, "scanner") +X(scc, Global, "scc") +X(scc_cycle, Global, "scc cycle") +X(scc_detail, Global, "scc detail") +X(scc_details, Global, "scc details") +X(search, Global, "search") +X(search_bug, Global, "search bug") +X(search_detail, Global, "search detail") +X(search_lite, Global, "search lite") +X(select_pivot, Global, "select pivot") +X(select_pivot_info, Global, "select pivot info") +X(select_small, Global, "select small") +X(select_var, select_var, "select var") +X(seq, Global, "seq") +X(seq_regex, Global, "seq regex") +X(seq_regex_brief, Global, "seq regex brief") +X(seq_regex_verbose, Global, "seq regex verbose") +X(seq_verbose, Global, "seq verbose") +X(set_conflict, Global, "set conflict") +X(set_not_learned_bug, Global, "set not learned bug") +X(setup, Global, "setup") +X(sf_array, Global, "sf array") +X(shallow_context_simplifier_bug, propagate_values_tactic, "shallow context simplifier bug") +X(shared, Global, "shared") +X(sign, Global, "sign") +X(sign_row_conflict, Global, "sign row conflict") +X(simp_counter, Global, "simp counter") +X(simple_check, Global, "simple check") +X(simple_checker, Global, "simple checker") +X(simple_checker_learned, Global, "simple checker learned") +X(simple_parser, Global, "simple parser") +X(simplex, Global, "simplex") +X(simplifier, Global, "simplifier") +X(simplify, Global, "simplify") +X(simplify_aux_clause_literals, Global, "simplify aux clause literals") +X(simplify_aux_lemma_literals, Global, "simplify aux lemma literals") +X(simplify_clauses, Global, "simplify clauses") +X(simplify_clauses_bug, Global, "simplify clauses bug") +X(simplify_clauses_detail, Global, "simplify clauses detail") +X(sine, Global, "sine") +X(sine_bug, Global, "sine bug") +X(skeleton, Global, "skeleton") +X(skid, parser, "skid") +X(skolemizer, skolemizer, "skolemizer") +X(sls, Global, "sls") +X(sls_eval, Global, "sls eval") +X(sls_model, sls_tactic, "sls model") +X(sls_opt, Global, "sls opt") +X(sls_score, Global, "sls score") +X(sls_top, Global, "sls top") +X(sls_verbose, Global, "sls verbose") +X(sls_whatif, Global, "sls whatif") +X(sls_whatif_failed, Global, "sls whatif failed") +X(small_object_allocator, Global, "small object allocator") +X(smaller_pattern_proc, Global, "smaller pattern proc") +X(smt2_pp, smt2_printer, "smt2 pp") +X(smt2parser, parser, "smt2parser") +X(smt_context, Global, "smt context") +X(smt_kernel, Global, "smt kernel") +X(smt_params, Global, "smt params") +X(smt_tactic, smt_tactic, "smt tactic") +X(smt_tactic_detail, smt_tactic, "smt tactic detail") +X(smt_tactic_memory, smt_tactic, "smt tactic memory") +X(smt_tactic_params, smt_tactic, "smt tactic params") +X(smtfd, solver, "smtfd") +X(smtfd_verbose, solver, "smtfd verbose") +X(solve_eqs, Global, "solve eqs") +X(solve_eqs_check_occs, Global, "solve eqs check occs") +X(solver, simplifier_solver, "solver") +X(solver2tactic, solver2tactic, "solver2tactic") +X(solver_na2as, Global, "solver na2as") +X(som, Global, "som") +X(sorted_sources, Global, "sorted sources") +X(spacer, conv_rewriter_cfg, "spacer") +X(spacer_farkas, Global, "spacer.farkas") +X(spacer_fkab, Global, "spacer.fkab") +X(spacer_ind_gen, pool_solver, "spacer.ind gen") +X(spacer_limnum, Global, "spacer.limnum") +X(spacer_mincut, Global, "spacer.mincut") +X(spacer_detail, Global, "spacer detail") +X(spacer_expand, Global, "spacer expand") +X(spacer_init_rule, Global, "spacer init rule") +X(spacer_mbp, Global, "spacer mbp") +X(spacer_normalize, Global, "spacer normalize") +X(spacer_normalize_order, Global, "spacer normalize order") +X(spacer_pdr, Global, "spacer pdr") +X(spacer_progress, Global, "spacer progress") +X(spacer_qgen, Global, "spacer qgen") +X(spacer_sat, Global, "spacer sat") +X(spacer_verbose, Global, "spacer verbose") +X(sparse_interpolator, Global, "sparse interpolator") +X(special_relations, Global, "special relations") +X(special_relations_verbose, Global, "special relations verbose") +X(specrel, Global, "specrel") +X(split_bug, imp, "split bug") +X(spol_bug, Global, "spol bug") +X(sqrt_bug, Global, "sqrt bug") +X(st, Global, "st") +X(st_bug, Global, "st bug") +X(state_graph, Global, "state graph") +X(str, Global, "str") +X(str_fl, Global, "str fl") +X(string_buffer, Global, "string buffer") +X(subpaving, Global, "subpaving") +X(subpaving_clause, Global, "subpaving clause") +X(subpaving_init, Global, "subpaving init") +X(subpaving_int_split, Global, "subpaving int split") +X(subpaving_is_int, Global, "subpaving is int") +X(subpaving_main, Global, "subpaving main") +X(subpaving_mk_bound, Global, "subpaving mk bound") +X(subpaving_mk_sum, Global, "subpaving mk sum") +X(subpaving_propagate, Global, "subpaving propagate") +X(subpaving_ref_count, Global, "subpaving ref count") +X(subpaving_relevant_bound, Global, "subpaving relevant bound") +X(subpaving_relevant_bound_bug, Global, "subpaving relevant bound bug") +X(subpaving_stats, Global, "subpaving stats") +X(subpaving_tactic, imp, "subpaving tactic") +X(subst_bug, Global, "subst bug") +X(subst_insert, Global, "subst insert") +X(subst_tree_bug, Global, "subst tree bug") +X(substitution, Global, "substitution") +X(substitution_tree_bug, Global, "substitution tree bug") +X(subsume, Global, "subsume") +X(subsume_verb, Global, "subsume verb") +X(subsumption, Global, "subsumption") +X(subsumption_bug, Global, "subsumption bug") +X(subsumption_resolution, Global, "subsumption resolution") +X(symmetry_reduce, imp, "symmetry reduce") +X(sync, parser, "sync") +X(t_fpa, Global, "t fpa") +X(t_fpa_detail, Global, "t fpa detail") +X(t_fpa_internalize, Global, "t fpa internalize") +X(t_str, Global, "t str") +X(t_str_binary_search, Global, "t str binary search") +X(t_str_detail, theory_str, "t str detail") +X(tactic, tactic2solver, "tactic") +X(tactic2solver, tactic2solver, "tactic2solver") +X(tan, Global, "tan") +X(tc, well_sorted_proc, "tc") +X(th_rewriter_step, th_rewriter_cfg, "th rewriter step") +X(theory_arith, Global, "theory arith") +X(theory_aware_branching, theory_aware_branching_queue, "theory aware branching") +X(theory_case_split, Global, "theory case split") +X(theory_dl, theory_dl, "theory dl") +X(to_patch_bug, Global, "to patch bug") +X(to_real_bug, Global, "to real bug") +X(to_var_bug, imp, "to var bug") +X(top_sort, eq_der, "top sort") +X(total_order, Global, "total order") +X(trigger_bug, mam_impl, "trigger bug") +X(triggers, Global, "triggers") +X(try_ite_value, Global, "try ite value") +X(tseitin_cnf, imp, "tseitin cnf") +X(tseitin_cnf_bug, imp, "tseitin cnf bug") +X(unassigned_atoms, Global, "unassigned atoms") +X(undo_mk_bool_var, Global, "undo mk bool var") +X(undo_mk_enode, Global, "undo mk enode") +X(unifier, Global, "unifier") +X(union_find, Global, "union find") +X(unit_bug, Global, "unit bug") +X(unit_resolution, Global, "unit resolution") +X(unit_resolution_justification_bug, Global, "unit resolution justification bug") +X(unit_subsumption_tactic, unit_subsumption_tactic, "unit subsumption tactic") +X(unsat_core, Global, "unsat core") +X(unsat_core_bug, Global, "unsat core bug") +X(unsat_core_trail, Global, "unsat core trail") +X(unsupported, imp, "unsupported") +X(update_and_pivot_bug, Global, "update and pivot bug") +X(update_and_pivot_bug_detail, Global, "update and pivot bug detail") +X(update_quantifier_weight, Global, "update quantifier weight") +X(upolynomial, Global, "upolynomial") +X(user_propagate, Global, "user propagate") +X(using_params, using_params_tactical, "using params") +X(util_bug, Global, "util bug") +X(utvpi, Global, "utvpi") +X(valid_row_assignment, Global, "valid row assignment") +X(valid_row_assignment_bug, Global, "valid row assignment bug") +X(value_bug, Global, "value bug") +X(value_sweep, Global, "value sweep") +X(var2basic, Global, "var2basic") +X(var_subst, Global, "var subst") +X(var_subst_bug, Global, "var subst bug") +X(proof_virtual, Global, "proof_virtual") +X(visit_b_justification_bug, Global, "visit b justification bug") +X(watch_list, Global, "watch list") +X(wf_column, Global, "wf column") +X(ws, well_sorted_proc, "ws") +X(xor3, Global, "xor3") +X(xor3_sorted, Global, "xor3 sorted") +X(z3_replayer, Global, "z3 replayer") +X(z3_replayer_bug, Global, "z3 replayer bug") +X(z3_replayer_cmd, Global, "z3 replayer cmd") +X(z3_replayer_escape, Global, "z3 replayer escape") +X(coming_from_quant, Global, "coming from quant") \ No newline at end of file diff --git a/src/util/trace_tags.h b/src/util/trace_tags.h new file mode 100644 index 000000000..889ba2e0b --- /dev/null +++ b/src/util/trace_tags.h @@ -0,0 +1,83 @@ +#pragma once + +#include + +enum class TraceTag { +#define X(tag, tag_class, desc) tag, +#include "trace_tags.def" +#undef X + Count +}; + +// Convert TraceTag to string +inline const char* tracetag_to_string(TraceTag tag) { + switch (tag) { +#define X(tag, tag_class, desc) case TraceTag::tag: return #tag; +#include "trace_tags.def" +#undef X + default: return "Unknown"; + } +} + +// Return description of TraceTag +inline const char* get_trace_tag_doc(TraceTag tag) { + switch (tag) { +#define X(tag, tag_class, desc) case TraceTag::tag: return desc; +#include "trace_tags.def" +#undef X + default: return "Unknown tag"; + } +} + +// Return the number of TraceTags +inline constexpr int trace_tag_count() { + return static_cast(TraceTag::Count); +} + +// Return all TraceTags as an array +inline const TraceTag* all_trace_tags() { + static TraceTag tags[] = { +#define X(tag, tag_class, desc) TraceTag::tag, +#include "trace_tags.def" +#undef X + }; + return tags; +} + +// Helper function to count tags in a class +inline constexpr int count_tags_in_class(TraceTag cls) { + int count = 0; + #define X(tag, tag_class, desc) if (TraceTag::tag_class == cls) count++; + #include "trace_tags.def" + #undef X + return count; +} + +// TODO(#7663): Implement tag_class activation of all associated tags +// TODO: Need to consider implementation approach and memory management +// Return all tags that belong to the given class +// inline const TraceTag* get_tags_by_class(TraceTag cls, int& count) { +// count = count_tags_in_class(cls); +// static TraceTag* class_tags = nullptr; +// if (class_tags) delete[] class_tags; + +// class_tags = new TraceTag[count]; +// int idx = 0; + +// #define X(tag, tag_class, desc) \ +// if (TraceTag::tag_class == cls) { \ +// class_tags[idx++] = TraceTag::tag; \ +// } +// #include "trace_tags.def" +// #undef X + +// return class_tags; +// } + +// Find TraceTag by string +// inline TraceTag find_trace_tag_by_string(const char* tag_str) { +// #define X(tag, tag_class, desc) if (strncmp(#tag, tag_str, strlen(#tag)) == 0) return TraceTag::tag; +// #include "trace_tags.def" +// #undef X +// return TraceTag::Count; +// } \ No newline at end of file diff --git a/src/util/union_find.h b/src/util/union_find.h index 0c08ac446..93d8affea 100644 --- a/src/util/union_find.h +++ b/src/util/union_find.h @@ -72,7 +72,7 @@ class union_find { void unmerge(unsigned r1) { unsigned r2 = m_find[r1]; - TRACE("union_find", tout << "unmerging " << r1 << " " << r2 << "\n";); + TRACE(union_find, tout << "unmerging " << r1 << " " << r2 << "\n";); SASSERT(find(r2) == r2); m_size[r2] -= m_size[r1]; m_find[r1] = r1; @@ -120,7 +120,7 @@ public: void merge(unsigned v1, unsigned v2) { unsigned r1 = find(v1); unsigned r2 = find(v2); - TRACE("union_find", tout << "merging " << r1 << " " << r2 << "\n";); + TRACE(union_find, tout << "merging " << r1 << " " << r2 << "\n";); if (r1 == r2) return; if (m_size[r1] > m_size[r2]) { @@ -137,7 +137,7 @@ public: } void set_root(unsigned v, unsigned root) { - TRACE("union_find", tout << "merging " << v << " " << root << "\n";); + TRACE(union_find, tout << "merging " << v << " " << root << "\n";); SASSERT(v != root); m_find[v] = root; m_size[root] += m_size[v];